1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 2001 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 # include <simgear/compiler.h>
54 # if defined(sgi) && !defined(__GNUC__)
65 # include <simgear/constants.h>
69 #ifdef __FreeBSD__ // define gcvt on FreeBSD
73 static char *gcvt(double number, size_t ndigit, char *buf)
75 sprintf(buf, "%f", number);
80 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
84 #define ID_JSBBASE "$Id$"
86 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
145 FG_LBARH, //normalized horizontal tail arm
146 FG_LBARV, //normalized vertical tail arm
149 FG_VBARH, //horizontal tail volume
150 FG_VBARV, //vertical tail volume
155 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
156 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
157 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
159 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
161 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
163 /** JSBSim Base class.
164 @author Jon S. Berndt
168 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
170 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
174 /// Constructor for FGJSBBase.
177 /// Destructor for FGJSBBase.
178 virtual ~FGJSBBase() {};
180 /// JSBSim Message structure
183 unsigned int messageId;
186 enum mType {eText, eInteger, eDouble, eBool} type;
192 ///@name JSBSim Enums.
195 enum {eL = 1, eM, eN };
197 enum {eP = 1, eQ, eR };
198 /// Velocities U, V, W
199 enum {eU = 1, eV, eW };
200 /// Positions X, Y, Z
201 enum {eX = 1, eY, eZ };
202 /// Euler angles Phi, Theta, Psi
203 enum {ePhi = 1, eTht, ePsi };
204 /// Stability axis forces, Drag, Side force, Lift
205 enum {eDrag = 1, eSide, eLift };
206 /// Local frame orientation Roll, Pitch, Yaw
207 enum {eRoll = 1, ePitch, eYaw };
208 /// Local frame position North, East, Down
209 enum {eNorth = 1, eEast, eDown };
212 ///@name JSBSim console output highlighting terms.
215 static char highint[5];
216 /// low intensity text
217 static char halfint[5];
218 /// normal intensity text
219 static char normint[6];
220 /// resets text properties
221 static char reset[5];
223 static char underon[5];
225 static char underoff[6];
227 static char fgblue[6];
229 static char fgcyan[6];
231 static char fgred[6];
233 static char fggreen[6];
235 static char fgdef[6];
238 ///@name JSBSim Messaging functions
240 /** Places a Message structure on the Message queue.
241 @param msg pointer to a Message structure
242 @return pointer to a Message structure */
243 Message* PutMessage(Message* msg);
244 /** Creates a message with the given text and places it on the queue.
245 @param text message text
246 @return pointer to a Message structure */
247 Message* PutMessage(string text);
248 /** Creates a message with the given text and boolean value and places it on the queue.
249 @param text message text
250 @param bVal boolean value associated with the message
251 @return pointer to a Message structure */
252 Message* PutMessage(string text, bool bVal);
253 /** Creates a message with the given text and integer value and places it on the queue.
254 @param text message text
255 @param iVal integer value associated with the message
256 @return pointer to a Message structure */
257 Message* PutMessage(string text, int iVal);
258 /** Creates a message with the given text and double value and places it on the queue.
259 @param text message text
260 @param dVal double value associated with the message
261 @return pointer to a Message structure */
262 Message* PutMessage(string text, double dVal);
263 /** Reads the message on the queue (but does not delete it).
264 @return pointer to a Message structure (or NULL if no mesage) */
265 Message* ReadMessage(void);
266 /** Reads the message on the queue and removes it from the queue.
267 @return pointer to a Message structure (or NULL if no mesage) */
268 Message* ProcessMessage(void);
270 string GetVersion(void) {return JSBSim_version;}
273 static Message localMsg;
275 static queue <Message*> Messages;
277 virtual void Debug(int from) {};
279 static short debug_lvl;
280 static unsigned int frame;
281 static unsigned int messageId;
283 static const double radtodeg;
284 static const double degtorad;
285 static const double hptoftlbssec;
286 static const double fpstokts;
287 static const double ktstofps;
288 static const double inchtoft;
289 static const double Reng; // Specific Gas Constant,ft^2/(sec^2*R)
290 static const double SHRatio;
291 static const string needed_cfg_version;
292 static const string JSBSim_version;
295 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%