3 /* $Log: barChartDriver.C,v $
4 /* Revision 1.14 1996/05/15 18:03:15 tamches
5 /* added newMetricMaxValCallbackCommand
7 * Revision 1.13 1996/01/11 01:52:53 tamches
8 * added command long2shortFocusName
10 * Revision 1.12 1996/01/10 02:25:34 tamches
11 * added --xsynch and --debug command-line options
12 * installed getMetricColorNameCommand
14 * Revision 1.11 1995/12/20 18:37:59 newhall
15 * matherr.h does not need to be included by visis
17 * Revision 1.10 1995/11/29 00:39:48 tamches
18 * now include tkTools.h, pdLogo.h
19 * Now hardcode the pdLogo
21 * Revision 1.9 1995/11/08 21:17:12 naim
22 * Adding matherr exception handler function to avoid error message when
23 * computing the "not a number" (NaN) value - naim
25 * Revision 1.8 1995/11/08 02:17:06 tamches
28 * Revision 1.7 1995/09/22 19:25:04 tamches
29 * removed warnings under g++ 2.7.0
31 * Revision 1.6 1995/08/06 22:11:13 tamches
32 * barChart now uses tcl2c.
33 * Now needs no command-line args.
35 * Revision 1.5 1995/07/06 18:55:31 tamches
36 * Now contains a main program suitable for tk4.0
38 * Revision 1.4 1994/10/13 00:52:36 tamches
39 * Minor additions to support a new command related to sorting
42 * Revision 1.3 1994/10/10 23:08:43 tamches
43 * preliminary changes on the way to swapping the x and y axes
45 * Revision 1.2 1994/09/29 20:05:36 tamches
48 * Revision 1.1 1994/09/29 19:50:51 tamches
49 * initial implementation.
50 * entrypoint for barchart C++ program. we create new tcl
51 * commands (which will eventually call back to barChartTcl.C
52 * and from there barChart.C) and then launch barChart.tcl.
65 #include "paradyn/xbm/logo.xbm"
68 #include "barChartTcl.h"
70 void panic(const char *msg) {
75 Tcl_Interp *MainInterp = NULL; // needed by Dg
76 bool xsynchFlag = false;
78 int main(int argc, char **argv) {
79 // Loop through the arguments:
80 for (argc--, argv++; argc > 0; argc--, argv++) {
81 if (0==strcmp(*argv, "--xsynch"))
83 else if (0==strcmp(*argv, "--debug")) {
85 cout << "barChart pid " << getpid() << " at sigpause..." << endl;
89 cerr << "barChart: unrecognized argument \"" << *argv << "\"" << endl;
94 // barChart no longer requires any arguments, thanks to tcl2c.
96 panic("barChart: argc should be 1");
98 MainInterp = Tcl_CreateInterp();
101 Tk_Window mainTkWindow = Tk_CreateMainWindow(MainInterp, NULL,
104 if (mainTkWindow == NULL)
105 tclpanic(MainInterp, "Could not Tk_CreateMainWindow()");
107 if (TCL_OK != Tcl_Init(MainInterp))
108 tclpanic(MainInterp, "Could not Tcl_Init()");
110 if (TCL_OK != Tk_Init(MainInterp))
111 tclpanic(MainInterp, "Could not Tk_Init");
113 if (TCL_OK != Dg2_Init(MainInterp))
114 tclpanic(MainInterp, "Could not Dg2_Init()");
116 Tcl_SetVar(MainInterp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
118 // Install our new tcl commands
119 Tcl_CreateCommand(MainInterp, "resizeCallback", resizeCallbackCommand,
123 Tcl_CreateCommand(MainInterp, "exposeCallback", exposeCallbackCommand,
127 Tcl_CreateCommand(MainInterp, "resourcesAxisHasChanged",
128 resourcesAxisHasChangedCommand,
132 Tcl_CreateCommand(MainInterp, "metricsAxisHasChanged", metricsAxisHasChangedCommand,
136 Tcl_CreateCommand(MainInterp, "newScrollPosition", newScrollPositionCommand,
140 Tcl_CreateCommand(MainInterp, "dataFormatHasChanged", dataFormatHasChangedCommand,
144 Tcl_CreateCommand(MainInterp, "rethinkIndirectResourcesCallback",
145 rethinkIndirectResourcesCommand,
149 Tcl_CreateCommand(MainInterp, "getMetricColorName",
150 getMetricColorNameCommand,
154 Tcl_CreateCommand(MainInterp, "long2shortFocusName", long2shortFocusNameCommand,
158 Tcl_CreateCommand(MainInterp, "newMetricMaxValCallback", newMetricMaxValCallbackCommand,
162 Tcl_CreateCommand(MainInterp, "launchBarChart", launchBarChartCommand,
164 deleteLaunchBarChartCommand);
166 // Krishna's tcl2c stuff gets loaded here:
167 // (initialize_tcl_sources() was auto-generated by 'tcl2c')
168 extern int initialize_tcl_sources(Tcl_Interp *);
169 if (TCL_OK != initialize_tcl_sources(MainInterp))
170 tclpanic(MainInterp, "barChart: could not initialize_tcl_sources");
172 //if (TCL_OK != Tcl_EvalFile(MainInterp, "/p/paradyn/development/tamches/core/visiClients/barchart/barChart.tcl"))
173 // tclpanic(MainInterp, "could not source barChart.tcl manually");
175 pdLogo::install_fixed_logo("paradynLogo", logo_bits, logo_width, logo_height);
176 tcl_cmd_installer createPdLogo(MainInterp, "makeLogo",
177 pdLogo::makeLogoCommand,
178 (ClientData)mainTkWindow);
180 myTclEval(MainInterp, "init_barchart_window");
181 myTclEval(MainInterp, "Initialize");
183 Tk_MainLoop(); // returns when all tk windows are closed
185 // shouldn't we be doing some cleanup here?