Hi Gernot!
So erstmal der Code, evtl. fällts dir selber auf!:
PROTOTYPE P_TTest: t AS TTest, text$, x, y
PROTOTYPE P_1Args: t AS TTest
PROTOTYPE P_String$: t AS TTest
TYPE TTest
x;y
text$
test AS P_TTest = F_TTest
GetX AS P_1Args = F_GetX
GetY AS P_1Args = F_GetY
GetText$ AS P_String$ = F_GetText$
ENDTYPE
GLOBAL _TTest AS TTest
LOCAL test AS TTest
test.test(test,"Blabla",10,20)
WHILE TRUE
SHOWSCREEN
WEND
END
FUNCTION F_TTest: t AS TTest, text$, x = 0 , y = 0
t.x = x
t.y = y
ENDFUNCTION
FUNCTION F_GetText$: t AS TTest
RETURN t.text$
ENDFUNCTION
FUNCTION F_GetX: t AS TTest
RETURN t.x
ENDFUNCTION
FUNCTION F_GetY: t AS TTest
RETURN t.y
ENDFUNCTION
Richtig! Es können keine String-Funktionen von PROTOTYPES verarbeitet werden.
Und das "t AS TTest" ist auch (hoffentlich nicht mehr lange)nervig :) :whip:
Hast du schon irgend einen Plan, wie man das lösen "KÃâ€"NNTE" :-[
sowas wär doch auch ne nette Lösung(sofern es überhaupt machbar wäre):
PROTOTYPE P_TTest CALLTYPE TTest: text$, x, y
TYPE TTest
x;y
text$
test AS P_TTest = F_TTest
ENDTYPE
...
FUNCTION F_TTest CALLTYPE TTest: text$, x, y
TTest.text$ = text$ // Hier TTest nehmen um es übersichtlich zu halten?! oder doch lieber this/self?
TTest.x = x
TTest.y = y
ENDFUNCTION
CALLTYPE würde hier prüfen beim aufruf der Funktion, ob es sich um eine TTest Instanz handelt:
LOCAL test AS TTest // instanz erstellen
test.test("test",10,20)
Oh mei. Das wäre ja dann Generics (Template) programming. Das ist echt kein BASIC mehr. Dafür gibt's doch INLINE.
Die Strings sind bug. Grrr. ;)
PROTOTYPE func_proto$: a
TYPE Tfoo
moo AS func_proto$
ENDTYPE
LOCAL pFoo$ AS func_proto$
IF pFoo$=FALSE THEN STDOUT "has no pointer\n"
pFoo$ = f1$
pFoo$(1)
pFoo$ = f2$
pFoo$(2)
call(pFoo$)
LOCAL tp AS Tfoo
tp.moo = f1$
tp.moo(4)
ALIAS fkt AS tp.moo
fkt(5)
KEYWAIT
FUNCTION f1$: one
STDOUT "f1: "+one+"\n"
ENDFUNCTION
FUNCTION f2$: a
RETURN "test"
STDOUT "f2: "+a+"\n"
ENDFUNCTION
FUNCTION call: foo$ AS func_proto$
foo$(3)
ENDFUNCTION
geht im nächsten Update. Wie ekelhaft.
ich hätte dann doch bitte gern inline asm :D
INLINE
__asm {
...
}
ENDINLINE
na super. Gibt es dann demnächst auch eine Schnittstelle zu einem Lochkarten-Lesegerät? :)
INLINE
__lochkart {
001001001-0
110100111-0
001000101-1
}
ENDINLINE
wir brauchen ein Sarkasmus tag im editor ;)
xD
:offtopic: