summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYakov Goldberg <yakov.g@samsung.com>2012-11-15 18:02:37 +0200
committerYakov Goldberg <yakov.g@samsung.com>2012-11-15 18:08:44 +0200
commite3f3962f8484a0f3f76b76e40d064f1020b16ad9 (patch)
tree5ff38b23c23b4ee693212a26b457faddbe86ad29
parente6eee44a89a0373dcc17553e58f56b44994ed817 (diff)
Major additions to parser and default
- _instance_add3 function added to support custom constr (eodefault.pyx) - eo_custom_add defined (eodefault.pxd) - def unref(): defined (eodefault.pyx) - _data_set() added to EoBase because of name clash - _data_set moved to _instance_add; need to remove it from init of each class
-rw-r--r--eo_py/eodefault.pxd1
-rw-r--r--eo_py/eodefault.pyx18
-rw-r--r--eoparser/xmlparser.py7
3 files changed, 25 insertions, 1 deletions
diff --git a/eo_py/eodefault.pxd b/eo_py/eodefault.pxd
index e7c3960..7eb09d6 100644
--- a/eo_py/eodefault.pxd
+++ b/eo_py/eodefault.pxd
@@ -51,6 +51,7 @@ cdef extern from "Eo.h":
51 Eo_Class *eo_base_class_get() 51 Eo_Class *eo_base_class_get()
52 52
53 Eo* eo_add(Eo_Class *klass, Eo *parent) 53 Eo* eo_add(Eo_Class *klass, Eo *parent)
54 Eo* eo_add_custom(Eo_Class *klass, Eo *parent, ...)
54 55
55 Eo* eo_ref(Eo *obj) 56 Eo* eo_ref(Eo *obj)
56 void eo_unref(Eo *obj) 57 void eo_unref(Eo *obj)
diff --git a/eo_py/eodefault.pyx b/eo_py/eodefault.pyx
index 67d6c9d..12194d8 100644
--- a/eo_py/eodefault.pyx
+++ b/eo_py/eodefault.pyx
@@ -88,6 +88,9 @@ cdef class EoDefault:
88 eodefault.eo_ref(self.eo) 88 eodefault.eo_ref(self.eo)
89 return self 89 return self
90 90
91 def unref(self):
92 eodefault.eo_unref(self.eo)
93
91 # eo_ref_get() 94 # eo_ref_get()
92 def ref_get(self): 95 def ref_get(self):
93 ref_count = <object>eodefault.eo_ref_get(self.eo) 96 ref_count = <object>eodefault.eo_ref_get(self.eo)
@@ -118,8 +121,21 @@ cdef class EoDefault:
118 cpdef _eo_instance_set2(self, _kl, EoDefault p): 121 cpdef _eo_instance_set2(self, _kl, EoDefault p):
119 kl = <long>_kl 122 kl = <long>_kl
120 cdef Eo_Class *kl2 = <Eo_Class*>kl 123 cdef Eo_Class *kl2 = <Eo_Class*>kl
121 self._eo_instance_set(eodefault.eo_add(kl2, eodefault._eo_instance_get(p))) 124 cdef Eo *o = eodefault.eo_add(kl2, eodefault._eo_instance_get(p))
125 self._eo_instance_set(o)
126 self._data_set(EoDefault.PY_EO_NAME, self)
122 127
128 #function added to start support custom constructors
129 def _eo_instance_set3(self, _kl, EoDefault p, *args):
130 kl = <long>_kl
131 cdef Eo_Class *kl2 = <Eo_Class*>kl
132 cdef Eo_Op _p0 = <Eo_Op>args[0]
133 cdef char *_p1 = <char*>args[1]
134 cdef int _p2 = <int>args[2]
135 print "_eo_instance_set3",_p0, _p1, _p2
136 cdef Eo *o = eodefault.eo_add_custom(kl2, eodefault._eo_instance_get(p), _p0, _p1, _p2)
137 self._eo_instance_set(o)
138 self._data_set(EoDefault.PY_EO_NAME, self)
123 139
124 cdef int print_func_name(self, f_name): 140 cdef int print_func_name(self, f_name):
125 print self.__class__, " :: ", f_name, " :: ", sys.getsizeof(self) 141 print self.__class__, " :: ", f_name, " :: ", sys.getsizeof(self)
diff --git a/eoparser/xmlparser.py b/eoparser/xmlparser.py
index 3cd38d4..6e24e44 100644
--- a/eoparser/xmlparser.py
+++ b/eoparser/xmlparser.py
@@ -788,6 +788,13 @@ class PyVisitor(Visitor):
788 function_lines.append(" _key = pytext_to_utf8(_key)") 788 function_lines.append(" _key = pytext_to_utf8(_key)")
789 function_lines.append(" cdef char* key = <char*> _key") 789 function_lines.append(" cdef char* key = <char*> _key")
790 function_lines.append(" eodefault.eo_do(eodefault._eo_instance_get(self), eobase_sub_id(eobase.EO_BASE_SUB_ID_DATA_SET), key, <void*>_data, NULL)") 790 function_lines.append(" eodefault.eo_do(eodefault._eo_instance_get(self), eobase_sub_id(eobase.EO_BASE_SUB_ID_DATA_SET), key, <void*>_data, NULL)")
791
792 function_lines.append("")
793 function_lines.append("def _data_set(self, object _key, object _data):")
794 function_lines.append(" _key = pytext_to_utf8(_key)")
795 function_lines.append(" cdef char* key = <char*> _key")
796 function_lines.append(" eodefault.eo_do(eodefault._eo_instance_get(self), eobase_sub_id(eobase.EO_BASE_SUB_ID_DATA_SET), key, <void*>_data, NULL)")
797
791 if_ret = True 798 if_ret = True
792 799
793 elif _o.op_id == "EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE": 800 elif _o.op_id == "EO_BASE_SUB_ID_EVENT_GLOBAL_FREEZE":