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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [demos/] [c-code/] [tixAppInit.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
/*
2
 * myAppInit.c --
3
 *
4
 *      This is a demo program that shows how to link your C programs
5
 *      with Tcl/Tk/Tix.
6
 *
7
 *      The program created in this directory is a demo program
8
 *      called "myapp". You can modify the files in this directory
9
 *      to use in your applications.
10
 *
11
 * Copyright (c) 1996, Expert Interface Technologies
12
 *
13
 * See the file "license.terms" for information on usage and redistribution
14
 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15
 *
16
 */
17
 
18
#include <tk.h>
19
#include <tix.h>
20
 
21
/*
22
 * The following variable is a special hack that is needed in order for
23
 * Sun shared libraries to be used for Tcl.
24
 */
25
 
26
extern int matherr();
27
int *tclDummyMathPtr = (int *) matherr;
28
 
29
 
30
/*
31
 *----------------------------------------------------------------------
32
 *
33
 * main --
34
 *
35
 *      This is the main program for the application.
36
 *
37
 * Results:
38
 *      None: Tk_Main never returns here, so this procedure never
39
 *      returns either.
40
 *
41
 * Side effects:
42
 *      Whatever the application does.
43
 *
44
 *----------------------------------------------------------------------
45
 */
46
 
47
int
48
main(argc, argv)
49
    int argc;                   /* Number of command-line arguments. */
50
    char **argv;                /* Values of command-line arguments. */
51
{
52
    Tk_Main(argc, argv, Tcl_AppInit);
53
    return 0;                    /* Needed only to prevent compiler warning. */
54
}
55
 
56
/*
57
 *----------------------------------------------------------------------
58
 *
59
 * Tcl_AppInit --
60
 *
61
 *      This procedure performs application-specific initialization.
62
 *      Most applications, especially those that incorporate additional
63
 *      packages, will have their own version of this procedure.
64
 *
65
 * Results:
66
 *      Returns a standard Tcl completion code, and leaves an error
67
 *      message in interp->result if an error occurs.
68
 *
69
 * Side effects:
70
 *      Depends on the startup script.
71
 *
72
 *----------------------------------------------------------------------
73
 */
74
 
75
int
76
Tcl_AppInit(interp)
77
    Tcl_Interp *interp;         /* Interpreter for application. */
78
{
79
    /* Initialize the Tcl, Tk and Tix packages (in this order) */
80
 
81
    if (Tcl_Init(interp) != TCL_OK) {
82
        return TCL_ERROR;
83
    }
84
    if (Tk_Init(interp) != TCL_OK) {
85
        return TCL_ERROR;
86
    }
87
    if (Tix_Init(interp) != TCL_OK) {
88
        return TCL_ERROR;
89
    }
90
 
91
    /*
92
     * If you want to use other packages, call their initialization
93
     * procedures here. Each call should look like this:
94
     *
95
     * if (Mod_Init(interp) != TCL_OK) {
96
     *     return TCL_ERROR;
97
     * }
98
     *
99
     * where "Mod" is the name of the module.
100
     *
101
     * For example, the intialization procedure for the BLT package is
102
     * BLT_Init().
103
     */
104
 
105
 
106
 
107
    /*
108
     * Call My_Init() to do application specific initialization.
109
     */
110
 
111
    if (My_Init(interp) != TCL_OK) {
112
        return TCL_ERROR;
113
    }
114
 
115
    /*
116
     * Specify a user-specific startup file to invoke
117
     */
118
 
119
    Tix_SetRcFileName(interp, "my");
120
 
121
    return TCL_OK;
122
}

powered by: WebSVN 2.1.0

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