]>
Commit | Line | Data |
---|---|---|
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 | * class PERL5 | |
18 | * | |
19 | * A Perl 5 implementation | |
20 | **************************************************************************/ | |
21 | ||
22 | class PERL5 : public Language { | |
23 | private: | |
24 | int export_all; | |
25 | char *package; | |
26 | char *module; | |
27 | String cmodule; | |
28 | String vinit; | |
29 | FILE *f_pm; | |
30 | String pm; // Package initialization code | |
31 | String magic; // Magic variable wrappers | |
32 | ||
33 | char *perl_path; | |
34 | int is_static; | |
35 | void get_pointer(char *iname, char *srcname, char *src, char *dest, | |
36 | DataType *t, String &f, char *ret); | |
37 | char *usage_var(char *, DataType *); | |
38 | char *usage_func(char *, DataType *, ParmList *); | |
39 | char *usage_const(char *, DataType *, char *); | |
40 | ||
41 | char *alt_header; | |
42 | ||
43 | // The following variables are used to manage Perl5 classes | |
44 | ||
45 | int blessed; // Enable object oriented features | |
46 | Hash classes; // A hash table for storing the classes we've seen so far | |
47 | int have_constructor; | |
48 | int have_destructor; | |
49 | int have_data_members; | |
50 | char *class_name; // Name of the class (what Perl thinks it is) | |
51 | char *class_type; // Type of class "struct", "class", "union" | |
52 | char *real_classname; // Real name of C/C++ class | |
53 | String *base_class; // Base class (if using inheritance) | |
54 | String *pcode; // Perl code associated with each class | |
55 | String *blessedmembers; // Member data associated with each class | |
56 | int member_func; // Set to 1 when wrapping a member function | |
57 | char *realpackage; // Name of real module | |
58 | String func_stubs; // Function stubs | |
59 | String var_stubs; // Variable stubs | |
60 | String *member_keys; // Keys for all member data | |
61 | String exported; // Exported symbols | |
62 | ||
63 | public : | |
64 | PERL5() { | |
65 | package = 0; | |
66 | module = 0; | |
67 | perl_path = "perl5"; | |
68 | is_static = 0; | |
69 | blessed = 0; | |
70 | alt_header = 0; | |
71 | member_func = 0; | |
72 | }; | |
73 | void parse_args(int, char *argv[]); | |
74 | void parse(); | |
75 | void create_function(char *, char *, DataType *, ParmList *); | |
76 | void link_variable(char *, char *, DataType *); | |
77 | void declare_const(char *, char *, DataType *, char *); | |
78 | void initialize(void); | |
79 | void headers(void); | |
80 | void close(void); | |
81 | void set_module(char *, char **); | |
82 | void set_init(char *); | |
83 | void add_native(char *, char *); | |
84 | void create_command(char *, char *); | |
85 | char *type_mangle(DataType *); | |
86 | ||
87 | // Support for blessed perl thingies.... | |
88 | ||
89 | void cpp_open_class(char *classname, char *rename, char *ctype, int strip); | |
90 | void cpp_close_class(); | |
91 | void cpp_member_func(char *name, char *iname, DataType *t, ParmList *l); | |
92 | void cpp_static_func(char *name, char *iname, DataType *t, ParmList *l); | |
93 | void cpp_variable(char *name, char *iname, DataType *t); | |
94 | void cpp_constructor(char *name, char *iname, ParmList *l); | |
95 | void cpp_destructor(char *name, char *newname); | |
96 | void cpp_inherit(char **baseclass, int mode = INHERIT_ALL); | |
97 | void cpp_declare_const(char *name, char *iname, DataType *type, char *value); | |
98 | void cpp_class_decl(char *, char *, char *); | |
99 | void add_typedef(DataType *t, char *name); | |
100 | void pragma(char *, char *, char *); | |
101 | void import(char *filename); | |
102 | }; | |
103 | ||
104 | ||
105 |