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.
21 #include <Draw_Main.hxx>
24 #include <Draw_Appli.hxx>
26 #include <TCollection_AsciiString.hxx>
32 #include <Draw_Window.hxx>
38 extern Draw_Viewer dout;
40 // extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
41 Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30
42 // true if complete command
44 // necessary for WNT in C21 only
45 static FDraw_InitAppli theDraw_InitAppli; //pointer to the Draw_InitAppli
49 //=======================================================================
51 // On Windows NT, both console (UNIX-like) and windowed (classical on
52 // WNT, with three separated windows - input, output and graphic)
53 // modes are supported.
54 // Depending on compilation mode of executable (CONSOLE or WINDOWS),
55 // either _main_ or _WinMain_ becomes entry point;
56 // the further different behaviour of DRAW is determined by variable
57 // Draw_IsConsoleSubsystem which is set by _main_ only
58 //=======================================================================
61 extern Standard_Boolean Draw_IsConsoleSubsystem;
63 //=======================================================================
66 //=======================================================================
68 Standard_Integer _main_ (int /*argc*/, char* argv[], char* /*envp*/[], const FDraw_InitAppli fDraw_InitAppli)
70 Draw_IsConsoleSubsystem = Standard_True;
71 theDraw_InitAppli = fDraw_InitAppli;
74 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
75 Tcl_FindExecutable(argv[0]);
79 wchar_t** anArgVec = CommandLineToArgvW (GetCommandLineW(), &aNbArgs);
80 Draw_Appli (::GetModuleHandleW (NULL), NULL, SW_SHOW, aNbArgs, anArgVec, fDraw_InitAppli);
85 //=======================================================================
86 //function : _WinMain_
88 //=======================================================================
90 Standard_Integer _WinMain_ (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR /*lpCmdLine*/, int nCmdShow, const FDraw_InitAppli fDraw_InitAppli)
92 theDraw_InitAppli = fDraw_InitAppli;
94 wchar_t** anArgVec = CommandLineToArgvW(GetCommandLineW(), &aNbArgs);
95 Draw_Appli (hInstance, hPrevinstance, nCmdShow, aNbArgs, anArgVec, fDraw_InitAppli);
100 //=======================================================================
103 //=======================================================================
105 Standard_Integer _main_ (Standard_Integer argc, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
108 #if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
109 Tcl_FindExecutable(argv[0]);
111 Draw_Appli(argc, argv, fDraw_InitAppli);