URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [c-code/] [myCmds.c] - Rev 1782
Go to most recent revision | Compare with Previous | Blame | View Log
#include <tk.h> #include <tix.h> int My_AddTwoCmd(clientData, interp, argc, argv) ClientData clientData; Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ char **argv; /* Argument strings. */ { int num; char buf[30]; if (argc != 2) { return Tix_ArgcError(interp, 1, argv, 1, "integer"); } if (Tcl_GetInt(interp, argv[1], &num) != TCL_OK) { return TCL_ERROR; } sprintf(buf, "%d", num+2); Tcl_AppendResult(interp, buf, NULL); return TCL_OK; } int My_SubTwoCmd(clientData, interp, argc, argv) ClientData clientData; Tcl_Interp *interp; /* Current interpreter. */ int argc; /* Number of arguments. */ char **argv; /* Argument strings. */ { int num; char buf[30]; if (argc != 2) { return Tix_ArgcError(interp, 1, argv, 1, "integer"); } if (Tcl_GetInt(interp, argv[1], &num) != TCL_OK) { return TCL_ERROR; } sprintf(buf, "%d", num-2); Tcl_AppendResult(interp, buf, NULL); return TCL_OK; }
Go to most recent revision | Compare with Previous | Blame | View Log