2 // Created: Thu Dec 30 10:40:46 1999
4 // <rln@burnax.nnov.matra-dtv.fr>
6 // *******************************************************************
8 // *******************************************************************
9 // This file is built from former NTMain.pxx duplicated in many executables
10 // extending DRAW Test Harness.
11 // Now is implemented only in one instance.
13 // Differences between CAS.CADE versions:
14 // - in C21 Draw_Appli is defined in Draw.cxx (DRAW UL) and calls externally
15 // defined Draw_InitAppli. Moreover, on WNT Draw_Appli was not declared as
16 // Standard_EXPORT and therefore it has to be duplicated explicitly in this
17 // code as in Draw.cxx.
18 // - in C30 Draw_Appli accepts Draw_InitAppli as parameter which is given to
19 // it in each executable. Draw_Appli is declared as Standard_EXPORT and
20 // therefore it needs not to be duplicated.
22 // To have only one instance of this file and to call it from all the executables
23 // thereare defined macros in .hxx that replace main/WinMain functions and which
24 // calls _main_/_WinMain_ defined in this file with specified Draw_InitAppli.
25 // To avoid Unresolved symbols on WNT, Draw_InitAppli is explicitly defined in this
26 // file as simple invoker of the function statically stored in this file and which
27 // is initialized by main/_WinMain_.
29 // WARNING: Although versions C21 and C30 are synchronised as much as they can,
30 // there are two versions of this file for both configurations. This is explained by:
31 // - Standard_IMPOR is differently defined,
32 // - Draw_Appli is differently declared.
45 #include <windows.h> /* SW_SHOW */
48 #include <Draw_Main.hxx>
51 #include <Draw_Appli.hxx>
58 #include <Draw_Window.hxx>
64 extern Draw_Viewer dout;
66 static char* ColorNames[MAXCOLOR] = {
67 "White","Red","Green","Blue","Cyan","Gold","Magenta",
68 "Maroon","Orange","Pink","Salmon","Violet","Yellow","Khaki","Coral"
71 static Standard_Boolean XLoop;
73 // extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
74 Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C30
75 // true if complete command
77 // necessary for WNT in C21 only
78 static FDraw_InitAppli theDraw_InitAppli; //pointer to the Draw_InitAppli
79 static void Draw_InitAppli(Draw_Interpretor& theCommands)
81 theDraw_InitAppli (theCommands);
86 //=======================================================================
88 // On Windows NT, both console (UNIX-like) and windowed (classical on
89 // WNT, with three separated windows - input, output and graphic)
90 // modes are supported.
91 // Depending on compilation mode of executable (CONSOLE or WINDOWS),
92 // either _main_ or _WinMain_ becomes entry point;
93 // the further different behaviour of DRAW is determined by variable
94 // Draw_IsConsoleSubsystem which is set by _main_ only
95 //=======================================================================
98 extern Standard_Boolean Draw_IsConsoleSubsystem;
100 //=======================================================================
103 //=======================================================================
105 Standard_Integer _main_ (int argc, char* argv[], char* envp[], const FDraw_InitAppli fDraw_InitAppli)
107 Draw_IsConsoleSubsystem = Standard_True;
108 //return _WinMain_(::GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW, fDraw_InitAppli);
109 theDraw_InitAppli = fDraw_InitAppli;
110 Standard_Boolean CONSOLE = Standard_True;
111 //ParseCommandLine(GetCommandLine());
114 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
115 Tcl_FindExecutable(argv[0]);
118 Draw_Appli(::GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW, fDraw_InitAppli);
123 //=======================================================================
124 //function : _WinMain_
126 //=======================================================================
128 Standard_Integer _WinMain_ (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpCmdLine, int nCmdShow, const FDraw_InitAppli fDraw_InitAppli)
130 // theDraw_InitAppli = fDraw_InitAppli;
131 // ParseCommandLine (lpCmdLine);
132 // Draw_Appli(hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli); // for C30;
136 //=======================================================================
139 //=======================================================================
141 Standard_Integer _main_ (Standard_Integer argc, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
144 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
145 Tcl_FindExecutable(argv[0]);
147 Draw_Appli(argc, argv, fDraw_InitAppli);