OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [c-code/] [myCmds.c] - Blame information for rev 1774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#include <tk.h>
2
#include <tix.h>
3
 
4
int
5
My_AddTwoCmd(clientData, interp, argc, argv)
6
    ClientData clientData;
7
    Tcl_Interp *interp;         /* Current interpreter. */
8
    int argc;                   /* Number of arguments. */
9
    char **argv;                /* Argument strings. */
10
{
11
    int num;
12
    char buf[30];
13
 
14
    if (argc != 2) {
15
        return Tix_ArgcError(interp, 1, argv, 1, "integer");
16
    }
17
 
18
    if (Tcl_GetInt(interp, argv[1], &num) != TCL_OK) {
19
        return TCL_ERROR;
20
    }
21
 
22
    sprintf(buf, "%d", num+2);
23
    Tcl_AppendResult(interp, buf, NULL);
24
    return TCL_OK;
25
}
26
 
27
int
28
My_SubTwoCmd(clientData, interp, argc, argv)
29
    ClientData clientData;
30
    Tcl_Interp *interp;         /* Current interpreter. */
31
    int argc;                   /* Number of arguments. */
32
    char **argv;                /* Argument strings. */
33
{
34
    int num;
35
    char buf[30];
36
 
37
    if (argc != 2) {
38
        return Tix_ArgcError(interp, 1, argv, 1, "integer");
39
    }
40
 
41
    if (Tcl_GetInt(interp, argv[1], &num) != TCL_OK) {
42
        return TCL_ERROR;
43
    }
44
 
45
    sprintf(buf, "%d", num-2);
46
    Tcl_AppendResult(interp, buf, NULL);
47
    return TCL_OK;
48
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.