From: Johan Dahlin Date: Tue, 25 Mar 2008 21:58:43 +0000 (+0000) Subject: Add constants and wrap a few more SymbolType fields X-Git-Tag: GOBJECT_INTROSPECTION_0_5_0~373 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=55e0a1d2b44aba6dd53d33d940d816b0f363939a;p=platform%2Fupstream%2Fgobject-introspection.git Add constants and wrap a few more SymbolType fields 2008-03-25 Johan Dahlin * giscanner/__init__.py: * giscanner/giscannermodule.c: * giscanner/sourcescanner.c: * giscanner/sourcescanner.h: Add constants and wrap a few more SymbolType fields svn path=/trunk/; revision=166 --- diff --git a/ChangeLog b/ChangeLog index 29bb7cf..40457d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2008-03-25 Johan Dahlin + * giscanner/__init__.py: + * giscanner/giscannermodule.c: + * giscanner/sourcescanner.c: + * giscanner/sourcescanner.h: + Add constants and wrap a few more SymbolType fields + +2008-03-25 Johan Dahlin + * configure.ac: * giscanner: * giscanner/__init__.py: diff --git a/giscanner/__init__.py b/giscanner/__init__.py index aff773a..448577e 100644 --- a/giscanner/__init__.py +++ b/giscanner/__init__.py @@ -1 +1,43 @@ from _giscanner import * + +(CSYMBOL_TYPE_INVALID, + CSYMBOL_TYPE_CONST, + CSYMBOL_TYPE_OBJECT, + CSYMBOL_TYPE_FUNCTION, + CSYMBOL_TYPE_STRUCT, + CSYMBOL_TYPE_UNION, + CSYMBOL_TYPE_ENUM, + CSYMBOL_TYPE_TYPEDEF) = range(8) + +(CTYPE_INVALID, + CTYPE_VOID, + CTYPE_BASIC_TYPE, + CTYPE_TYPEDEF, + CTYPE_STRUCT, + CTYPE_UNION, + CTYPE_ENUM, + CTYPE_POINTER, + CTYPE_ARRAY, + CTYPE_FUNCTION) = range(10) + +STORAGE_CLASS_NONE = 0 +STORAGE_CLASS_TYPEDEF = 1 << 1 +STORAGE_CLASS_EXTERN = 1 << 2 +STORAGE_CLASS_STATIC = 1 << 3 +STORAGE_CLASS_AUTO = 1 << 4 +STORAGE_CLASS_REGISTER = 1 << 5 + +TYPE_QUALIFIER_NONE = 0 +TYPE_QUALIFIER_CONST = 1 << 1 +TYPE_QUALIFIER_RESTRICT = 1 << 2 +TYPE_QUALIFIER_VOLATILE = 1 << 3 + +FUNCTION_NONE = 0 +FUNCTION_INLINE = 1 << 1 + +UNARY_ADDRESS_OF +UNARY_POINTER_INDIRECTION +UNARY_PLUS +UNARY_MINUS +UNARY_BITWISE_COMPLEMENT +UNARY_LOGICAL_NEGATION diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c index b9245f2..4d7bc7d 100644 --- a/giscanner/giscannermodule.c +++ b/giscanner/giscannermodule.c @@ -100,9 +100,15 @@ symbol_get_base_type(PyGISourceSymbol *self, } static PyGetSetDef _PyGISourceSymbol_getsets[] = { + /* int ref_count; */ { "type", (getter)symbol_get_type, NULL, NULL}, + /* int id; */ { "ident", (getter)symbol_get_ident, NULL, NULL}, { "base_type", (getter)symbol_get_base_type, NULL, NULL}, + /* gboolean const_int_set; */ + /* int const_int; */ + /* char *const_string; */ + /* GSList *directives; */ { 0 } }; @@ -118,6 +124,27 @@ type_get_type(PyGISourceType *self, } static PyObject * +type_get_storage_class_specifier(PyGISourceType *self, + void *context) +{ + return PyInt_FromLong(self->type->storage_class_specifier); +} + +static PyObject * +type_get_type_qualifier(PyGISourceType *self, + void *context) +{ + return PyInt_FromLong(self->type->type_qualifier); +} + +static PyObject * +type_get_function_specifier(PyGISourceType *self, + void *context) +{ + return PyInt_FromLong(self->type->function_specifier); +} + +static PyObject * type_get_name(PyGISourceType *self, void *context) { @@ -130,9 +157,25 @@ type_get_name(PyGISourceType *self, return PyString_FromString(self->type->name); } +static PyObject * +type_get_base_type(PyGISourceType *self, + void *context) +{ + PyGISourceType *item; + item = (PyGISourceType *)PyObject_GC_New(PyGISourceType, + &PyGISourceType_Type); + item->type = self->type->base_type; + return (PyObject*)item; +} + static PyGetSetDef _PyGISourceType_getsets[] = { { "type", (getter)type_get_type, NULL, NULL}, + { "storage_class_specifier", (getter)type_get_storage_class_specifier, NULL, NULL}, + { "type_qualifier", (getter)type_get_type_qualifier, NULL, NULL}, + { "function_specifier", (getter)type_get_function_specifier, NULL, NULL}, { "name", (getter)type_get_name, NULL, NULL}, + { "base_type", (getter)type_get_base_type, NULL, NULL}, + /* { "child_list", (getter)type_get_child_list, NULL, NULL}, */ { 0 } }; diff --git a/giscanner/sourcescanner.c b/giscanner/sourcescanner.c index bb916e8..1902691 100644 --- a/giscanner/sourcescanner.c +++ b/giscanner/sourcescanner.c @@ -1,4 +1,4 @@ -/* GObject introspectaion: public scanner api +/* GObject introspection: public scanner api * * Copyright (C) 2007 Jürg Billeter * Copyright (C) 2008 Johan Dahlin diff --git a/giscanner/sourcescanner.h b/giscanner/sourcescanner.h index c1365e0..496a226 100644 --- a/giscanner/sourcescanner.h +++ b/giscanner/sourcescanner.h @@ -1,4 +1,4 @@ -/* GObject introspectaion: public scanner api +/* GObject introspection: public scanner api * * Copyright (C) 2007 Jürg Billeter * Copyright (C) 2008 Johan Dahlin