// dg2.C // customized (for barchart) version of DGclient.C in tclVisi directory /* $Log: dg2.C,v $ /* Revision 1.13 1996/01/10 21:11:15 tamches /* added METRICAVEUNITS, METRICSUMUNITS /* * Revision 1.12 1995/11/29 00:40:07 tamches * removed myTclEval * * Revision 1.11 1995/11/17 17:39:32 newhall * changed Dg start command, and call to GetMetsRes * * Revision 1.10 1995/11/17 17:32:27 newhall * changed Dg start command to take no arguments, replaced call to MetricUnits * with call to MetricLabel * * Revision 1.9 1995/09/22 19:23:41 tamches * removed warnings under g++ 2.7.0 * * Revision 1.8 1995/08/06 22:11:48 tamches * removed some warnings by using myTclEval * * Revision 1.7 1995/02/26 02:01:48 newhall * added callback functions for new visiLib phase info. * * Revision 1.6 1994/11/06 10:24:04 tamches * minor cleanups (especially commenting) * * Revision 1.5 1994/10/11 21:59:47 tamches * Removed extra StartVisi() bug. * Implemented dataGrid[][].Enabled() * * Revision 1.4 1994/10/10 23:08:47 tamches * preliminary changes on the way to swapping the x and y axes * * Revision 1.3 1994/10/10 14:36:18 tamches * fixed some resizing bugs * * Revision 1.2 1994/09/29 20:05:39 tamches * minor cvs fixes * * Revision 1.1 1994/09/29 19:52:25 tamches * initial implementation. * This is a modified version of DGclient.C (tclVisi/src), specially * tuned for the barchart program. * */ // An updated version of DGClient.C for barchart2.C // Contains several **deletions** to remove blt_barchart influences #include // exit() #include #include "tcl.h" #include "tk.h" #include "tkTools.h" // myTclEval() #include "dg2.h" #include "visi/h/visualization.h" #include "barChartTcl.h" #include "barChart.h" void my_visi_callback(void*, int*, long unsigned int*) { if (visi_callback() == -1) exit(0); } int Dg2AddMetricsCallback(int) { myTclEval(MainInterp, "DgConfigCallback"); // if necessary, the tcl program will call xAxisHasChanged and/or // yAxisHasChanged, which are commands we implement in barChart.C. // We take action then. return TCL_OK; } int Dg2Fold(int) { myTclEval(MainInterp, "DgFoldCallback"); return TCL_OK; } int Dg2InvalidMetricsOrResources(int) { myTclEval(MainInterp, "DgInvalidCallback"); return TCL_OK; } int Dg2PhaseNameCallback(int) { myTclEval(MainInterp, "DgPhaseCallback"); return TCL_OK; } #define AGGREGATE 0 #define BINWIDTH 1 #define FOLDMETHOD 2 #define METRICNAME 3 #define METRICUNITS 4 #define METRICAVEUNITS 5 #define METRICSUMUNITS 6 #define NUMBINS 7 #define NUMMETRICS 8 #define NUMRESOURCES 9 #define DEFINEPHASE 10 #define RESOURCENAME 11 #define STARTSTREAM 12 #define STOPSTREAM 13 #define DGSUM 14 #define DGVALID 15 #define DGENABLED 16 #define VALUE 17 #define CMDERROR 18 #define LASTBUCKET 19 #define FIRSTBUCKET 20 struct cmdTabEntry { const char *cmdname; int index; int numargs; }; static struct cmdTabEntry Dg_Cmds[] = { {"aggregate", AGGREGATE, 2}, {"binwidth", BINWIDTH, 0}, {"firstbucket", FIRSTBUCKET, 2}, {"foldmethod", FOLDMETHOD, 2}, {"lastbucket", LASTBUCKET, 2}, {"metricname", METRICNAME, 1}, {"metricunits", METRICUNITS, 1}, {"metricaveunits", METRICAVEUNITS,1}, {"metricsumunits", METRICSUMUNITS,1}, {"numbins", NUMBINS, 0}, {"nummetrics", NUMMETRICS, 0}, {"numresources", NUMRESOURCES, 0}, {"phase", DEFINEPHASE, 3}, {"resourcename", RESOURCENAME, 1}, {"start", STARTSTREAM, 0}, {"stop", STOPSTREAM, 2}, {"sum", DGSUM, 2}, {"valid", DGVALID, 2}, {"enabled", DGENABLED, 2}, {"value", VALUE, 3}, {NULL, CMDERROR, 0} }; int findCommand(Tcl_Interp *interp, int argc, char *argv[]) { if (argc == 0) { sprintf(interp->result, "USAGE: Dg