1 /* objcmd8.swg : Tcl 8.x object creation */
3 static int Tcl@CLASS@Cmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
4 void (*del)(ClientData) = 0;
6 int (*cmd)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST*) = 0;
7 @CLASSTYPE@ newObj = 0;
14 tcl_result = Tcl_GetObjResult(interp);
16 cmd = @TCLCONSTRUCTOR@;
18 _str = Tcl_GetStringFromObj(objv[1],&length);
19 if (strcmp(_str,"-this") == 0) thisarg = 2;
20 else if (strcmp(_str,"-args") == 0) {
22 cmd = @TCLCONSTRUCTOR@;
23 } else if (objc == 2) {
26 cmd = @TCLCONSTRUCTOR@;
27 } else if (objc >= 3) {
29 _str = Tcl_GetStringFromObj(objv[2],&length);
30 if (strcmp(_str,"-this") == 0) thisarg = 3;
33 cmd = @TCLCONSTRUCTOR@;
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) {
48 r = SWIG_GetPointerObj(interp,objv[thisarg],(void **) &newObj,"@CLASSMANGLE@");
50 Tcl_SetStringObj(tcl_result,"Type error. not a @CLASS@ object.",-1);
53 if (!name) name = Tcl_GetStringFromObj(objv[thisarg],&length);
54 Tcl_SetStringObj(tcl_result,name,-1);
56 Tcl_SetStringObj(tcl_result,"wrong # args.",-1);
60 Tcl_SetStringObj(tcl_result,"No constructor available.",-1);
65 if (!Tcl_GetCommandInfo(interp,name,&dummy)) {
66 Tcl_CreateObjCommand(interp,name, Tcl@CLASS@MethodCmd, (ClientData) newObj, del);
69 Tcl_SetStringObj(tcl_result,"Object name already exists!",-1);