summaryrefslogtreecommitdiff
path: root/eoparser/cparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'eoparser/cparser.py')
-rw-r--r--eoparser/cparser.py22
1 files changed, 16 insertions, 6 deletions
diff --git a/eoparser/cparser.py b/eoparser/cparser.py
index 904b912..7f23b05 100644
--- a/eoparser/cparser.py
+++ b/eoparser/cparser.py
@@ -216,7 +216,8 @@ class Cparser(object):
216 for t in ids_and_descs: 216 for t in ids_and_descs:
217 op_id = t[0] #op_id 217 op_id = t[0] #op_id
218 func_name = re.findall("SUB_ID_(.*)", op_id) 218 func_name = re.findall("SUB_ID_(.*)", op_id)
219 op_list.append((op_id, func_name[0].lower())) 219 func_name = func_name[0].lower()
220 op_list.append((op_id, func_name))
220 221
221 op_desc[tup[0]] = op_list 222 op_desc[tup[0]] = op_list
222 223
@@ -334,9 +335,12 @@ class Cparser(object):
334 #and checking if it is in macros list. If not - we forgot to add comment 335 #and checking if it is in macros list. If not - we forgot to add comment
335 #if yes - cutting types from define 336 #if yes - cutting types from define
336 for op, f in op_desc: 337 for op, f in op_desc:
338 found = False
337 for d in defines: 339 for d in defines:
340 # looking for #define elm_obj_flip_get ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_GET)
338 o = re.match("#define ([\w]*)\([^\)]*\) %s\(%s\).*"%(b_id_macro, op), d) 341 o = re.match("#define ([\w]*)\([^\)]*\) %s\(%s\).*"%(b_id_macro, op), d)
339 if o != None: 342 if o != None:
343 found = True
340 s_tmp = o.group(1) 344 s_tmp = o.group(1)
341 345
342 if s_tmp not in macros: 346 if s_tmp not in macros:
@@ -369,13 +373,16 @@ class Cparser(object):
369 i += 1 373 i += 1
370 self.cl_data[cl_id][const.FUNCS][f][const.PARAMETERS] = params 374 self.cl_data[cl_id][const.FUNCS][f][const.PARAMETERS] = params
371 self.cl_data[cl_id][const.FUNCS][f][const.C_MACRO] = s_tmp 375 self.cl_data[cl_id][const.FUNCS][f][const.C_MACRO] = s_tmp
376
377 if not found:
378 print "Warning: no API for %s in %s"%(op, self.cl_data[cl_id][const.H_FILE])
379 print "Function won't be added"
380 self.cl_data[cl_id][const.FUNCS].pop(f)
381
372 382
373 383
374 #generating XML 384 #generating XML
375 def build_xml(self, cl_id): 385 def build_xml(self, cl_id):
376 #FIXME: because i don't parse several EO_DEFINE_CLASS in file
377 #if const.C_NAME not in self.cl_data[cl_id]:
378 # return
379 self.cl_data[cl_id][const.XML_FILE] = os.path.join(self.outdir, normalize_names([self.cl_data[cl_id][const.C_NAME]])[0] + ".xml") 386 self.cl_data[cl_id][const.XML_FILE] = os.path.join(self.outdir, normalize_names([self.cl_data[cl_id][const.C_NAME]])[0] + ".xml")
380 387
381 cl_data = self.cl_data[cl_id] 388 cl_data = self.cl_data[cl_id]
@@ -429,10 +436,13 @@ class Cparser(object):
429 for k in cl_data[const.FUNCS]: 436 for k in cl_data[const.FUNCS]:
430 SubElement(op_tag, const.XML_SUB_ID, {const.NAME:cl_data[const.FUNCS][k][const.OP_ID]}) 437 SubElement(op_tag, const.XML_SUB_ID, {const.NAME:cl_data[const.FUNCS][k][const.OP_ID]})
431 438
439 c_macro = cl_data[const.FUNCS][k][const.C_MACRO]
440 #if generating XML not for base class, change func name to avoid name clash
441 func_name = k if cl_id == "EO_BASE_CLASS" else c_macro
432 442
433 m = SubElement(m_tag, const.METHOD, {const.NAME : k, 443 m = SubElement(m_tag, const.METHOD, {const.NAME : func_name,
434 const.OP_ID:cl_data[const.FUNCS][k][const.OP_ID], 444 const.OP_ID:cl_data[const.FUNCS][k][const.OP_ID],
435 const.C_MACRO:cl_data[const.FUNCS][k][const.C_MACRO]}) 445 const.C_MACRO:c_macro})
436 446
437 #defining parameter type 447 #defining parameter type
438 if const.PARAMETERS in cl_data[const.FUNCS][k]: 448 if const.PARAMETERS in cl_data[const.FUNCS][k]: