aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-12-02 10:58:39 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-12-02 11:16:31 +0200
commitb4ddf1a6cefe5af1994a5b9592ed8b2366679450 (patch)
tree6117ca0a8781aa1e3458946183d2009ecc68ed45
parentXMLparser::JSvisitor: func_name_prefix = '__' added into names of funcs for C++ (diff)
downloadeo_bindings-b4ddf1a6cefe5af1994a5b9592ed8b2366679450.tar.gz
Names of generated funcs changed to the same as C macro. Example updated
Signed-off-by: Yakov Goldberg <yakov.g@samsung.com>
-rw-r--r--eoparser/cparser.py22
-rw-r--r--examples/evas_elem_test.py32
2 files changed, 32 insertions, 22 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):
for t in ids_and_descs:
op_id = t[0] #op_id
func_name = re.findall("SUB_ID_(.*)", op_id)
- op_list.append((op_id, func_name[0].lower()))
+ func_name = func_name[0].lower()
+ op_list.append((op_id, func_name))
op_desc[tup[0]] = op_list
@@ -334,9 +335,12 @@ class Cparser(object):
#and checking if it is in macros list. If not - we forgot to add comment
#if yes - cutting types from define
for op, f in op_desc:
+ found = False
for d in defines:
+ # looking for #define elm_obj_flip_get ELM_OBJ_FLIP_ID(ELM_OBJ_FLIP_SUB_ID_GET)
o = re.match("#define ([\w]*)\([^\)]*\) %s\(%s\).*"%(b_id_macro, op), d)
if o != None:
+ found = True
s_tmp = o.group(1)
if s_tmp not in macros:
@@ -369,13 +373,16 @@ class Cparser(object):
i += 1
self.cl_data[cl_id][const.FUNCS][f][const.PARAMETERS] = params
self.cl_data[cl_id][const.FUNCS][f][const.C_MACRO] = s_tmp
+
+ if not found:
+ print "Warning: no API for %s in %s"%(op, self.cl_data[cl_id][const.H_FILE])
+ print "Function won't be added"
+ self.cl_data[cl_id][const.FUNCS].pop(f)
+
#generating XML
def build_xml(self, cl_id):
- #FIXME: because i don't parse several EO_DEFINE_CLASS in file
- #if const.C_NAME not in self.cl_data[cl_id]:
- # return
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")
cl_data = self.cl_data[cl_id]
@@ -429,10 +436,13 @@ class Cparser(object):
for k in cl_data[const.FUNCS]:
SubElement(op_tag, const.XML_SUB_ID, {const.NAME:cl_data[const.FUNCS][k][const.OP_ID]})
+ c_macro = cl_data[const.FUNCS][k][const.C_MACRO]
+ #if generating XML not for base class, change func name to avoid name clash
+ func_name = k if cl_id == "EO_BASE_CLASS" else c_macro
- m = SubElement(m_tag, const.METHOD, {const.NAME : k,
+ m = SubElement(m_tag, const.METHOD, {const.NAME : func_name,
const.OP_ID:cl_data[const.FUNCS][k][const.OP_ID],
- const.C_MACRO:cl_data[const.FUNCS][k][const.C_MACRO]})
+ const.C_MACRO:c_macro})
#defining parameter type
if const.PARAMETERS in cl_data[const.FUNCS][k]:
diff --git a/examples/evas_elem_test.py b/examples/evas_elem_test.py
index efd8eb4..08e7bd1 100644
--- a/examples/evas_elem_test.py
+++ b/examples/evas_elem_test.py
@@ -11,35 +11,35 @@ print "Init res:", py_elm_init(sys.argv)
print ""
w1 = ElmWin(None, "my win name", 0)
-w1.title_set("first_title")
-t = w1.title_get()
+w1.elm_obj_win_title_set("first_title")
+t = w1.elm_obj_win_title_get()
print "title:", t
-w1.size_set(370, 350)
-xx,yy = w1.size_get()
+w1.evas_obj_size_set(370, 350)
+xx,yy = w1.evas_obj_size_get()
print "size : " , xx, yy
-w1.visibility_set(1)
-v = w1.visibility_get()
+w1.evas_obj_visibility_set(1)
+v = w1.evas_obj_visibility_get()
print "v=", v
bg = ElmBg(w1)
-bg.size_hint_weight_set(1.0, 1.0)
-w1.resize_object_add(bg)
-bg.visibility_set(1)
+bg.evas_obj_size_hint_weight_set(1.0, 1.0)
+w1.elm_obj_win_resize_object_add(bg)
+bg.evas_obj_visibility_set(1)
box = ElmBox(w1)
-box.size_hint_weight_set(1.0, 1.0)
-w1.resize_object_add(box)
-box.visibility_set(1)
+box.evas_obj_size_hint_weight_set(1.0, 1.0)
+w1.elm_obj_win_resize_object_add(box)
+box.evas_obj_visibility_set(1)
but = ElmButton(w1)
#but.text_set("Button")
-box.pack_end(but)
-but.visibility_set(1)
+box.elm_obj_box_pack_end(but)
+but.evas_obj_visibility_set(1)
-d = w1.screen_dpi_get()
+d = w1.elm_obj_win_screen_dpi_get()
print d
-d = w1.role_get()
+d = w1.elm_obj_win_role_get()
print d
#d = w1.fullscreen_set(1)