Broke dependence between the DataType class and the Language class.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@575 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-07-12 20:17:44 +00:00
commit 99504189ce
5 changed files with 59 additions and 50 deletions

View file

@ -143,6 +143,41 @@ static DOHString *modinit = 0;
static DOHString *modextern = 0;
static DOHString *pragma_include = 0;
// Perl specific type mangler function
static char *
type_mangle(DataType *t) {
static char result[128];
int i;
char *r, *c;
if (blessed) {
// Check to see if we've blessed this datatype
if ((Getattr(classes,t->name)) && (t->is_pointer <= 1)) {
// This is a blessed class. Return just the type-name
strcpy(result, GetChar(classes,t->name));
return result;
}
}
r = result;
c = t->name;
for ( c = t->name; *c; c++,r++) {
*r = *c;
}
for (i = 0; i < (t->is_pointer-t->implicit_ptr); i++, r++) {
strcpy(r,"Ptr");
r+=2;
}
*r = 0;
return result;
}
// ---------------------------------------------------------------------
// PERL5::parse_args(int argc, char *argv[])
//
@ -258,6 +293,8 @@ PERL5::parse() {
modextern = NewString("");
pragma_include = NewString("");
DataType_set_mangle(type_mangle);
// Print out PERL5 specific headers
headers();
@ -648,45 +685,6 @@ void PERL5::close(void)
Delete(base);
}
// ----------------------------------------------------------------------
// char *PERL5::type_mangle(DataType *t)
//
// Mangles a datatype into a Perl5 name compatible with xsubpp type
// T_PTROBJ.
// ----------------------------------------------------------------------
char *
PERL5::type_mangle(DataType *t) {
static char result[128];
int i;
char *r, *c;
if (blessed) {
// Check to see if we've blessed this datatype
if ((Getattr(classes,t->name)) && (t->is_pointer <= 1)) {
// This is a blessed class. Return just the type-name
strcpy(result, GetChar(classes,t->name));
return result;
}
}
r = result;
c = t->name;
for ( c = t->name; *c; c++,r++) {
*r = *c;
}
for (i = 0; i < (t->is_pointer-t->implicit_ptr); i++, r++) {
strcpy(r,"Ptr");
r+=2;
}
*r = 0;
return result;
}
// ----------------------------------------------------------------------
// PERL5::get_pointer(char *iname, char *srcname, char *src, char *target,
// DataType *t, String &f, char *ret)

View file

@ -40,7 +40,6 @@ public :
virtual void set_init(char *);
virtual void add_native(char *, char *, DataType *, ParmList *);
virtual void create_command(char *, char *);
virtual char *type_mangle(DataType *);
// Support for blessed perl thingies....