7
7
* Tcl8 language module for SWIG.
8
8
* ----------------------------------------------------------------------------- */
10
char cvsroot_tcl8_cxx[] = "$Id: tcl8.cxx 10270 2008-02-27 15:29:55Z wsfulton $";
10
char cvsroot_tcl8_cxx[] = "$Id: tcl8.cxx 10453 2008-05-15 21:18:44Z wsfulton $";
12
12
#include "swigmod.h"
13
13
#include "cparse.h"
304
304
Printv(f->def, "SWIGINTERN int\n ", wname, "(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {", NIL);
306
/* Print out variables for storing arguments. */
307
emit_args(type, parms, f);
306
// Emit all of the local variables for holding arguments.
307
emit_parameter_variables(parms, f);
309
309
/* Attach standard typemaps */
310
310
emit_attach_parmmaps(parms, f);
445
445
/* Now write code to make the function call */
446
String *actioncode = emit_action(n);
448
448
/* Need to redo all of this code (eventually) */
450
450
/* Return value if necessary */
451
if ((tm = Swig_typemap_lookup_new("out", n, "result", 0))) {
451
if ((tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode))) {
452
452
Replaceall(tm, "$source", "result");
453
453
#ifdef SWIG_USE_RESULTOBJ
454
454
Replaceall(tm, "$target", "resultobj");
467
467
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number, "Unable to use return type %s in function %s.\n", SwigType_str(type, 0), name);
469
emit_return_variable(n, type, f);
470
471
/* Dump output argument code */
471
472
Printv(f->code, outarg, NIL);
476
477
/* Look for any remaining cleanup */
477
478
if (GetFlag(n, "feature:new")) {
478
if ((tm = Swig_typemap_lookup_new("newfree", n, "result", 0))) {
479
if ((tm = Swig_typemap_lookup("newfree", n, "result", 0))) {
479
480
Replaceall(tm, "$source", "result");
480
481
Printf(f->code, "%s\n", tm);
484
if ((tm = Swig_typemap_lookup_new("ret", n, "result", 0))) {
485
if ((tm = Swig_typemap_lookup("ret", n, "result", 0))) {
485
486
Replaceall(tm, "$source", "result");
486
487
Printf(f->code, "%s\n", tm);
565
566
Setattr(n, "wrap:name", getfname);
566
567
Printv(getf->def, "SWIGINTERN const char *", getfname, "(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, char *name1, char *name2, int flags) {", NIL);
567
568
Wrapper_add_local(getf, "value", "Tcl_Obj *value = 0");
568
if ((tm = Swig_typemap_lookup_new("varout", n, name, 0))) {
569
if ((tm = Swig_typemap_lookup("varout", n, name, 0))) {
569
570
Replaceall(tm, "$source", name);
570
571
Replaceall(tm, "$target", "value");
571
572
Replaceall(tm, "$result", "value");
572
573
/* Printf(getf->code, "%s\n",tm); */
573
addfail = emit_action_code(n, getf, tm);
574
addfail = emit_action_code(n, getf->code, tm);
574
575
Printf(getf->code, "if (value) {\n");
575
576
Printf(getf->code, "Tcl_SetVar2(interp,name1,name2,Tcl_GetStringFromObj(value,NULL), flags);\n");
576
577
Printf(getf->code, "Tcl_DecrRefCount(value);\n");
601
602
Wrapper_add_local(setf, "value", "Tcl_Obj *value = 0");
602
603
Wrapper_add_local(setf, "name1o", "Tcl_Obj *name1o = 0");
604
if ((tm = Swig_typemap_lookup_new("varin", n, name, 0))) {
605
if ((tm = Swig_typemap_lookup("varin", n, name, 0))) {
605
606
Replaceall(tm, "$source", "value");
606
607
Replaceall(tm, "$target", name);
607
608
Replaceall(tm, "$input", "value");
610
611
Printf(setf->code, "Tcl_DecrRefCount(name1o);\n");
611
612
Printf(setf->code, "if (!value) SWIG_fail;\n");
612
613
/* Printf(setf->code,"%s\n", tm); */
613
emit_action_code(n, setf, tm);
614
emit_action_code(n, setf->code, tm);
614
615
Printf(setf->code, "return NULL;\n");
615
616
Printf(setf->code, "fail:\n");
616
617
Printf(setf->code, "return \"%s\";\n", iname);
675
676
value = Char(wname);
678
if ((tm = Swig_typemap_lookup_new("consttab", n, name, 0))) {
679
if ((tm = Swig_typemap_lookup("consttab", n, name, 0))) {
679
680
Replaceall(tm, "$source", value);
680
681
Replaceall(tm, "$target", name);
681
682
Replaceall(tm, "$value", value);
682
683
Replaceall(tm, "$nsname", nsname);
683
684
Printf(const_tab, "%s,\n", tm);
684
} else if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) {
685
} else if ((tm = Swig_typemap_lookup("constcode", n, name, 0))) {
685
686
Replaceall(tm, "$source", value);
686
687
Replaceall(tm, "$target", name);
687
688
Replaceall(tm, "$value", value);
782
783
Printv(f_wrappers, "SWIGINTERN void swig_delete_", class_name, "(void *obj) {\n", NIL);
783
784
if (destructor_action) {
784
785
Printv(f_wrappers, SwigType_str(rt, "arg1"), " = (", SwigType_str(rt, 0), ") obj;\n", NIL);
785
Printv(f_wrappers, destructor_action, NIL);
786
Printv(f_wrappers, destructor_action, "\n", NIL);
788
789
Printv(f_wrappers, " delete (", SwigType_str(rt, 0), ") obj;\n", NIL);