]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/swig_lib/tcl/objcmd8.swg
Updates for building wxSWIG on Linux
[wxWidgets.git] / wxPython / wxSWIG / swig_lib / tcl / objcmd8.swg
1 /* objcmd8.swg : Tcl 8.x object creation */
2
3 static int Tcl@CLASS@Cmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
4 void (*del)(ClientData) = 0;
5 char *name = 0;
6 int (*cmd)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST*) = 0;
7 @CLASSTYPE@ newObj = 0;
8 int firstarg = 0;
9 int thisarg = 0;
10 int length;
11 char *_str;
12 Tcl_Obj *tcl_result;
13
14 tcl_result = Tcl_GetObjResult(interp);
15 if (objc == 1) {
16 cmd = @TCLCONSTRUCTOR@;
17 } else {
18 _str = Tcl_GetStringFromObj(objv[1],&length);
19 if (strcmp(_str,"-this") == 0) thisarg = 2;
20 else if (strcmp(_str,"-args") == 0) {
21 firstarg = 1;
22 cmd = @TCLCONSTRUCTOR@;
23 } else if (objc == 2) {
24 firstarg = 1;
25 name = _str;
26 cmd = @TCLCONSTRUCTOR@;
27 } else if (objc >= 3) {
28 name = _str;
29 _str = Tcl_GetStringFromObj(objv[2],&length);
30 if (strcmp(_str,"-this") == 0) thisarg = 3;
31 else {
32 firstarg = 1;
33 cmd = @TCLCONSTRUCTOR@;
34 }
35 }
36 }
37 if (cmd) {
38 int result;
39 result = (*cmd)(clientData,interp,objc-firstarg,&objv[firstarg]);
40 if (result == TCL_OK) {
41 SWIG_GetPointerObj(interp,tcl_result,(void **) &newObj,"@CLASSMANGLE@");
42 } else { return result; }
43 if (!name) name = Tcl_GetStringFromObj(tcl_result,&length);
44 del = @TCLDESTRUCTOR@;
45 } else if (thisarg > 0) {
46 if (thisarg < objc) {
47 char *r;
48 r = SWIG_GetPointerObj(interp,objv[thisarg],(void **) &newObj,"@CLASSMANGLE@");
49 if (r) {
50 Tcl_SetStringObj(tcl_result,"Type error. not a @CLASS@ object.",-1);
51 return TCL_ERROR;
52 }
53 if (!name) name = Tcl_GetStringFromObj(objv[thisarg],&length);
54 Tcl_SetStringObj(tcl_result,name,-1);
55 } else {
56 Tcl_SetStringObj(tcl_result,"wrong # args.",-1);
57 return TCL_ERROR;
58 }
59 } else {
60 Tcl_SetStringObj(tcl_result,"No constructor available.",-1);
61 return TCL_ERROR;
62 }
63 {
64 Tcl_CmdInfo dummy;
65 if (!Tcl_GetCommandInfo(interp,name,&dummy)) {
66 Tcl_CreateObjCommand(interp,name, Tcl@CLASS@MethodCmd, (ClientData) newObj, del);
67 return TCL_OK;
68 } else {
69 Tcl_SetStringObj(tcl_result,"Object name already exists!",-1);
70 return TCL_ERROR;
71 }
72 }
73 }
74