]>
Commit | Line | Data |
---|---|---|
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 | * python.h | |
20 | * | |
21 | * Header file for Python module. Warning ; this is work in progress. | |
22 | **************************************************************************/ | |
23 | ||
24 | class PYTHON : public Language { | |
25 | protected: | |
26 | char *module; // Module name | |
27 | char *path; // Pathname of where to look for library files | |
28 | char *methods; // Method table name | |
29 | char *global_name; // Name of global variables. | |
30 | void get_pointer(char *iname, char *srcname, char *src, char *dest, DataType *t, String &f, char *ret); | |
31 | int shadow; | |
32 | int have_defarg; | |
33 | int docstring; | |
34 | int have_output; | |
35 | int use_kw; | |
36 | FILE *f_shadow; | |
37 | struct Method { // Methods list. Needed to build methods | |
38 | char *name; // Array at very end. | |
39 | char *function; | |
40 | Method *next; | |
41 | }; | |
42 | Method *head; | |
43 | Hash hash; | |
44 | String classes; | |
45 | String func; | |
46 | String vars; | |
47 | String modinit; | |
48 | String modextern; | |
49 | ||
50 | char *import_file; | |
51 | void add_method(char *name, char *function); | |
52 | void print_methods(); | |
53 | char *usage_var(char *, DataType *); | |
54 | char *usage_func(char *, DataType *, ParmList *); | |
55 | char *usage_const(char *, DataType *, char *); | |
56 | char *add_docstring(DocEntry *de); | |
57 | ||
58 | // Add for Python-COM support | |
59 | virtual void initialize_cmodule(); | |
60 | virtual void close_cmodule(); | |
61 | virtual void emit_function_header(WrapperFunction &emit_to, char *wname); | |
62 | virtual char *convert_self(WrapperFunction &f); | |
63 | virtual char *make_funcname_wrapper(char *fnName); | |
64 | void emitAddPragmas(String& output, char* name, char* spacing); | |
65 | public : | |
66 | PYTHON() { | |
67 | module = (char *) 0; | |
68 | path = "python"; // Set this to subdirectory where language | |
69 | // Dependent library files will be stored | |
70 | head = 0; // Head of method list | |
71 | global_name = "cvar"; | |
72 | shadow = 0; | |
73 | have_defarg = 0; | |
74 | import_file = 0; | |
75 | use_kw = 0; | |
76 | }; | |
77 | ||
78 | // Don't change any of this | |
79 | void parse_args(int, char *argv[]); | |
80 | void parse(); | |
81 | void create_function(char *, char *, DataType *, ParmList *); | |
82 | void link_variable(char *, char *, DataType *); | |
83 | void declare_const(char *, char *, DataType *, char *); | |
84 | void initialize(void); | |
85 | void headers(void); | |
86 | void close(void); | |
87 | void set_module(char *, char **); | |
88 | void set_init(char *); | |
89 | void add_native(char *, char *); | |
90 | void create_command(char *, char *); | |
91 | void import(char *); | |
92 | ||
93 | // C++ extensions---for creating shadow classes | |
94 | ||
95 | void cpp_member_func(char *name, char *iname, DataType *t, ParmList *l); | |
96 | void cpp_constructor(char *name, char *iname, ParmList *l); | |
97 | void cpp_destructor(char *name, char *newname); | |
98 | void cpp_open_class(char *classname, char *rname, char *ctype, int strip); | |
99 | void cpp_close_class(); | |
100 | void cpp_cleanup(); | |
101 | void cpp_inherit(char **baseclass, int mode = INHERIT_ALL); | |
102 | void cpp_variable(char *name, char *iname, DataType *t); | |
103 | void cpp_declare_const(char *name, char *iname, DataType *type, char *value); | |
104 | void cpp_class_decl(char *, char *,char *); | |
105 | void pragma(char *, char *, char *); | |
106 | void cpp_pragma(Pragma *); | |
107 | void add_typedef(DataType *t, char *name); | |
108 | }; | |
109 | ||
110 | #define PYSHADOW_MEMBER 0x2 | |
111 |