diff options
author | Matt Wilson <msw@redhat.com> | 1999-12-13 03:11:18 +0000 |
---|---|---|
committer | Matt Wilson <msw@src.gnome.org> | 1999-12-13 03:11:18 +0000 |
commit | 6f99ccee1be9e21368385dbff9eac485b1440531 (patch) | |
tree | b0bb050eea12995be531e68d59ff4ca36b01a1b2 /generate | |
parent | acebfab67912ae40c62089a2519d00c4241cbdb6 (diff) | |
download | pygtk-6f99ccee1be9e21368385dbff9eac485b1440531.tar.gz |
added util.py to be installed
1999-12-12 Matt Wilson <msw@redhat.com>
* pygnome/gnome/Makefile.am (gnome_PYTHON): added util.py
to be installed
* pygnome/gnome/util.py: Added new file to wrap gnome-util.h
functions.
* pygnome/generate/gnome.defs: added new gnome-util functions.
* pygtk/generate/generate.py (FunctionDefsParser.define_func): added new
string_or_null type to check for NULL when passing strings back
Diffstat (limited to 'generate')
-rw-r--r-- | generate/generate.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/generate/generate.py b/generate/generate.py index b423322a..4aa37fc9 100644 --- a/generate/generate.py +++ b/generate/generate.py @@ -224,7 +224,7 @@ class FunctionDefsParser(TypesParser): parseList = [] # args to PyArg_ParseTuple argList = [] # args to actual function extraCode = [] # any extra code (for enums, flags) - if retType == 'string': + if retType == 'string' or retType == 'string_or_null': # this is needed so we can free result string varDefs.add('char', '*ret') varDefs.add('PyObject', '*py_ret') @@ -400,7 +400,11 @@ class FunctionDefsParser(TypesParser): elif retType == 'string': impl.write(' ret = ') impl.write(funcCall) - impl.write(';\n py_ret = PyString_FromString(ret);\n g_free(ret);\n return py_ret;\n') + impl.write(';\n py_ret = PyString_FromString(ret);\n g_free(ret);\n return py_ret;\n') + elif retType == 'string_or_null': + impl.write(' ret = ') + impl.write(funcCall) + impl.write(';\n if (ret) {\n py_ret = PyString_FromString(ret);\n g_free(ret);\n return py_ret;\n } else {\n Py_INCREF(Py_None);\n return Py_None;\n }\n') elif retType in ('char', 'uchar'): impl.write(' return PyString_fromStringAndSize(*(') impl.write(funcCall) |