diff options
author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-28 15:31:46 +0000 |
---|---|---|
committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-01-28 15:31:46 +0000 |
commit | a1ae48d2ef48492faafd26464e64e2dccd0d8565 (patch) | |
tree | c124d920b7ee607ba7e70efc5e89426093998cdf /bindings | |
parent | fa9566aa59005360a562595d3b0c20b2bd75478b (diff) | |
download | lasso-a1ae48d2ef48492faafd26464e64e2dccd0d8565.tar.gz lasso-a1ae48d2ef48492faafd26464e64e2dccd0d8565.tar.xz lasso-a1ae48d2ef48492faafd26464e64e2dccd0d8565.zip |
Bindings: better parse oftype annotation for hashtable, allow to skip structures
* bindings/bindings.py:
add possibility to skip generating bindings for structures to
overrides.xml.
parse element-type annotation /* of XXX */ for hashtable objects.
output to stderr warning about skipped objects.
parse idwsf_strings.h
* bindings/overrides.xml:
skip more ID-WSF 1.0 functions in java and perl.
skip structure LassoAuthentication.
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/bindings.py | 43 | ||||
-rw-r--r-- | bindings/overrides.xml | 31 |
2 files changed, 50 insertions, 24 deletions
diff --git a/bindings/bindings.py b/bindings/bindings.py index 0ec3cc6f..12840231 100644 --- a/bindings/bindings.py +++ b/bindings/bindings.py @@ -59,10 +59,14 @@ class BindingData: self.options = options self.overrides = ET.parse(os.path.join(self.src_dir, 'overrides.xml')) self.functions_toskip = dict() + self.structs_toskip = dict() for func in self.overrides.findall('func'): if func.attrib.get('skip') == 'true': self.functions_toskip[func.attrib.get('name')] = 1 + for struct in self.overrides.findall('struct'): + if struct.attrib.get('skip') == 'true': + self.structs_toskip[struct.attrib.get('name')] = 1 def match_tag_language(self,tag): if self.options and self.options.language: @@ -183,6 +187,7 @@ toskip = None class Function: return_type = None return_type_qualifier = None + return_arg = None name = None rename = None args = None @@ -193,7 +198,7 @@ class Function: def __repr__(self): return '<Function return_type:%s name:%s args:%r>' % ( - self.return_type, self.name, self.args) + self.return_arg, self.name, self.args) def apply_overrides(self): for func in binding.overrides.findall('func'): @@ -425,7 +430,10 @@ def parse_header(header_file): in_struct_private = False elif in_struct: if line.startswith('}'): - binding.structs.append(in_struct) + if not in_struct.name in binding.structs_toskip: + binding.structs.append(in_struct) + else: + print >>sys.stderr, 'W: skipping structure %s due to overrides.xml' % in_struct.name in_struct = None elif '/*< public >*/' in line: in_struct_private = False @@ -439,20 +447,19 @@ def parse_header(header_file): # TODO: Add parsing of OFTYPE member_match = re.match('\s+(\w+)\s+(\*?\w+)', line) if member_match: - member_type = member_match.group(1) - member_name = member_match.group(2) - if member_name == 'parent': - in_struct.parent = member_type + member_type, member_name = normalise_var(member_match.group(1), member_match.group(2)) + field = (member_type, member_name, {}) + if member_type == 'void*': + print >>sys.stderr, 'W: skipping field %s.%s' % (in_struct.name, member_name) else: - in_struct.members.append( - list(normalise_var(member_type, member_name)) + [{}]) - if member_type == 'GList': - options = in_struct.members[-1][-1] - if '/* of' in line: - of_type = line[line.index('/* of')+6:].split()[0] - if of_type == 'strings': - of_type = 'char*' - options['element-type'] = of_type + if is_glist(field) or is_hashtable(field): + found = re.search(r' of ([^*]*)', line) + if found: + field[2]['element-type'] = clean_type(found.group(1)) + if member_name == 'parent': + in_struct.parent = member_type + else: + in_struct.members.append(field) elif line.startswith('LASSO_EXPORT '): while not line.strip().endswith(';'): i += 1 @@ -497,6 +504,8 @@ def parse_header(header_file): f.apply_overrides() if not f.skip: binding.functions.append(f) + else: + print >>sys.stderr, 'W: skipping function', f i += 1 @@ -520,7 +529,9 @@ def parse_headers(srcdir): makefile_am = open(os.path.join(base, 'Makefile.am')).read() filenames = [x for x in filenames if x.endswith('.h') if x in makefile_am] for filename in filenames: - if filename in ('xml_idff.h', 'xml_idwsf.h', 'xml_saml2.h', 'idwsf_strings.h'): + if not binding.options.idwsf and filename == 'idwsf_strings.h': + continue + if filename in ('xml_idff.h', 'xml_idwsf.h', 'xml_saml2.h'): continue if filename == 'lasso_config.h' or 'private' in filename: continue diff --git a/bindings/overrides.xml b/bindings/overrides.xml index 2b6c4357..70c93c24 100644 --- a/bindings/overrides.xml +++ b/bindings/overrides.xml @@ -37,13 +37,13 @@ <!-- LassoWsfProfile --> <func name="lasso_wsf_profile_get_identity" return_owner="false" /> <func name="lasso_wsf_profile_get_session" return_owner="false" /> - <func name="lasso_wsf_profile_get_remote_provider" skip="java"/> - <func name="lasso_data_service_get_answer" skip="java"/> - <func name="lasso_data_service_get_query_item" skip="java"/> - <func name="lasso_data_service_add_modification" skip="java"/> - <func name="lasso_data_service_get_answers" skip="java"/> - <func name="lasso_data_service_get_answers_by_select" skip="java"/> - <func name="lasso_data_service_get_answers_by_item_id" skip="java"/> + <func name="lasso_wsf_profile_get_remote_provider" skip="java,perl"/> + <func name="lasso_data_service_get_answer" skip="java,perl"/> + <func name="lasso_data_service_get_query_item" skip="java,perl"/> + <func name="lasso_data_service_add_modification" skip="java,perl"/> + <func name="lasso_data_service_get_answers" skip="java,perl"/> + <func name="lasso_data_service_get_answers_by_select" skip="java,perl"/> + <func name="lasso_data_service_get_answers_by_item_id" skip="java,perl"/> <func name="lasso_saml2_encrypted_element_decrypt" skip="true"/> <!-- LassoIdentity --> <func name="lasso_identity_get_federation" return_owner="false" /> @@ -177,9 +177,24 @@ <arg name="abstract" rename="abstract_" language="java"/> <func name="lasso_personal_profile_service_new_full" rename="lasso_personal_profile_server_new_personal_profile_service_full"/> <func name="lasso_wsf_profile_new_full" rename="lasso_wsf_profile_wsf_profile_new_full"/> - <func name="lasso_authentication_init_request" skip="true"/> <func name="lasso_wsa_endpoint_reference_get_target_identity_token" skip="true"/> <func name="lasso_wsa_endpoint_reference_get_security_token" skip="true"/> + <func name="lasso_wsa_endpoint_reference_associate_service_to_type" skip="true"/> + <func name="lasso_authentication_get_type" skip="true"/> + <func name="lasso_authentication_get_type" skip="true"/> + <func name="lasso_authentication_new" skip="true"/> + <func name="lasso_authentication_destroy" skip="true"/> + <func name="lasso_authentication_client_start" skip="true"/> + <func name="lasso_authentication_client_step" skip="true"/> + <func name="lasso_authentication_get_mechanism_list" skip="true"/> + <func name="lasso_authentication_init_request" skip="true"/> + <func name="lasso_authentication_process_request_msg" skip="true"/> + <func name="lasso_authentication_process_response_msg" skip="true"/> + <func name="lasso_authentication_server_start" skip="true"/> + <func name="lasso_authentication_server_step" skip="true"/> + <struct name="LassoAuthentication" skip="true"/> + <func name="lasso_wsse_username_token_derive_key" skip="true"/> + <func name="lasso_wsa_endpoint_reference_add_security_token" skip="true"/> <!-- Exceptions --> <exception> <category name="Profile"/> |