diff options
author | Logan Johnson <ljohnson@users.sourceforge.net> | 2003-06-04 23:29:12 +0000 |
---|---|---|
committer | Logan Johnson <ljohnson@users.sourceforge.net> | 2003-06-04 23:29:12 +0000 |
commit | 22d7c12c26e32dc7a206b89579f561c5fc402af2 (patch) | |
tree | bcdd580d5586039ce836d2a34c3a74a794b29c56 /Source | |
parent | f0ef13929d6ae4bc2bea883c015c03b5a7b194b1 (diff) | |
download | swig-22d7c12c26e32dc7a206b89579f561c5fc402af2.tar.gz |
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
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Swig/typemap.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c index e6c58e8ae..fa57dd86d 100644 --- a/Source/Swig/typemap.c +++ b/Source/Swig/typemap.c @@ -709,7 +709,7 @@ void typemap_replace_vars(String *s, ParmList *locals, SwigType *type, String *p varname = &var[strlen(var)]; /* 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)) { String *size; @@ -1187,6 +1187,30 @@ String *Swig_typemap_lookup_new(const String_or_char *op, Node *node, const Stri 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() * @@ -1204,7 +1228,6 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f) ParmList *locals; int argnum = 0; char temp[256]; - Parm *kw; p = parms; while (p) { @@ -1241,7 +1264,7 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f) pname = Getattr(p,"name"); lname = Getattr(p,"lname"); mtype = Getattr(p,"tmap:match"); - + if (mtype) { typemap_replace_vars(s,locals, mtype,pname,lname,i+1); Delattr(p,"tmap:match"); @@ -1277,20 +1300,11 @@ Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f) Setattr(firstp,tmop_name(temp),p); /* Attach kwargs */ - kw = Getattr(tm,"kwargs"); - while (kw) { - sprintf(temp,"%s:%s",Char(op),Char(Getattr(kw,"name"))); - Setattr(firstp,tmop_name(temp), Copy(Getattr(kw,"value"))); - 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); - } - } + Swig_typemap_attach_kwargs(tm,op,firstp); + + /* Print warnings, if any */ + Swig_typemap_warn(op,firstp); + /* Look for code fragments */ { String *f; |