minor cvs fixes
[dyninst.git] / visiClients / barchart / src / barChartDriver.C
1 // barChartDriver.C
2
3 /* $Log: barChartDriver.C,v $
4 /* Revision 1.2  1994/09/29 20:05:36  tamches
5 /* minor cvs fixes
6 /*
7  * Revision 1.1  1994/09/29  19:50:51  tamches
8  * initial implementation.
9  * entrypoint for barchart C++ program.  we create new tcl
10  * commands (which will eventually call back to barChartTcl.C
11  * and from there barChart.C) and then launch barChart.tcl.
12  *
13 */
14
15 #include <stdlib.h>
16 #include <iostream.h>
17
18 #include <tcl.h>
19 #include <tk.h>
20 #include "dg2.h"
21 #include "barChartTcl.h"
22
23 void panic(char *msg) {
24    cerr << msg << endl;
25    exit(5);
26 }
27
28 extern "C" {
29    int Blt_Init(Tcl_Interp *);
30 }
31
32 Tcl_Interp *MainInterp;
33
34 int Tcl_AppInit(Tcl_Interp *interp) {
35    // tk library's main() will call this routine for us.  We must perform all
36    // needed initializations here...
37
38    MainInterp = interp; // needed by Dg
39
40    if (TCL_ERROR == Tcl_Init(interp))
41       return TCL_ERROR;
42
43    if (TCL_ERROR == Tk_Init(interp))
44       return TCL_ERROR;
45
46 //   if (TCL_ERROR == Blt_Init(interp))
47 //      // for blt_drag n' drop
48 //      return TCL_ERROR;
49
50    if (TCL_ERROR == Dg2_Init(interp))
51       // installs lots of tcl and C++ callbacks
52       return TCL_ERROR;
53
54    tcl_RcFileName = "~/.wishrc";
55
56    // Install our new tcl commands
57    Tcl_CreateCommand(interp, "resizeCallback", resizeCallbackCommand,
58                      NULL, // ClientData
59                      deleteDummyProc);
60
61    Tcl_CreateCommand(interp, "exposeCallback", exposeCallbackCommand,
62                      NULL, // ClientData
63                      deleteDummyProc);
64
65    Tcl_CreateCommand(interp, "xAxisHasChanged", xAxisHasChangedCommand,
66                      NULL, // ClientData
67                      deleteDummyProc);
68
69    Tcl_CreateCommand(interp, "yAxisHasChanged", yAxisHasChangedCommand,
70                      NULL, // ClientData
71                      deleteDummyProc);
72
73    Tcl_CreateCommand(interp, "newScrollPosition", newScrollPositionCommand,
74                      NULL, // ClientData
75                      deleteDummyProc);
76
77    Tcl_CreateCommand(interp, "dataFormatHasChanged", dataFormatHasChangedCommand,
78                      NULL, // ClientData
79                      deleteDummyProc);
80
81    Tcl_CreateCommand(interp, "launchBarChart", launchBarChartCommand,
82                      NULL, // ClientData
83                      deleteLaunchBarChartCommand);
84
85    return TCL_OK;
86 }
87
88 // we use main() from the tk library, which is rigged to call
89 // int Tcl_AppInit(Tcl_Interp *) which gives us a change to install
90 // new tcl commands.
91
92 extern int main(int argc, char **argv);
93 int (*dummy)(int, char**) = main; // make use of main() to ensure it gets linked in...