diff options
author | Colin Walters <walters@verbum.org> | 2010-07-21 21:06:17 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-08-31 16:05:56 -0400 |
commit | e66d50732c8ce5cf3ef198e114d94e102a1c4911 (patch) | |
tree | 11136782cda96b23479e388197bcf58736842e2d /giscanner/transformer.py | |
parent | abc4e514ff46ed77159b19f56dea54eeef8bc909 (diff) | |
download | gobject-introspection-e66d50732c8ce5cf3ef198e114d94e102a1c4911.tar.gz |
Use GLib types consistently
Rather than have the scanner/parser handle both e.g. "glong" and
"long", simply use the GLib types everywhere.
This commit adds TYPE_LONG_LONG and TYPE_LONG_DOUBLE to the
scanner types; however, rather than add them to the typelib,
they're just marked as not-introspectable.
Diffstat (limited to 'giscanner/transformer.py')
-rw-r--r-- | giscanner/transformer.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 2f255211..e2a22049 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -25,7 +25,8 @@ from .ast import (Bitfield, Callback, Enum, Function, Namespace, Member, Parameter, Return, Struct, Field, Type, Array, Alias, Interface, Class, Node, Union, Varargs, Constant, type_name_from_ctype, - type_names, TYPE_STRING, BASIC_GIR_TYPES) + type_names, TYPE_ANY, TYPE_STRING, + BASIC_GIR_TYPES) from .config import DATADIR, GIR_DIR, GIR_SUFFIX from .glibast import GLibBoxed from .girparser import GIRParser @@ -345,7 +346,7 @@ context will be used.""" return False def _handle_closure(self, param, closure_idx, closure_param): - if (closure_param.type.name == 'any' and + if (closure_param.type.name == TYPE_ANY and closure_param.name.endswith('data')): param.closure_name = closure_param.name param.closure_index = closure_idx @@ -412,7 +413,7 @@ context will be used.""" elif source_type.type == CTYPE_POINTER: value = self._create_source_type(source_type.base_type) + '*' else: - value = 'any' + value = TYPE_ANY return value def _create_parameters(self, base_type): @@ -527,7 +528,7 @@ context will be used.""" # Preserve "pointerness" of struct/union members if (is_member and canonical.endswith('*') and derefed_typename in BASIC_GIR_TYPES): - return 'any' + return TYPE_ANY else: return derefed_typename @@ -584,10 +585,10 @@ context will be used.""" type_name = 'utf8' value = symbol.const_string elif symbol.const_int is not None: - type_name = 'int' + type_name = 'gint' value = symbol.const_int elif symbol.const_double is not None: - type_name = 'double' + type_name = 'gdouble' value = symbol.const_double else: raise AssertionError() @@ -658,7 +659,7 @@ context will be used.""" # Mark the 'user_data' arguments for i, param in enumerate(parameters): - if (param.type.name == 'any' and + if (param.type.name == TYPE_ANY and param.name == 'user_data'): param.closure_index = i |