]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/Modules/debug.cxx
the Russian translations were somehow corrupted, fixed
[wxWidgets.git] / wxPython / wxSWIG / Modules / debug.cxx
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 * $Header$
17 *
18 * debug.cxx
19 *
20 * This is a dummy language module that is used only for testing the SWIG
21 * parser.
22 *
23 * It creates a wrapper file, but only containing descriptions of what
24 * was wrapped.
25 *
26 ***************************************************************************/
27
28 #include "swig.h"
29 #include "debug.h"
30
31 void DEBUGLANG::parse_args(int, char **) {
32 sprintf(LibDir,"%s",path);
33 typemap_lang = "debug";
34 }
35
36 void DEBUGLANG::parse() {
37 headers();
38 yyparse();
39 }
40
41 void DEBUGLANG::set_module(char *mod_name, char **) {
42 if (module) return;
43 module = new char[strlen(mod_name)+1];
44 strcpy(module,mod_name);
45 }
46
47 void DEBUGLANG::set_init(char *init_name) {
48 set_module(init_name,0);
49 }
50
51 void DEBUGLANG::headers(void) {
52 fprintf(f_header,"/* DEBUG : Language specific headers go here */\n\n");
53 fprintf(f_header,"/* DEBUG : Pointer conversion function here */\n\n");
54 fprintf(f_header,"/* DEBUG : Language specific code here */\n\n");
55 }
56
57 void DEBUGLANG::initialize(void) {
58
59 fprintf(f_header,"#define SWIG_init %s_init\n\n", module);
60 fprintf(f_header,"#define SWIG_name \"%s\"\n", module);
61
62 fprintf(f_init,"\n/* MODULE INITIALIZATION */\n\n");
63 fprintf(f_init,"void %s_init() {\n", module);
64
65 }
66
67 void DEBUGLANG::close(void) {
68 fprintf(f_init,"} /* END INIT */\n");
69
70 fprintf(f_wrappers,"SWIG POINTER-MAPPING TABLE\n\n");
71 emit_ptr_equivalence(f_init);
72 }
73
74 void DEBUGLANG::create_function(char *name, char *iname, DataType *d, ParmList *l) {
75
76 fprintf(f_wrappers,"WRAPPER : ");
77 emit_extern_func(name,d,l,0,f_wrappers);
78 fprintf(f_wrappers,"\n");
79
80 fprintf(f_init," ADD COMMAND : %s --> ", iname);
81 emit_extern_func(name,d,l,0,f_init);
82
83 }
84
85 void DEBUGLANG::link_variable(char *name, char *iname, DataType *t) {
86 fprintf(f_wrappers,"WRAPPER : ");
87 emit_extern_var(name,t,0,f_wrappers);
88
89 fprintf(f_init," ADD VARIABLE : %s --> ", iname);
90 emit_extern_var(name,t,0,f_init);
91
92 }
93
94 void DEBUGLANG::declare_const(char *name, char *, DataType *type, char *value) {
95 if (!value) value = "[None]";
96 fprintf(f_init," ADD CONSTANT : %s %s = %s\n", type->print_cast(),name,value);
97 }
98
99 void DEBUGLANG::add_native(char *name, char *funcname) {
100 fprintf(f_init," ADD NATIVE : %s --> %s\n", name, funcname);
101 }
102
103 void DEBUGLANG::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
104 fprintf(f_wrappers," MEMBER FUNC : ");
105 emit_extern_func(name,t,l,0,f_wrappers);
106 fprintf(f_wrappers,"\n");
107 if (!iname) iname = name;
108 fprintf(f_init," ADD MEMBER FUN : %s --> ", iname);
109 emit_extern_func(name,t,l,0,f_init);
110 }
111
112 void DEBUGLANG::cpp_constructor(char *name, char *iname, ParmList *l) {
113 DataType *t;
114 fprintf(f_wrappers," CONSTRUCTOR : ");
115 t = new DataType(T_USER);
116 sprintf(t->name,"%s",name);
117 t->is_pointer=1;
118 emit_extern_func(name,t,l,0,f_wrappers);
119 if (!iname) iname = name;
120 fprintf(f_init," ADD CONSTRUCT : %s --> ", iname);
121 emit_extern_func(name,t,l,0,f_init);
122 }
123
124 void DEBUGLANG::cpp_destructor(char *name, char *iname) {
125 fprintf(f_wrappers," DESTRUCTOR : ~%s();\n", name);
126 if (!iname) iname = name;
127 fprintf(f_init," ADD DESTRUCT : %s --> ~%s();\n",iname,name);
128 }
129
130 void DEBUGLANG::cpp_open_class(char *name, char *iname, char *ctype, int strip) {
131 this->Language::cpp_open_class(name, iname, ctype,strip);
132 fprintf(f_wrappers,"C++ CLASS START : %s %s ========================================\n\n",ctype,name);
133 fprintf(f_init,"\n // C++ CLASS START : %s %s\n",ctype,name);
134 }
135
136 void DEBUGLANG::cpp_close_class() {
137 fprintf(f_wrappers,"C++ CLASS END ===================================================\n\n");
138 fprintf(f_init," // C++ CLASS END \n\n");
139 }
140
141 void DEBUGLANG::cpp_inherit(char **baseclass, int) {
142 int i = 0;
143 if (baseclass) {
144 fprintf(f_wrappers,"inheriting from baseclass :");
145 while (baseclass[i]) {
146 fprintf(f_wrappers," %s",baseclass[i]);
147 i++;
148 }
149 fprintf(f_wrappers,"\n");
150 }
151 this->Language::cpp_inherit(baseclass);
152 }
153
154 void DEBUGLANG::cpp_variable(char *name, char *iname, DataType *t) {
155 fprintf(f_wrappers," ATTRIBUTE : ");
156 emit_extern_var(name,t,0,f_wrappers);
157 if (!iname) iname = name;
158 fprintf(f_init," ADD MEMBER : %s --> ", iname);
159 emit_extern_var(name,t,0,f_init);
160 }
161 void DEBUGLANG::cpp_static_func(char *name, char *iname, DataType *t, ParmList *l) {
162
163 fprintf(f_wrappers," STATIC FUNC : ");
164 emit_extern_func(name,t,l,0,f_wrappers);
165 fprintf(f_init," ADD STATIC FUNC: %s --> ", iname);
166 emit_extern_func(name,t,l,0,f_init);
167
168 }
169
170 void DEBUGLANG::cpp_declare_const(char *name, char *iname, DataType *t, char *value) {
171 if (!value) value = "[None]";
172 fprintf(f_wrappers," C++ CONST : %s %s = %s\n", t->print_cast(), name, value);
173 if (!iname) iname = name;
174 fprintf(f_init," ADD C++ CONST : %s --> %s = %s\n", iname, t->print_cast(), value);
175 }
176
177 void DEBUGLANG::cpp_static_var(char *name, char *iname, DataType *t) {
178 fprintf(f_wrappers," C++ STATIC VAR: ");
179 emit_extern_var(name,t,0,f_wrappers);
180 if (!iname) iname = name;
181 fprintf(f_init," ADD STATIC VAR : %s --> ",iname);
182 emit_extern_var(name,t,0,f_init);
183 }
184
185 void DEBUGLANG::pragma(char *lname, char *name, char *value) {
186 fprintf(f_wrappers,"PRAGMA : LANG = %s, NAME = %s ", lname, name);
187 if (value) {
188 fprintf(f_wrappers,", VALUE = %s\n", value);
189 } else {
190 fprintf(f_wrappers,"\n");
191 }
192 }
193
194 void DEBUGLANG::cpp_class_decl(char *name, char *, char *type) {
195 fprintf(f_wrappers,"C++ CLASS DECLARATION : %s %s\n", type,name);
196 }
197
198