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>
51 # include <simgear/constants.h>
59 # if defined(sgi) && !defined(__GNUC__)
69 # define M_PI 3.14159265358979323846
74 #if !defined(WIN32) || defined(__GNUC__)
78 #ifdef __FreeBSD__ // define gcvt on FreeBSD
82 static char *gcvt(double number, size_t ndigit, char *buf)
84 sprintf(buf, "%f", number);
89 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
93 #define ID_JSBBASE "$Id$"
95 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
100 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
101 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
104 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
108 /** JSBSim Base class.
109 @author Jon S. Berndt
113 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
121 /// Constructor for FGJSBBase.
124 /// Destructor for FGJSBBase.
125 virtual ~FGJSBBase() {};
127 /// JSBSim Message structure
130 unsigned int messageId;
133 enum mType {eText, eInteger, eDouble, eBool} type;
139 ///@name JSBSim Enums.
142 enum {eL = 1, eM, eN };
144 enum {eP = 1, eQ, eR };
145 /// Velocities U, V, W
146 enum {eU = 1, eV, eW };
147 /// Positions X, Y, Z
148 enum {eX = 1, eY, eZ };
149 /// Euler angles Phi, Theta, Psi
150 enum {ePhi = 1, eTht, ePsi };
151 /// Stability axis forces, Drag, Side force, Lift
152 enum {eDrag = 1, eSide, eLift };
153 /// Local frame orientation Roll, Pitch, Yaw
154 enum {eRoll = 1, ePitch, eYaw };
155 /// Local frame position North, East, Down
156 enum {eNorth = 1, eEast, eDown };
159 ///@name JSBSim console output highlighting terms.
162 static char highint[5];
163 /// low intensity text
164 static char halfint[5];
165 /// normal intensity text
166 static char normint[6];
167 /// resets text properties
168 static char reset[5];
170 static char underon[5];
172 static char underoff[6];
174 static char fgblue[6];
176 static char fgcyan[6];
178 static char fgred[6];
180 static char fggreen[6];
182 static char fgdef[6];
185 ///@name JSBSim Messaging functions
187 /** Places a Message structure on the Message queue.
188 @param msg pointer to a Message structure
189 @return pointer to a Message structure */
190 Message* PutMessage(Message* msg);
191 /** Creates a message with the given text and places it on the queue.
192 @param text message text
193 @return pointer to a Message structure */
194 Message* PutMessage(string text);
195 /** Creates a message with the given text and boolean value and places it on the queue.
196 @param text message text
197 @param bVal boolean value associated with the message
198 @return pointer to a Message structure */
199 Message* PutMessage(string text, bool bVal);
200 /** Creates a message with the given text and integer value and places it on the queue.
201 @param text message text
202 @param iVal integer value associated with the message
203 @return pointer to a Message structure */
204 Message* PutMessage(string text, int iVal);
205 /** Creates a message with the given text and double value and places it on the queue.
206 @param text message text
207 @param dVal double value associated with the message
208 @return pointer to a Message structure */
209 Message* PutMessage(string text, double dVal);
210 /** Reads the message on the queue (but does not delete it).
211 @return pointer to a Message structure (or NULL if no mesage) */
212 Message* ReadMessage(void);
213 /** Reads the message on the queue and removes it from the queue.
214 @return pointer to a Message structure (or NULL if no mesage) */
215 Message* ProcessMessage(void);
217 string GetVersion(void) {return JSBSim_version;}
219 void disableHighLighting(void);
222 static Message localMsg;
224 static queue <Message*> Messages;
226 virtual void Debug(int from) {};
228 static short debug_lvl;
229 static unsigned int frame;
230 static unsigned int messageId;
232 static const double radtodeg;
233 static const double degtorad;
234 static const double hptoftlbssec;
235 static const double psftoinhg;
236 static const double fpstokts;
237 static const double ktstofps;
238 static const double inchtoft;
239 static const double in3tom3;
240 static const double Reng; // Specific Gas Constant,ft^2/(sec^2*R)
241 static const double SHRatio;
242 static const string needed_cfg_version;
243 static const string JSBSim_version;
246 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%