]>
Commit | Line | Data |
---|---|---|
1 | *** python.cxx.old Fri Jan 02 23:17:40 1998 | |
2 | --- python.cxx Fri Aug 28 15:49:18 1998 | |
3 | *************** | |
4 | *** 1678,1685 **** | |
5 | --- 1678,1702 ---- | |
6 | fprintf(stderr,"%s : Line %d. Unable to locate file %s\n", input_file, line_number, value); | |
7 | } | |
8 | } | |
9 | } | |
10 | + } else if (strcmp(cmd, "addtomethod") == 0) { | |
11 | + // parse value, expected to be in the form "methodName:line" | |
12 | + char* txtptr = strchr(value, ':'); | |
13 | + if (txtptr) { | |
14 | + // add name and line to a list in current_class | |
15 | + *txtptr = 0; | |
16 | + txtptr++; | |
17 | + AddPragmaData* apData = new AddPragmaData(value, txtptr); | |
18 | + current_class->addPragmas.append(apData); | |
19 | + | |
20 | + } else { | |
21 | + fprintf(stderr,"%s : Line %d. Malformed addtomethod pragma. Should be \"methodName:text\"\n", | |
22 | + input_file, line_number); | |
23 | + } | |
24 | + } else if (strcmp(cmd, "addtoclass") == 0) { | |
25 | + AddPragmaData* apData = new AddPragmaData("__class__", value); | |
26 | + current_class->addPragmas.append(apData); | |
27 | } else { | |
28 | fprintf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number); | |
29 | } | |
30 | } | |
31 | *** python.h.old Thu Jul 24 23:18:50 1997 | |
32 | --- python.h Fri Aug 28 15:46:08 1998 | |
33 | *************** | |
34 | *** 184,191 **** | |
35 | --- 184,203 ---- | |
36 | void cpp_declare_const(char *name, char *iname, DataType *type, char *value); | |
37 | void cpp_class_decl(char *, char *,char *); | |
38 | void pragma(char *, char *, char *); | |
39 | void add_typedef(DataType *t, char *name); | |
40 | + | |
41 | + void emitAddPragmas(String& output, char* name, char* spacing); | |
42 | }; | |
43 | ||
44 | #define PYSHADOW_MEMBER 0x2 | |
45 | + | |
46 | + struct AddPragmaData { | |
47 | + String m_method; | |
48 | + String m_text; | |
49 | + | |
50 | + AddPragmaData(char* method, char* text) | |
51 | + : m_method(method), | |
52 | + m_text(text) | |
53 | + {} | |
54 | + }; | |
55 | ||
56 | *** pycpp.cxx.old Fri Jan 02 21:23:22 1998 | |
57 | --- pycpp.cxx Tue Jul 20 14:34:36 1999 | |
58 | *************** | |
59 | *** 275,282 **** | |
60 | --- 275,283 ---- | |
61 | #endif | |
62 | } | |
63 | } | |
64 | // if ((t->type != T_VOID) || (t->is_pointer)) | |
65 | + emitAddPragmas(*pyclass, realname, tab8); | |
66 | *pyclass << tab8 << "return val\n"; | |
67 | ||
68 | // Change the usage string to reflect our shadow class | |
69 | ||
70 | *************** | |
71 | *** 393,400 **** | |
72 | --- 394,402 ---- | |
73 | } | |
74 | } | |
75 | *construct << ")\n"; | |
76 | *construct << tab8 << "self.thisown = 1\n"; | |
77 | + emitAddPragmas(*construct, "__init__", tab8); | |
78 | have_constructor = 1; | |
79 | } else { | |
80 | ||
81 | // Hmmm. We seem to be creating a different constructor. We're just going to create a | |
82 | *************** | |
83 | *** 490,503 **** | |
84 | if (class_renamed) realname = class_name; | |
85 | else realname = name; | |
86 | } | |
87 | ||
88 | ! *pyclass << tab4 << "def __del__(self):\n" | |
89 | << tab8 << "if self.thisown == 1 :\n" | |
90 | << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n"; | |
91 | ! | |
92 | have_destructor = 1; | |
93 | - | |
94 | if (doc_entry) { | |
95 | doc_entry->usage = ""; | |
96 | doc_entry->usage << "del this"; | |
97 | } | |
98 | --- 492,504 ---- | |
99 | if (class_renamed) realname = class_name; | |
100 | else realname = name; | |
101 | } | |
102 | ||
103 | ! *pyclass << tab4 << "def __del__(self, " << module << "=" << module << "):\n" | |
104 | << tab8 << "if self.thisown == 1 :\n" | |
105 | << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n"; | |
106 | ! emitAddPragmas(*pyclass, "__del__", tab8); | |
107 | have_destructor = 1; | |
108 | if (doc_entry) { | |
109 | doc_entry->usage = ""; | |
110 | doc_entry->usage << "del this"; | |
111 | } | |
112 | *************** | |
113 | *** 551,558 **** | |
114 | --- 552,561 ---- | |
115 | repr << tab4 << "def __repr__(self):\n" | |
116 | << tab8 << "return \"<C " << class_name <<" instance>\"\n"; | |
117 | ||
118 | classes << repr; | |
119 | + emitAddPragmas(classes, "__class__", tab4); | |
120 | + | |
121 | } | |
122 | ||
123 | // Now build the real class with a normal constructor | |
124 | ||
125 | *************** | |
126 | *** 746,753 **** | |
127 | --- 749,778 ---- | |
128 | hash.add(name,copy_string((char *) hash.lookup(t->name))); | |
129 | } | |
130 | } | |
131 | ||
132 | + // -------------------------------------------------------------------------------- | |
133 | + // PYTHON::emitAddPragmas(String& output, char* name, char* spacing); | |
134 | + // | |
135 | + // Search the current_class->addPragmas vector for any text belonging to name. | |
136 | + // Append the text properly spcaed to the output string. | |
137 | + // | |
138 | + // -------------------------------------------------------------------------------- | |
139 | + | |
140 | + void PYTHON::emitAddPragmas(String& output, char* name, char* spacing) | |
141 | + { | |
142 | + AddPragmaData* apData; | |
143 | + size_t count; | |
144 | + int i; | |
145 | + | |
146 | + count = current_class->addPragmas.count(); | |
147 | + for (i=0; i<count; i++) { | |
148 | + apData = (AddPragmaData*)current_class->addPragmas[i]; | |
149 | + if (strcmp(apData->m_method, name) == 0) { | |
150 | + output << spacing << apData->m_text << "\n"; | |
151 | + } | |
152 | + } | |
153 | + } | |
154 | ||
155 | /********************************************************************************* | |
156 | * | |
157 | * $Log$ | |
158 | * Revision 1.2 1999/07/31 07:54:05 RD | |
159 | * wxPython 2.1b1: | |
160 | * | |
161 | * Added the missing wxWindow.GetUpdateRegion() method. | |
162 | * | |
163 | * Made a new change in SWIG (update your patches everybody) that | |
164 | * provides a fix for global shadow objects that get an exception in | |
165 | * their __del__ when their extension module has already been deleted. | |
166 | * It was only a 1 line change in .../SWIG/Modules/pycpp.cxx at about | |
167 | * line 496 if you want to do it by hand. | |
168 | * | |
169 | * It is now possible to run through MainLoop more than once in any one | |
170 | * process. The cleanup that used to happen as MainLoop completed (and | |
171 | * prevented it from running again) has been delayed until the wxc module | |
172 | * is being unloaded by Python. | |
173 | * | |
174 | * wxWindow.PopupMenu() now takes a wxPoint instead of x,y. Added | |
175 | * wxWindow.PopupMenuXY to be consistent with some other methods. | |
176 | * | |
177 | * Added wxGrid.SetEditInPlace and wxGrid.GetEditInPlace. | |
178 | * | |
179 | * You can now provide your own app.MainLoop method. See | |
180 | * wxPython/demo/demoMainLoop.py for an example and some explaination. | |
181 | * | |
182 | * Got the in-place-edit for the wxTreeCtrl fixed and added some demo | |
183 | * code to show how to use it. | |
184 | * | |
185 | * Put the wxIcon constructor back in for GTK as it now has one that | |
186 | * matches MSW's. | |
187 | * | |
188 | * Added wxGrid.GetCells | |
189 | * | |
190 | * Added wxSystemSettings static methods as functions with names like | |
191 | * wxSystemSettings_GetSystemColour. | |
192 | * | |
193 | * Removed wxPyMenu since using menu callbacks have been depreciated in | |
194 | * wxWindows. Use wxMenu and events instead. | |
195 | * | |
196 | * Added alternate wxBitmap constructor (for MSW only) as | |
197 | * wxBitmapFromData(data, type, width, height, depth = 1) | |
198 | * | |
199 | * Added a helper function named wxPyTypeCast that can convert shadow | |
200 | * objects of one type into shadow objects of another type. (Like doing | |
201 | * a down-cast.) See the implementation in wx.py for some docs. | |
202 | * |