]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_menu_mass.cpp
remove macintosh (note: not MacOS-X) and MWERKS workarounds.
[flightgear.git] / src / FDM / UIUCModel / uiuc_menu_mass.cpp
1 /**********************************************************************
2                                                                        
3  FILENAME:     uiuc_menu_mass.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                06/30/2003   (RD) replaced istrstream with istringstream
22                             to get rid of the annoying warning about
23                             using the strstream header
24
25 ----------------------------------------------------------------------
26
27  AUTHOR(S):    Robert Deters      <rdeters@uiuc.edu>
28                Michael Selig      <m-selig@uiuc.edu>
29
30 ----------------------------------------------------------------------
31
32  VARIABLES:
33
34 ----------------------------------------------------------------------
35
36  INPUTS:       n/a
37
38 ----------------------------------------------------------------------
39
40  OUTPUTS:      n/a
41
42 ----------------------------------------------------------------------
43
44  CALLED BY:    uiuc_menu()
45
46 ----------------------------------------------------------------------
47
48  CALLS TO:     check_float() if needed
49                d_2_to_3() if needed
50                d_1_to_2() if needed
51                i_1_to_2() if needed
52                d_1_to_1() if needed
53
54  ----------------------------------------------------------------------
55
56  COPYRIGHT:    (C) 2003 by Michael Selig
57
58  This program is free software; you can redistribute it and/or
59  modify it under the terms of the GNU General Public License
60  as published by the Free Software Foundation.
61
62  This program is distributed in the hope that it will be useful,
63  but WITHOUT ANY WARRANTY; without even the implied warranty of
64  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
65  GNU General Public License for more details.
66
67  You should have received a copy of the GNU General Public License
68  along with this program; if not, write to the Free Software
69  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
70
71 **********************************************************************/
72
73 #include <simgear/compiler.h>
74
75
76 #include <cstdlib>
77 #include <string>
78 #include STL_IOSTREAM
79
80 #include "uiuc_menu_mass.h"
81
82 SG_USING_STD(cerr);
83 SG_USING_STD(cout);
84 SG_USING_STD(endl);
85
86 #ifndef _MSC_VER
87 SG_USING_STD(exit);
88 #endif
89
90 void parse_mass( const string& linetoken2, const string& linetoken3,
91                  const string& linetoken4, const string& linetoken5, 
92                  const string& linetoken6, const string& linetoken7, 
93                  const string& linetoken8, const string& linetoken9,
94                  const string& linetoken10, const string& aircraft_directory,
95                  LIST command_line ) {
96     double token_value;
97     istringstream token3(linetoken3.c_str());
98     istringstream token4(linetoken4.c_str());
99     istringstream token5(linetoken5.c_str());
100     istringstream token6(linetoken6.c_str());
101     istringstream token7(linetoken7.c_str());
102     istringstream token8(linetoken8.c_str());
103     istringstream token9(linetoken9.c_str());
104     istringstream token10(linetoken10.c_str());
105
106     switch(mass_map[linetoken2])
107       {
108       case Weight_flag:
109         {
110           if (check_float(linetoken3))
111             token3 >> token_value;
112           else
113             uiuc_warnings_errors(1, *command_line);
114           
115           Weight = token_value;
116           Mass = Weight * INVG;
117           massParts -> storeCommands (*command_line);
118           break;
119         }
120       case Mass_flag:
121         {
122           if (check_float(linetoken3))
123             token3 >> token_value;
124           else
125             uiuc_warnings_errors(1, *command_line);
126           
127           Mass = token_value;
128           massParts -> storeCommands (*command_line);
129           break;
130         }
131       case I_xx_flag:
132         {
133           if (check_float(linetoken3))
134             token3 >> token_value;
135           else
136             uiuc_warnings_errors(1, *command_line);
137           
138           I_xx = token_value;
139           massParts -> storeCommands (*command_line);
140           break;
141         }
142       case I_yy_flag:
143         {
144           if (check_float(linetoken3))
145             token3 >> token_value;
146           else
147             uiuc_warnings_errors(1, *command_line);
148           
149           I_yy = token_value;
150           massParts -> storeCommands (*command_line);
151           break;
152         }
153       case I_zz_flag:
154         {
155           if (check_float(linetoken3))
156             token3 >> token_value;
157           else
158             uiuc_warnings_errors(1, *command_line);
159           
160           I_zz = token_value;
161           massParts -> storeCommands (*command_line);
162           break;
163         }
164       case I_xz_flag:
165         {
166           if (check_float(linetoken3))
167             token3 >> token_value;
168           else
169             uiuc_warnings_errors(1, *command_line);
170           
171           I_xz = token_value;
172           massParts -> storeCommands (*command_line);
173           break;
174         }
175       case Mass_appMass_ratio_flag:
176         {
177           if (check_float(linetoken3))
178             token3 >> token_value;
179           else
180             uiuc_warnings_errors(1, *command_line);
181           
182           Mass_appMass_ratio = token_value;
183           massParts -> storeCommands (*command_line);
184           break;
185         }
186       case I_xx_appMass_ratio_flag:
187         {
188           if (check_float(linetoken3))
189             token3 >> token_value;
190           else
191             uiuc_warnings_errors(1, *command_line);
192           
193           I_xx_appMass_ratio = token_value;
194           massParts -> storeCommands (*command_line);
195           break;
196         }
197       case I_yy_appMass_ratio_flag:
198         {
199           if (check_float(linetoken3))
200             token3 >> token_value;
201           else
202             uiuc_warnings_errors(1, *command_line);
203           
204           I_yy_appMass_ratio = token_value;
205           massParts -> storeCommands (*command_line);
206           break;
207         }
208       case I_zz_appMass_ratio_flag:
209         {
210           if (check_float(linetoken3))
211             token3 >> token_value;
212           else
213             uiuc_warnings_errors(1, *command_line);
214           
215           I_zz_appMass_ratio = token_value;
216           massParts -> storeCommands (*command_line);
217           break;
218         }
219       case Mass_appMass_flag:
220         {
221           if (check_float(linetoken3))
222             token3 >> token_value;
223           else
224             uiuc_warnings_errors(1, *command_line);
225           
226           Mass_appMass = token_value;
227           massParts -> storeCommands (*command_line);
228           break;
229         }
230       case I_xx_appMass_flag:
231         {
232           if (check_float(linetoken3))
233             token3 >> token_value;
234           else
235             uiuc_warnings_errors(1, *command_line);
236           
237           I_xx_appMass = token_value;
238           massParts -> storeCommands (*command_line);
239           break;
240         }
241       case I_yy_appMass_flag:
242         {
243           if (check_float(linetoken3))
244             token3 >> token_value;
245           else
246             uiuc_warnings_errors(1, *command_line);
247           
248           I_yy_appMass = token_value;
249           massParts -> storeCommands (*command_line);
250           break;
251         }
252       case I_zz_appMass_flag:
253         {
254           if (check_float(linetoken3))
255             token3 >> token_value;
256           else
257             uiuc_warnings_errors(1, *command_line);
258           
259           I_zz_appMass = token_value;
260           massParts -> storeCommands (*command_line);
261           break;
262         }
263       default:
264         {
265           if (ignore_unknown_keywords) {
266             // do nothing
267           } else {
268             // print error message
269             uiuc_warnings_errors(2, *command_line);
270           }
271           break;
272         }
273       };
274 }