1 *** python.cxx.old Fri Jan 02 22:17:40 1998
2 --- python.cxx Fri Aug 28 14:49:18 1998
9 + } else if (strcmp(cmd, "addtomethod") == 0) {
10 + // parse value, expected to be in the form "methodName:line"
11 + char* txtptr = strchr(value, ':');
13 + // add name and line to a list in current_class
16 + AddPragmaData* apData = new AddPragmaData(value, txtptr);
17 + current_class->addPragmas.append(apData);
20 + fprintf(stderr,"%s : Line %d. Malformed addtomethod pragma. Should be \"methodName:text\"\n",
21 + input_file, line_number);
23 + } else if (strcmp(cmd, "addtoclass") == 0) {
24 + AddPragmaData* apData = new AddPragmaData("__class__", value);
25 + current_class->addPragmas.append(apData);
27 fprintf(stderr,"%s : Line %d. Unrecognized pragma.\n", input_file, line_number);
29 *** python.h.old Thu Jul 24 22:18:50 1997
30 --- python.h Fri Aug 28 14:46:08 1998
34 void cpp_class_decl(char *, char *,char *);
35 void pragma(char *, char *, char *);
36 void add_typedef(DataType *t, char *name);
38 + void emitAddPragmas(String& output, char* name, char* spacing);
41 #define PYSHADOW_MEMBER 0x2
43 + struct AddPragmaData {
47 + AddPragmaData(char* method, char* text)
53 *** pycpp.cxx.old Fri Jan 02 20:23:22 1998
54 --- pycpp.cxx Fri Aug 28 16:01:46 1998
60 // if ((t->type != T_VOID) || (t->is_pointer))
61 + emitAddPragmas(*pyclass, realname, tab8);
62 *pyclass << tab8 << "return val\n";
64 // Change the usage string to reflect our shadow class
70 *construct << tab8 << "self.thisown = 1\n";
71 + emitAddPragmas(*construct, "__init__", tab8);
77 *pyclass << tab4 << "def __del__(self):\n"
78 << tab8 << "if self.thisown == 1 :\n"
79 << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n";
84 doc_entry->usage = "";
85 doc_entry->usage << "del this";
87 *pyclass << tab4 << "def __del__(self):\n"
88 << tab8 << "if self.thisown == 1 :\n"
89 << tab8 << tab4 << module << "." << name_destroy(realname) << "(self.this)\n";
90 ! emitAddPragmas(*pyclass, "__del__", tab8);
93 doc_entry->usage = "";
94 doc_entry->usage << "del this";
98 << tab8 << "return \"<C " << class_name <<" instance>\"\n";
101 + emitAddPragmas(classes, "__class__", tab4);
105 // Now build the real class with a normal constructor
112 + // --------------------------------------------------------------------------------
113 + // PYTHON::emitAddPragmas(String& output, char* name, char* spacing);
115 + // Search the current_class->addPragmas vector for any text belonging to name.
116 + // Append the text properly spcaed to the output string.
118 + // --------------------------------------------------------------------------------
120 + void PYTHON::emitAddPragmas(String& output, char* name, char* spacing)
122 + AddPragmaData* apData;
126 + count = current_class->addPragmas.count();
127 + for (i=0; i<count; i++) {
128 + apData = (AddPragmaData*)current_class->addPragmas[i];
129 + if (strcmp(apData->m_method, name) == 0) {
130 + output << spacing << apData->m_text << "\n";
135 /*********************************************************************************