Eolian: Add new api from q66's efl branch

This commit is contained in:
Kai Huuhko 2014-06-26 13:57:43 +03:00
parent 1c6f42b395
commit 45e43df37c
2 changed files with 46 additions and 1 deletions

View File

@ -57,10 +57,12 @@ cdef extern from "Eolian.h":
Eina_Bool eolian_eo_file_parse(const char *filename)
Eina_Bool eolian_eot_file_parse(const char *filepath)
int eolian_init()
int eolian_shutdown()
Eina_Bool eolian_directory_scan(const char *dir)
Eina_Bool eolian_all_eo_files_parse()
Eina_Bool eolian_all_eot_files_parse()
Eina_Bool eolian_show(const Eolian_Class klass)
Eolian_Class eolian_class_find_by_name(const char *class_name)
Eolian_Class eolian_class_find_by_file(const char *file_name)
@ -79,6 +81,7 @@ cdef extern from "Eolian.h":
Eolian_Function_Type eolian_function_type_get(Eolian_Function function_id)
Eolian_Function_Scope eolian_function_scope_get(Eolian_Function function_id)
const char *eolian_function_name_get(Eolian_Function function_id)
const char *eolian_function_full_c_name_get(Eolian_Function function_id, const char *prefix)
Eolian_Function eolian_class_function_find_by_name(const Eolian_Class klass, const char *func_name, Eolian_Function_Type f_type)
const char *eolian_function_data_get(Eolian_Function function_id, const char *key)
Eina_Bool eolian_function_is_virtual_pure(Eolian_Function function_id, Eolian_Function_Type f_type)

View File

@ -148,6 +148,19 @@ def eo_file_parse(filename):
EINA_LOG_DOM_WARN(EOLIAN_DOM, "Failure in eo_file_parse()", NULL)
return ret
def eot_file_parse(filename):
"""Parse a given .eot file and fill the database.
:param filename: Name of the file to parse.
:see: :func:`eolian_eo_file_parse`
"""
if isinstance(filename, unicode): filename = PyUnicode_AsUTF8String(filename)
cdef bint ret = eolian_eot_file_parse(filename)
if not ret:
EINA_LOG_DOM_WARN(EOLIAN_DOM, "Failure in eot_file_parse()", NULL)
return ret
def init():
"""Init Eolian.
@ -183,7 +196,7 @@ def directory_scan(directory):
def all_eo_files_parse():
"""Force parsing of all the files located in the directories
given in eolian_directory_scan..
given in eolian_directory_scan.
:return: True on success, False otherwise.
@ -195,6 +208,20 @@ def all_eo_files_parse():
EINA_LOG_DOM_WARN(EOLIAN_DOM, "Failure in all_eo_files_parse()", NULL)
return ret
def all_eot_files_parse():
"""Force parsing of all the .eot files located in the directories
given in eolian_directory_scan.
:return: True on success, False otherwise.
:see: :py:func:`directory_scan`
"""
cdef bint ret = eolian_all_eot_files_parse()
if not ret:
EINA_LOG_DOM_WARN(EOLIAN_DOM, "Failure in all_eot_files_parse()", NULL)
return ret
def show(Class klass=None):
"""Show information about a given class.
@ -491,6 +518,21 @@ cdef class Function(object):
def __get__(self):
return _ctouni(eolian_function_name_get(self.function_id))
def full_c_name_get(self, prefix):
"""Returns the full C name of a function (with prefix). It's here
because the C API names are deduplicated (prefix of function and suffix
of prefix merge if applicable) and this helps generators not write the
same code over and over.
:param prefix: function prefix
:type prefix: string
:return: the function name
:rtype: string
"""
if isinstance(prefix, unicode): prefix = PyUnicode_AsUTF8String(prefix)
return _ctouni(eolian_function_full_c_name_get(self.function_id, prefix))
def data_get(self, key):
"""Returns a specific data for a function.