#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 : public Thread { protected: RCArray< KSGSVariable > *lokaleVariablen; RCArray< KSGSBefehl > *befehle; KSGSVariable *klasse; KSGScriptProcessor *obj; KSGSThreadKlasse *threadVar; int returnTyp; KSGSVariable *retVar; Critical cs; bool pausiert; bool beendet; bool continueB; bool breakB; int scrId; // privat __declspec( dllexport ) virtual void lock(); __declspec( dllexport ) virtual void unlock(); public: // Konstruktor __declspec( dllexport ) KSGSFunktionInstanz( RCArray< KSGSBefehl > *ba, int rt, KSGScriptProcessor *obj, KSGSVariable *klasse ); // Destruktor __declspec( dllexport ) virtual ~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 isFunctionExecuting() const; __declspec( dllexport ) virtual int warteAufFunktion( int zeit ); __declspec( dllexport ) virtual bool isExecuting() const; }; class KSGSFunktion : public virtual ReferenceCounter { 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; public: // Konstruktor __declspec( dllexport ) KSGSFunktion( int id, int sichtbar, int typ ); // Destruktor __declspec( dllexport ) virtual ~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( KSGScriptProcessor *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; }; } #endif