first version of phaseTable
[dyninst.git] / visiClients / phaseTable / src / main.C
1 /*
2  * $Log: main.C,v $
3  * Revision 1.1  1995/12/15 22:01:54  tamches
4  * first version of phaseTable
5  *
6  */
7
8 #include <stdio.h>
9 #include <signal.h>
10
11 #include "tclclean.h"
12 #include "tkclean.h"
13 #include "tkTools.h"
14
15 #include "pdLogo.h"
16 #include "paradyn/xbm/logo.xbm"
17
18 #include "util/h/matherr.h"
19
20 extern Dg_Init(Tcl_Interp *interp);
21
22 Tcl_Interp *MainInterp;
23
24 int app_init() {
25     Tk_Window main = Tk_MainWindow(MainInterp);
26
27     if (Dg_Init(MainInterp) == TCL_ERROR)
28         return TCL_ERROR;
29
30     if (Tcl_Init(MainInterp) == TCL_ERROR)
31         return TCL_ERROR;
32
33     if (Tk_Init(MainInterp) == TCL_ERROR)
34         return TCL_ERROR;
35
36     tcl_RcFileName = "~/.wishrc";
37
38     // now install "makeLogo", etc:
39     pdLogo::install_fixed_logo("paradynLogo", logo_bits, logo_width,
40                                logo_height);
41     tcl_cmd_installer createPdLogo(MainInterp, "makeLogo", pdLogo::makeLogoCommand,
42                                    (ClientData)main);
43
44     // now initialize_tcl_sources created by tcl2c:
45     extern int initialize_tcl_sources(Tcl_Interp *);
46     if (TCL_OK != initialize_tcl_sources(MainInterp))
47        tclpanic(MainInterp, "phaseTable: could not initialize_tcl_sources");
48     
49     return TCL_OK;
50 }
51
52 int main(int, char **) {
53    MainInterp = Tcl_CreateInterp();
54    assert(MainInterp);
55
56    Tk_Window mainTkWindow = Tk_CreateMainWindow(MainInterp, NULL,
57                                                 "phaseTable",
58                                                 "PhaseTable");
59    if (mainTkWindow == NULL)
60       tclpanic(MainInterp, "phaseTable: could not Tk_CreateMainWindow");
61
62    if (TCL_OK != app_init()) // formerly Tcl_AppInit()
63       tclpanic(MainInterp, "PhaseTable: app_init() failed");
64
65    Tk_MainLoop(); // returns when all tk windows are closed
66 }
67