]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/Modules/debug.cxx
1 /*******************************************************************************
2 * Simplified Wrapper and Interface Generator (SWIG)
4 * Author : David Beazley
6 * Department of Computer Science
7 * University of Chicago
10 * beazley@cs.uchicago.edu
12 * Please read the file LICENSE for the copyright and terms by which SWIG
13 * can be used and distributed.
14 *******************************************************************************/
15 /**************************************************************************
20 * This is a dummy language module that is used only for testing the SWIG
23 * It creates a wrapper file, but only containing descriptions of what
26 ***************************************************************************/
31 void DEBUGLANG::parse_args(int, char **) {
32 sprintf(LibDir
,"%s",path
);
33 typemap_lang
= "debug";
36 void DEBUGLANG::parse() {
41 void DEBUGLANG::set_module(char *mod_name
, char **) {
43 module = new char[strlen(mod_name
)+1];
44 strcpy(module,mod_name
);
47 void DEBUGLANG::set_init(char *init_name
) {
48 set_module(init_name
,0);
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");
57 void DEBUGLANG::initialize(void) {
59 fprintf(f_header
,"#define SWIG_init %s_init\n\n", module);
60 fprintf(f_header
,"#define SWIG_name \"%s\"\n", module);
62 fprintf(f_init
,"\n/* MODULE INITIALIZATION */\n\n");
63 fprintf(f_init
,"void %s_init() {\n", module);
67 void DEBUGLANG::close(void) {
68 fprintf(f_init
,"} /* END INIT */\n");
70 fprintf(f_wrappers
,"SWIG POINTER-MAPPING TABLE\n\n");
71 emit_ptr_equivalence(f_init
);
74 void DEBUGLANG::create_function(char *name
, char *iname
, DataType
*d
, ParmList
*l
) {
76 fprintf(f_wrappers
,"WRAPPER : ");
77 emit_extern_func(name
,d
,l
,0,f_wrappers
);
78 fprintf(f_wrappers
,"\n");
80 fprintf(f_init
," ADD COMMAND : %s --> ", iname
);
81 emit_extern_func(name
,d
,l
,0,f_init
);
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
);
89 fprintf(f_init
," ADD VARIABLE : %s --> ", iname
);
90 emit_extern_var(name
,t
,0,f_init
);
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
);
99 void DEBUGLANG::add_native(char *name
, char *funcname
) {
100 fprintf(f_init
," ADD NATIVE : %s --> %s\n", name
, funcname
);
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
);
112 void DEBUGLANG::cpp_constructor(char *name
, char *iname
, ParmList
*l
) {
114 fprintf(f_wrappers
," CONSTRUCTOR : ");
115 t
= new DataType(T_USER
);
116 sprintf(t
->name
,"%s",name
);
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
);
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
);
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
);
136 void DEBUGLANG::cpp_close_class() {
137 fprintf(f_wrappers
,"C++ CLASS END ===================================================\n\n");
138 fprintf(f_init
," // C++ CLASS END \n\n");
141 void DEBUGLANG::cpp_inherit(char **baseclass
, int) {
144 fprintf(f_wrappers
,"inheriting from baseclass :");
145 while (baseclass
[i
]) {
146 fprintf(f_wrappers
," %s",baseclass
[i
]);
149 fprintf(f_wrappers
,"\n");
151 this->Language::cpp_inherit(baseclass
);
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
);
161 void DEBUGLANG::cpp_static_func(char *name
, char *iname
, DataType
*t
, ParmList
*l
) {
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
);
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
);
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
);
185 void DEBUGLANG::pragma(char *lname
, char *name
, char *value
) {
186 fprintf(f_wrappers
,"PRAGMA : LANG = %s, NAME = %s ", lname
, name
);
188 fprintf(f_wrappers
,", VALUE = %s\n", value
);
190 fprintf(f_wrappers
,"\n");
194 void DEBUGLANG::cpp_class_decl(char *name
, char *, char *type
) {
195 fprintf(f_wrappers
,"C++ CLASS DECLARATION : %s %s\n", type
,name
);