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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
91 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
93 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
95 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
99 /** JSBSim Base class.
100 @author Jon S. Berndt
104 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
112 /// Constructor for FGJSBBase.
115 /// Destructor for FGJSBBase.
116 virtual ~FGJSBBase() {};
118 /// JSBSim Message structure
121 unsigned int messageId;
124 enum mType {eText, eInteger, eDouble, eBool} type;
130 ///@name JSBSim Enums.
133 enum {eL = 1, eM, eN };
135 enum {eP = 1, eQ, eR };
136 /// Velocities U, V, W
137 enum {eU = 1, eV, eW };
138 /// Positions X, Y, Z
139 enum {eX = 1, eY, eZ };
140 /// Euler angles Phi, Theta, Psi
141 enum {ePhi = 1, eTht, ePsi };
142 /// Stability axis forces, Drag, Side force, Lift
143 enum {eDrag = 1, eSide, eLift };
144 /// Local frame orientation Roll, Pitch, Yaw
145 enum {eRoll = 1, ePitch, eYaw };
146 /// Local frame position North, East, Down
147 enum {eNorth = 1, eEast, eDown };
150 ///@name JSBSim console output highlighting terms.
153 static char highint[5];
154 /// low intensity text
155 static char halfint[5];
156 /// normal intensity text
157 static char normint[6];
158 /// resets text properties
159 static char reset[5];
161 static char underon[5];
163 static char underoff[6];
165 static char fgblue[6];
167 static char fgcyan[6];
169 static char fgred[6];
171 static char fggreen[6];
173 static char fgdef[6];
176 ///@name JSBSim Messaging functions
178 /** Places a Message structure on the Message queue.
179 @param msg pointer to a Message structure
180 @return pointer to a Message structure */
181 Message* PutMessage(Message* msg);
182 /** Creates a message with the given text and places it on the queue.
183 @param text message text
184 @return pointer to a Message structure */
185 Message* PutMessage(string text);
186 /** Creates a message with the given text and boolean value and places it on the queue.
187 @param text message text
188 @param bVal boolean value associated with the message
189 @return pointer to a Message structure */
190 Message* PutMessage(string text, bool bVal);
191 /** Creates a message with the given text and integer value and places it on the queue.
192 @param text message text
193 @param iVal integer value associated with the message
194 @return pointer to a Message structure */
195 Message* PutMessage(string text, int iVal);
196 /** Creates a message with the given text and double value and places it on the queue.
197 @param text message text
198 @param dVal double value associated with the message
199 @return pointer to a Message structure */
200 Message* PutMessage(string text, double dVal);
201 /** Reads the message on the queue (but does not delete it).
202 @return pointer to a Message structure (or NULL if no mesage) */
203 Message* ReadMessage(void);
204 /** Reads the message on the queue and removes it from the queue.
205 @return pointer to a Message structure (or NULL if no mesage) */
206 Message* ProcessMessage(void);
208 string GetVersion(void) {return JSBSim_version;}
210 void disableHighLighting(void);
213 static Message localMsg;
215 static queue <Message*> Messages;
217 virtual void Debug(int from) {};
219 static short debug_lvl;
220 static unsigned int frame;
221 static unsigned int messageId;
223 static const double radtodeg;
224 static const double degtorad;
225 static const double hptoftlbssec;
226 static const double psftoinhg;
227 static const double fpstokts;
228 static const double ktstofps;
229 static const double inchtoft;
230 static const double in3tom3;
231 static const double Reng; // Specific Gas Constant,ft^2/(sec^2*R)
232 static const double SHRatio;
233 static const string needed_cfg_version;
234 static const string JSBSim_version;
237 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%