Slight improvement to -debug-tmsearch and multi-argument typemaps

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11794 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-12-22 19:21:55 +00:00
commit 97f959ddf0
2 changed files with 25 additions and 4 deletions

View file

@ -1403,7 +1403,7 @@ Expect to see them being used more and more within the various libraries in late
</p>
<H3><a name="Typemaps_nn20"></a>10.3.5 Multi-arguments typemaps</H3>
<H3><a name="Typemaps_multi_argument_typemaps"></a>10.3.5 Multi-arguments typemaps</H3>
<p>
@ -1534,6 +1534,22 @@ SWIGINTERN PyObject *_wrap_foo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
</pre>
</div>
<p>
Searches for multi-argument typemaps are not mentioned unless a matching multi-argument typemap does actually exist.
For example, the output for the code in the <a href="#Typemaps_multi_argument_typemaps">previous section</a> is as follows:
</p>
<div class="shell">
<pre>
...
---- Searching for a suitable 'in' typemap for: char *buffer
Looking for: char *buffer
Multi-argument typemap found...
Using: %typemap(in) (char *buffer,int len)
...
</pre>
</div>
<H2><a name="Typemaps_nn21"></a>10.4 Code generation rules</H2>

View file

@ -257,10 +257,14 @@ static void typemap_register(const_String_or_char_ptr tmap_method, ParmList *par
/* Setattr(tm2,multi_tmap_method,multi_tmap_method); */
Delete(multi_tmap_method);
} else {
String *parms_str = ParmList_str(parmlist_start);
String *typemap = NewStringf("typemap(%s) %s", actual_tmap_method, parms_str);
ParmList *clocals = CopyParmList(locals);
ParmList *ckwargs = CopyParmList(kwargs);
String *parms_str = ParmList_str(parmlist_start);
String *typemap;
if (ParmList_len(parmlist_start) > 1)
typemap = NewStringf("typemap(%s) (%s)", actual_tmap_method, parms_str);
else
typemap = NewStringf("typemap(%s) %s", actual_tmap_method, parms_str);
Setattr(tm2, "code", code);
Setattr(tm2, "type", type);
@ -643,10 +647,11 @@ static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type
ts = tm_scope;
if (debug_display) {
const String *empty_string = NewStringEmpty();
String *empty_string = NewStringEmpty();
String *typestr = SwigType_str(type, cqualifiedname ? cqualifiedname : (cname ? cname : empty_string));
Printf(stdout, "---- Searching for a suitable '%s' typemap for: %s\n", tmap_method, typestr);
Delete(typestr);
Delete(empty_string);
}
while (ts >= 0) {
ctype = type;