#ifndef lint #include "copyright.h" static char *rcs="$Header: /mit/hst/src/main/RCS/Main.c,v 2.5 90/08/28 14:51:49 tldavis Exp Locker: tldavis $"; #endif /************* * $Source: /mit/hst/src/main/RCS/Main.c,v $ * Cardiovascular Simulator * Copyright 1990 Timothy L. Davis * * This routine gets the show on the road by installing the * parameter and patient databases, and creating an instance of the * user interface. * The main control loop is contained in * ../event/Event.c:DispatchDataAndEvents(). * $Log: Main.c,v $ * Revision 2.5 90/08/28 14:51:49 tldavis * linted. * * Revision 2.3 90/08/18 18:46:57 tldavis * General cleanup, using X11R4-style setup. * * Revision 2.2 90/08/10 10:31:43 dot * R4 updates; Xaw includes are now in X11/Xaw * * Revision 2.1 90/08/07 16:19:13 tldavis * Removing unused vars & functions from compilation. * * Revision 2.0 90/08/06 17:56:19 tldavis * Final X11R3 version. * * Revision 1.7 90/08/06 17:07:09 tldavis * Aded some optional color code from Dr. Samn. * * Revision 1.6 90/05/31 16:56:10 tldavis * Pre-ACIS checkin. * * Revision 1.5 89/06/28 11:52:51 tldavis * X11R3 Version, no baroreceptor yet. * * Revision 1.4 88/10/11 01:55:04 hst * removed DEBUG flag. * * Revision 1.3 88/10/10 01:29:02 tldavis * Fixed lots of bugs. A few remain(on paper). * * Revision 1.2 88/10/05 11:18:55 tldavis * Made button box pop-up. Need to fix hints to place on screen. * * Revision 1.1 88/10/04 10:44:16 tldavis * Initial revision * ****************/ /* For Dr. Samn; should be included by Intrinsic.h anyway. */ #include #include #include /* End of includes for Dr. Samn */ #include #include #include #include #ifdef SVR4 #include #else #include #endif #include "../event/Event.h" #include "../plot/Plot.h" #include "../nl/NumberLine.h" #include "Interface.h" #include "../sim/CVDefs.h" #include "../data/Parameter.h" extern char *getenv(); extern void ReflexesOff(); /*PUBLIC*/ char *CVLib; /* location of library files */ /*PUBLIC*/ Display *dpy; int screen; Window root; /*PUBLIC*/ unsigned long white_pixel, black_pixel, border_pixel; main(argc, argv) int argc; char **argv; { Arg args[10]; int i; char buf[256]; #ifndef XAW_BC XrmOptionDescRec options[2]; XtAppContext app_context; #else Widget shell; #endif if (!(CVLib = getenv("CVLIB"))) CVLib = "/usr/local/lib/cvsim"; sprintf(buf, "%s/parameter.db",CVLib); LoadParameterData(buf); ReflexesOff(); setsimulation(); #ifdef DEBUG printf("XtAppInitialize...\n"); #endif #ifdef XAW_BC shell = XtInitialize(argv[0],"CVsim", (XrmOptionDescRec *)NULL, (Cardinal)0, (Cardinal *)&argc, (String *)argv); dpy = XtDisplay(shell); #else XtToolkitInitialize(); app_context = XtCreateApplicationContext(); dpy = XtOpenDisplay(app_context, (String)NULL, (String)NULL, "CVsim", options, (Cardinal)0, (Cardinal *)&argc, (String *)argv); #endif screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); white_pixel = WhitePixel(dpy, screen); black_pixel = BlackPixel(dpy, screen); #ifdef DEBUG XSynchronize(dpy, 1); /* makes it slow but easier for bug tracking */ printf("Creating Widgets...\n"); #endif i=0; InterfaceCreate((Widget)0, args, i); MakeSimulator(getsimulation(NORMAL),(double)0.0); DispatchDataAndEvents(); /* should never return */ }