Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/giscanner/giscannermodule.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-02-25 20:25:36 (GMT)
committer Colin Walters <walters@verbum.org>2009-02-25 20:34:21 (GMT)
commit0b9dda0e725446882dca84b6a64688c8f0e5a4e3 (patch)
treefd7b7e5d75dc86ea18c1168310d80402fddf5c45 /giscanner/giscannermodule.c
parentc58582c7a88a95616fa87b81517ab8a2a76af92f (diff)
Bug 555964 - Parse floating-point #defines
Previously we just supported int and string, add double to this. Technically we should probably differentiate between float and double, but it's not likely to be very useful in practice to do so.
Diffstat (limited to 'giscanner/giscannermodule.c')
-rw-r--r--giscanner/giscannermodule.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c
index 7d63784..80d7f6b 100644
--- a/giscanner/giscannermodule.c
+++ b/giscanner/giscannermodule.c
@@ -135,10 +135,27 @@ static PyObject *
symbol_get_const_int (PyGISourceSymbol *self,
void *context)
{
+ if (!self->symbol->const_int_set)
+ {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
return PyInt_FromLong (self->symbol->const_int);
}
static PyObject *
+symbol_get_const_double (PyGISourceSymbol *self,
+ void *context)
+{
+ if (!self->symbol->const_double_set)
+ {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ return PyFloat_FromDouble (self->symbol->const_double);
+}
+
+static PyObject *
symbol_get_const_string (PyGISourceSymbol *self,
void *context)
{
@@ -171,7 +188,9 @@ static const PyGetSetDef _PyGISourceSymbol_getsets[] = {
{ "ident", (getter)symbol_get_ident, NULL, NULL},
{ "base_type", (getter)symbol_get_base_type, NULL, NULL},
/* gboolean const_int_set; */
- { "const_int", (getter)symbol_get_const_int, NULL, NULL},
+ { "const_int", (getter)symbol_get_const_int, NULL, NULL},
+ /* gboolean const_double_set; */
+ { "const_double", (getter)symbol_get_const_double, NULL, NULL},
{ "const_string", (getter)symbol_get_const_string, NULL, NULL},
{ "source_filename", (getter)symbol_get_source_filename, NULL, NULL},
{ 0 }