/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Source/Swig/cwrap.c
C | 794 lines | 536 code | 101 blank | 157 comment | 83 complexity | fee1fc76b2cddfcecc9a989d5f1c41fd MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1/* -----------------------------------------------------------------------------
2 * cwrap.c
3 *
4 * This file defines a variety of wrapping rules for C/C++ handling including
5 * the naming of local variables, calling conventions, and so forth.
6 *
7 * Author(s) : David Beazley (beazley@cs.uchicago.edu)
8 *
9 * Copyright (C) 1998-2000. The University of Chicago
10 * Copyright (C) 1995-1998. The University of Utah and The Regents of the
11 * University of California.
12 *
13 * See the file LICENSE for information on usage and redistribution.
14 * ----------------------------------------------------------------------------- */
15
16static char cvsroot[] = "$Header$";
17
18#include "swig.h"
19
20static Parm *nonvoid_parms(Parm *p) {
21 if (p) {
22 SwigType *t = Getattr(p,"type");
23 if (SwigType_type(t) == T_VOID) return 0;
24 }
25 return p;
26}
27
28/* -----------------------------------------------------------------------------
29 * Swig_parm_name()
30 *
31 * Generates a name for the ith argument in an argument list
32 * ----------------------------------------------------------------------------- */
33
34String *
35Swig_cparm_name(Parm *p, int i) {
36 String *name = NewStringf("arg%d",i+1);
37 if (p) {
38 Setattr(p,"lname",name);
39 }
40 return name;
41}
42
43/* -----------------------------------------------------------------------------
44 * Swig_clocal()
45 *
46 * Creates a string that declares a C local variable type. Converts references
47 * and user defined types to pointers.
48 * ----------------------------------------------------------------------------- */
49
50String *
51Swig_clocal(SwigType *t, String_or_char *name, String_or_char *value) {
52 String *decl;
53
54 decl = NewString("");
55
56 switch(SwigType_type(t)) {
57 case T_REFERENCE:
58 if (value) {
59 Printf(decl,"%s = (%s) &%s_defvalue", SwigType_lstr(t,name), SwigType_lstr(t,0), name);
60 } else {
61 Printf(decl,"%s = 0", SwigType_lstr(t,name));
62 }
63 break;
64 case T_VOID:
65 break;
66 case T_VARARGS:
67 Printf(decl,"void *%s = 0", name);
68 break;
69
70 default:
71 if (value) {
72 Printf(decl,"%s = (%s) %s", SwigType_lstr(t,name), SwigType_lstr(t,0), SwigType_lcaststr(t,value));
73 } else {
74 Printf(decl,"%s", SwigType_lstr(t,name));
75 }
76 }
77 return decl;
78}
79
80/* -----------------------------------------------------------------------------
81 * Swig_wrapped_var_convert()
82 *
83 * Converts a member variable for use in the get and set wrapper methods.
84 * This function only converts user defined types to pointers.
85 * ----------------------------------------------------------------------------- */
86
87String *
88Swig_wrapped_var_type(SwigType *t) {
89 SwigType *ty;
90 ty = Copy(t);
91
92 if (SwigType_isclass(t)) {
93 SwigType_add_pointer(ty);
94 }
95 return ty;
96}
97
98String *
99Swig_wrapped_var_deref(SwigType *t, String_or_char *name) {
100 if (SwigType_isclass(t)) {
101 return NewStringf("*%s",name);
102 } else {
103 return SwigType_rcaststr(t,name);
104 }
105}
106
107String *
108Swig_wrapped_var_assign(SwigType *t, String_or_char *name) {
109 if (SwigType_isclass(t)) {
110 return NewStringf("&%s",name);
111 } else {
112 return SwigType_lcaststr(t,name);
113 }
114}
115
116/* -----------------------------------------------------------------------------
117 * Swig_cargs()
118 *
119 * Emit all of the local variables for a list of parameters. Returns the
120 * number of parameters.
121 * ----------------------------------------------------------------------------- */
122
123int Swig_cargs(Wrapper *w, ParmList *p) {
124 int i;
125 SwigType *pt;
126 String *pvalue;
127 String *pname;
128 String *local;
129 String *lname;
130 SwigType *altty;
131 String *type;
132 int tycode;
133
134 i = 0;
135 while (p != 0) {
136 lname = Swig_cparm_name(p,i);
137 pt = Getattr(p,"type");
138 if ((SwigType_type(pt) != T_VOID)) {
139 pname = Getattr(p,"name");
140 pvalue = Getattr(p,"value");
141 altty = Getattr(p,"alttype");
142 type = Getattr(p,"type");
143 tycode = SwigType_type(type);
144 if (tycode == T_REFERENCE) {
145 if (pvalue) {
146 String *defname, *defvalue;
147 defname = NewStringf("%s_defvalue", lname);
148 defvalue = NewStringf("%s = %s", SwigType_str(type,defname), pvalue);
149 Wrapper_add_localv(w,defname, defvalue, NIL);
150 Delete(defname);
151 Delete(defvalue);
152 }
153 } else if (!pvalue && (tycode == T_POINTER)) {
154 pvalue = (String *) "0";
155 }
156 if (!altty) {
157 local = Swig_clocal(pt,lname,pvalue);
158 } else {
159 local = Swig_clocal(altty,lname, pvalue);
160 }
161 Wrapper_add_localv(w,lname,local,NIL);
162 i++;
163 }
164 p = nextSibling(p);
165 }
166 return(i);
167}
168
169/* -----------------------------------------------------------------------------
170 * Swig_cresult()
171 *
172 * This function generates the C code needed to set the result of a C
173 * function call.
174 * ----------------------------------------------------------------------------- */
175
176String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl) {
177 String *fcall;
178
179 fcall = NewString("");
180 switch(SwigType_type(t)) {
181 case T_VOID:
182 break;
183 case T_REFERENCE:
184 Printf(fcall,"{\n");
185 Printf(fcall,"%s = ", SwigType_str(t,"_result_ref"));
186 break;
187 case T_USER:
188 Printf(fcall,"%s = ", name);
189 break;
190
191 default:
192 /* Normal return value */
193 Printf(fcall,"%s = (%s)", name, SwigType_lstr(t,0));
194 break;
195 }
196
197 /* Now print out function call */
198 Printv(fcall,decl,NIL);
199
200 /* A sick hack */
201 {
202 char *c = Char(decl) + Len(decl) - 1;
203 if (!((*c == ';') || (*c == '}')))
204 Printf(fcall, ";");
205 }
206 Printf(fcall,"\n");
207
208 if (SwigType_type(t) == T_REFERENCE) {
209 Printf(fcall,"%s = (%s) &_result_ref;\n", name, SwigType_lstr(t,0));
210 Printf(fcall,"}\n");
211 }
212 return fcall;
213}
214
215/* -----------------------------------------------------------------------------
216 * Swig_cfunction_call()
217 *
218 * Creates a string that calls a C function using the local variable rules
219 * defined above.
220 *
221 * name(arg0, arg1, arg2, ... argn)
222 *
223 * ----------------------------------------------------------------------------- */
224
225String *
226Swig_cfunction_call(String_or_char *name, ParmList *parms) {
227 String *func;
228 int i = 0;
229 int comma = 0;
230 Parm *p = parms;
231 SwigType *pt;
232 String *nname;
233
234 func = NewString("");
235 nname = SwigType_namestr(name);
236 Printf(func,"%s(", nname);
237 while (p) {
238 String *pname;
239 pt = Getattr(p,"type");
240
241 if ((SwigType_type(pt) != T_VOID)) {
242 if (comma) Printf(func,",");
243 pname = Swig_cparm_name(p,i);
244 Printf(func,"%s", SwigType_rcaststr(pt, pname));
245 comma = 1;
246 i++;
247 }
248 p = nextSibling(p);
249 }
250 Printf(func,")");
251 return func;
252}
253
254/* -----------------------------------------------------------------------------
255 * Swig_cmethod_call()
256 *
257 * Generates a string that calls a C++ method from a list of parameters.
258 *
259 * arg0->name(arg1, arg2, arg3, ..., argn)
260 *
261 * self is an argument that defines how to handle the first argument. Normally,
262 * it should be set to "this->". With C++ proxy classes enabled, it could be
263 * set to "(*this)->" or some similar sequence.
264 * ----------------------------------------------------------------------------- */
265
266String *
267Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self) {
268 String *func, *nname;
269 int i = 0;
270 Parm *p = parms;
271 SwigType *pt;
272 int comma = 0;
273
274 if (!self) self = (char *) "(this)->";
275
276 func = NewString("");
277 nname = SwigType_namestr(name);
278 if (!p) return func;
279 Append(func,self);
280 pt = Getattr(p,"type");
281
282 /* If the method is invoked through a dereferenced pointer, we don't add any casts
283 (needed for smart pointers). Otherwise, we cast to the appropriate type */
284
285 if (Strstr(func,"*this")) {
286 Replaceall(func,"this", Swig_cparm_name(p,0));
287 } else {
288 Replaceall(func,"this", SwigType_rcaststr(pt, Swig_cparm_name(p,0)));
289 }
290
291 if (SwigType_istemplate(name)) {
292 Printf(func,"template %s(", nname);
293 } else {
294 Printf(func,"%s(", nname);
295 }
296 i++;
297 p = nextSibling(p);
298 while (p) {
299 String *pname;
300 pt = Getattr(p,"type");
301 if ((SwigType_type(pt) != T_VOID)) {
302 if (comma) Printf(func,",");
303 pname = Swig_cparm_name(p,i);
304 Printf(func,"%s", SwigType_rcaststr(pt, pname));
305 comma = 1;
306 i++;
307 }
308 p = nextSibling(p);
309 }
310 Printf(func,")");
311 Delete(nname);
312 return func;
313}
314
315/* -----------------------------------------------------------------------------
316 * Swig_cconstructor_call()
317 *
318 * Creates a string that calls a C constructor function.
319 *
320 * (name *) calloc(1,sizeof(name));
321 * ----------------------------------------------------------------------------- */
322
323String *
324Swig_cconstructor_call(String_or_char *name) {
325 DOH *func;
326
327 func = NewString("");
328 Printf(func,"(%s *) calloc(1, sizeof(%s))", name, name);
329 return func;
330}
331
332
333/* -----------------------------------------------------------------------------
334 * Swig_cppconstructor_call()
335 *
336 * Creates a string that calls a C function using the local variable rules
337 * defined above.
338 *
339 * name(arg0, arg1, arg2, ... argn)
340 *
341 * ----------------------------------------------------------------------------- */
342
343String *
344Swig_cppconstructor_call(String_or_char *name, ParmList *parms) {
345 String *func;
346 String *nname;
347 int i = 0;
348 int comma = 0;
349 Parm *p = parms;
350 SwigType *pt;
351 nname = SwigType_namestr(name);
352 func = NewString("");
353 Printf(func,"new %s(", nname);
354 while (p) {
355 String *pname;
356 pt = Getattr(p,"type");
357 if ((SwigType_type(pt) != T_VOID)) {
358 if (comma) Printf(func,",");
359 pname = Swig_cparm_name(p,i);
360 Printf(func,"%s", SwigType_rcaststr(pt, pname));
361 comma = 1;
362 i++;
363 }
364 p = nextSibling(p);
365 }
366 Printf(func,")");
367 Delete(nname);
368 return func;
369}
370
371
372/* -----------------------------------------------------------------------------
373 * Swig_cdestructor_call()
374 *
375 * Creates a string that calls a C constructor function.
376 *
377 * free((char *) arg0);
378 * ----------------------------------------------------------------------------- */
379
380String *
381Swig_cdestructor_call() {
382 String *func;
383 func = NewString("");
384 Printf(func,"free((char *) %s)", Swig_cparm_name(0,0));
385 return func;
386}
387
388
389/* -----------------------------------------------------------------------------
390 * Swig_cppdestructor_call()
391 *
392 * Creates a string that calls a C constructor function.
393 *
394 * delete arg0;
395 * ----------------------------------------------------------------------------- */
396
397String *
398Swig_cppdestructor_call() {
399 String *func;
400
401 func = NewString("");
402 Printf(func,"delete %s", Swig_cparm_name(0,0));
403 return func;
404}
405
406/* -----------------------------------------------------------------------------
407 * Swig_cmemberset_call()
408 *
409 * Generates a string that sets the name of a member in a C++ class or C struct.
410 *
411 * arg0->name = arg1
412 *
413 * ----------------------------------------------------------------------------- */
414
415String *
416Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self) {
417 String *func;
418 func = NewString("");
419 if (!self) self = NewString("(this)->");
420 else self = NewString(self);
421 Replaceall(self,"this",Swig_cparm_name(0,0));
422 if (SwigType_type(type) != T_ARRAY) {
423 Printf(func,"if (%s) %s%s = %s",Swig_cparm_name(0,0), self,name, Swig_wrapped_var_deref(type, Swig_cparm_name(0,1)));
424 }
425 Delete(self);
426 return(func);
427}
428
429
430/* -----------------------------------------------------------------------------
431 * Swig_cmemberget_call()
432 *
433 * Generates a string that sets the name of a member in a C++ class or C struct.
434 *
435 * arg0->name
436 *
437 * ----------------------------------------------------------------------------- */
438
439String *
440Swig_cmemberget_call(String_or_char *name, SwigType *t, String_or_char *self) {
441 String *func;
442 if (!self) self = NewString("(this)->");
443 else self = NewString(self);
444 Replaceall(self,"this",Swig_cparm_name(0,0));
445 func = NewString("");
446 Printf(func,"%s (%s%s)", Swig_wrapped_var_assign(t,""),self, name);
447 Delete(self);
448 return func;
449}
450
451/* -----------------------------------------------------------------------------
452 * Swig_MethodToFunction(Node *n)
453 *
454 * Converts a C++ method node to a function accessor function.
455 * ----------------------------------------------------------------------------- */
456
457int
458Swig_MethodToFunction(Node *n, String *classname, int flags) {
459 String *name, *qualifier;
460 ParmList *parms;
461 SwigType *type;
462 Parm *p;
463 String *self = 0;
464
465 /* If smart pointer, change self derefencing */
466 if (flags & CWRAP_SMART_POINTER) {
467 self = NewString("(*this)->");
468 }
469 /* If node is a member template expansion, we don't allow added code */
470
471 if (Getattr(n,"templatetype")) flags &= ~(CWRAP_EXTEND);
472
473 name = Getattr(n,"name");
474 qualifier = Getattr(n,"qualifier");
475 parms = CopyParmList(nonvoid_parms(Getattr(n,"parms")));
476
477 type = NewString(classname);
478 if (qualifier) {
479 SwigType_push(type,qualifier);
480 }
481 SwigType_add_pointer(type);
482 p = NewParm(type,"self");
483 Setattr(p,"hidden","1");
484 set_nextSibling(p,parms);
485 Delete(type);
486
487 /* Generate action code for the access */
488 if (!(flags & CWRAP_EXTEND)) {
489 Setattr(n,"wrap:action", Swig_cresult(Getattr(n,"type"),"result", Swig_cmethod_call(name,p,self)));
490 } else {
491 String *code;
492 String *mangled;
493 String *membername = Swig_name_member(classname, name);
494 mangled = Swig_name_mangle(membername);
495
496 code = Getattr(n,"code");
497 type = Getattr(n,"type");
498
499 /* Check if the method is overloaded. If so, and it has code attached, we append an extra suffix
500 to avoid a name-clash in the generated wrappers. This allows overloaded methods to be defined
501 in C. */
502
503 if (Getattr(n,"sym:overloaded") && code) {
504 Append(mangled,Getattr(n,"sym:overname"));
505 }
506
507 Setattr(n,"wrap:action", Swig_cresult(Getattr(n,"type"),"result", Swig_cfunction_call(mangled,p)));
508
509 /* See if there is any code that we need to emit */
510 if (code) {
511 String *body;
512 String *tmp = NewStringf("%s(%s)", mangled, ParmList_str(p));
513 body = SwigType_str(type,tmp);
514 Delete(tmp);
515 Printv(body,code,"\n",NIL);
516 Setattr(n,"wrap:code",body);
517 }
518 Delete(membername);
519 Delete(mangled);
520 }
521 Setattr(n,"parms",p);
522 Delete(p);
523 Delete(self);
524 return SWIG_OK;
525}
526
527/* -----------------------------------------------------------------------------
528 * Swig_ConstructorToFunction()
529 *
530 * This function creates a C wrapper for a C constructor function.
531 * ----------------------------------------------------------------------------- */
532
533int
534Swig_ConstructorToFunction(Node *n, String *classname, int cplus, int flags)
535{
536 ParmList *parms;
537 SwigType *type;
538 String *membername;
539 String *mangled;
540 membername = Swig_name_construct(classname);
541 mangled = Swig_name_mangle(membername);
542
543 parms = CopyParmList(nonvoid_parms(Getattr(n,"parms")));
544 type = NewString(classname);
545 SwigType_add_pointer(type);
546
547 if (flags & CWRAP_EXTEND) {
548 String *code = Getattr(n,"code");
549 if (code) {
550 String *wrap;
551 String *s = NewStringf("%s(%s)", mangled, ParmList_str(parms));
552 wrap = SwigType_str(type,s);
553 Delete(s);
554 Printv(wrap,code,"\n",NIL);
555 Setattr(n,"wrap:code",wrap);
556 Delete(wrap);
557 }
558 Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cfunction_call(mangled,parms)));
559 } else {
560 if (cplus) {
561 Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cppconstructor_call(classname,parms)));
562 } else {
563 Setattr(n,"wrap:action", Swig_cresult(type,"result", Swig_cconstructor_call(classname)));
564 }
565 }
566 Setattr(n,"type",type);
567 Setattr(n,"parms", parms);
568 Delete(type);
569 Delete(parms);
570 Delete(mangled);
571 Delete(membername);
572 return SWIG_OK;
573}
574
575/* -----------------------------------------------------------------------------
576 * Swig_DestructorToFunction()
577 *
578 * This function creates a C wrapper for a destructor function.
579 * ----------------------------------------------------------------------------- */
580
581int
582Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
583{
584 SwigType *type;
585 Parm *p;
586
587 type = NewString(classname);
588 SwigType_add_pointer(type);
589 p = NewParm(type,"self");
590 Delete(type);
591 type = NewString("void");
592
593 if (flags & CWRAP_EXTEND) {
594 String *membername, *mangled, *code;
595 membername = Swig_name_destroy(classname);
596 mangled = Swig_name_mangle(membername);
597 code = Getattr(n,"code");
598 if (code) {
599 String *s = NewStringf("void %s(%s)", mangled, ParmList_str(p));
600 Printv(s,code,"\n",NIL);
601 Setattr(n,"wrap:code",s);
602 Delete(s);
603 }
604 Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cfunction_call(mangled,p)));
605 Delete(membername);
606 Delete(mangled);
607 } else {
608 if (cplus) {
609 Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cppdestructor_call()));
610 } else {
611 Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cdestructor_call()));
612 }
613 }
614 Setattr(n,"type",type);
615 Setattr(n,"parms", p);
616 Delete(type);
617 Delete(p);
618 return SWIG_OK;
619}
620
621/* -----------------------------------------------------------------------------
622 * Swig_MembersetToFunction()
623 *
624 * This function creates a C wrapper for setting a structure member.
625 * ----------------------------------------------------------------------------- */
626
627int
628Swig_MembersetToFunction(Node *n, String *classname, int flags) {
629 String *name;
630 ParmList *parms;
631 Parm *p;
632 SwigType *t;
633 SwigType *ty;
634 SwigType *type;
635 String *membername;
636 String *mangled;
637 String *self= 0;
638
639 if (flags & CWRAP_SMART_POINTER) {
640 self = NewString("(*this)->");
641 }
642
643 name = Getattr(n,"name");
644 type = Getattr(n,"type");
645
646 membername = Swig_name_member(classname, Swig_name_set(name));
647 mangled = Swig_name_mangle(membername);
648
649 t = NewString(classname);
650 SwigType_add_pointer(t);
651 parms = NewParm(t,"self");
652 Delete(t);
653
654 ty = Swig_wrapped_var_type(type);
655 p = NewParm(ty,name);
656 set_nextSibling(parms,p);
657
658 /* If the type is a pointer or reference. We mark it with a special wrap:disown attribute */
659 if (SwigType_check_decl(type,"p.")) {
660 Setattr(p,"wrap:disown","1");
661 }
662 Delete(p);
663
664 if (flags & CWRAP_EXTEND) {
665 String *code = Getattr(n,"code");
666 if (code) {
667 String *s = NewStringf("void %s(%s)", mangled, ParmList_str(parms));
668 Printv(s,code,"\n",NIL);
669 Setattr(n,"wrap:code",s);
670 Delete(s);
671 }
672 Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cfunction_call(mangled,parms)));
673 } else {
674 Setattr(n,"wrap:action", NewStringf("%s;\n", Swig_cmemberset_call(name,type,self)));
675 }
676 Setattr(n,"type","void");
677 Setattr(n,"parms", parms);
678 Delete(parms);
679 Delete(ty);
680 Delete(membername);
681 Delete(mangled);
682 Delete(self);
683 return SWIG_OK;
684}
685
686/* -----------------------------------------------------------------------------
687 * Swig_MembergetToFunction()
688 *
689 * This function creates a C wrapper for setting a structure member.
690 * ----------------------------------------------------------------------------- */
691
692int
693Swig_MembergetToFunction(Node *n, String *classname, int flags) {
694 String *name;
695 ParmList *parms;
696 SwigType *t;
697 SwigType *ty;
698 SwigType *type;
699 String *membername;
700 String *mangled;
701 String *self = 0;
702
703 if (flags & CWRAP_SMART_POINTER) {
704 self = NewString("(*this)->");
705 }
706
707 name = Getattr(n,"name");
708 type = Getattr(n,"type");
709
710 membername = Swig_name_member(classname, Swig_name_get(name));
711 mangled = Swig_name_mangle(membername);
712
713 t = NewString(classname);
714 SwigType_add_pointer(t);
715 parms = NewParm(t,"self");
716 Delete(t);
717
718 ty = Swig_wrapped_var_type(type);
719 if (flags & CWRAP_EXTEND) {
720 String *code = Getattr(n,"code");
721 if (code) {
722 String *tmp = NewStringf("%s(%s)", mangled, ParmList_str(parms));
723 String *s = SwigType_str(ty,tmp);
724 Delete(tmp);
725 Printv(s,code,"\n",NIL);
726 Setattr(n,"wrap:code",s);
727 Delete(s);
728 }
729 Setattr(n,"wrap:action", Swig_cresult(ty,"result",Swig_cfunction_call(mangled,parms)));
730 } else {
731 Setattr(n,"wrap:action", Swig_cresult(ty,"result",Swig_cmemberget_call(name,type,self)));
732 }
733 Setattr(n,"type",ty);
734 Setattr(n,"parms", parms);
735 Delete(parms);
736 Delete(ty);
737 Delete(membername);
738 Delete(mangled);
739 return SWIG_OK;
740}
741
742/* -----------------------------------------------------------------------------
743 * Swig_VarsetToFunction()
744 *
745 * This function creates a C wrapper for setting a global variable.
746 * ----------------------------------------------------------------------------- */
747
748int
749Swig_VarsetToFunction(Node *n) {
750 String *name,*nname;
751 ParmList *parms;
752 SwigType *type, *ty;
753
754 name = Getattr(n,"name");
755 type = Getattr(n,"type");
756
757 nname = SwigType_namestr(name);
758
759 ty = Swig_wrapped_var_type(type);
760 parms = NewParm(ty,"value");
761 Delete(ty);
762
763 Setattr(n,"wrap:action", NewStringf("%s = %s;\n", nname, Swig_wrapped_var_deref(type,Swig_cparm_name(0,0))));
764 Setattr(n,"type","void");
765 Setattr(n,"parms",parms);
766 Delete(parms);
767 Delete(nname);
768 return SWIG_OK;
769}
770
771/* -----------------------------------------------------------------------------
772 * Swig_VargetToFunction()
773 *
774 * This function creates a C wrapper for getting a global variable.
775 * ----------------------------------------------------------------------------- */
776
777int
778Swig_VargetToFunction(Node *n) {
779 String *name, *nname;
780 SwigType *type, *ty;
781
782 name = Getattr(n,"name");
783 type = Getattr(n,"type");
784
785 nname = SwigType_namestr(name);
786 ty = Swig_wrapped_var_type(type);
787
788 Setattr(n,"wrap:action", Swig_cresult(ty,"result",Swig_wrapped_var_assign(type,nname)));
789 Setattr(n,"type",ty);
790 Delattr(n,"parms");
791 Delete(nname);
792 Delete(ty);
793 return SWIG_OK;
794}