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