Allowing the empty %template directive, such as

%template() std::vector<int>;

to process the class "typedef"s and "typemap"s. Before
only the internal "typedef"s were processed.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5750 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-17 08:18:17 +00:00
commit cf8a1c311c
3 changed files with 27 additions and 4 deletions

View file

@ -176,8 +176,19 @@ int Dispatcher::emit_one(Node *n) {
int Dispatcher::emit_children(Node *n) {
Node *c;
char *eo = Char(Getattr(n,"feature:emitonlychildren"));
for (c = firstChild(n); c; c = nextSibling(c)) {
emit_one(c);
if (eo) {
const char *tag = Char(nodeType(c));
if (Strcmp(tag,"cdecl") == 0) {
if (checkAttribute(c, "storage", "typedef"))
tag = "typedef";
}
if (strstr(eo,tag) == 0) {
continue;
}
}
emit_one(c);
}
return SWIG_OK;
}
@ -250,7 +261,8 @@ int Language::emit_one(Node *n) {
int oldext;
if (!n) return SWIG_OK;
if (Getattr(n,"feature:ignore")) return SWIG_OK;
if (Getattr(n,"feature:ignore")
&& !Getattr(n,"feature:onlychildren")) return SWIG_OK;
oldext = Extend;
if (Getattr(n,"feature:extend")) Extend = 1;
@ -1693,6 +1705,15 @@ int Language::classDirector(Node *n) {
* ---------------------------------------------------------------------- */
int Language::classDeclaration(Node *n) {
String *ochildren = Getattr(n,"feature:onlychildren");
if (ochildren) {
Setattr(n,"feature:emitonlychildren",ochildren);
emit_children(n);
Delattr(n,"feature:emitonlychildren");
Setattr(n,"feature:ignore","1");
return SWIG_NOWRAP;
}
String *kind = Getattr(n,"kind");
String *name = Getattr(n,"name");
String *tdname = Getattr(n,"tdname");

View file

@ -1738,7 +1738,7 @@ public:
b = First(baselist);
while (b.item) {
String *bname = Getattr(b.item, "python:proxy");
if (!bname) {
if (!bname || Getattr(b.item,"feature:ignore")) {
b = Next(b);
continue;
}

View file

@ -400,7 +400,9 @@ public:
fname = SwigType_typedef_resolve_all(name);
if (Strcmp(fname,name) != 0) {
cn = Swig_symbol_clookup_local(fname,0);
if ((!cn) || (Strcmp(nodeType(cn),"template") == 0)) {
if ((!cn) || (Strcmp(nodeType(cn),"template") == 0)
|| (Getattr(cn,"feature:onlychildren") != 0)
|| (Getattr(n,"feature:onlychildren") != 0)) {
Swig_symbol_cadd(fname,n);
SwigType_typedef_class(fname);
scopename = Copy(fname);