#ifndef KSGSFunktion_H #define KSGSFunktion_H #include "KSGSBefehl.h" #include #include namespace KSGScript { class KSGScriptObj; // ../Main/KSGScript.h class KSGSKlasseInstanz; // KSGSKlasse.h class KSGSThreadKlasse; // ../Klassen/KSGSThread.h class KSGSVariable; struct KSGSVariableDef; class KSGSFunktionInstanz : private Thread { protected: RCArray< KSGSVariable > *lokaleVariablen; RCArray< KSGSBefehl > *befehle; KSGSVariable *klasse; KSGScriptObj *obj; KSGSThreadKlasse *threadVar; int returnTyp; KSGSVariable *retVar; Critical cs; bool pausiert; bool beendet; bool continueB; bool breakB; int scrId; int ref; // privat __declspec( dllexport ) virtual void lock(); __declspec( dllexport ) virtual void unlock(); public: // Konstruktor __declspec( dllexport ) KSGSFunktionInstanz( RCArray< KSGSBefehl > *ba, int rt, KSGScriptObj *obj, KSGSVariable *klasse ); // Destruktor __declspec( dllexport ) ~KSGSFunktionInstanz(); // nicht constant __declspec( dllexport ) virtual void setParameter( Array< KSGSVariableDef* > *zDef, RCArray< KSGSVariable > *vars ); __declspec( dllexport ) virtual void setReturnVariable( KSGSVariable *var ); __declspec( dllexport ) virtual void setPause( bool p ); __declspec( dllexport ) virtual void setContinue(); __declspec( dllexport ) virtual void setBreak(); __declspec( dllexport ) virtual void setEnde(); __declspec( dllexport ) virtual KSGSVariable *startFunktion(); __declspec( dllexport ) virtual void thread(); __declspec( dllexport ) virtual int getStatus(); __declspec( dllexport ) virtual void setVariable( int id, KSGSVariable *var ); // constant __declspec( dllexport ) virtual KSGSVariable *getVariable( int id ) const; __declspec( dllexport ) virtual int getReturnTyp() const; __declspec( dllexport ) virtual bool wirdFunktionAusgeführt() const; __declspec( dllexport ) virtual int warteAufFunktion( int zeit ); __declspec( dllexport ) virtual bool wirdAusgeführt() const; // Reference Counting __declspec( dllexport ) virtual KSGSFunktionInstanz *getThis(); __declspec( dllexport ) virtual KSGSFunktionInstanz *release(); }; class KSGSFunktion { protected: RCArray< KSGSBefehl > *befehle; Array< KSGSVariableDef* > *parameter; Text name; int typId; int sichtbar; // 0 = global, 1 = global in Klasse, 2 = lokal in Klasse int id; int ref; public: // Konstruktor __declspec( dllexport ) KSGSFunktion( int id, int sichtbar, int typ ); // Destruktor __declspec( dllexport ) ~KSGSFunktion(); // nicht constant __declspec( dllexport ) virtual void setName( const char *txt ); __declspec( dllexport ) virtual void addParameter( KSGSVariableDef *var ); __declspec( dllexport ) virtual void addBefehl( KSGSBefehl *befehl ); __declspec( dllexport ) virtual KSGSFunktionInstanz *erstellInstanz( KSGScriptObj *obj, KSGSVariable *klasse, RCArray< KSGSVariable > *params ); // constant __declspec( dllexport ) virtual int getId() const; __declspec( dllexport ) virtual int getTypId() const; __declspec( dllexport ) virtual int getSichtbarkeit() const; __declspec( dllexport ) virtual bool hatName( const char *txt ) const; // Reference Counting __declspec( dllexport ) virtual KSGSFunktion *getThis(); __declspec( dllexport ) virtual KSGSFunktion *release(); }; } #endif