3 /* $Log: barChartDriver.C,v $
4 /* Revision 1.12 1996/01/10 02:25:34 tamches
5 /* added --xsynch and --debug command-line options
6 /* installed getMetricColorNameCommand
8 * Revision 1.11 1995/12/20 18:37:59 newhall
9 * matherr.h does not need to be included by visis
11 * Revision 1.10 1995/11/29 00:39:48 tamches
12 * now include tkTools.h, pdLogo.h
13 * Now hardcode the pdLogo
15 * Revision 1.9 1995/11/08 21:17:12 naim
16 * Adding matherr exception handler function to avoid error message when
17 * computing the "not a number" (NaN) value - naim
19 * Revision 1.8 1995/11/08 02:17:06 tamches
22 * Revision 1.7 1995/09/22 19:25:04 tamches
23 * removed warnings under g++ 2.7.0
25 * Revision 1.6 1995/08/06 22:11:13 tamches
26 * barChart now uses tcl2c.
27 * Now needs no command-line args.
29 * Revision 1.5 1995/07/06 18:55:31 tamches
30 * Now contains a main program suitable for tk4.0
32 * Revision 1.4 1994/10/13 00:52:36 tamches
33 * Minor additions to support a new command related to sorting
36 * Revision 1.3 1994/10/10 23:08:43 tamches
37 * preliminary changes on the way to swapping the x and y axes
39 * Revision 1.2 1994/09/29 20:05:36 tamches
42 * Revision 1.1 1994/09/29 19:50:51 tamches
43 * initial implementation.
44 * entrypoint for barchart C++ program. we create new tcl
45 * commands (which will eventually call back to barChartTcl.C
46 * and from there barChart.C) and then launch barChart.tcl.
59 #include "paradyn/xbm/logo.xbm"
62 #include "barChartTcl.h"
64 void panic(const char *msg) {
69 Tcl_Interp *MainInterp = NULL; // needed by Dg
70 bool xsynchFlag = false;
72 int main(int argc, char **argv) {
73 // Loop through the arguments:
74 for (argc--, argv++; argc > 0; argc--, argv++) {
75 if (0==strcmp(*argv, "--xsynch"))
77 else if (0==strcmp(*argv, "--debug")) {
79 cout << "barChart pid " << getpid() << " at sigpause..." << endl;
83 cerr << "barChart: unrecognized argument \"" << *argv << "\"" << endl;
88 // barChart no longer requires any arguments, thanks to tcl2c.
90 panic("barChart: argc should be 1");
92 MainInterp = Tcl_CreateInterp();
95 Tk_Window mainTkWindow = Tk_CreateMainWindow(MainInterp, NULL,
98 if (mainTkWindow == NULL)
99 tclpanic(MainInterp, "Could not Tk_CreateMainWindow()");
101 if (TCL_OK != Tcl_Init(MainInterp))
102 tclpanic(MainInterp, "Could not Tcl_Init()");
104 if (TCL_OK != Tk_Init(MainInterp))
105 tclpanic(MainInterp, "Could not Tk_Init");
107 if (TCL_OK != Dg2_Init(MainInterp))
108 tclpanic(MainInterp, "Could not Dg2_Init()");
110 Tcl_SetVar(MainInterp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
112 // Install our new tcl commands
113 Tcl_CreateCommand(MainInterp, "resizeCallback", resizeCallbackCommand,
117 Tcl_CreateCommand(MainInterp, "exposeCallback", exposeCallbackCommand,
121 Tcl_CreateCommand(MainInterp, "resourcesAxisHasChanged",
122 resourcesAxisHasChangedCommand,
126 Tcl_CreateCommand(MainInterp, "metricsAxisHasChanged", metricsAxisHasChangedCommand,
130 Tcl_CreateCommand(MainInterp, "newScrollPosition", newScrollPositionCommand,
134 Tcl_CreateCommand(MainInterp, "dataFormatHasChanged", dataFormatHasChangedCommand,
138 Tcl_CreateCommand(MainInterp, "rethinkIndirectResourcesCallback",
139 rethinkIndirectResourcesCommand,
143 Tcl_CreateCommand(MainInterp, "getMetricColorName",
144 getMetricColorNameCommand,
148 Tcl_CreateCommand(MainInterp, "launchBarChart", launchBarChartCommand,
150 deleteLaunchBarChartCommand);
152 // Krishna's tcl2c stuff gets loaded here:
153 // (initialize_tcl_sources() was auto-generated by 'tcl2c')
154 extern int initialize_tcl_sources(Tcl_Interp *);
155 if (TCL_OK != initialize_tcl_sources(MainInterp))
156 tclpanic(MainInterp, "barChart: could not initialize_tcl_sources");
158 //if (TCL_OK != Tcl_EvalFile(MainInterp, "/p/paradyn/development/tamches/core/visiClients/barchart/barChart.tcl"))
159 // tclpanic(MainInterp, "could not source barChart.tcl manually");
161 pdLogo::install_fixed_logo("paradynLogo", logo_bits, logo_width, logo_height);
162 tcl_cmd_installer createPdLogo(MainInterp, "makeLogo",
163 pdLogo::makeLogoCommand,
164 (ClientData)mainTkWindow);
166 myTclEval(MainInterp, "init_barchart_window");
167 myTclEval(MainInterp, "Initialize");
169 Tk_MainLoop(); // returns when all tk windows are closed
171 // shouldn't we be doing some cleanup here?