diff options
author | Johan Dahlin <johan@gnome.org> | 2008-03-27 19:20:45 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-03-27 19:20:45 +0000 |
commit | 8427c62f516831ffef9aa8e2b35748b856bf89ec (patch) | |
tree | 5fb3fd892c4577af55579f3dda9b57ee71e58934 /giscanner/giscannermodule.c | |
parent | 2faf92a1d87c6cd9b0d3dce20da74dc82a7e82c8 (diff) | |
download | gobject-introspection-8427c62f516831ffef9aa8e2b35748b856bf89ec.tar.gz |
Add simple pre-processor using subprocess and a PIPE. Change the
2008-03-27 Johan Dahlin <johan@gnome.org>
* giscanner/giscannermodule.c:
* giscanner/scannerlexer.l:
* giscanner/sourcescanner.c:
* tools/g-ir-scanner:
Add simple pre-processor using subprocess and a PIPE.
Change the parse_file apis to accept a file descriptor.
svn path=/trunk/; revision=169
Diffstat (limited to 'giscanner/giscannermodule.c')
-rw-r--r-- | giscanner/giscannermodule.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/giscanner/giscannermodule.c b/giscanner/giscannermodule.c index 4d7bc7d5..c14151e0 100644 --- a/giscanner/giscannermodule.c +++ b/giscanner/giscannermodule.c @@ -200,13 +200,14 @@ static PyObject * pygi_source_scanner_parse_file (PyGISourceScanner *self, PyObject *args) { + int fd; char *filename; FILE *fp; - if (!PyArg_ParseTuple (args, "s:SourceScanner.__init__", &filename)) + if (!PyArg_ParseTuple (args, "is:SourceScanner.__init__", &fd, &filename)) return NULL; - fp = fopen (filename, "r"); + fp = fdopen (fd, "r"); if (!fp) { PyErr_SetFromErrnoWithFilename (PyExc_OSError, filename); @@ -215,16 +216,14 @@ pygi_source_scanner_parse_file (PyGISourceScanner *self, self->scanner->filenames = g_list_append (self->scanner->filenames, g_strdup (filename)); - self->scanner->current_filename = self->scanner->filenames->data; - + self->scanner->current_filename = g_strdup (filename); + if (!gi_source_scanner_parse_file (self->scanner, fp)) { g_print ("Something went wrong..\n"); return NULL; } - fclose (fp); - Py_INCREF (Py_None); return Py_None; } |