diff options
author | Johan Dahlin <jdahlin@async.com.br> | 2008-05-24 14:44:32 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-05-24 14:44:32 +0000 |
commit | 3e9c0d2462d922b6b00680ac9b52c495e24ef208 (patch) | |
tree | 7690f35393d53dfbdc13e1ed51af24160808b337 /giscanner/giscannermodule.c | |
parent | 661f264f8ad30b3261454b579b92a84e518d8e28 (diff) | |
download | gobject-introspection-3e9c0d2462d922b6b00680ac9b52c495e24ef208.tar.gz |
Revert back to using temporary files to send in headers. Allow Functions
2008-05-24 Johan Dahlin <jdahlin@async.com.br>
* giscanner/ast.py:
* giscanner/girwriter.py:
* giscanner/giscannermodule.c
(pygi_source_scanner_append_filename),
(pygi_source_scanner_parse_file):
* giscanner/glibtransformer.py:
* giscanner/sourcescanner.py:
Revert back to using temporary files to send in headers.
Allow Functions to be passed in as callbacks, add a couple
of try/excepts missing features.
We can now scan pango
svn path=/trunk/; revision=274
Diffstat (limited to 'giscanner/giscannermodule.c')
-rw-r--r-- | giscanner/giscannermodule.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c index ce5c4561..df258404 100644 --- a/giscanner/giscannermodule.c +++ b/giscanner/giscannermodule.c @@ -361,27 +361,38 @@ pygi_source_scanner_init (PyGISourceScanner *self, } static PyObject * +pygi_source_scanner_append_filename (PyGISourceScanner *self, + PyObject *args) +{ + char *filename; + + if (!PyArg_ParseTuple (args, "s:SourceScanner.append_filename", &filename)) + return NULL; + + self->scanner->filenames = g_list_append (self->scanner->filenames, + g_strdup (filename)); + + Py_INCREF (Py_None); + return Py_None; +} + +static PyObject * pygi_source_scanner_parse_file (PyGISourceScanner *self, PyObject *args) { int fd; - char *filename; FILE *fp; - if (!PyArg_ParseTuple (args, "is:SourceScanner.parse_file", &fd, &filename)) + if (!PyArg_ParseTuple (args, "i:SourceScanner.parse_file", &fd)) return NULL; fp = fdopen (fd, "r"); if (!fp) { - PyErr_SetFromErrnoWithFilename (PyExc_OSError, filename); + PyErr_SetFromErrno (PyExc_OSError); return NULL; } - self->scanner->filenames = - g_list_append (self->scanner->filenames, g_strdup (filename)); - self->scanner->current_filename = g_strdup (filename); - if (!gi_source_scanner_parse_file (self->scanner, fp)) { g_print ("Something went wrong during parsing.\n"); @@ -479,6 +490,7 @@ pygi_source_scanner_get_directives (PyGISourceScanner *self, static const PyMethodDef _PyGISourceScanner_methods[] = { { "get_directives", (PyCFunction) pygi_source_scanner_get_directives, METH_VARARGS }, { "get_symbols", (PyCFunction) pygi_source_scanner_get_symbols, METH_NOARGS }, + { "append_filename", (PyCFunction) pygi_source_scanner_append_filename, METH_VARARGS }, { "parse_file", (PyCFunction) pygi_source_scanner_parse_file, METH_VARARGS }, { "lex_filename", (PyCFunction) pygi_source_scanner_lex_filename, METH_VARARGS }, { "set_macro_scan", (PyCFunction) pygi_source_scanner_set_macro_scan, METH_VARARGS }, |