]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/swig_lib/tcl/methodcmd.swg
Since I have made several changes to SWIG over the years to accomodate
[wxWidgets.git] / wxPython / wxSWIG / swig_lib / tcl / methodcmd.swg
1 /* methodcmd.swg : Tcl method invocation */
2
3 static int Tcl@CLASS@MethodCmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) {
4 int (*cmd)(ClientData, Tcl_Interp *, int, char **) = 0;
5 char temp[256], *oldarg;
6 int rcode;
7 int length;
8 char c;
9
10 if (argc < 2) {
11 Tcl_SetResult(interp,"@CLASS@ methods : { @METHODLIST@ }",TCL_STATIC);
12 return TCL_ERROR;
13 }
14 c = argv[1][0];
15 length = strlen(argv[1]);
16 SWIG_MakePtr(temp,(void *) clientData, "@CLASSMANGLE@");
17 if (0);
18 @METHODS@
19 else if ((c == 'c') && (strncmp(argv[1],"configure",length) == 0) && (length >= 2)) {
20 int i = 2;
21 cmd = 0;
22 while (i+1 < argc) {
23 @CONFIGMETHODS@
24 if (cmd) {
25 oldarg = argv[i];
26 argv[i] = &temp[0];
27 rcode = (*cmd)(clientData,interp,3,&argv[i-1]);
28 argv[i] = oldarg;
29 if (rcode == TCL_ERROR) return rcode;
30 cmd = 0;
31 } else {
32 Tcl_SetResult(interp,"Invalid configure option. Must be { @CONFIGLIST@ }",TCL_STATIC);
33 return TCL_ERROR;
34 }
35 i+=2;
36 }
37 if ((i < argc) || (i == 2)) {
38 Tcl_SetResult(interp,"{ @CONFIGLIST@ }",TCL_STATIC);
39 return TCL_ERROR;
40 }
41 return TCL_OK;
42 } else if ((c == 'c') && (strncmp(argv[1],"cget",length) == 0) && (length >= 2)) {
43 if (argc == 3) {
44 if (0) {}
45 @CGETMETHODS@
46 else if (strcmp(argv[2],"-this") == 0) {
47 SWIG_MakePtr(interp->result,(void *) clientData, "@CLASSMANGLE@");
48 return TCL_OK;
49 }
50 if (cmd) {
51 oldarg = argv[2];
52 argv[2] = &temp[0];
53 rcode = (*cmd)(clientData,interp,argc-1,&argv[1]);
54 argv[2] = oldarg;
55 return rcode;
56 } else {
57 Tcl_SetResult(interp,"Invalid cget option. Must be { -this @CGETLIST@ }",TCL_STATIC);
58 return TCL_ERROR;
59 }
60 } else {
61 Tcl_SetResult(interp,"{ -this @CGETLIST@ }", TCL_STATIC);
62 return TCL_ERROR;
63 }
64 }
65 if (!cmd) {
66 Tcl_SetResult(interp,"Invalid Method. Must be { @METHODLIST@}",TCL_STATIC);
67 return TCL_ERROR;
68 }
69 oldarg = argv[1];
70 argv[1] = &temp[0];
71 rcode = (*cmd)(clientData,interp,argc,argv);
72 argv[1] = oldarg;
73 return rcode;
74 }