Broke up Swig_typemap_attach_parms() a bit for readability.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4862 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Logan Johnson 2003-06-04 23:29:12 +00:00
commit 22d7c12c26

View file

@ -709,7 +709,7 @@ void typemap_replace_vars(String *s, ParmList *locals, SwigType *type, String *p
varname = &var[strlen(var)]; varname = &var[strlen(var)];
/* If the original datatype was an array. We're going to go through and substitute /* If the original datatype was an array. We're going to go through and substitute
it's array dimensions */ its array dimensions */
if (SwigType_isarray(type)) { if (SwigType_isarray(type)) {
String *size; String *size;
@ -1187,6 +1187,30 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri
return s; return s;
} }
static void
Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p) {
char temp[256];
Parm *kw = Getattr(tm,"kwargs");
while (kw) {
sprintf(temp,"%s:%s",Char(op),Char(Getattr(kw,"name")));
Setattr(p,tmop_name(temp), Copy(Getattr(kw,"value")));
kw = nextSibling(kw);
}
}
static void
Swig_typemap_warn(const String_or_char *op, Parm *p) {
char temp[256];
String *w;
sprintf(temp,"%s:warning", Char(op));
w = Getattr(p,tmop_name(temp));
if (w) {
Swig_warning(0,Getfile(p), Getline(p), "%s\n", w);
}
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Swig_typemap_attach_parms() * Swig_typemap_attach_parms()
* *
@ -1204,7 +1228,6 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
ParmList *locals; ParmList *locals;
int argnum = 0; int argnum = 0;
char temp[256]; char temp[256];
Parm *kw;
p = parms; p = parms;
while (p) { while (p) {
@ -1277,20 +1300,11 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f)
Setattr(firstp,tmop_name(temp),p); Setattr(firstp,tmop_name(temp),p);
/* Attach kwargs */ /* Attach kwargs */
kw = Getattr(tm,"kwargs"); Swig_typemap_attach_kwargs(tm,op,firstp);
while (kw) {
sprintf(temp,"%s:%s",Char(op),Char(Getattr(kw,"name"))); /* Print warnings, if any */
Setattr(firstp,tmop_name(temp), Copy(Getattr(kw,"value"))); Swig_typemap_warn(op,firstp);
kw = nextSibling(kw);
}
{
String *w;
sprintf(temp,"%s:warning", Char(op));
w = Getattr(firstp,tmop_name(temp));
if (w) {
Swig_warning(0,Getfile(firstp), Getline(firstp), "%s\n", w);
}
}
/* Look for code fragments */ /* Look for code fragments */
{ {
String *f; String *f;