/***********************************************************************/ /* Open Visualization Data Explorer */ /* (C) Copyright IBM Corp. 1989,1999 */ /* ALL RIGHTS RESERVED */ /* This code licensed under the */ /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ /***********************************************************************/ #include #include "defines.h" #include "DXApplication.h" #ifdef DXD_WINSOCK_SOCKETS //SMH must initialize Win Sockets #define _WINSPOOL_ //SMH prevent name clash from uneeded included inlcudes #include #endif #ifdef DXD_IBM_OS2_SOCKETS #include #endif #include #if USE_PROFILING_ON_ALPHA #ifdef alphax // for monitoring software extern "C" { extern void __start(); extern unsigned long _etext; } #include #include #endif #endif #ifdef DXD_WIN #include #include /* Motif Toolkit */ #include /* Mrm */ #ifdef _X86_ #include /* HCL - exit prototype */ #include /* HCL - HCLXmInit prototype */ #endif #endif // // Used by the assert macro. // const char *AssertMsgString = "Internal error detected at \"%s\":%d.\n"; void main(unsigned int argc, char** argv) { #ifdef DXD_WIN #ifdef _X86_ HCLXmInit(); #endif #endif #ifdef DXD_WINSOCK_SOCKETS //SMH initialize Win Sockets { WSADATA *wsadata = new WSADATA; WSAStartup(MAKEWORD(1,1),wsadata); delete wsadata; } #endif #ifdef DXD_IBM_OS2_SOCKETS sock_init(); #endif #if USE_PROFILING_ON_ALPHA // // For machines with built-in profiling. This mechanim profiles everything // in the executable except shared libs. (That's everything between __start // and _etext. Smaller ranges are possible by using other names.) // Invoking moncontrol(0) / moncontrol(1) provides a mechanism to start and stop // profiling -- you could add a menubar button for engineers only in order // to profile a chunk of code, or you could shut of profiling after startup. // // The PROFDIR env variable is a directory name to hold the results. It is used // by the monitoring software, not by dx. // #ifdef alphax boolean profiling_on = FALSE; char *pdir = (char *)getenv ("PROFDIR"); if ((pdir)&&(pdir[0])) { if (monstartup ((caddr_t)__start, (caddr_t)&_etext)==-1) { perror("monstartup"); } else { profiling_on = TRUE; } } #endif #endif // // Initialize Xt Intrinsics, build all the windows, and enter event loop. // Note that all the windows are created elsewhere (App.C), // and managed in the application initialization routine. // if (NOT theApplication) { theApplication = new DXApplication("DX"); } // add *tearOffModel:: XmTEAR_OFF_ENABLED/XmTEAR_OFF_DISABLED XmRepTypeInstallTearOffModelConverter(); if (!theApplication->initialize(&argc, argv)) exit(1); theApplication->handleEvents(); // // This is a very nasty hack for SunOS 4.1 when displaying on a display // other than the console (e.g. ibm6000). When exiting, if the application // is deleted, we get a core dump. I haven't verified that the problem // goes away with X11R4, but want to make us try and deal with this then. // #if !defined(sun4) || (defined(XlibSpecificationRelease) && XlibSpecificationRelease > 4) delete theApplication; #endif #if USE_PROFILING_ON_ALPHA #ifdef alphax if (profiling_on) { monitor(0); } #endif #endif #ifdef DXD_WINSOCK_SOCKETS //SMH cleanup Win Sockets CloseXlibConnection(); WSACleanup(); #endif exit(0); }