From: Marcelo M. <mm...@ac...> - 2006-01-09 23:35:56
|
Yes, the %rename is fixed now for the other languages that don't add a namewarn. (it was a very silly problem). So, please use it, for example you can add in your language and add new encodings, for example: /* create encoding for enum names in lisp */ String *Swig_string_lispid(String *s) { /* do something with the enum name */ String *res = Copy(s); Replaceall(res,"-", "_"); return res; } guile::main() { ... /* register the encoding */ DohEncoding("lispid",Swig_string_lispid); .. } then you can the following %rename: /* use the 'lispid encoding' */ %rename("c-enum-%(lispid)s",match=enumitem) ""; enum Hello { hi_there; -> renamed to "c-enum-hi-there" whats_up; -> also renamed to "c-enum-whats-up" }; int hi_there() {} -> no renamed nice, right? The same way we can add a "regular expression" encoder, any voluunter?, the only thing we need is a regexp library and write a small encoder function as the above, well, more like the Swig_string_command (misc.c), but the idea is the same. Marcelo William S Fulton wrote: > Marcelo Matus wrote: > >> hmm, we have to check this more careful. >> >> It is very strange since the rename mechanism is at a very general >> level, i.e., is the same >> for all the languages, and is done at the parsing stage when the >> "sym:name" attribute is set. >> >> it works for all the other languages, but guile, in some way, manage >> to disable it. >> >> we will need to do some debugging here.... >> >> >> Marcelo >> > Yeah, I noticed the %rename problem too, but see it is fixed now. It > was also affecting Lua. > >> >> Matthias Koeppe wrote: >> >>> Hi Marcelo, >>> >>> just checking CVS SWIG for Guile, and the "name" test case is failing: >>> The %rename in the following lines isn't working any more. >>> >>> #ifdef SWIGGUILE >>> %rename foo_1 "foo-2"; >>> #else >>> %rename foo_1 "foo_2"; >>> #endif >>> %inline %{ >>> void foo_1() {} >>> %} >>> >>> Looking at the CHANGES.current, I am amazed about the new features of >>> %rename you added! So can you help explaining/fixing this? >> > Yes, Marcelo has being going flat out with all sorts of new features :) > >>> Thanks >>> >>> > > Not sure if you get the following errors on your box Matthias. Apart > from these Guile is looking good on my setup. > > Checking testcase li_std_string (with run test) under guile > ERROR: In procedure GlobalString: > ERROR: Wrong type argument in position 1: "whee" > make[1]: *** [li_std_string.cpptest] Error 2 > > > Checking testcase cpp_basic under guile > cpp_basic_wrap.cxx: In function `scm_unused_struct* > _wrap_Foo_func_ptr_set(scm_unused_struct*, scm_unused_struct*)': > cpp_basic_wrap.cxx:1181: error: cannot convert ` > SWIG_Guile_MustGetPtr((&swig_module), s_1, swig_types[0], 2, 0, > "Foo-func-ptr-set")' from type `void*' to type `int (Foo::*)(int)' > cpp_basic_wrap.cxx: In function `scm_unused_struct* > _wrap_Foo_func_ptr_get(scm_unused_struct*)': > cpp_basic_wrap.cxx:1213: error: object missing in use of `result' > cpp_basic_wrap.cxx: In function `scm_unused_struct* > _wrap_get_func1_ptr()': > cpp_basic_wrap.cxx:1642: error: object missing in use of `result' > cpp_basic_wrap.cxx: In function `scm_unused_struct* > _wrap_get_func2_ptr()': > cpp_basic_wrap.cxx:1663: error: object missing in use of `result' > make[2]: *** [guile_gh_cpp] Error 1 > make[1]: *** [cpp_basic.cpptest] Error 2 > > Checking testcase namespace_spaces under guile > namespace_spaces_wrap.cxx: In function `scm_unused_struct* > _wrap_Foo_func_ptr_set(scm_unused_struct*, scm_unused_struct*)': > namespace_spaces_wrap.cxx:1134: error: cannot convert ` > SWIG_Guile_MustGetPtr((&swig_module), s_1, swig_types[0], 2, 0, > "Foo-func-ptr-set")' from type `void*' to type `void (Foo::*)(int)' > namespace_spaces_wrap.cxx: In function `scm_unused_struct* > _wrap_Foo_func_ptr_get(scm_unused_struct*)': > namespace_spaces_wrap.cxx:1166: error: object missing in use of `result' > make[2]: *** [guile_gh_cpp] Error 1 > make[1]: *** [namespace_spaces.cpptest] Error 2 > > William |