1 /* objcmd.swg : Tcl object creation */
 
   3 static int Tcl@CLASS@Cmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
 
   4     void (*del)(ClientData) = 0;
 
   6     int (*cmd)(ClientData, Tcl_Interp *, int, char **) = 0;
 
   7     @CLASSTYPE@ newObj = 0;
 
  11         cmd = @TCLCONSTRUCTOR@;
 
  13         if (strcmp(argv[1],"-this") == 0) thisarg = 2;
 
  14         else if (strcmp(argv[1],"-args") == 0) {
 
  16             cmd = @TCLCONSTRUCTOR@;
 
  17         } else if (argc == 2) {
 
  20             cmd = @TCLCONSTRUCTOR@;
 
  21         } else if (argc >= 3) {
 
  23             if (strcmp(argv[2],"-this") == 0) thisarg = 3;
 
  26                 cmd = @TCLCONSTRUCTOR@;
 
  32         result = (*cmd)(clientData,interp,argc-firstarg,&argv[firstarg]);
 
  33         if (result == TCL_OK) {
 
  34             SWIG_GetPtr(interp->result,(void **) &newObj,"@CLASSMANGLE@");
 
  35         } else { return result; }
 
  36         if (!name) name = interp->result;
 
  37         del = @TCLDESTRUCTOR@;
 
  38     } else if (thisarg > 0) { 
 
  41             r = SWIG_GetPtr(argv[thisarg],(void **) &newObj,"@CLASSMANGLE@");
 
  43                 interp->result = "Type error. not a @CLASS@ object.";
 
  46             if (!name) name = argv[thisarg];
 
  47             /* Return value is same as pointer value */
 
  48             Tcl_SetResult(interp,argv[thisarg],TCL_VOLATILE);
 
  50             interp->result = "wrong # args.";
 
  54         interp->result = "No constructor available.";
 
  59       if (!Tcl_GetCommandInfo(interp,name,&dummy)) {
 
  60         Tcl_CreateCommand(interp,name, Tcl@CLASS@MethodCmd, (ClientData) newObj, del);
 
  63         Tcl_SetResult(interp,"",TCL_VOLATILE);
 
  64         Tcl_AppendResult(interp,"Object ", name, " already exists!", (char *) NULL);