Partial support for %constant and structs

Test case is slightly modified from the test case in issue #250

Use of constant objects does not seem to work in Python - the type is
SwigPyObject instead of constant_directive.Type1.
This commit is contained in:
William S Fulton 2014-12-18 06:37:49 +00:00
commit 2e01533b23
7 changed files with 32 additions and 48 deletions

View file

@ -914,21 +914,10 @@ public:
String *null_attribute = 0;
// Now write code to make the function call
if (!native_function_flag) {
if (Cmp(nodeType(n), "constant") == 0) {
// Wrapping a constant hack
Swig_save("functionWrapper", n, "wrap:action", NIL);
// below based on Swig_VargetToFunction()
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
Setattr(n, "wrap:action", NewStringf("%s = (%s)(%s);", Swig_cresult_name(), SwigType_lstr(ty, 0), Getattr(n, "value")));
}
Swig_director_emit_dynamic_cast(n, f);
String *actioncode = emit_action(n);
if (Cmp(nodeType(n), "constant") == 0)
Swig_restore(n);
/* Return value if necessary */
if ((tm = Swig_typemap_lookup_out("out", n, Swig_cresult_name(), f, actioncode))) {
canThrow(n, "out", n);