]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wxSWIG/Modules/swigmain.cxx
Since I have made several changes to SWIG over the years to accomodate
[wxWidgets.git] / wxPython / wxSWIG / Modules / swigmain.cxx
CommitLineData
c90f71dd
RD
1/*******************************************************************************
2 * Simplified Wrapper and Interface Generator (SWIG)
3 *
4 * Author : David Beazley
5 *
6 * Department of Computer Science
7 * University of Chicago
8 * 1100 E 58th Street
9 * Chicago, IL 60637
10 * beazley@cs.uchicago.edu
11 *
12 * Please read the file LICENSE for the copyright and terms by which SWIG
13 * can be used and distributed.
14 *******************************************************************************/
15
16/***********************************************************************
17 * $Header$
18 *
19 * swigmain.cxx
20 *
21 * The main program.
22 *
23 ***********************************************************************/
24
25#include "wrap.h"
26#include "swigtcl.h"
27#include "tcl8.h"
28#include "perl5.h"
29#include "python.h"
30// #include "pythoncom.h"
31#include "guile.h"
32#include "debug.h"
33#include "ascii.h"
34#include "latex.h"
35#include "html.h"
36#include "nodoc.h"
37#include <ctype.h>
38
39static char *usage = "\
40swig <options> filename\n\n\
41Target Language Options:\n\
42 -tcl - Generate Tcl wrappers.\n\
43 -tcl8 - Generate Tcl 8.0 wrappers.\n\
44 -python - Generate Python wrappers.\n\
45 -perl5 - Generate Perl5 wrappers.\n\
46 -guile - Generate Guile wrappers.\n\
47 -debug - Parser debugging module.\n";
48
49#ifdef MACSWIG
50static char *macmessage = "\
51Copyright (c) 1995-1997\n\
52University of Utah and the Regents of the University of California\n\n\
53Enter SWIG processing options and filename below. For example :\n\
54\n\
55 -tcl -c++ interface.i\n\
56\n\
57-help displays a list of all available options.\n\
58\n\
59Note : Macintosh filenames should be enclosed in quotes if they contain whitespace.\n\
60\n";
61
62#endif
63
64//-----------------------------------------------------------------
65// main()
66//
67// Main program. Initializes the files and starts the parser.
68//-----------------------------------------------------------------
69
70#ifndef MACSWIG
71int main(int argc, char **argv) {
72#else
73int Mac_main(int argc, char **argv) {
74#endif
75
76 int i;
77
78 Language *dl = new SWIG_LANG;
79 Documentation *dd = new SWIG_DOC;
80 extern int SWIG_main(int, char **, Language *, Documentation *);
81
82 init_args(argc,argv);
83
84 // Get options
85 for (i = 1; i < argc; i++) {
86 if (argv[i]) {
87 if(strcmp(argv[i],"-tcl") == 0) {
88 dl = new TCL;
89 mark_arg(i);
90 } else if (strcmp(argv[i],"-tcl8") == 0) {
91 dl = new TCL8;
92 mark_arg(i);
93 } else if (strcmp(argv[i],"-perl5") == 0) {
94 dl = new PERL5;
95 mark_arg(i);
96 } else if (strcmp(argv[i],"-python") == 0) {
97 dl = new PYTHON;
98 mark_arg(i);
99 } else if (strcmp(argv[i],"-debug") == 0) {
100 dl = new DEBUGLANG;
101 mark_arg(i);
102 } else if (strcmp(argv[i],"-guile") == 0) {
103 dl = new GUILE;
104 mark_arg(i);
105 } else if (strcmp(argv[i],"-help") == 0) {
106 fputs(usage,stderr);
107 mark_arg(i);
108 }
109 }
110 }
111 SWIG_main(argc,argv,dl,dd);
112 return 0;
113}
114
115#ifdef MACSWIG
116int MacMainEntry(char *options) {
117 static char *_argv[256];
118 int i,argc;
119 char *c,*s,*t;
120
121 swig_log = fopen("swig_log","w");
122 fprintf(swig_log,"SWIG 1.1\n");
123 fprintf(swig_log,"Options : %s\n", options);
124 fprintf(swig_log,"-----------------------------------------------------\n");
125
126 // Tokenize the user input
127
128 _argv[0] = "swig";
129 i=1;
130 c = options;
131 while (*c) {
132 while(isspace(*c)) c++;
133 if (*c) {
134 s = c; // Starting character
135 while(isgraph(*c)) {
136 if (*c == '\"') {
137 c++;
138 while ((*c) && (*c != '\"'))
139 c++;
140 c++;
141 } else {
142 c++;
143 }
144 }
145 // Found some whitespace
146 if (*c) {
147 *c = 0;
148 c++;
149 }
150 _argv[i] = copy_string(s);
151 // Go through and remove quotes (if necessary)
152
153 t = _argv[i];
154 while(*s) {
155 if (*s != '\"')
156 *(t++) = *s;
157 s++;
158 }
159 *t = 0;
160 i++;
161 }
162 }
163 argc = i;
164 _argv[i] = 0;
165 return Mac_main(argc,_argv);
166}
167
168#endif