From 841ecdf404e166945f5cc6cd320ca15dfb93b57c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 19 Dec 2012 19:28:29 +0000 Subject: allow generation of header for exported interfaces and structures. --- src/nsgenbind.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/nsgenbind.c') diff --git a/src/nsgenbind.c b/src/nsgenbind.c index 0f549f9..1c5100e 100644 --- a/src/nsgenbind.c +++ b/src/nsgenbind.c @@ -30,7 +30,7 @@ static struct options* process_cmdline(int argc, char **argv) return NULL; } - while ((opt = getopt(argc, argv, "vDW::d:I:o:")) != -1) { + while ((opt = getopt(argc, argv, "vDW::d:I:o:h:")) != -1) { switch (opt) { case 'I': options->idlpath = strdup(optarg); @@ -40,6 +40,10 @@ static struct options* process_cmdline(int argc, char **argv) options->outfilename = strdup(optarg); break; + case 'h': + options->hdrfilename = strdup(optarg); + break; + case 'd': options->depfilename = strdup(optarg); break; @@ -58,7 +62,7 @@ static struct options* process_cmdline(int argc, char **argv) default: /* '?' */ fprintf(stderr, - "Usage: %s [-d depfilename] [-I idlpath] [-o filename] inputfile\n", + "Usage: %s [-v] [-D] [-W] [-d depfilename] [-I idlpath] [-o filename] [-h headerfile] inputfile\n", argv[0]); free(options); return NULL; @@ -131,10 +135,17 @@ int main(int argc, char **argv) genbind_ast_dump(genbind_root, 0); } - res = jsapi_libdom_output(options->outfilename, genbind_root); + res = jsapi_libdom_output(options->outfilename, + options->hdrfilename, + genbind_root); if (res != 0) { fprintf(stderr, "Error: output failed with code %d\n", res); - unlink(options->outfilename); + if (options->outfilename != NULL) { + unlink(options->outfilename); + } + if (options->hdrfilename != NULL) { + unlink(options->hdrfilename); + } return res; } -- cgit v1.2.3