X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/6a5fa4e03967ab980cdc7ef96a42400bc29b4414..176c45720f3b9e5555fe1084d3e6ea59488c1785:/src/sim/w_graph.c?ds=sidebyside diff --git a/src/sim/w_graph.c b/src/sim/w_graph.c index 950799f..cd04d12 100644 --- a/src/sim/w_graph.c +++ b/src/sim/w_graph.c @@ -71,6 +71,11 @@ short Graph10Max, Graph120Max; Tcl_HashTable GraphCmds; int GraphUpdateTime = 100; +void DoUpdateGraph(SimGraph *graph); +void DoNewGraph(SimGraph *graph); +void DoResizeGraph(SimGraph *graph, int w, int h); +void InitNewGraph(SimGraph *graph); + #define DEF_GRAPH_FONT "-Adobe-Helvetica-Bold-R-Normal-*-140-*" #define DEF_GRAPH_BG_COLOR "#b0b0b0" @@ -96,7 +101,7 @@ Tk_ConfigSpec GraphConfigSpecs[] = { }; -XDisplay *FindXDisplay(); +extern XDisplay *FindXDisplay(Tk_Window tkwin); static void @@ -104,8 +109,6 @@ DisplaySimGraph(ClientData clientData) { SimGraph *graph = (SimGraph *) clientData; Tk_Window tkwin = graph->tkwin; - Pixmap pm = None; - Drawable d; graph->flags &= ~VIEW_REDRAW_PENDING; @@ -133,6 +136,7 @@ DestroySimGraph(ClientData clientData) } +void EventuallyRedrawGraph(SimGraph *graph) { if (!(graph->flags & VIEW_REDRAW_PENDING)) { @@ -209,8 +213,6 @@ int GraphCmdconfigure(GRAPH_ARGS) int GraphCmdposition(GRAPH_ARGS) { - int result = TCL_OK; - if ((argc != 2) && (argc != 4)) { return TCL_ERROR; } @@ -330,14 +332,14 @@ DoGraphCmd(CLIENT_ARGS) SimGraph *graph = (SimGraph *) clientData; Tcl_HashEntry *ent; int result = TCL_OK; - int (*cmd)(); + int (*cmd)(SimGraph*, Tcl_Interp*, int, char**); if (argc < 2) { return TCL_ERROR; } - if (ent = Tcl_FindHashEntry(&GraphCmds, argv[1])) { - cmd = (int (*)())ent->clientData; + if ((ent = Tcl_FindHashEntry(&GraphCmds, argv[1]))) { + cmd = (int (*)(SimGraph*, Tcl_Interp*, int, char**))ent->clientData; Tk_Preserve((ClientData) graph); result = cmd(graph, interp, argc, argv); Tk_Release((ClientData) graph); @@ -381,7 +383,7 @@ GraphViewCmd(CLIENT_ARGS) StructureNotifyMask, SimGraphEventProc, (ClientData) graph); Tcl_CreateCommand(interp, Tk_PathName(graph->tkwin), - DoGraphCmd, (ClientData) graph, (void (*)()) NULL); + DoGraphCmd, (ClientData) graph, (void (*)(int *)) NULL); /* Tk_MakeWindowExist(graph->tkwin); @@ -434,12 +436,11 @@ unsigned char HistColor[] = { }; -graph_command_init() +void +graph_command_init(void) { - int new; - Tcl_CreateCommand(tk_mainInterp, "graphview", GraphViewCmd, - (ClientData)MainWindow, (void (*)()) NULL); + (ClientData)MainWindow, (void (*)(int *)) NULL); Tcl_InitHashTable(&GraphCmds, TCL_STRING_KEYS); @@ -568,9 +569,10 @@ initGraphs(void) /* comefrom: InitWillStuff */ +void InitGraphMax(void) { - register x; + register int x; ResHisMax = 0; ComHisMax = 0; @@ -604,11 +606,9 @@ InitGraphMax(void) } +void InitNewGraph(SimGraph *graph) { - int d = 8; - struct XDisplay *xd; - graph->next = NULL; graph->range = 10; graph->mask = ALL_HISTORIES; @@ -641,6 +641,7 @@ InitNewGraph(SimGraph *graph) } +void DestroyGraph(SimGraph *graph) { SimGraph **gp; @@ -666,10 +667,9 @@ DestroyGraph(SimGraph *graph) } +void DoResizeGraph(SimGraph *graph, int w, int h) { - int resize = 0; - graph->w_width = w; graph->w_height = h; if (graph->pixmap != None) { @@ -688,6 +688,7 @@ DoResizeGraph(SimGraph *graph, int w, int h) } +void DoNewGraph(SimGraph *graph) { sim->graphs++; graph->next = sim->graph; sim->graph = graph; @@ -698,6 +699,7 @@ DoNewGraph(SimGraph *graph) #define BORDER 5 +void DoUpdateGraph(SimGraph *graph) { Display *dpy;