Display filename and line number in output when using -debug-tmsearch

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11801 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-12-24 17:00:35 +00:00
commit 8b7c0afcfc
2 changed files with 24 additions and 31 deletions

View file

@ -1464,7 +1464,7 @@ A sample of the debugging output is shown below for the "in" typemap:
<pre> <pre>
swig -debug-tmsearch example.i swig -debug-tmsearch example.i
... ...
---- Searching for a suitable 'in' typemap for: Row4 rows[10] example.h:26: Searching for a suitable 'in' typemap for: Row4 rows[10]
Looking for: Row4 rows[10] Looking for: Row4 rows[10]
Looking for: Row4 [10] Looking for: Row4 [10]
Looking for: Row4 rows[ANY] Looking for: Row4 rows[ANY]
@ -1542,7 +1542,7 @@ For example, the output for the code in the <a href="#Typemaps_multi_argument_ty
<div class="shell"> <div class="shell">
<pre> <pre>
... ...
---- Searching for a suitable 'in' typemap for: char *buffer example.h:39: Searching for a suitable 'in' typemap for: char *buffer
Looking for: char *buffer Looking for: char *buffer
Multi-argument typemap found... Multi-argument typemap found...
Using: %typemap(in) (char *buffer,int len) Using: %typemap(in) (char *buffer,int len)

View file

@ -626,7 +626,7 @@ static void debug_search_result_display(Node *tm) {
* 'code' attribute. * 'code' attribute.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type, const_String_or_char_ptr name, const_String_or_char_ptr qualifiedname, SwigType **matchtype) { static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type, const_String_or_char_ptr name, const_String_or_char_ptr qualifiedname, SwigType **matchtype, Node *node) {
Hash *result = 0, *tm, *tm1, *tma; Hash *result = 0, *tm, *tm1, *tma;
Hash *backup = 0; Hash *backup = 0;
SwigType *noarrays = 0; SwigType *noarrays = 0;
@ -649,7 +649,7 @@ static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type
if (debug_display) { if (debug_display) {
String *empty_string = NewStringEmpty(); String *empty_string = NewStringEmpty();
String *typestr = SwigType_str(type, cqualifiedname ? cqualifiedname : (cname ? cname : empty_string)); 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); Swig_diagnostic(Getfile(node), Getline(node), "Searching for a suitable '%s' typemap for: %s\n", tmap_method, typestr);
Delete(typestr); Delete(typestr);
Delete(empty_string); Delete(empty_string);
} }
@ -846,7 +846,7 @@ static Hash *typemap_search_multi(const_String_or_char_ptr tmap_method, ParmList
name = Getattr(parms, "name"); name = Getattr(parms, "name");
/* Try to find a match on the first type */ /* Try to find a match on the first type */
tm = typemap_search(tmap_method, type, name, 0, &mtype); tm = typemap_search(tmap_method, type, name, 0, &mtype, parms);
if (tm) { if (tm) {
if (mtype && SwigType_isarray(mtype)) { if (mtype && SwigType_isarray(mtype)) {
Setattr(parms, "tmap:match", mtype); Setattr(parms, "tmap:match", mtype);
@ -1259,6 +1259,22 @@ static void typemap_locals(DOHString * s, ParmList *l, Wrapper *f, int argnum) {
} }
} }
/* -----------------------------------------------------------------------------
* typemap_warn()
*
* If any warning message is attached to this parameter's "tmap:<method>:warning"
* attribute, print that warning message.
* ----------------------------------------------------------------------------- */
static void typemap_warn(const_String_or_char_ptr tmap_method, Parm *p) {
String *temp = NewStringf("%s:warning", tmap_method);
String *w = Getattr(p, typemap_method_name(temp));
Delete(temp);
if (w) {
Swig_warning(0, Getfile(p), Getline(p), "%s\n", w);
}
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Swig_typemap_lookup() * Swig_typemap_lookup()
* *
@ -1326,7 +1342,7 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
qpname = qsn; qpname = qsn;
} }
tm = typemap_search(tmap_method, type, pname, qpname, &mtype); tm = typemap_search(tmap_method, type, pname, qpname, &mtype, node);
if (typemap_search_debug) if (typemap_search_debug)
debug_search_result_display(tm); debug_search_result_display(tm);
@ -1459,15 +1475,8 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr tmap_method, No
Setattr(node, typemap_method_name(temp), "1"); Setattr(node, typemap_method_name(temp), "1");
} }
/* Look for warnings */ /* Print warnings, if any */
{ typemap_warn(cmethod, node);
String *w;
sprintf(temp, "%s:warning", cmethod);
w = Getattr(node, typemap_method_name(temp));
if (w) {
Swig_warning(0, Getfile(node), Getline(node), "%s\n", w);
}
}
/* Look for code fragments */ /* Look for code fragments */
{ {
@ -1542,22 +1551,6 @@ static void typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr tmap_method
Delete(temp); Delete(temp);
} }
/* -----------------------------------------------------------------------------
* typemap_warn()
*
* If any warning message is attached to this parameter's "tmap:<method>:warning"
* attribute, print that warning message.
* ----------------------------------------------------------------------------- */
static void typemap_warn(const_String_or_char_ptr tmap_method, Parm *p) {
String *temp = NewStringf("%s:warning", tmap_method);
String *w = Getattr(p, typemap_method_name(temp));
Delete(temp);
if (w) {
Swig_warning(0, Getfile(p), Getline(p), "%s\n", w);
}
}
static void typemap_emit_code_fragments(const_String_or_char_ptr tmap_method, Parm *p) { static void typemap_emit_code_fragments(const_String_or_char_ptr tmap_method, Parm *p) {
String *temp = NewStringf("%s:fragment", tmap_method); String *temp = NewStringf("%s:fragment", tmap_method);
String *f = Getattr(p, typemap_method_name(temp)); String *f = Getattr(p, typemap_method_name(temp));