#ifndef KSGSLeser_H #define KSGSLeser_H #include #include #include using namespace Framework; namespace KSGScript { class KSGScriptO; class KSGSKlasse; class KSGSFunktion; struct KSGSVariableDef; class KSGSCompVarTable; class KSGSCompFuncTable; class KSGSCompKlassTable; class KSGSBefehl; __declspec( dllexport ) void removeLehr( Text *txt ); __declspec( dllexport ) void removeKlammer( Text *txt ); __declspec( dllexport ) int hatOperator( Text *txt ); __declspec( dllexport ) int getOperatorPos( Text *txt, int *län ); struct KSGSLeseDebug { Text datei; int zeile; }; struct KSGSLeseBefehl { int typ; Text befehl; Array< KSGSLeseBefehl* > listA; Array< KSGSLeseBefehl* > listB; KSGSLeseDebug debug; // Destruktor __declspec( dllexport ) ~KSGSLeseBefehl(); }; struct KSGSLeseVariable { Text typ; Text name; Text wert; KSGSLeseDebug debug; }; struct KSGSLeseFunktion { int ref = 1; Text name; Text typ; Array< KSGSLeseVariable* > parameter; Array< KSGSLeseBefehl* > befehle; KSGSLeseDebug debug; void release(); // Destruktor __declspec( dllexport ) ~KSGSLeseFunktion(); }; struct KSGSLeseKlasse { int ref = 1; Text name; Array< KSGSLeseVariable* > variablen; Array< bool > vSichtbar; Array< KSGSLeseFunktion* > funktionen; Array< bool > fSichtbar; KSGSLeseDebug debug; void release(); // Destruktor __declspec( dllexport ) ~KSGSLeseKlasse(); }; struct KSGSLeseScript { Array< KSGSLeseVariable* > variablen; Array< KSGSLeseFunktion* > funktionen; Array< KSGSLeseKlasse* > klassen; // Destruktor __declspec( dllexport ) ~KSGSLeseScript(); }; class KSGSLeser { private: KSGScriptO *zObj; int mainFuncId; int mausFuncId; int tastaturFuncId; int tickFuncId; int renderFuncId; int ref; protected: bool errorIgnore; Text *pfad; KSGSLeseScript *dat; int zeile; Reader *d; // Script Laden KSGSLeser(); virtual void handleError( int begin, int ende ); virtual void handleKommentar( int beginn, int ende ); virtual void handleString( int beginn, int ende ); __declspec( dllexport ) bool ladeDatei(); __declspec( dllexport ) bool leseBis( char c ); __declspec( dllexport ) __int64 nextPosOf( char c, char c2 ); __declspec( dllexport ) bool leseBisText(); __declspec( dllexport ) int leseNext(); __declspec( dllexport ) bool istTrenner( char c ); __declspec( dllexport ) bool istLehr( char c ); __declspec( dllexport ) virtual KSGSLeseKlasse *leseKlasse(); __declspec( dllexport ) virtual KSGSLeseFunktion *leseFunktion(); __declspec( dllexport ) KSGSLeseVariable *leseVariable( bool param = 0 ); __declspec( dllexport ) KSGSLeseBefehl *leseBefehl(); // Script Compilieren __declspec( dllexport ) bool compileKlasse( KSGSLeseKlasse *zLK, KSGSCompKlassTable *zKT ); __declspec( dllexport ) bool compileFunktion( KSGSLeseFunktion *zLF, KSGSCompKlassTable *zKT, KSGSCompFuncTable *zFT, int s = 0 ); __declspec( dllexport ) KSGSVariableDef *compileVariable( KSGSLeseVariable *zLV, KSGSCompKlassTable *zKT, int id ); __declspec( dllexport ) KSGSKlasse *buildKlasse( KSGSLeseKlasse *zLK, KSGSCompKlassTable *zKT, KSGSCompFuncTable *zFT, KSGSCompVarTable *zVT ); __declspec( dllexport ) KSGSFunktion *buildFunktion( KSGSLeseFunktion *zLF, KSGSCompKlassTable *zKT, KSGSCompFuncTable *zFT, KSGSCompVarTable *zVT, const char *klassName = 0 ); __declspec( dllexport ) KSGSBefehl *buildBefehl( KSGSLeseBefehl *zLB, KSGSCompKlassTable *zKT, KSGSCompFuncTable *zFT, KSGSCompVarTable *zVT, const char *klassName = 0, const char *funktionName = 0 ); public: // Konstruktor __declspec( dllexport ) KSGSLeser( const char *pfad, KSGScriptO *zObj ); // Destruktor __declspec( dllexport ) ~KSGSLeser(); // nicht constant __declspec( dllexport ) bool laden(); __declspec( dllexport ) bool compile( RCArray< KSGSKlasse > *klassen, RCArray< KSGSFunktion > *funktionen, Array< KSGSVariableDef* > *variablen ); // constant __declspec( dllexport ) int getMainFuncId() const; __declspec( dllexport ) int getMausFuncId() const; __declspec( dllexport ) int getTastaturFuncId() const; __declspec( dllexport ) int getTickFuncId() const; __declspec( dllexport ) int getRenderFuncId() const; // Reference Counting __declspec( dllexport ) KSGSLeser *getThis(); __declspec( dllexport ) KSGSLeser *release(); }; } #endif