Преглед на файлове

An neues Framework angepasst

Kolja Strohm преди 5 години
родител
ревизия
89e4215335
променени са 40 файла, в които са добавени 174 реда и са изтрити 492 реда
  1. 0 81
      ksgScript/Befehl/KSGSBefehl.cpp
  2. 1 19
      ksgScript/Befehl/KSGSBefehl.h
  3. 154 171
      ksgScript/Befehl/KSGSFunktion.cpp
  4. 3 7
      ksgScript/Befehl/KSGSFunktion.h
  5. 1 1
      ksgScript/Befehl/KSGSKlasse.h
  6. 0 15
      ksgScript/Editor/Parser/ColorParser.cpp
  7. 1 5
      ksgScript/Editor/Parser/ColorParser.h
  8. 0 18
      ksgScript/Funktionen/KSGSRückruf.cpp
  9. 0 4
      ksgScript/Funktionen/KSGSRückruf.h
  10. 0 9
      ksgScript/Klassen/KSGSAnimation2D.cpp
  11. 0 2
      ksgScript/Klassen/KSGSAnimation2D.h
  12. 0 9
      ksgScript/Klassen/KSGSAnimation2DData.cpp
  13. 0 2
      ksgScript/Klassen/KSGSAnimation2DData.h
  14. 0 9
      ksgScript/Klassen/KSGSArray.cpp
  15. 0 2
      ksgScript/Klassen/KSGSArray.h
  16. 12 12
      ksgScript/Klassen/KSGSBild.cpp
  17. 0 2
      ksgScript/Klassen/KSGSBild.h
  18. 0 9
      ksgScript/Klassen/KSGSBildZ.cpp
  19. 0 2
      ksgScript/Klassen/KSGSBildZ.h
  20. 0 9
      ksgScript/Klassen/KSGSBool.cpp
  21. 0 2
      ksgScript/Klassen/KSGSBool.h
  22. 0 9
      ksgScript/Klassen/KSGSDouble.cpp
  23. 0 2
      ksgScript/Klassen/KSGSDouble.h
  24. 0 10
      ksgScript/Klassen/KSGSFenster.cpp
  25. 0 2
      ksgScript/Klassen/KSGSFenster.h
  26. 0 9
      ksgScript/Klassen/KSGSInt.cpp
  27. 0 2
      ksgScript/Klassen/KSGSInt.h
  28. 0 9
      ksgScript/Klassen/KSGSKnopf.cpp
  29. 0 2
      ksgScript/Klassen/KSGSKnopf.h
  30. 0 9
      ksgScript/Klassen/KSGSMausEreignis.cpp
  31. 0 2
      ksgScript/Klassen/KSGSMausEreignis.h
  32. 0 9
      ksgScript/Klassen/KSGSTastaturEreignis.cpp
  33. 0 2
      ksgScript/Klassen/KSGSTastaturEreignis.h
  34. 0 9
      ksgScript/Klassen/KSGSText.cpp
  35. 0 2
      ksgScript/Klassen/KSGSText.h
  36. 0 9
      ksgScript/Klassen/KSGSTextFeld.cpp
  37. 0 2
      ksgScript/Klassen/KSGSTextFeld.h
  38. 1 10
      ksgScript/Klassen/KSGSThread.cpp
  39. 0 2
      ksgScript/Klassen/KSGSThread.h
  40. 1 1
      ksgScript/Leser/KSGSLeser.h

+ 0 - 81
ksgScript/Befehl/KSGSBefehl.cpp

@@ -823,15 +823,6 @@ KSGSVariable *KSGSCallBefehl::ausf
 	return v;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSCallBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSOperatorBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1004,15 +995,6 @@ KSGSVariable *KSGSOperatorBefehl::ausf
 	return ret;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSOperatorBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSIfBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1172,15 +1154,6 @@ KSGSVariable *KSGSIfBefehl::ausf
 	return 0;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSIfBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSForBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1363,15 +1336,6 @@ KSGSVariable *KSGSForBefehl::ausf
 	return 0;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSForBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSWhileBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1481,15 +1445,6 @@ KSGSVariable *KSGSWhileBefehl::ausf
 	return 0;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSWhileBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSReturnBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1529,15 +1484,6 @@ KSGSVariable *KSGSReturnBefehl::ausf
 	return 0;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSReturnBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSBreakBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1560,15 +1506,6 @@ KSGSVariable *KSGSBreakBefehl::ausf
 	return 0;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSBreakBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSContinueBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1591,15 +1528,6 @@ KSGSVariable *KSGSContinueBefehl::ausf
 	return 0;
 }
 
-// Reference Counting
-KSGSBefehl *KSGSContinueBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSVariableBefehl Klasse aus KSGSBefehl.h
 // Konstruktor
@@ -1635,13 +1563,4 @@ KSGSVariableBefehl::~KSGSVariableBefehl()
 KSGSVariable *KSGSVariableBefehl::ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const
 {
 	return prozessErstell( erstell, zObj, zFI, zKI );
-}
-
-// Reference Counting
-KSGSBefehl *KSGSVariableBefehl::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 1 - 19
ksgScript/Befehl/KSGSBefehl.h

@@ -115,7 +115,7 @@ namespace KSGScript
 		// Konstruktor
 		__declspec( dllexport ) KSGSBefehl( Typ typ );
 		// Destruktor
-		__declspec( dllexport ) ~KSGSBefehl();
+		__declspec( dllexport ) virtual ~KSGSBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const;
 		__declspec( dllexport ) bool hatFehler() const;
@@ -145,8 +145,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSCallBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSOperatorBefehl : public KSGSBefehl
@@ -164,8 +162,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSOperatorBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSIfBefehl : public KSGSBefehl
@@ -183,8 +179,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSIfBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSForBefehl : public KSGSBefehl
@@ -203,8 +197,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSForBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSWhileBefehl : public KSGSBefehl
@@ -221,8 +213,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSWhileBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSReturnBefehl : public KSGSBefehl
@@ -238,8 +228,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSReturnBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSBreakBefehl : public KSGSBefehl
@@ -254,8 +242,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSBreakBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSContinueBefehl : public KSGSBefehl
@@ -270,8 +256,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSContinueBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 
 	class KSGSVariableBefehl : public KSGSBefehl
@@ -287,8 +271,6 @@ namespace KSGScript
 		__declspec( dllexport ) ~KSGSVariableBefehl();
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *ausführen( KSGScriptObj *zObj, KSGSFunktionInstanz *zFI, KSGSVariable *zKI ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSBefehl *release() override;
 	};
 }
 

+ 154 - 171
ksgScript/Befehl/KSGSFunktion.cpp

@@ -13,33 +13,32 @@ using namespace KSGScript;
 KSGSFunktionInstanz::KSGSFunktionInstanz( RCArray< KSGSBefehl > *ba, int rt, KSGScriptObj *obj, KSGSVariable *klasse )
     : Thread()
 {
-	lokaleVariablen = new RCArray< KSGSVariable >();
-	befehle = ba;
-	this->klasse = klasse;
-	this->obj = obj;
-	threadVar = 0;
-	returnTyp = rt;
-	retVar = 0;
-	pausiert = 0;
-	beendet = 0;
-	breakB = 0;
-	continueB = 0;
-	scrId = obj->getScriptId();
-	ref = 1;
+    lokaleVariablen = new RCArray< KSGSVariable >();
+    befehle = ba;
+    this->klasse = klasse;
+    this->obj = obj;
+    threadVar = 0;
+    returnTyp = rt;
+    retVar = 0;
+    pausiert = 0;
+    beendet = 0;
+    breakB = 0;
+    continueB = 0;
+    scrId = obj->getScriptId();
 }
 
 // Destruktor
 KSGSFunktionInstanz::~KSGSFunktionInstanz()
 {
-	lokaleVariablen->release();
-	befehle->release();
-	if( klasse )
-	    klasse->release();
-	obj->release();
-	if( threadVar )
-		threadVar->release();
-	if( retVar )
-		retVar->release();
+    lokaleVariablen->release();
+    befehle->release();
+    if( klasse )
+        klasse->release();
+    obj->release();
+    if( threadVar )
+        threadVar->release();
+    if( retVar )
+        retVar->release();
 }
 
 // privat
@@ -56,264 +55,248 @@ void KSGSFunktionInstanz::unlock()
 // nicht constant
 void KSGSFunktionInstanz::setParameter( Array< KSGSVariableDef* > *zDef, RCArray< KSGSVariable > *vars )
 {
-	int anz = zDef->getEintragAnzahl();
-	for( int i = 0; i < anz; i++ )
-	{
-		int id = zDef->get( i )->id;
-		if( vars->z( id ) )
-		{
-			if( zDef->get( i )->typId != vars->z( id )->getTyp() )
-			{
-				KSGSVariable *var = vars->z( id )->umwandelnIn( zDef->get( i )->typId );
-				if( !var )
-					lokaleVariablen->set( KSGSKlasseInstanz::erstellVariable( obj, zDef->get( i ) ), id );
-				else
-					lokaleVariablen->set( var, id );
-			}
-			else
-				lokaleVariablen->set( vars->get( id ), id );
-		}
-		else
-			lokaleVariablen->set( KSGSKlasseInstanz::erstellVariable( obj, zDef->get( i ) ), id );
-	}
-	vars->release();
+    int anz = zDef->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+    {
+        int id = zDef->get( i )->id;
+        if( vars->z( id ) )
+        {
+            if( zDef->get( i )->typId != vars->z( id )->getTyp() )
+            {
+                KSGSVariable *var = vars->z( id )->umwandelnIn( zDef->get( i )->typId );
+                if( !var )
+                    lokaleVariablen->set( KSGSKlasseInstanz::erstellVariable( obj, zDef->get( i ) ), id );
+                else
+                    lokaleVariablen->set( var, id );
+            }
+            else
+                lokaleVariablen->set( vars->get( id ), id );
+        }
+        else
+            lokaleVariablen->set( KSGSKlasseInstanz::erstellVariable( obj, zDef->get( i ) ), id );
+    }
+    vars->release();
 }
 
 void KSGSFunktionInstanz::setReturnVariable( KSGSVariable *var )
 {
-	if( var->getTyp() != returnTyp )
-	{
-		error( 15, {}, obj );
-		KSGSVariable *tmp = var->umwandelnIn( returnTyp );
-		var->release();
-		var = tmp;
-	}
-	lock();
-	if( retVar )
-		retVar->release();
-	retVar = var;
-	unlock();
+    if( var->getTyp() != returnTyp )
+    {
+        error( 15, {}, obj );
+        KSGSVariable *tmp = var->umwandelnIn( returnTyp );
+        var->release();
+        var = tmp;
+    }
+    lock();
+    if( retVar )
+        retVar->release();
+    retVar = var;
+    unlock();
 }
 
 void KSGSFunktionInstanz::setPause( bool p )
 {
-	pausiert = p;
+    pausiert = p;
 }
 
 void KSGSFunktionInstanz::setContinue()
 {
-	continueB = 1;
+    continueB = 1;
 }
 
 void KSGSFunktionInstanz::setBreak()
 {
-	breakB = 0;
+    breakB = 0;
 }
 
 void KSGSFunktionInstanz::setEnde()
 {
-	beendet = 1;
+    beendet = 1;
 }
 
 KSGSVariable *KSGSFunktionInstanz::startFunktion()
 {
-	if( run )
-		return 0;
-	if( threadVar )
-		threadVar = (KSGSThreadKlasse*)threadVar->release();
-	if( retVar )
-		retVar = retVar->release();
-	if( returnTyp == KSGS_THREAD )
-	{
-		threadVar = new KSGSThreadKlasse( obj, getThis() );
-		start();
-		return threadVar->getThis();
-	}
-	else
-	{
-		run = 1;
-		thread();
-		warteAufFunktion( INFINITE );
-		return retVar ? retVar->getThis() : 0;
-	}
+    if( run )
+        return 0;
+    if( threadVar )
+        threadVar = (KSGSThreadKlasse*)threadVar->release();
+    if( retVar )
+        retVar = retVar->release();
+    if( returnTyp == KSGS_THREAD )
+    {
+        threadVar = new KSGSThreadKlasse( obj, (KSGSFunktionInstanz*)getThis() );
+        start();
+        return threadVar->getThis();
+    }
+    else
+    {
+        run = 1;
+        thread();
+        warteAufFunktion( INFINITE );
+        return retVar ? retVar->getThis() : 0;
+    }
 }
 
 void KSGSFunktionInstanz::thread()
 {
-	getThis();
-	int anz = befehle->getEintragAnzahl();
-	for( int i = 0; i < anz; i++ )
-	{
-		while( pausiert && !beendet && !obj->istBeendet( scrId ) )
-			Sleep( 100 );
-		if( obj->istBeendet( scrId ) || beendet )
-			break;
-		KSGSBefehl *b = befehle->z( i );
-		if( b )
-		{
-			KSGSVariable *var = b->ausführen( obj, this, klasse );
-			if( var )
-				var->release();
-		}
-	}
-	run = 0;
-	if( threadVar )
-	{
-		threadVar->threadEnde();
-		threadVar = (KSGSThreadKlasse*)threadVar->release();
-	}
-	release();
+    getThis();
+    int anz = befehle->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+    {
+        while( pausiert && !beendet && !obj->istBeendet( scrId ) )
+            Sleep( 100 );
+        if( obj->istBeendet( scrId ) || beendet )
+            break;
+        KSGSBefehl *b = befehle->z( i );
+        if( b )
+        {
+            KSGSVariable *var = b->ausführen( obj, this, klasse );
+            if( var )
+                var->release();
+        }
+    }
+    run = 0;
+    if( threadVar )
+    {
+        threadVar->threadEnde();
+        threadVar = (KSGSThreadKlasse*)threadVar->release();
+    }
+    release();
 }
 
 int KSGSFunktionInstanz::getStatus()
 {
-	if( !isRunning() || beendet )
-		return 0;
-	if( pausiert )
-		return 1;
-	if( breakB )
-	{
-		breakB = 0;
-		return 2;
-	}
-	if( continueB )
-	{
-		continueB = 0;
-		return 3;
-	}
-	return 4;
+    if( !isRunning() || beendet )
+        return 0;
+    if( pausiert )
+        return 1;
+    if( breakB )
+    {
+        breakB = 0;
+        return 2;
+    }
+    if( continueB )
+    {
+        continueB = 0;
+        return 3;
+    }
+    return 4;
 }
 
 void KSGSFunktionInstanz::setVariable( int id, KSGSVariable *var )
 {
-	lokaleVariablen->set( var, id );
+    lokaleVariablen->set( var, id );
 }
 
 // constant
 KSGSVariable *KSGSFunktionInstanz::getVariable( int id ) const
 {
-	return lokaleVariablen->get( id );
+    return lokaleVariablen->get( id );
 }
 
 int KSGSFunktionInstanz::getReturnTyp() const
 {
-	return returnTyp;
+    return returnTyp;
 }
 
 bool KSGSFunktionInstanz::wirdFunktionAusgeführt() const
 {
-	return isRunning();
+    return isRunning();
 }
 
 int KSGSFunktionInstanz::warteAufFunktion( int zeit )
 {
-	if( run )
-		return warteAufThread( zeit );
-	return 0;
+    if( run )
+        return warteAufThread( zeit );
+    return 0;
 }
 
 bool KSGSFunktionInstanz::wirdAusgeführt() const
 {
-	return isRunning() && !beendet && !pausiert;
+    return isRunning() && !beendet && !pausiert;
 }
 
-// Reference Counting
-KSGSFunktionInstanz *KSGSFunktionInstanz::getThis()
-{
-	ref++;
-	return this;
-}
-
-KSGSFunktionInstanz *KSGSFunktionInstanz::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
-
 // Inhalt der KSGSFunktion Klasse aus KSGSFunktion.h
 // Konstruktor
 KSGSFunktion::KSGSFunktion( int id, int sichtbar, int typ )
-	: typId( typ ),
-	  sichtbar( sichtbar ),
-	  id( id ),
-	  ref( 1 )
+    : typId( typ ),
+    sichtbar( sichtbar ),
+    id( id ),
+    ref( 1 )
 {
-	befehle = new RCArray< KSGSBefehl >();
-	parameter = new Array< KSGSVariableDef* >();
-	name = "";
+    befehle = new RCArray< KSGSBefehl >();
+    parameter = new Array< KSGSVariableDef* >();
+    name = "";
 }
 
 // Destruktor
 KSGSFunktion::~KSGSFunktion()
 {
-	if( befehle )
-		befehle->release();
-	int anz = parameter->getEintragAnzahl();
-	for( int i = 0; i < anz; i++ )
-		delete parameter->get( i );
-	if( parameter )
-		parameter->release();
+    if( befehle )
+        befehle->release();
+    int anz = parameter->getEintragAnzahl();
+    for( int i = 0; i < anz; i++ )
+        delete parameter->get( i );
+    if( parameter )
+        parameter->release();
 }
 
 // nicht constant
 void KSGSFunktion::setName( const char *txt )
 {
-	name = txt;
+    name = txt;
 }
 
 void KSGSFunktion::addParameter( KSGSVariableDef *var )
 {
-	parameter->add( var );
+    parameter->add( var );
 }
 
 void KSGSFunktion::addBefehl( KSGSBefehl *befehl )
 {
-	befehle->add( befehl );
+    befehle->add( befehl );
 }
 
 KSGSFunktionInstanz *KSGSFunktion::erstellInstanz( KSGScriptObj *obj, KSGSVariable *klasse, RCArray< KSGSVariable > *params )
 {
-	KSGSFunktionInstanz *inst = new KSGSFunktionInstanz( befehle->getThis(), typId, obj, klasse );
-	if( params )
-		inst->setParameter( parameter, params );
-	return inst;
+    KSGSFunktionInstanz *inst = new KSGSFunktionInstanz( befehle->getThis(), typId, obj, klasse );
+    if( params )
+        inst->setParameter( parameter, params );
+    return inst;
 }
 
 // constant
 int KSGSFunktion::getId() const
 {
-	return id;
+    return id;
 }
 
 int KSGSFunktion::getTypId() const
 {
-	return typId;
+    return typId;
 }
 
 int KSGSFunktion::getSichtbarkeit() const
 {
-	return sichtbar;
+    return sichtbar;
 }
 
 bool KSGSFunktion::hatName( const char *txt ) const
 {
-	return name.istGleich( txt );
+    return name.istGleich( txt );
 }
 
 // Reference Counting
 KSGSFunktion *KSGSFunktion::getThis()
 {
-	ref++;
-	return this;
+    ref++;
+    return this;
 }
 
 KSGSFunktion *KSGSFunktion::release()
 {
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
+    ref--;
+    if( !ref )
+        delete this;
+    return 0;
 }

+ 3 - 7
ksgScript/Befehl/KSGSFunktion.h

@@ -13,7 +13,7 @@ namespace KSGScript
     class KSGSVariable;
     struct KSGSVariableDef;
 
-	class KSGSFunktionInstanz : private Thread
+	class KSGSFunktionInstanz : public Thread
 	{
 	protected:
 		RCArray< KSGSVariable > *lokaleVariablen;
@@ -30,7 +30,6 @@ namespace KSGScript
 		bool continueB;
 		bool breakB;
 		int scrId;
-		int ref;
 
 		// privat
 		__declspec( dllexport ) virtual void lock();
@@ -40,7 +39,7 @@ namespace KSGScript
 		// Konstruktor
 		__declspec( dllexport ) KSGSFunktionInstanz( RCArray< KSGSBefehl > *ba, int rt, KSGScriptObj *obj, KSGSVariable *klasse );
 		// Destruktor
-		__declspec( dllexport ) ~KSGSFunktionInstanz();
+		__declspec( dllexport ) virtual ~KSGSFunktionInstanz();
 		// nicht constant
 		__declspec( dllexport ) virtual void setParameter( Array< KSGSVariableDef* > *zDef, RCArray< KSGSVariable > *vars );
 		__declspec( dllexport ) virtual void setReturnVariable( KSGSVariable *var );
@@ -58,9 +57,6 @@ namespace KSGScript
 		__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
@@ -78,7 +74,7 @@ namespace KSGScript
 		// Konstruktor
 		__declspec( dllexport ) KSGSFunktion( int id, int sichtbar, int typ );
 		// Destruktor
-		__declspec( dllexport ) ~KSGSFunktion();
+		__declspec( dllexport ) virtual ~KSGSFunktion();
 		// nicht constant
 		__declspec( dllexport ) virtual void setName( const char *txt );
 		__declspec( dllexport ) virtual void addParameter( KSGSVariableDef *var );

+ 1 - 1
ksgScript/Befehl/KSGSKlasse.h

@@ -26,7 +26,7 @@ namespace KSGScript
 		// Konstruktor
 		KSGSKlasseInstanz( int typ, Array< KSGSVariableDef* > *zVars, RCArray< KSGSFunktion > *funcs, KSGScriptObj *zObj );
 		// Destruktor
-		~KSGSKlasseInstanz();
+		virtual ~KSGSKlasseInstanz();
 		// nicht constant
 		virtual KSGSVariable *startFunktion( int id, bool zugriff, RCArray< KSGSVariable > *parameter ) override;
 		virtual KSGSVariable *doOperator( int id, KSGSVariable *rechts ) override;

+ 0 - 15
ksgScript/Editor/Parser/ColorParser.cpp

@@ -12,7 +12,6 @@ const int ColorParser::typeAnz = 16;
 ColorParser::ColorParser( Text *zTxt )
 {
     pfad = new Text( "" );
-    ref = 1;
     txt = zTxt->getThis();
     reset();
     reload();
@@ -367,18 +366,4 @@ KSGScriptEditor::ColorType ColorParser::getNextColor( int p, int &underlineC )
             underlineC = KSGScriptEditor::ColorType::ERROR_UNDERLINE;
     }
     return color;
-}
-
-// Reference Counting
-ColorParser *ColorParser::getThis()
-{
-    ref++;
-    return this;
-}
-
-ColorParser *ColorParser::release()
-{
-    if( !--ref )
-        delete this;
-    return 0;
 }

+ 1 - 5
ksgScript/Editor/Parser/ColorParser.h

@@ -7,7 +7,7 @@ using namespace Framework;
 
 namespace KSGScript
 {
-    class ColorParser : private KSGSLeser
+    class ColorParser : public KSGSLeser
     {
     private:
         struct Position
@@ -33,7 +33,6 @@ namespace KSGScript
         Array< TextAbschnitt > error;
         Array< TextAbschnitt > kommentar;
         Array< TextAbschnitt > string;
-        int ref;
         Text *txt;
         Text *wd;
         Position pos;
@@ -60,8 +59,5 @@ namespace KSGScript
         KSGSLeseFunktion *leseFunktion() override;
         // Gibt den Farbtyp des nächsten Zeichens zurück
         KSGScriptEditor::ColorType getNextColor( int pos, int &underlineC );
-        // Reference Counting
-        ColorParser *getThis();
-        ColorParser *release();
     };
 }

+ 0 - 18
ksgScript/Funktionen/KSGSRückruf.cpp

@@ -33,15 +33,6 @@ KSGSVariable *KSGSR
 	return obj->rückruf( parameter ? parameter->getThis() : new RCArray< KSGSVariable >() );
 }
 
-// Reference Counting
-KSGSFunktionInstanz *KSGSRückrufInstanz::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
-}
-
 
 // Inhalt der KSGSRückrufFunktion Klasse aus KSGSRückruf.h
 // Konstruktor
@@ -57,13 +48,4 @@ KSGSFunktionInstanz *KSGSR
 	if( params )
 		inst->setParameter( 0, params );
 	return inst;
-}
-
-// Reference Counting
-KSGSFunktion *KSGSRückrufFunktion::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 4
ksgScript/Funktionen/KSGSRückruf.h

@@ -17,8 +17,6 @@ namespace KSGScript
 		// nicht constant
 		__declspec( dllexport ) virtual void setParameter( Array< KSGSVariableDef* > *zDef, RCArray< KSGSVariable > *vars ) override;
 		__declspec( dllexport ) virtual KSGSVariable *startFunktion() override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSFunktionInstanz *release();
 	};
 
 	class KSGSRückrufFunktion : public KSGSFunktion
@@ -28,7 +26,5 @@ namespace KSGScript
 		__declspec( dllexport ) KSGSRückrufFunktion();
 		// nicht constant
 		__declspec( dllexport ) virtual KSGSFunktionInstanz *erstellInstanz( KSGScriptObj *obj, KSGSVariable *klasse, RCArray< KSGSVariable > *params );
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSFunktion *release();
 	};
 }

+ 0 - 9
ksgScript/Klassen/KSGSAnimation2D.cpp

@@ -191,13 +191,4 @@ Animation2D *KSGSAnimation2DKlasse::getVal() const
 Animation2D *KSGSAnimation2DKlasse::zVal() const
 {
     return val;
-}
-
-// Reference Counting
-KSGSVariable *KSGSAnimation2DKlasse::release()
-{
-    ref--;
-    if( !ref )
-        delete this;
-    return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSAnimation2D.h

@@ -23,8 +23,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual Animation2D *getVal() const;
 		__declspec( dllexport ) virtual Animation2D *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSAnimation2DData.cpp

@@ -135,13 +135,4 @@ Animation2DData *KSGSAnimation2DDataKlasse::getVal() const
 Animation2DData *KSGSAnimation2DDataKlasse::zVal() const
 {
 	return val;
-}
-
-// Reference Counting
-KSGSVariable *KSGSAnimation2DDataKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSAnimation2DData.h

@@ -22,8 +22,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual Animation2DData *getVal() const;
 		__declspec( dllexport ) virtual Animation2DData *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSArray.cpp

@@ -119,13 +119,4 @@ RCArray< KSGSVariable > *KSGSArrayKlasse::getVal() const
 RCArray< KSGSVariable > *KSGSArrayKlasse::zVal() const
 {
 	return val;
-}
-
-// Reference Counting
-KSGSVariable *KSGSArrayKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSArray.h

@@ -22,8 +22,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual RCArray< KSGSVariable > *getVal() const;
 		__declspec( dllexport ) virtual RCArray< KSGSVariable > *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 12 - 12
ksgScript/Klassen/KSGSBild.cpp

@@ -52,9 +52,18 @@ KSGSVariable *KSGSBildKlasse::startFunktion( int id, bool access, RCArray< KSGSV
 	case 3: // void alphaPixel( int, int, int )
 		if( parameter->getEintragAnzahl() < 3 )
 			error( 20, {}, obj );
-		val->alphaPixelDP( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0,
-						   parameter->z( 1 ) ? parameter->z( 1 )->getInt() : 0,
-						   parameter->z( 2 ) ? parameter->z( 2 )->getInt() : 0 );
+        if( val->hasAlpha3D() )
+        {
+            val->alphaPixelDP3D( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0,
+                                 parameter->z( 1 ) ? parameter->z( 1 )->getInt() : 0,
+                                 parameter->z( 2 ) ? parameter->z( 2 )->getInt() : 0 );
+        }
+        else
+        {
+            val->alphaPixelDP2D( parameter->z( 0 ) ? parameter->z( 0 )->getInt() : 0,
+                                 parameter->z( 1 ) ? parameter->z( 1 )->getInt() : 0,
+                                 parameter->z( 2 ) ? parameter->z( 2 )->getInt() : 0 );
+        }
 		break;
 	case 4: // void setPixel( int, int, int )
 		if( parameter->getEintragAnzahl() < 3 )
@@ -315,13 +324,4 @@ Bild *KSGSBildKlasse::getVal() const
 Bild *KSGSBildKlasse::zVal() const
 {
 	return val;
-}
-
-// Reference Counting
-KSGSVariable *KSGSBildKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSBild.h

@@ -23,8 +23,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual Bild *getVal() const;
 		__declspec( dllexport ) virtual Bild *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSBildZ.cpp

@@ -221,15 +221,6 @@ BildZ *KSGSBildZKlasse::zVal() const
     return val;
 }
 
-// Reference Counting
-KSGSVariable *KSGSBildZKlasse::release()
-{
-    ref--;
-    if( !ref )
-        delete this;
-    return 0;
-}
-
 
 // Ereignisse
 bool KSGScript::ksgsBildZME( void *var, void *obj, MausEreignis me )

+ 0 - 2
ksgScript/Klassen/KSGSBildZ.h

@@ -25,8 +25,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual BildZ *getVal() const;
 		__declspec( dllexport ) virtual BildZ *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 
 	// Ereignisse

+ 0 - 9
ksgScript/Klassen/KSGSBool.cpp

@@ -133,13 +133,4 @@ KSGSVariable *KSGSBoolKlasse::umwandelnIn( int typ ) const
 	}
 	error( 16, {}, obj );
 	return 0;
-}
-
-// Reference Counting
-KSGSVariable *KSGSBoolKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSBool.h

@@ -20,8 +20,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual bool getVal() const;
 		__declspec( dllexport ) virtual KSGSVariable *umwandelnIn( int typ ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSDouble.cpp

@@ -157,13 +157,4 @@ KSGSVariable *KSGSDoubleKlasse::umwandelnIn( int typ ) const
 	}
 	error( 16, {}, obj );
 	return 0;
-}
-
-// Reference Counting
-KSGSVariable *KSGSDoubleKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSDouble.h

@@ -21,8 +21,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual double getVal() const;
 		__declspec( dllexport ) virtual KSGSVariable *umwandelnIn( int typ ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 10
ksgScript/Klassen/KSGSFenster.cpp

@@ -510,16 +510,6 @@ Fenster *KSGSFensterKlasse::zVal() const
     return val;
 }
 
-// Reference Counting
-KSGSVariable *KSGSFensterKlasse::release()
-{
-    ref--;
-    if( !ref )
-        delete this;
-    return 0;
-}
-
-
 // Ereignisse
 bool KSGScript::ksgsFensterME( void *var, void *obj, MausEreignis me )
 {

+ 0 - 2
ksgScript/Klassen/KSGSFenster.h

@@ -26,8 +26,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual Fenster *getVal() const;
 		__declspec( dllexport ) virtual Fenster *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 
 	// Ereignisse

+ 0 - 9
ksgScript/Klassen/KSGSInt.cpp

@@ -157,13 +157,4 @@ KSGSVariable *KSGSIntKlasse::umwandelnIn( int typ ) const
 	}
 	error( 16, {}, obj );
 	return 0;
-}
-
-// Reference Counting
-KSGSVariable *KSGSIntKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSInt.h

@@ -21,8 +21,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual int getVal() const;
 		__declspec( dllexport ) virtual KSGSVariable *umwandelnIn( int typ ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSKnopf.cpp

@@ -313,15 +313,6 @@ Knopf *KSGSKnopfKlasse::zVal() const
     return val;
 }
 
-// Reference Counting
-KSGSVariable *KSGSKnopfKlasse::release()
-{
-    ref--;
-    if( !ref )
-        delete this;
-    return 0;
-}
-
 
 // Ereignisse
 bool KSGScript::ksgsKnopfME( void *var, void *obj, MausEreignis me )

+ 0 - 2
ksgScript/Klassen/KSGSKnopf.h

@@ -24,8 +24,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual Knopf *getVal() const;
 		__declspec( dllexport ) virtual Knopf *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 
 	// Ereignisse

+ 0 - 9
ksgScript/Klassen/KSGSMausEreignis.cpp

@@ -126,13 +126,4 @@ KSGSVariable *KSGSMausEreignisKlasse::getVariable( int id, bool zugriff ) const
 MausEreignis KSGSMausEreignisKlasse::getVal() const
 {
 	return val;
-}
-
-// Reference Counting
-KSGSVariable *KSGSMausEreignisKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSMausEreignis.h

@@ -23,8 +23,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *getVariable( int id, bool zugriff ) const override;
 		__declspec( dllexport ) virtual MausEreignis getVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSTastaturEreignis.cpp

@@ -102,13 +102,4 @@ KSGSVariable *KSGSTastaturEreignisKlasse::getVariable( int id, bool zugriff ) co
 TastaturEreignis KSGSTastaturEreignisKlasse::getVal() const
 {
 	return val;
-}
-
-// Reference Counting
-KSGSVariable *KSGSTastaturEreignisKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSTastaturEreignis.h

@@ -23,8 +23,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual KSGSVariable *getVariable( int id, bool zugriff ) const override;
 		__declspec( dllexport ) virtual TastaturEreignis getVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSText.cpp

@@ -217,13 +217,4 @@ KSGSVariable *KSGSTextKlasse::umwandelnIn( int typ ) const
 	}
 	error( 16, {}, obj );
 	return 0;
-}
-
-// Reference Counting
-KSGSVariable *KSGSTextKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSText.h

@@ -22,8 +22,6 @@ namespace KSGScript
 		__declspec( dllexport ) virtual Text *getVal() const;
 		__declspec( dllexport ) virtual Text *zVal() const;
 		__declspec( dllexport ) virtual KSGSVariable *umwandelnIn( int typ ) const override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 0 - 9
ksgScript/Klassen/KSGSTextFeld.cpp

@@ -396,15 +396,6 @@ TextFeld *KSGSTextFeldKlasse::zVal() const
     return val;
 }
 
-// Reference Counting
-KSGSVariable *KSGSTextFeldKlasse::release()
-{
-    ref--;
-    if( !ref )
-        delete this;
-    return 0;
-}
-
 
 // Ereignisse
 bool KSGScript::ksgsTextFeldME( void *var, void *obj, MausEreignis me )

+ 0 - 2
ksgScript/Klassen/KSGSTextFeld.h

@@ -26,8 +26,6 @@ namespace KSGScript
 		// constant
 		__declspec( dllexport ) virtual TextFeld *getVal() const;
 		__declspec( dllexport ) virtual TextFeld *zVal() const;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 
 	// Ereignisse

+ 1 - 10
ksgScript/Klassen/KSGSThread.cpp

@@ -25,7 +25,7 @@ KSGSThreadKlasse::~KSGSThreadKlasse()
 void KSGSThreadKlasse::threadEnde()
 {
 	if( func )
-		func = func->release();
+		func = (KSGSFunktionInstanz*)func->release();
 }
 
 KSGSVariable *KSGSThreadKlasse::startFunktion( int id, bool access, RCArray< KSGSVariable > *parameter )
@@ -69,13 +69,4 @@ KSGSVariable *KSGSThreadKlasse::startFunktion( int id, bool access, RCArray< KSG
 	}
 	parameter->release();
 	return 0;
-}
-
-// Reference Counting
-KSGSVariable *KSGSThreadKlasse::release()
-{
-	ref--;
-	if( !ref )
-		delete this;
-	return 0;
 }

+ 0 - 2
ksgScript/Klassen/KSGSThread.h

@@ -18,8 +18,6 @@ namespace KSGScript
 		// nicht constant
 		__declspec( dllexport ) void threadEnde();
 		__declspec( dllexport ) virtual KSGSVariable *startFunktion( int id, bool access, RCArray< KSGSVariable > *parameter ) override;
-		// Reference Counting
-		__declspec( dllexport ) virtual KSGSVariable *release() override;
 	};
 }
 

+ 1 - 1
ksgScript/Leser/KSGSLeser.h

@@ -130,7 +130,7 @@ namespace KSGScript
 		// Konstruktor
 		__declspec( dllexport ) KSGSLeser( const char *pfad, KSGScriptO *zObj );
 		// Destruktor
-		__declspec( dllexport ) ~KSGSLeser();
+		__declspec( dllexport ) virtual ~KSGSLeser();
 		// nicht constant
 		__declspec( dllexport ) bool laden();
 		__declspec( dllexport ) bool compile( RCArray< KSGSKlasse > *klassen, RCArray< KSGSFunktion > *funktionen, Array< KSGSVariableDef* > *variablen );