1 // Created on: 1999-12-30
2 // Created by: Roman LYGIN
3 // Copyright (c) 1999-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 // *******************************************************************
18 // RLN 06 January 2000
19 // *******************************************************************
20 // This file is built from former NTMain.pxx duplicated in many executables
21 // extending DRAW Test Harness.
22 // Now is implemented only in one instance.
24 // Differences between CAS.CADE versions:
25 // - in C21 Draw_Appli is defined in Draw.cxx (DRAW UL) and calls externally
26 // defined Draw_InitAppli. Moreover, on WNT Draw_Appli was not declared as
27 // Standard_EXPORT and therefore it has to be duplicated explicitly in this
28 // code as in Draw.cxx.
29 // - in C30 Draw_Appli accepts Draw_InitAppli as parameter which is given to
30 // it in each executable. Draw_Appli is declared as Standard_EXPORT and
31 // therefore it needs not to be duplicated.
33 // To have only one instance of this file and to call it from all the executables
34 // thereare defined macros in .hxx that replace main/WinMain functions and which
35 // calls _main_/_WinMain_ defined in this file with specified Draw_InitAppli.
36 // To avoid Unresolved symbols on WNT, Draw_InitAppli is explicitly defined in this
37 // is initialized by main/_WinMain_.
39 // WARNING: Although versions C21 and C30 are synchronised as much as they can,
40 // there are two versions of this file for both configurations. This is explained by:
41 // - Standard_IMPOR is differently defined,
42 // - 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 // extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
67 Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30
68 // true if complete command
70 // necessary for WNT in C21 only
71 static FDraw_InitAppli theDraw_InitAppli; //pointer to the Draw_InitAppli
75 //=======================================================================
77 // On Windows NT, both console (UNIX-like) and windowed (classical on
78 // WNT, with three separated windows - input, output and graphic)
79 // modes are supported.
80 // Depending on compilation mode of executable (CONSOLE or WINDOWS),
81 // either _main_ or _WinMain_ becomes entry point;
82 // the further different behaviour of DRAW is determined by variable
83 // Draw_IsConsoleSubsystem which is set by _main_ only
84 //=======================================================================
87 extern Standard_Boolean Draw_IsConsoleSubsystem;
89 //=======================================================================
92 //=======================================================================
94 Standard_Integer _main_ (int /*argc*/, char* argv[], char* /*envp*/[], const FDraw_InitAppli fDraw_InitAppli)
96 Draw_IsConsoleSubsystem = Standard_True;
97 //return _WinMain_(::GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW, fDraw_InitAppli);
98 theDraw_InitAppli = fDraw_InitAppli;
99 //ParseCommandLine(GetCommandLine());
102 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
103 Tcl_FindExecutable(argv[0]);
106 Draw_Appli(::GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW, fDraw_InitAppli);
111 //=======================================================================
112 //function : _WinMain_
114 //=======================================================================
116 Standard_Integer _WinMain_ (HINSTANCE /*hInstance*/, HINSTANCE /*hPrevinstance*/, LPSTR /*lpCmdLine*/, int /*nCmdShow*/, const FDraw_InitAppli /*fDraw_InitAppli*/)
118 // theDraw_InitAppli = fDraw_InitAppli;
119 // ParseCommandLine (lpCmdLine);
120 // Draw_Appli(hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli); // for C30;
124 //=======================================================================
127 //=======================================================================
129 Standard_Integer _main_ (Standard_Integer argc, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
132 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
133 Tcl_FindExecutable(argv[0]);
135 Draw_Appli(argc, argv, fDraw_InitAppli);