]>
Commit | Line | Data |
---|---|---|
09ee8e72 RD |
1 | *** cplus.cxx.old Mon Feb 02 14:55:42 1998 |
2 | --- cplus.cxx Fri Aug 28 12:02:50 1998 | |
3 | *************** | |
4 | *** 581,612 **** | |
5 | // Class for managing class members (internally) | |
6 | // ---------------------------------------------------------------------- | |
7 | ||
8 | static char *inherit_base_class = 0; | |
9 | ||
10 | - class CPP_class { | |
11 | - public: | |
12 | - char *classname; // Real class name | |
13 | - char *classrename; // New name of class (if applicable) | |
14 | - char *classtype; // class type (struct, union, class) | |
15 | - int strip; // Strip off class declarator | |
16 | - int wextern; // Value of extern wrapper variable for this class | |
17 | - int have_constructor; // Status bit indicating if we've seen a constructor | |
18 | - int have_destructor; // Status bit indicating if a destructor has been seen | |
19 | - int is_abstract; // Status bit indicating if this is an abstract class | |
20 | - int generate_default; // Generate default constructors | |
21 | - int objective_c; // Set if this is an objective C class | |
22 | - int error; // Set if this class can't be generated | |
23 | - int line; // Line number | |
24 | - char **baseclass; // Base classes (if any) | |
25 | - Hash *local; // Hash table for local types | |
26 | - Hash *scope; // Local scope hash table | |
27 | - DocEntry *de; // Documentation entry of class | |
28 | - CPP_member *members; // Linked list of members | |
29 | - CPP_class *next; // Next class | |
30 | - static CPP_class *classlist; // List of all classes stored | |
31 | ||
32 | ! CPP_class(char *name, char *ctype) { | |
33 | CPP_class *c; | |
34 | classname = copy_string(name); | |
35 | classtype = copy_string(ctype); | |
36 | classrename = 0; | |
37 | --- 581,593 ---- | |
38 | // Class for managing class members (internally) | |
39 | // ---------------------------------------------------------------------- | |
40 | ||
41 | static char *inherit_base_class = 0; | |
42 | + CPP_class *CPP_class::classlist = 0; | |
43 | + CPP_class *current_class; | |
44 | ||
45 | ||
46 | ! CPP_class::CPP_class(char *name, char *ctype) { | |
47 | CPP_class *c; | |
48 | classname = copy_string(name); | |
49 | classtype = copy_string(ctype); | |
50 | classrename = 0; | |
51 | *************** | |
52 | *** 642,650 **** | |
53 | // ------------------------------------------------------------------------------ | |
54 | // Add a new C++ member to this class | |
55 | // ------------------------------------------------------------------------------ | |
56 | ||
57 | ! void add_member(CPP_member *m) { | |
58 | CPP_member *cm; | |
59 | ||
60 | // Set base class where this was defined | |
61 | if (inherit_base_class) | |
62 | --- 623,631 ---- | |
63 | // ------------------------------------------------------------------------------ | |
64 | // Add a new C++ member to this class | |
65 | // ------------------------------------------------------------------------------ | |
66 | ||
67 | ! void CPP_class::add_member(CPP_member *m) { | |
68 | CPP_member *cm; | |
69 | ||
70 | // Set base class where this was defined | |
71 | if (inherit_base_class) | |
72 | *************** | |
73 | *** 664,672 **** | |
74 | // ------------------------------------------------------------------------------ | |
75 | // Search for a member with the given name. Returns the member on success, 0 on failure | |
76 | // ------------------------------------------------------------------------------ | |
77 | ||
78 | ! CPP_member *search_member(char *name) { | |
79 | CPP_member *m; | |
80 | char *c; | |
81 | m = members; | |
82 | while (m) { | |
83 | --- 645,653 ---- | |
84 | // ------------------------------------------------------------------------------ | |
85 | // Search for a member with the given name. Returns the member on success, 0 on failure | |
86 | // ------------------------------------------------------------------------------ | |
87 | ||
88 | ! CPP_member *CPP_class::search_member(char *name) { | |
89 | CPP_member *m; | |
90 | char *c; | |
91 | m = members; | |
92 | while (m) { | |
93 | *************** | |
94 | *** 680,688 **** | |
95 | // ------------------------------------------------------------------------------ | |
96 | // Inherit. Put all the declarations associated with this class into the current | |
97 | // ------------------------------------------------------------------------------ | |
98 | ||
99 | ! void inherit_decls(int mode) { | |
100 | CPP_member *m; | |
101 | m = members; | |
102 | while (m) { | |
103 | inherit_base_class = m->base; | |
104 | --- 661,669 ---- | |
105 | // ------------------------------------------------------------------------------ | |
106 | // Inherit. Put all the declarations associated with this class into the current | |
107 | // ------------------------------------------------------------------------------ | |
108 | ||
109 | ! void CPP_class::inherit_decls(int mode) { | |
110 | CPP_member *m; | |
111 | m = members; | |
112 | while (m) { | |
113 | inherit_base_class = m->base; | |
114 | *************** | |
115 | *** 696,704 **** | |
116 | // ------------------------------------------------------------------------------ | |
117 | // Emit all of the declarations associated with this class | |
118 | // ------------------------------------------------------------------------------ | |
119 | ||
120 | ! void emit_decls() { | |
121 | CPP_member *m = members; | |
122 | int last_scope = name_scope(0); | |
123 | abstract = is_abstract; | |
124 | while (m) { | |
125 | --- 677,685 ---- | |
126 | // ------------------------------------------------------------------------------ | |
127 | // Emit all of the declarations associated with this class | |
128 | // ------------------------------------------------------------------------------ | |
129 | ||
130 | ! void CPP_class::emit_decls() { | |
131 | CPP_member *m = members; | |
132 | int last_scope = name_scope(0); | |
133 | abstract = is_abstract; | |
134 | while (m) { | |
135 | *************** | |
136 | *** 713,721 **** | |
137 | // ------------------------------------------------------------------------------ | |
138 | // Search for a given class in the list | |
139 | // ------------------------------------------------------------------------------ | |
140 | ||
141 | ! static CPP_class *search(char *name) { | |
142 | CPP_class *c; | |
143 | c = classlist; | |
144 | if (!name) return 0; | |
145 | while (c) { | |
146 | --- 694,702 ---- | |
147 | // ------------------------------------------------------------------------------ | |
148 | // Search for a given class in the list | |
149 | // ------------------------------------------------------------------------------ | |
150 | ||
151 | ! CPP_class *CPP_class::search(char *name) { | |
152 | CPP_class *c; | |
153 | c = classlist; | |
154 | if (!name) return 0; | |
155 | while (c) { | |
156 | *************** | |
157 | *** 729,737 **** | |
158 | // Add default constructors and destructors | |
159 | // | |
160 | // ------------------------------------------------------------------------------ | |
161 | ||
162 | ! void create_default() { | |
163 | if (!generate_default) return; | |
164 | ||
165 | // Try to generate a constructor if not available. | |
166 | ||
167 | --- 710,718 ---- | |
168 | // Add default constructors and destructors | |
169 | // | |
170 | // ------------------------------------------------------------------------------ | |
171 | ||
172 | ! void CPP_class::create_default() { | |
173 | if (!generate_default) return; | |
174 | ||
175 | // Try to generate a constructor if not available. | |
176 | ||
177 | *************** | |
178 | *** 751,764 **** | |
179 | // ------------------------------------------------------------------------------ | |
180 | // Dump *all* of the classes saved out to the various | |
181 | // language modules (this does what cplus_close_class used to do) | |
182 | // ------------------------------------------------------------------------------ | |
183 | - static void create_all(); | |
184 | - }; | |
185 | - | |
186 | - CPP_class *CPP_class::classlist = 0; | |
187 | - static CPP_class *current_class; | |
188 | - | |
189 | void CPP_class::create_all() { | |
190 | CPP_class *c; | |
191 | c = classlist; | |
192 | while (c) { | |
193 | --- 732,739 ---- | |
194 | *** vector.cxx.old Fri Aug 28 14:23:16 1998 | |
195 | --- vector.cxx Fri Aug 28 14:46:52 1998 | |
196 | *************** | |
197 | *** 0 **** | |
198 | --- 1,182 ---- | |
199 | + | |
200 | + /******************************************************************************* | |
201 | + * Simplified Wrapper and Interface Generator (SWIG) | |
202 | + * | |
203 | + * Dave Beazley | |
204 | + * | |
205 | + * Department of Computer Science Theoretical Division (T-11) | |
206 | + * University of Utah Los Alamos National Laboratory | |
207 | + * Salt Lake City, Utah 84112 Los Alamos, New Mexico 87545 | |
208 | + * beazley@cs.utah.edu beazley@lanl.gov | |
209 | + * | |
210 | + * Copyright (c) 1995-1997 | |
211 | + * The University of Utah and the Regents of the University of California | |
212 | + * All Rights Reserved | |
213 | + * | |
214 | + * Permission is hereby granted, without written agreement and without | |
215 | + * license or royalty fees, to use, copy, modify, and distribute this | |
216 | + * software and its documentation for any purpose, provided that | |
217 | + * (1) The above copyright notice and the following two paragraphs | |
218 | + * appear in all copies of the source code and (2) redistributions | |
219 | + * including binaries reproduces these notices in the supporting | |
220 | + * documentation. Substantial modifications to this software may be | |
221 | + * copyrighted by their authors and need not follow the licensing terms | |
222 | + * described here, provided that the new terms are clearly indicated in | |
223 | + * all files where they apply. | |
224 | + * | |
225 | + * IN NO EVENT SHALL THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, THE | |
226 | + * UNIVERSITY OF UTAH OR DISTRIBUTORS OF THIS SOFTWARE BE LIABLE TO ANY | |
227 | + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL | |
228 | + * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, | |
229 | + * EVEN IF THE AUTHORS OR ANY OF THE ABOVE PARTIES HAVE BEEN ADVISED OF | |
230 | + * THE POSSIBILITY OF SUCH DAMAGE. | |
231 | + * | |
232 | + * THE AUTHOR, THE UNIVERSITY OF CALIFORNIA, AND THE UNIVERSITY OF UTAH | |
233 | + * SPECIFICALLY DISCLAIM ANY WARRANTIES,INCLUDING, BUT NOT LIMITED TO, | |
234 | + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
235 | + * PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND | |
236 | + * THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE, | |
237 | + * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
238 | + * | |
239 | + *******************************************************************************/ | |
240 | + | |
241 | + #include "internal.h" | |
242 | + | |
243 | + /******************************************************************************* | |
244 | + * $Header$ | |
245 | + * | |
246 | + * File : vector.cxx | |
247 | + * | |
248 | + * A very simple Vector class. Allways assumes that memory allocations are | |
249 | + * successful. Should be made more robust... | |
250 | + * | |
251 | + *******************************************************************************/ | |
252 | + | |
253 | + void* Vector::s_nullPtr = NULL; | |
254 | + | |
255 | + // ----------------------------------------------------------------------------- | |
256 | + // Vector::Vector(size_t allocSize = 8) | |
257 | + // | |
258 | + // Constructor. Creates a new Vector. | |
259 | + // | |
260 | + // Inputs : initial allocation size (optional) | |
261 | + // | |
262 | + // Output : New Vector object. | |
263 | + // | |
264 | + // Side Effects : None | |
265 | + // ----------------------------------------------------------------------------- | |
266 | + | |
267 | + Vector::Vector(size_t allocSize) | |
268 | + : m_size(allocSize), | |
269 | + m_count(0), | |
270 | + m_data(0) | |
271 | + { | |
272 | + if (m_size) { | |
273 | + m_data = new void*[m_size]; | |
274 | + int i; | |
275 | + for (i=0; i<m_size;i++) | |
276 | + m_data[i] = 0; | |
277 | + } | |
278 | + } | |
279 | + | |
280 | + | |
281 | + // ----------------------------------------------------------------------------- | |
282 | + // Vector::~Vector | |
283 | + // | |
284 | + // Destructor. Only cleans up the vector, not its contents! | |
285 | + // | |
286 | + // ----------------------------------------------------------------------------- | |
287 | + | |
288 | + | |
289 | + Vector::~Vector() { | |
290 | + if (m_data) { | |
291 | + delete [] m_data; | |
292 | + } | |
293 | + | |
294 | + m_data = 0; | |
295 | + m_size = m_count = 0; | |
296 | + } | |
297 | + | |
298 | + | |
299 | + | |
300 | + // ----------------------------------------------------------------------------- | |
301 | + // size_t Vector::extend(size_t newSize) | |
302 | + // | |
303 | + // Extends the vector to at least newSize length. Won't do anything if newSize | |
304 | + // is smaller than the current size of the vector. | |
305 | + // | |
306 | + // Returns the new allocated size. | |
307 | + // | |
308 | + // ----------------------------------------------------------------------------- | |
309 | + | |
310 | + #define GRANULARITY 16 | |
311 | + | |
312 | + size_t Vector::extend(size_t newSize) { | |
313 | + | |
314 | + if (newSize > m_size) { | |
315 | + newSize = newSize + (GRANULARITY - (newSize % GRANULARITY)); | |
316 | + | |
317 | + void** temp = new void*[newSize]; | |
318 | + memcpy(temp, m_data, m_size*sizeof(void*)); | |
319 | + | |
320 | + int i; | |
321 | + for (i=m_size; i<newSize; i++) | |
322 | + temp[i] = 0; | |
323 | + | |
324 | + delete [] m_data; | |
325 | + m_data = temp; | |
326 | + m_size = newSize; | |
327 | + } | |
328 | + return m_size; | |
329 | + } | |
330 | + | |
331 | + | |
332 | + // ----------------------------------------------------------------------------- | |
333 | + // Vector::append(void* object) | |
334 | + // | |
335 | + // Appends the object pointer to vector at index m_count. Increments m_count. | |
336 | + // Returns the new count. | |
337 | + // ----------------------------------------------------------------------------- | |
338 | + | |
339 | + size_t Vector::append(void* object) { | |
340 | + if (m_count >= m_size) { | |
341 | + extend(m_count + 1); | |
342 | + } | |
343 | + | |
344 | + m_data[m_count] = object; | |
345 | + m_count += 1; | |
346 | + | |
347 | + return m_count; | |
348 | + } | |
349 | + | |
350 | + | |
351 | + // ----------------------------------------------------------------------------- | |
352 | + // Vector::operator[] (size_t idx) | |
353 | + // | |
354 | + // Returns a reference to the void pointer at idx. If idx is beyond the range | |
355 | + // of the vector, returns a reference to s_nullPtr. | |
356 | + // | |
357 | + // ----------------------------------------------------------------------------- | |
358 | + | |
359 | + void*& Vector::operator[] (size_t idx) { | |
360 | + if (idx >= m_size) { | |
361 | + s_nullPtr = 0; | |
362 | + return s_nullPtr; | |
363 | + } | |
364 | + | |
365 | + return m_data[idx]; | |
366 | + } | |
367 | + | |
368 | + | |
369 | + /*********************************************************************** | |
370 | + * | |
371 | + * -- Revision History | |
372 | + * $Log$ | |
cf694132 RD |
373 | + * Revision 1.2 1999/04/30 03:28:35 RD |
374 | + * wxPython 2.0b9, first phase (win32) | |
375 | + * Added gobs of stuff, see wxPython/README.txt for details | |
376 | + * | |
377 | + * Revision 1.1.4.1 1999/03/27 23:28:59 RD | |
378 | + * | |
379 | + * wxPython 2.0b8 | |
380 | + * Python thread support | |
381 | + * various minor additions | |
382 | + * various minor fixes | |
383 | + * | |
09ee8e72 RD |
384 | + * Revision 1.1 1998/10/03 05:56:03 RD |
385 | + * *** empty log message *** | |
386 | + * | |
387 | + * | |
388 | + ***********************************************************************/ | |
389 | + | |
390 | + | |
391 | + | |
392 | + | |
393 | + | |
394 | + | |
395 | *** makefile.msc.old Mon Jun 23 15:15:32 1997 | |
396 | --- makefile.msc Fri Aug 28 10:21:58 1998 | |
397 | *************** | |
398 | *** 33,50 **** | |
399 | # Normally, you shouldn't have to change anything below this point # | |
400 | ######################################################################## | |
401 | ||
402 | LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj emit.obj newdoc.obj ascii.obj \ | |
403 | ! html.obj latex.obj cplus.obj lang.obj hash.obj sstring.obj wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj | |
404 | ||
405 | LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ | |
406 | ! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ | |
407 | sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx | |
408 | ||
409 | LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h | |
410 | LIBNAME = ..\libswig.lib | |
411 | INCLUDE = -I../Include -I$(STD_INC) | |
412 | ! CFLAGS = -Zi -nologo -DSWIG_LIB="\"$(SWIG_LIB)\"" -DSWIG_CC="\"$(CC)\"" -DMSDOS -DSTDC_HEADERS=1 -DHAVE_LIBDL=1 $(SWIG_OPTS) | |
413 | LD_FLAGS = -VERBOSE | |
414 | ||
415 | ||
416 | # | |
417 | --- 33,50 ---- | |
418 | # Normally, you shouldn't have to change anything below this point # | |
419 | ######################################################################## | |
420 | ||
421 | LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj emit.obj newdoc.obj ascii.obj \ | |
422 | ! html.obj latex.obj cplus.obj lang.obj hash.obj vector.obj sstring.obj wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj | |
423 | ||
424 | LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ | |
425 | ! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx vector.cxx \ | |
426 | sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx | |
427 | ||
428 | LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h | |
429 | LIBNAME = ..\libswig.lib | |
430 | INCLUDE = -I../Include -I$(STD_INC) | |
431 | ! CFLAGS = -Zi -nologo -DSWIG_LIB="\"$(SWIG_LIB)\"" -DSWIG_CC="\"$(CC)\"" -DMSDOS -DSTDC_HEADERS=1 -DHAVE_LIBDL=1 $(SWIG_OPTS) $(OTHERFLAGS) | |
432 | LD_FLAGS = -VERBOSE | |
433 | ||
434 | ||
435 | # | |
436 | *** makefile.bc.old Sun Jan 04 12:49:24 1998 | |
437 | --- makefile.bc Fri Aug 28 14:42:58 1998 | |
438 | *************** | |
439 | *** 34,47 **** | |
440 | ######################################################################## | |
441 | ||
442 | LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj \ | |
443 | emit.obj newdoc.obj ascii.obj \ | |
444 | ! html.obj latex.obj cplus.obj lang.obj hash.obj sstring.obj \ | |
445 | wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj | |
446 | ||
447 | LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx \ | |
448 | emit.cxx newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ | |
449 | ! sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx | |
450 | ||
451 | LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h | |
452 | LIBNAME = ..\libswig.lib | |
453 | INCLUDE = -I../Include -I$(STD_INC) | |
454 | --- 34,47 ---- | |
455 | ######################################################################## | |
456 | ||
457 | LIBOBJS = main.obj scanner.obj symbol.obj include.obj types.obj parms.obj \ | |
458 | emit.obj newdoc.obj ascii.obj \ | |
459 | ! html.obj latex.obj cplus.obj lang.obj hash.obj vector.obj sstring.obj \ | |
460 | wrapfunc.obj getopt.obj comment.obj typemap.obj naming.obj | |
461 | ||
462 | LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx \ | |
463 | emit.cxx newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ | |
464 | ! vector.cxx sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx | |
465 | ||
466 | LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h | |
467 | LIBNAME = ..\libswig.lib | |
468 | INCLUDE = -I../Include -I$(STD_INC) | |
469 | *** Makefile.in.old Wed May 28 22:56:56 1997 | |
470 | --- Makefile.in Fri Aug 28 14:43:36 1998 | |
471 | *************** | |
472 | *** 51,63 **** | |
473 | # Normally, you shouldn't have to change anything below this point # | |
474 | ######################################################################## | |
475 | ||
476 | LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \ | |
477 | ! html.o latex.o cplus.o lang.o hash.o sstring.o wrapfunc.o getopt.o comment.o \ | |
478 | typemap.o naming.o | |
479 | ||
480 | LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ | |
481 | ! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \ | |
482 | sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx | |
483 | ||
484 | LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h | |
485 | LIB = ../libswig.a | |
486 | --- 51,63 ---- | |
487 | # Normally, you shouldn't have to change anything below this point # | |
488 | ######################################################################## | |
489 | ||
490 | LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \ | |
491 | ! html.o latex.o cplus.o lang.o hash.o vector.o sstring.o wrapfunc.o getopt.o comment.o \ | |
492 | typemap.o naming.o | |
493 | ||
494 | LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \ | |
495 | ! newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx vector.cxx \ | |
496 | sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx | |
497 | ||
498 | LIBHEADERS = internal.h ../Include/swig.h latex.h ascii.h html.h nodoc.h | |
499 | LIB = ../libswig.a |