From 1da68bbc4d0725498d0e317e50c37d6cce515f22 Mon Sep 17 00:00:00 2001 From: "shaver%netscape.com" Date: Fri, 18 Dec 1998 17:12:07 +0000 Subject: [PATCH] invoke -> typelib --- xpcom/tools/xpidl/Makefile.in | 2 +- xpcom/tools/xpidl/xpidl.c | 18 +++++++------- xpcom/tools/xpidl/xpidl.h | 6 ++--- xpcom/tools/xpidl/xpidl_idl.c | 8 +++---- xpcom/tools/xpidl/xpidl_invoke.c | 0 xpcom/tools/xpidl/xpidl_typelib.c | 37 +++++++++++++++++++++++++++++ xpcom/typelib/xpidl/Makefile.in | 2 +- xpcom/typelib/xpidl/xpidl.c | 18 +++++++------- xpcom/typelib/xpidl/xpidl.h | 6 ++--- xpcom/typelib/xpidl/xpidl_idl.c | 8 +++---- xpcom/typelib/xpidl/xpidl_invoke.c | 0 xpcom/typelib/xpidl/xpidl_typelib.c | 37 +++++++++++++++++++++++++++++ 12 files changed, 108 insertions(+), 34 deletions(-) delete mode 100644 xpcom/tools/xpidl/xpidl_invoke.c create mode 100644 xpcom/tools/xpidl/xpidl_typelib.c delete mode 100644 xpcom/typelib/xpidl/xpidl_invoke.c create mode 100644 xpcom/typelib/xpidl/xpidl_typelib.c diff --git a/xpcom/tools/xpidl/Makefile.in b/xpcom/tools/xpidl/Makefile.in index 6b0b7290bb2..12409cb712e 100644 --- a/xpcom/tools/xpidl/Makefile.in +++ b/xpcom/tools/xpidl/Makefile.in @@ -28,7 +28,7 @@ CSRCS = \ xpidl.c \ xpidl_idl.c \ xpidl_header.c \ - xpidl_invoke.c \ + xpidl_typelib.c \ xpidl_doc.c \ $(NULL) diff --git a/xpcom/tools/xpidl/xpidl.c b/xpcom/tools/xpidl/xpidl.c index f394211c3a0..b27120f0383 100644 --- a/xpcom/tools/xpidl/xpidl.c +++ b/xpcom/tools/xpidl/xpidl.c @@ -26,13 +26,13 @@ gboolean enable_debug = FALSE; gboolean enable_warnings = FALSE; gboolean verbose_mode = FALSE; gboolean generate_docs = FALSE; -gboolean generate_invoke = FALSE; +gboolean generate_typelib = FALSE; gboolean generate_headers = FALSE; gboolean generate_nothing = FALSE; static char xpidl_usage_str[] = -"Usage: %s [-i] [-d] [-h] [-w] [-v] [-I path] [-n] [-o basename] filename.idl\n" -" -i generate InterfaceInfo data (filename.int) (NYI)\n" +"Usage: %s [-t] [-d] [-h] [-w] [-v] [-I path] [-n] [-o basename] filename.idl\n" +" -t generate typelib data (filename.xpt) (NYI)\n" " -d generate HTML documentation (filename.html) (NYI)\n" " -h generate C++ headers (filename.h)\n" " -w turn on warnings (recommended)\n" @@ -68,12 +68,12 @@ main(int argc, char *argv[]) case 'd': generate_docs = TRUE; break; - case 'i': - generate_invoke = TRUE; + case 't': + generate_typelib = TRUE; break; case 'h': - generate_headers = TRUE; - break; + generate_headers = TRUE; + break; case 'w': enable_warnings = TRUE; break; @@ -114,8 +114,8 @@ main(int argc, char *argv[]) } } - if (!(generate_docs || generate_invoke || generate_headers)) { - fprintf(stderr, "ERROR: must specify one of -i, -d, -h\n"); + if (!(generate_docs || generate_typelib || generate_headers)) { + fprintf(stderr, "ERROR: must specify one of -t, -d, -h\n"); xpidl_usage(argc, argv); return 1; } diff --git a/xpcom/tools/xpidl/xpidl.h b/xpcom/tools/xpidl/xpidl.h index 4e8ca79c1e7..de5710683d9 100644 --- a/xpcom/tools/xpidl/xpidl.h +++ b/xpcom/tools/xpidl/xpidl.h @@ -39,7 +39,7 @@ extern gboolean enable_debug; extern gboolean enable_warnings; extern gboolean verbose_mode; extern gboolean generate_docs; -extern gboolean generate_invoke; +extern gboolean generate_typelib; extern gboolean generate_headers; extern gboolean generate_nothing; @@ -59,7 +59,7 @@ typedef struct { } TreeState; #define TREESTATE_HEADER 0 -#define TREESTATE_INVOKE 1 +#define TREESTATE_TYPELIB 1 #define TREESTATE_DOC 2 #define TREESTATE_NUM 3 @@ -74,7 +74,7 @@ typedef gboolean (*nodeHandler)(TreeState *); extern nodeHandler *nodeDispatch[TREESTATE_NUM]; extern nodeHandler *headerDispatch(); -extern nodeHandler *invokeDispatch(); +extern nodeHandler *typelibDispatch(); extern nodeHandler *docDispatch(); /* diff --git a/xpcom/tools/xpidl/xpidl_idl.c b/xpcom/tools/xpidl/xpidl_idl.c index 695e0453e0d..059f80da14e 100644 --- a/xpcom/tools/xpidl/xpidl_idl.c +++ b/xpcom/tools/xpidl/xpidl_idl.c @@ -23,7 +23,7 @@ #include "xpidl.h" FILE *typelib_file = NULL; -FILE *invoke_file = NULL; +FILE *doc_file = NULL; FILE *header_file = NULL; nodeHandler *nodeDispatch[TREESTATE_NUM] = { NULL }; @@ -466,7 +466,7 @@ xpidl_process_idl(char *filename, IncludePathEntry *include_path, state.includes = stack.includes; state.include_path = include_path; nodeDispatch[TREESTATE_HEADER] = headerDispatch(); - nodeDispatch[TREESTATE_INVOKE] = invokeDispatch(); + nodeDispatch[TREESTATE_TYPELIB] = typelibDispatch(); nodeDispatch[TREESTATE_DOC] = docDispatch(); if (generate_headers) { if (strcmp(basename, "-")) { @@ -489,8 +489,8 @@ xpidl_process_idl(char *filename, IncludePathEntry *include_path, if (!ok) return 0; } - if (generate_invoke) { - state.mode = TREESTATE_INVOKE; + if (generate_typelib) { + state.mode = TREESTATE_TYPELIB; state.tree = top; if (!process_tree(&state)) return 0; diff --git a/xpcom/tools/xpidl/xpidl_invoke.c b/xpcom/tools/xpidl/xpidl_invoke.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/xpcom/tools/xpidl/xpidl_typelib.c b/xpcom/tools/xpidl/xpidl_typelib.c new file mode 100644 index 00000000000..a13e2c4dcef --- /dev/null +++ b/xpcom/tools/xpidl/xpidl_typelib.c @@ -0,0 +1,37 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* + * Generate typelib files for use with InterfaceInfo. + * http://www.mozilla.org/scriptable/typelib_file.html + */ + +#include "xpidl.h" + +nodeHandler *typelibDispatch() +{ + static nodeHandler table[IDLN_LAST]; + static gboolean initialized = FALSE; + + if (!initialized) { + /* Initialize non-NULL elements */ + initialized = TRUE; + } + + return table; +} diff --git a/xpcom/typelib/xpidl/Makefile.in b/xpcom/typelib/xpidl/Makefile.in index 6b0b7290bb2..12409cb712e 100644 --- a/xpcom/typelib/xpidl/Makefile.in +++ b/xpcom/typelib/xpidl/Makefile.in @@ -28,7 +28,7 @@ CSRCS = \ xpidl.c \ xpidl_idl.c \ xpidl_header.c \ - xpidl_invoke.c \ + xpidl_typelib.c \ xpidl_doc.c \ $(NULL) diff --git a/xpcom/typelib/xpidl/xpidl.c b/xpcom/typelib/xpidl/xpidl.c index f394211c3a0..b27120f0383 100644 --- a/xpcom/typelib/xpidl/xpidl.c +++ b/xpcom/typelib/xpidl/xpidl.c @@ -26,13 +26,13 @@ gboolean enable_debug = FALSE; gboolean enable_warnings = FALSE; gboolean verbose_mode = FALSE; gboolean generate_docs = FALSE; -gboolean generate_invoke = FALSE; +gboolean generate_typelib = FALSE; gboolean generate_headers = FALSE; gboolean generate_nothing = FALSE; static char xpidl_usage_str[] = -"Usage: %s [-i] [-d] [-h] [-w] [-v] [-I path] [-n] [-o basename] filename.idl\n" -" -i generate InterfaceInfo data (filename.int) (NYI)\n" +"Usage: %s [-t] [-d] [-h] [-w] [-v] [-I path] [-n] [-o basename] filename.idl\n" +" -t generate typelib data (filename.xpt) (NYI)\n" " -d generate HTML documentation (filename.html) (NYI)\n" " -h generate C++ headers (filename.h)\n" " -w turn on warnings (recommended)\n" @@ -68,12 +68,12 @@ main(int argc, char *argv[]) case 'd': generate_docs = TRUE; break; - case 'i': - generate_invoke = TRUE; + case 't': + generate_typelib = TRUE; break; case 'h': - generate_headers = TRUE; - break; + generate_headers = TRUE; + break; case 'w': enable_warnings = TRUE; break; @@ -114,8 +114,8 @@ main(int argc, char *argv[]) } } - if (!(generate_docs || generate_invoke || generate_headers)) { - fprintf(stderr, "ERROR: must specify one of -i, -d, -h\n"); + if (!(generate_docs || generate_typelib || generate_headers)) { + fprintf(stderr, "ERROR: must specify one of -t, -d, -h\n"); xpidl_usage(argc, argv); return 1; } diff --git a/xpcom/typelib/xpidl/xpidl.h b/xpcom/typelib/xpidl/xpidl.h index 4e8ca79c1e7..de5710683d9 100644 --- a/xpcom/typelib/xpidl/xpidl.h +++ b/xpcom/typelib/xpidl/xpidl.h @@ -39,7 +39,7 @@ extern gboolean enable_debug; extern gboolean enable_warnings; extern gboolean verbose_mode; extern gboolean generate_docs; -extern gboolean generate_invoke; +extern gboolean generate_typelib; extern gboolean generate_headers; extern gboolean generate_nothing; @@ -59,7 +59,7 @@ typedef struct { } TreeState; #define TREESTATE_HEADER 0 -#define TREESTATE_INVOKE 1 +#define TREESTATE_TYPELIB 1 #define TREESTATE_DOC 2 #define TREESTATE_NUM 3 @@ -74,7 +74,7 @@ typedef gboolean (*nodeHandler)(TreeState *); extern nodeHandler *nodeDispatch[TREESTATE_NUM]; extern nodeHandler *headerDispatch(); -extern nodeHandler *invokeDispatch(); +extern nodeHandler *typelibDispatch(); extern nodeHandler *docDispatch(); /* diff --git a/xpcom/typelib/xpidl/xpidl_idl.c b/xpcom/typelib/xpidl/xpidl_idl.c index 695e0453e0d..059f80da14e 100644 --- a/xpcom/typelib/xpidl/xpidl_idl.c +++ b/xpcom/typelib/xpidl/xpidl_idl.c @@ -23,7 +23,7 @@ #include "xpidl.h" FILE *typelib_file = NULL; -FILE *invoke_file = NULL; +FILE *doc_file = NULL; FILE *header_file = NULL; nodeHandler *nodeDispatch[TREESTATE_NUM] = { NULL }; @@ -466,7 +466,7 @@ xpidl_process_idl(char *filename, IncludePathEntry *include_path, state.includes = stack.includes; state.include_path = include_path; nodeDispatch[TREESTATE_HEADER] = headerDispatch(); - nodeDispatch[TREESTATE_INVOKE] = invokeDispatch(); + nodeDispatch[TREESTATE_TYPELIB] = typelibDispatch(); nodeDispatch[TREESTATE_DOC] = docDispatch(); if (generate_headers) { if (strcmp(basename, "-")) { @@ -489,8 +489,8 @@ xpidl_process_idl(char *filename, IncludePathEntry *include_path, if (!ok) return 0; } - if (generate_invoke) { - state.mode = TREESTATE_INVOKE; + if (generate_typelib) { + state.mode = TREESTATE_TYPELIB; state.tree = top; if (!process_tree(&state)) return 0; diff --git a/xpcom/typelib/xpidl/xpidl_invoke.c b/xpcom/typelib/xpidl/xpidl_invoke.c deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/xpcom/typelib/xpidl/xpidl_typelib.c b/xpcom/typelib/xpidl/xpidl_typelib.c new file mode 100644 index 00000000000..a13e2c4dcef --- /dev/null +++ b/xpcom/typelib/xpidl/xpidl_typelib.c @@ -0,0 +1,37 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +/* + * Generate typelib files for use with InterfaceInfo. + * http://www.mozilla.org/scriptable/typelib_file.html + */ + +#include "xpidl.h" + +nodeHandler *typelibDispatch() +{ + static nodeHandler table[IDLN_LAST]; + static gboolean initialized = FALSE; + + if (!initialized) { + /* Initialize non-NULL elements */ + initialized = TRUE; + } + + return table; +}