0022922: Clean up warnings on uninitialized / unused variables
[occt.git] / src / Draw / Draw_Main.cxx
CommitLineData
7fd59977 1// File: Draw_Main.cxx
2// Created: Thu Dec 30 10:40:46 1999
3// Author: Roman LYGIN
4// <rln@burnax.nnov.matra-dtv.fr>
5
6// *******************************************************************
7// RLN 06 January 2000
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.
12
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.
21
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_.
28
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.
33
34
7fd59977 35
36#ifdef HAVE_CONFIG_H
37# include <config.h>
38#endif
39
40#ifdef HAVE_STRINGS_H
41# include <strings.h>
42#endif
43
44#ifdef WNT
45#include <windows.h> /* SW_SHOW */
46#endif
47
48#include <Draw_Main.hxx>
49#include <stdlib.h>
50#include <string.h>
51#include <Draw_Appli.hxx>
52#include <OSD.hxx>
53
54#include <tcl.h>
55
56#ifdef WNT
57#include <sys/stat.h>
58#include <Draw_Window.hxx>
59
60#include <stdio.h>
61#include <io.h>
62#include <fcntl.h>
63
64extern Draw_Viewer dout;
65
66static char* ColorNames[MAXCOLOR] = {
67 "White","Red","Green","Blue","Cyan","Gold","Magenta",
68 "Maroon","Orange","Pink","Salmon","Violet","Yellow","Khaki","Coral"
69 };
70
71static Standard_Boolean XLoop;
72
73// extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
74Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C30
75// true if complete command
76
77// necessary for WNT in C21 only
78static FDraw_InitAppli theDraw_InitAppli; //pointer to the Draw_InitAppli
79static void Draw_InitAppli(Draw_Interpretor& theCommands)
80{
81 theDraw_InitAppli (theCommands);
82}
83#endif
84
85#ifdef WNT
86//=======================================================================
87//NOTE: OCC11
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//=======================================================================
96
97
98extern Standard_Boolean Draw_IsConsoleSubsystem;
99
100//=======================================================================
101//function : _main_
102//purpose :
103//=======================================================================
104
105Standard_Integer _main_ (int argc, char* argv[], char* envp[], const FDraw_InitAppli fDraw_InitAppli)
106{
107 Draw_IsConsoleSubsystem = Standard_True;
108 //return _WinMain_(::GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW, fDraw_InitAppli);
109 theDraw_InitAppli = fDraw_InitAppli;
7fd59977 110 //ParseCommandLine(GetCommandLine());
111
112 // MKV 01.02.05
113#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
114 Tcl_FindExecutable(argv[0]);
115#endif
116
117 Draw_Appli(::GetModuleHandle(NULL), NULL, GetCommandLine(), SW_SHOW, fDraw_InitAppli);
118 return 0;
119
120}
121
122//=======================================================================
123//function : _WinMain_
124//purpose :
125//=======================================================================
126
127Standard_Integer _WinMain_ (HINSTANCE hInstance, HINSTANCE hPrevinstance, LPSTR lpCmdLine, int nCmdShow, const FDraw_InitAppli fDraw_InitAppli)
128{
129// theDraw_InitAppli = fDraw_InitAppli;
130// ParseCommandLine (lpCmdLine);
131// Draw_Appli(hInstance, hPrevinstance, lpCmdLine, nCmdShow, Draw_InitAppli); // for C30;
132 return 0;
133}
134#else
135//=======================================================================
136//function : _main_
137//purpose :
138//=======================================================================
139
140Standard_Integer _main_ (Standard_Integer argc, char* argv[], const FDraw_InitAppli fDraw_InitAppli)
141{
142 // MKV 01.02.05
143#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)))
144 Tcl_FindExecutable(argv[0]);
145#endif
146 Draw_Appli(argc, argv, fDraw_InitAppli);
147 return 0;
148}
149#endif
150