]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_menu_geometry.cpp
Provide a fix for the MSVC/Cygwin GDI build problem
[flightgear.git] / src / FDM / UIUCModel / uiuc_menu_geometry.cpp
1 /**********************************************************************
2                                                                        
3  FILENAME:     uiuc_menu_geometry.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  reads input data for specified aircraft and creates 
8                approporiate data storage space
9
10 ----------------------------------------------------------------------
11
12  STATUS:       alpha version
13
14 ----------------------------------------------------------------------
15
16  REFERENCES:   based on "menu reader" format of Michael Selig
17
18 ----------------------------------------------------------------------
19
20  HISTORY:      04/04/2003   initial release
21
22 ----------------------------------------------------------------------
23
24  AUTHOR(S):    Robert Deters      <rdeters@uiuc.edu>
25                Michael Selig      <m-selig@uiuc.edu>
26
27 ----------------------------------------------------------------------
28
29  VARIABLES:
30
31 ----------------------------------------------------------------------
32
33  INPUTS:       n/a
34
35 ----------------------------------------------------------------------
36
37  OUTPUTS:      n/a
38
39 ----------------------------------------------------------------------
40
41  CALLED BY:    uiuc_menu()
42
43 ----------------------------------------------------------------------
44
45  CALLS TO:     check_float() if needed
46                d_2_to_3() if needed
47                d_1_to_2() if needed
48                i_1_to_2() if needed
49                d_1_to_1() if needed
50
51  ----------------------------------------------------------------------
52
53  COPYRIGHT:    (C) 2003 by Michael Selig
54
55  This program is free software; you can redistribute it and/or
56  modify it under the terms of the GNU General Public License
57  as published by the Free Software Foundation.
58
59  This program is distributed in the hope that it will be useful,
60  but WITHOUT ANY WARRANTY; without even the implied warranty of
61  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
62  GNU General Public License for more details.
63
64  You should have received a copy of the GNU General Public License
65  along with this program; if not, write to the Free Software
66  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
67  USA or view http://www.gnu.org/copyleft/gpl.html.
68
69 **********************************************************************/
70
71 #include <simgear/compiler.h>
72
73 #if defined( __MWERKS__ )
74 // -dw- optimizer chokes (big-time) trying to optimize humongous
75 // loop/switch statements
76 #pragma optimization_level 0
77 #endif
78
79 #include <cstdlib>
80 #include <string>
81 #include STL_IOSTREAM
82
83 #include "uiuc_menu_geometry.h"
84
85 SG_USING_STD(cerr);
86 SG_USING_STD(cout);
87 SG_USING_STD(endl);
88
89 #ifndef _MSC_VER
90 SG_USING_STD(exit);
91 #endif
92
93 void parse_geometry( const string& linetoken2, const string& linetoken3,
94                      const string& linetoken4, const string& linetoken5, 
95                      const string& linetoken6, const string& linetoken7, 
96                      const string& linetoken8, const string& linetoken9,
97                      const string& linetoken10, 
98                      const string& aircraft_directory, LIST command_line ) {
99     double token_value;
100     istrstream token3(linetoken3.c_str());
101     istrstream token4(linetoken4.c_str());
102     istrstream token5(linetoken5.c_str());
103     istrstream token6(linetoken6.c_str());
104     istrstream token7(linetoken7.c_str());
105     istrstream token8(linetoken8.c_str());
106     istrstream token9(linetoken9.c_str());
107     istrstream token10(linetoken10.c_str());
108
109     switch(geometry_map[linetoken2])
110       {
111       case bw_flag:
112         {
113           if (check_float(linetoken3))
114             token3 >> token_value;
115           else
116             uiuc_warnings_errors(1, *command_line);
117           
118           bw = token_value;
119           geometryParts -> storeCommands (*command_line);
120           break;
121         }
122       case cbar_flag:
123         {
124           if (check_float(linetoken3))
125             token3 >> token_value;
126           else
127             uiuc_warnings_errors(1, *command_line);
128           
129           cbar = token_value;
130           geometryParts -> storeCommands (*command_line);
131           break;
132         }
133       case Sw_flag:
134         {
135           if (check_float(linetoken3))
136             token3 >> token_value;
137           else
138             uiuc_warnings_errors(1, *command_line);
139           
140           Sw = token_value;
141           geometryParts -> storeCommands (*command_line);
142           break;
143         }
144       case ih_flag:
145         {
146           if (check_float(linetoken3))
147             token3 >> token_value;
148           else
149             uiuc_warnings_errors(1, *command_line);
150           
151           ih = token_value;
152           geometryParts -> storeCommands (*command_line);
153           break;
154         }
155       case bh_flag:
156         {
157           if (check_float(linetoken3))
158             token3 >> token_value;
159           else
160             uiuc_warnings_errors(1, *command_line);
161           
162           bh = token_value;
163           geometryParts -> storeCommands (*command_line);
164           break;
165         }
166       case ch_flag:
167         {
168           if (check_float(linetoken3))
169             token3 >> token_value;
170           else
171             uiuc_warnings_errors(1, *command_line);
172           
173           ch = token_value;
174           geometryParts -> storeCommands (*command_line);
175           break;
176         }
177       case Sh_flag:
178         {
179           if (check_float(linetoken3))
180             token3 >> token_value;
181           else
182             uiuc_warnings_errors(1, *command_line);
183           
184           Sh = token_value;
185           geometryParts -> storeCommands (*command_line);
186           break;
187         }
188       default:
189         {
190           if (ignore_unknown_keywords) {
191             // do nothing
192           } else {
193             // print error message
194             uiuc_warnings_errors(2, *command_line);
195           }
196           break;
197         }
198       };
199 }