summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2010-05-26 23:22:49 +0000
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2010-05-26 23:22:49 +0000
commite2ce97f397c7d59d2d99ee3907dd5db930a9287e (patch)
tree611259e23cc15941a61b9bde945e2c6bd3bf70ab /Source
parent7b2c6b477abff9a81da8b10549ed9a758ad7a2ef (diff)
downloadswig-e2ce97f397c7d59d2d99ee3907dd5db930a9287e.tar.gz
Add the ability for special variable macros to call other special variable macros. Also added additional diagnostics when using -debug-tmsearch. Add tests for std::vector of shared_ptr.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12059 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Source')
-rw-r--r--Source/Swig/typemap.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/Source/Swig/typemap.c b/Source/Swig/typemap.c
index 2bf806e66..607ab6d10 100644
--- a/Source/Swig/typemap.c
+++ b/Source/Swig/typemap.c
@@ -1940,10 +1940,16 @@ static void replace_embedded_typemap(String *s, ParmList *parm_sublist, Wrapper
#ifdef SWIG_DEBUG
Printf(stdout, "Swig_typemap_attach_parms: embedded\n");
#endif
- if (!already_substituting) {
- already_substituting = 1;
+ if (already_substituting < 10) {
+ already_substituting++;
+ if ((in_typemap_search_multi == 0) && typemap_search_debug) {
+ String *dtypemap = NewString(dollar_typemap);
+ Replaceall(dtypemap, "$TYPEMAP", "$typemap");
+ Printf(stdout, " Containing: %s\n", dtypemap);
+ Delete(dtypemap);
+ }
Swig_typemap_attach_parms(tmap_method, to_match_parms, f);
- already_substituting = 0;
+ already_substituting--;
/* Look for the typemap code */
attr = NewStringf("tmap:%s", tmap_method);
@@ -1974,10 +1980,11 @@ static void replace_embedded_typemap(String *s, ParmList *parm_sublist, Wrapper
}
Delete(attr);
} else {
- /* simple recursive call check, but prevents using an embedded typemap that contains another embedded typemap */
+ /* Simple recursive call check to prevent infinite recursion - this strategy only allows a limited
+ * number of calls by a embedded typemaps to other embedded typemaps though */
String *dtypemap = NewString(dollar_typemap);
Replaceall(dtypemap, "$TYPEMAP", "$typemap");
- Swig_error(Getfile(s), Getline(s), "Recursive $typemap calls not supported - %s\n", dtypemap);
+ Swig_error(Getfile(s), Getline(s), "Likely recursive $typemap calls containing %s. Use -debug-tmsearch to debug.\n", dtypemap);
Delete(dtypemap);
}
syntax_error = 0;