00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGSCANPARSESKEL_H_
00040 #define _OSGSCANPARSESKEL_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044
00045
00046 #include <OSGSystemDef.h>
00047 #include <OSGBaseTypes.h>
00048 #include <OSGColor.h>
00049 #include <OSGVector.h>
00050 #include <OSGTime.h>
00051 #include <OSGPlane.h>
00052 #include <OSGMatrix.h>
00053 #include <OSGDynamicVolume.h>
00054 #include <OSGImage.h>
00055
00056 #ifndef TOK_HEADER
00057 #include "OSGScanParseSkel.tab.h"
00058 #endif
00059
00060 #include <string>
00061
00062 #ifdef OSG_FLEX_USE_IOSTREAM_INPUT
00063 #include <iosfwd>
00064 #endif
00065
00066 class OSGScanParseLexer;
00067 int OSGScanParseSkel_parse(void*);
00068
00069 OSG_BEGIN_NAMESPACE
00070
00073
00074 class OSG_SYSTEMLIB_DLLMAPPING ScanParseSkel
00075 {
00076 friend int ::OSGScanParseSkel_parse(void*);
00077
00078
00079 public:
00080
00081 enum BuildInFieldType
00082 {
00083 OSGsfBool = TOK_SFBool,
00084 OSGsfColor = TOK_SFColor,
00085 OSGsfColorRGBA = TOK_SFColorRGBA,
00086 OSGsfDouble = TOK_SFDouble,
00087 OSGsfFloat = TOK_SFFloat,
00088 OSGsfImage = TOK_SFImage,
00089 OSGsfInt32 = TOK_SFInt32,
00090 OSGsfMatrix3d = TOK_SFMatrix3d,
00091 OSGsfMatrix3f = TOK_SFMatrix3f,
00092 OSGsfMatrix4d = TOK_SFMatrix4d,
00093 OSGsfMatrix4f = TOK_SFMatrix4f,
00094 OSGsfNode = TOK_SFNode,
00095 OSGsfRotation = TOK_SFRotation,
00096 OSGsfString = TOK_SFString,
00097 OSGsfTime = TOK_SFTime,
00098 OSGsfVec2d = TOK_SFVec2d,
00099 OSGsfVec2f = TOK_SFVec2f,
00100 OSGsfVec3d = TOK_SFVec3d,
00101 OSGsfVec3f = TOK_SFVec3f,
00102 OSGsfVec4d = TOK_SFVec4d,
00103 OSGsfVec4f = TOK_SFVec4f,
00104 OSGmfBool = TOK_MFBool,
00105 OSGmfColor = TOK_MFColor,
00106 OSGmfColorRGBA = TOK_MFColorRGBA,
00107 OSGmfDouble = TOK_MFDouble,
00108 OSGmfFloat = TOK_MFFloat,
00109 OSGmfImage = TOK_MFImage,
00110 OSGmfInt32 = TOK_MFInt32,
00111 OSGmfMatrix3d = TOK_MFMatrix3d,
00112 OSGmfMatrix3f = TOK_MFMatrix3f,
00113 OSGmfMatrix4d = TOK_MFMatrix4d,
00114 OSGmfMatrix4f = TOK_MFMatrix4f,
00115 OSGmfNode = TOK_MFNode,
00116 OSGmfRotation = TOK_MFRotation,
00117 OSGmfString = TOK_MFString,
00118 OSGmfTime = TOK_MFTime,
00119 OSGmfVec2d = TOK_MFVec2d,
00120 OSGmfVec2f = TOK_MFVec2f,
00121 OSGmfVec3d = TOK_MFVec3d,
00122 OSGmfVec3f = TOK_MFVec3f,
00123 OSGmfVec4d = TOK_MFVec4d,
00124 OSGmfVec4f = TOK_MFVec4f,
00125
00126 OSGmfColor4f = TOK_MFColorRGBA,
00127 OSGmfColor4i = TOK_MFColor4i,
00128 OSGmfColor3f = TOK_MFColor,
00129 OSGmfMatrix = TOK_MFMatrix4f,
00130 OSGmfPnt2f = TOK_MFPnt2f,
00131 OSGmfPnt3f = TOK_MFPnt3f,
00132 OSGmfPnt4f = TOK_MFPnt4f,
00133 OSGmfPlane = TOK_MFPlane,
00134 OSGsfColor4f = TOK_SFColorRGBA,
00135 OSGsfColor4i = TOK_SFColor4i,
00136 OSGsfColor3f = TOK_SFColor,
00137 OSGsfMatrix = TOK_SFMatrix4f,
00138 OSGsfPnt2f = TOK_SFPnt2f,
00139 OSGsfPnt3f = TOK_SFPnt3f,
00140 OSGsfPnt4f = TOK_SFPnt4f,
00141 OSGsfPlane = TOK_SFPlane,
00142 OSGsfVolume = TOK_SFVolume
00143 };
00144
00145 enum
00146 {
00147 LastOption = 0x0001
00148 };
00149
00150
00154 ScanParseSkel(void);
00155
00157
00161 virtual ~ScanParseSkel(void);
00162
00164
00168 #ifdef OSG_FLEX_USE_IOSTREAM_INPUT
00169 virtual void scanStream ( std::istream &is );
00170 #endif
00171
00172 virtual void scanFile (const Char8 *szFilename);
00173
00174 virtual Int32 lex ( YYSTYPE *lvalp );
00175 virtual const Char8 *getText ( void );
00176
00177 virtual void handleError(const Char8 *szErrorText);
00178
00180
00184 virtual bool verifyHeader (const Char8 *szHeader);
00185
00186 virtual void beginProto (const Char8 *szProtoname);
00187 virtual void endProto (void);
00188
00189 virtual void beginExternProto (const Char8 *szProtoname);
00190 virtual void endExternProtoInterface (void );
00191 virtual void endExternProto (void );
00192
00193 virtual void beginScript (const Char8 *szProtoname);
00194 virtual void endScript (void);
00195
00196 virtual void beginEventInDecl (const Char8 *szEventType,
00197 const UInt32 uiFieldTypeId,
00198 const Char8 *szEventName);
00199
00200 virtual void beginEventOutDecl (const Char8 *szEventType,
00201 const UInt32 uiFieldTypeId,
00202 const Char8 *szEventName);
00203
00204 virtual void endEventDecl (void);
00205
00206 virtual void beginFieldDecl (const Char8 *szFieldType,
00207 const UInt32 uiFieldTypeId,
00208 const Char8 *szFieldName);
00209
00210 virtual void endFieldDecl (void);
00211
00212 virtual void beginExposedFieldDecl (const Char8 *szFieldType,
00213 const UInt32 uiFieldTypeId,
00214 const Char8 *szFieldName);
00215
00216 virtual void endExposedFieldDecl (void);
00217
00218
00219 virtual void addExternEventInDecl (const Char8 *szEventType,
00220 const UInt32 uiFieldTypeId,
00221 const Char8 *szEventName);
00222
00223 virtual void addExternEventOutDecl (const Char8 *szEventType,
00224 const UInt32 uiFieldTypeId,
00225 const Char8 *szEventName);
00226
00227 virtual void addExternFieldDecl (const Char8 *szFieldType,
00228 const UInt32 uiFieldTypeId,
00229 const Char8 *szFieldName);
00230
00231 virtual void addExternExposedFieldDecl(const Char8 *szFieldType,
00232 const UInt32 uiFieldTypeId,
00233 const Char8 *szFieldName);
00234
00236
00240 virtual void beginField(const Char8 *szFieldname,
00241 const UInt32 uiFieldTypeId);
00242
00243 virtual void endField (void);
00244
00246
00250 virtual void beginNode(const Char8 *szNodeTypename,
00251 const Char8 *szNodename);
00252
00253 virtual void endNode (void);
00254
00255 virtual void use (const Char8 *szName);
00256 virtual void is (const Char8 *szName);
00257
00259
00263 virtual void addFieldValue(const Char8 *szFieldVal);
00264
00265 virtual void addBoolValue(bool b);
00266
00267 virtual void addColorValue(const Color3f &c);
00268
00269 virtual void addColorRGBAValue(const Color4f &c);
00270
00271 virtual void addDoubleValue(Real64 d);
00272
00273 virtual void addFloatValue(Real32 f);
00274
00275 virtual void addImageValue(ImagePtr &img);
00276
00277 virtual void addInt32Value(Int32 i);
00278
00279 virtual void addMatrix3dValue(Real64 m00, Real64 m10, Real64 m20,
00280 Real64 m01, Real64 m11, Real64 m21,
00281 Real64 m02, Real64 m12, Real64 m22);
00282
00283 virtual void addMatrix3fValue(Real32 m00, Real32 m10, Real32 m20,
00284 Real32 m01, Real32 m11, Real32 m21,
00285 Real32 m02, Real32 m12, Real32 m22);
00286
00287 virtual void addMatrix4dValue(const Matrix4d &m);
00288
00289 virtual void addMatrix4fValue(const Matrix4f &m);
00290
00291 virtual void addRotationValue(const Vec3f &axis, Real32 angle);
00292
00293 virtual void addStringValue(const std::string &s);
00294
00295 virtual void addTimeValue(Time t);
00296
00297 virtual void addVec2dValue(const Vec2d &v);
00298
00299 virtual void addVec2fValue(const Vec2f &v);
00300
00301 virtual void addVec3dValue(const Vec3d &v);
00302
00303 virtual void addVec3fValue(const Vec3f &v);
00304
00305 virtual void addVec4dValue(const Vec4d &v);
00306
00307 virtual void addVec4fValue(const Vec4f &v);
00308
00309 virtual void addColor4iValue(const Color4ub &c);
00310
00311 virtual void addPnt2fValue(const Pnt2f &p);
00312
00313 virtual void addPnt3fValue(const Pnt3f &p);
00314
00315 virtual void addPnt4fValue(const Pnt4f &p);
00316
00317 virtual void addPlaneValue(const Plane &p);
00318
00319 virtual void addVolumeValue(const DynamicVolume &v);
00320
00321 virtual void addRoute (const Char8 *szOutNodename,
00322 const Char8 *szOutFieldname,
00323 const Char8 *szInNodename,
00324 const Char8 *szInFieldname);
00325
00326 virtual void profileElement (const Char8 *szProfileName);
00327
00328 virtual void componentElement (const Char8 *szComponentName);
00329
00330 virtual void metaElement (const Char8 *szMetaKey,
00331 const Char8 *szMetaValue);
00332
00333 virtual void importElement (const Char8 *szInlineName,
00334 const Char8 *szNodeName,
00335 const Char8 *szImportAs );
00336
00337 virtual void exportElement (const Char8 *szNodeName,
00338 const Char8 *szExportAs );
00339
00341
00345 bool getMapFieldTypes (void);
00346
00347 virtual Int32 mapExtIntFieldType(const Char8 *szFieldname,
00348 const Int32 iFieldTypeId);
00349
00350 virtual UInt32 getFieldType (const Char8 *szFieldname);
00351
00352 OSGScanParseLexer *getLexer(void);
00353
00355
00356 protected:
00357
00358
00362 bool _bMapTypeIds;
00363 Char8 *_szReferenceHeader;
00364 OSGScanParseLexer *_pLexer;
00365
00366 void reset ( void);
00367
00368 void setMapTypeIds ( bool bVal);
00369
00370 void setReferenceHeader(const Char8 *szReferenceHeader);
00371
00373
00374 private:
00375
00377 ScanParseSkel(const ScanParseSkel &source);
00379 void operator =(const ScanParseSkel &source);
00380
00381 std::string _tmpString1, _tmpString2, _tmpString3;
00382 Real32 _tmpFloat1, _tmpFloat2, _tmpFloat3, _tmpFloat4;
00383
00384 void beginValue();
00385
00386 void appendValue();
00387
00388 void beginImage(Int32 width, Int32 height, Int32 components);
00389
00390 void addImagePixel(Int32 pixel);
00391
00392 void endImage();
00393
00394 ImagePtr _image;
00395
00396 UInt8 *_imageDataPtr;
00397 };
00398
00399
00400
00401
00402
00403 OSG_END_NAMESPACE
00404
00405 #define OSGSCANPARSESKEL_HEADER_CVSID "@(#)$Id: $"
00406
00407 #endif