]>
Commit | Line | Data |
---|---|---|
8bf5d46e RD |
1 | *** python.cxx.old Fri Jan 02 23:17:40 1998 |
2 | --- python.cxx Fri Aug 28 15:49:18 1998 | |
09ee8e72 | 3 | *************** |
8bf5d46e RD |
4 | *** 1678,1685 **** |
5 | --- 1678,1702 ---- | |
6 | fprintf(stderr,"%s : Line %d. Unable to locate file %s\n", input_file, line_number, value); | |
09ee8e72 RD |
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); | |
8bf5d46e | 19 | + |
09ee8e72 RD |
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 | } | |
8bf5d46e RD |
30 | } |
31 | *** python.h.old Thu Jul 24 23:18:50 1997 | |
32 | --- python.h Fri Aug 28 15:46:08 1998 | |
09ee8e72 | 33 | *************** |
8bf5d46e RD |
34 | *** 184,191 **** |
35 | --- 184,203 ---- | |
36 | void cpp_declare_const(char *name, char *iname, DataType *type, char *value); | |
09ee8e72 RD |
37 | void cpp_class_decl(char *, char *,char *); |
38 | void pragma(char *, char *, char *); | |
39 | void add_typedef(DataType *t, char *name); | |
8bf5d46e | 40 | + |
09ee8e72 RD |
41 | + void emitAddPragmas(String& output, char* name, char* spacing); |
42 | }; | |
8bf5d46e | 43 | |
09ee8e72 | 44 | #define PYSHADOW_MEMBER 0x2 |
8bf5d46e | 45 | + |
09ee8e72 RD |
46 | + struct AddPragmaData { |
47 | + String m_method; | |
48 | + String m_text; | |
8bf5d46e | 49 | + |
09ee8e72 RD |
50 | + AddPragmaData(char* method, char* text) |
51 | + : m_method(method), | |
52 | + m_text(text) | |
53 | + {} | |
54 | + }; | |
8bf5d46e RD |
55 | |
56 | *** pycpp.cxx.old Fri Jan 02 21:23:22 1998 | |
57 | --- pycpp.cxx Tue Jul 20 14:34:36 1999 | |
09ee8e72 | 58 | *************** |
8bf5d46e RD |
59 | *** 275,282 **** |
60 | --- 275,283 ---- | |
61 | #endif | |
09ee8e72 RD |
62 | } |
63 | } | |
64 | // if ((t->type != T_VOID) || (t->is_pointer)) | |
65 | + emitAddPragmas(*pyclass, realname, tab8); | |
66 | *pyclass << tab8 << "return val\n"; | |
8bf5d46e | 67 | |
09ee8e72 | 68 | // Change the usage string to reflect our shadow class |
8bf5d46e | 69 | |
09ee8e72 | 70 | *************** |
8bf5d46e RD |
71 | *** 393,400 **** |
72 | --- 394,402 ---- | |
73 | } | |
09ee8e72 RD |
74 | } |
75 | *construct << ")\n"; | |
76 | *construct << tab8 << "self.thisown = 1\n"; | |
77 | + emitAddPragmas(*construct, "__init__", tab8); | |
78 | have_constructor = 1; | |
79 | } else { | |
8bf5d46e RD |
80 | |
81 | // Hmmm. We seem to be creating a different constructor. We're just going to create a | |
09ee8e72 | 82 | *************** |
8bf5d46e RD |
83 | *** 490,503 **** |
84 | if (class_renamed) realname = class_name; | |
85 | else realname = name; | |
86 | } | |
87 | ||
88 | ! *pyclass << tab4 << "def __del__(self):\n" | |
09ee8e72 RD |
89 | << tab8 << "if self.thisown == 1 :\n" |
90 | << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n"; | |
8bf5d46e | 91 | ! |
09ee8e72 | 92 | have_destructor = 1; |
8bf5d46e | 93 | - |
09ee8e72 RD |
94 | if (doc_entry) { |
95 | doc_entry->usage = ""; | |
96 | doc_entry->usage << "del this"; | |
8bf5d46e RD |
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" | |
09ee8e72 RD |
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"; | |
8bf5d46e | 111 | } |
09ee8e72 | 112 | *************** |
8bf5d46e RD |
113 | *** 551,558 **** |
114 | --- 552,561 ---- | |
115 | repr << tab4 << "def __repr__(self):\n" | |
09ee8e72 | 116 | << tab8 << "return \"<C " << class_name <<" instance>\"\n"; |
8bf5d46e | 117 | |
09ee8e72 RD |
118 | classes << repr; |
119 | + emitAddPragmas(classes, "__class__", tab4); | |
8bf5d46e | 120 | + |
09ee8e72 | 121 | } |
8bf5d46e | 122 | |
09ee8e72 | 123 | // Now build the real class with a normal constructor |
8bf5d46e | 124 | |
09ee8e72 | 125 | *************** |
8bf5d46e RD |
126 | *** 746,753 **** |
127 | --- 749,778 ---- | |
128 | hash.add(name,copy_string((char *) hash.lookup(t->name))); | |
09ee8e72 RD |
129 | } |
130 | } | |
8bf5d46e | 131 | |
09ee8e72 RD |
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 | + // -------------------------------------------------------------------------------- | |
8bf5d46e | 139 | + |
09ee8e72 RD |
140 | + void PYTHON::emitAddPragmas(String& output, char* name, char* spacing) |
141 | + { | |
142 | + AddPragmaData* apData; | |
143 | + size_t count; | |
144 | + int i; | |
8bf5d46e | 145 | + |
09ee8e72 RD |
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 | + } | |
8bf5d46e | 154 | |
09ee8e72 RD |
155 | /********************************************************************************* |
156 | * | |
8bf5d46e RD |
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 | * |