
Maps,Listen und Array pointer solltest du aber Ignorieren. Die hatte ich gerade etwas verdraengt

Code: Alles auswählen
Class Test
Public Method Testit()
Debug "test"
EndMethod
EndClass
*Hallo.Test = NewObject()
*Hallo\Testit()
; bis hierher funktionierts!
; wenn ich die folgende Zeile hinzufüge kommt der Fehler:
*Hallo.Test = FreeObject()
Code: Alles auswählen
Procedure Test(List *myList.point())
*p.point = AddElement(*myList())
*p\x = 10
*p\y = 12
EndProcedure
NewList MyList.point()
Test(@MyList())
ForEach MyList()
Debug MyList()\x
Debug MyList()\y
Next
Code: Alles auswählen
Class Test
Public NewMap myMap.point()
;[...]
EndClass
*t.Test = NewObject
*t\myMap("1")\x = 10
*t\myMap("1")\y = 10
*t\myMap("2")\x = 11
*t\myMap("2")\y = 11
Code: Alles auswählen
Macro NewInstancMap(Class,Instance,typ)
NewMap Class#Instance#.typ()
EndMacro
Macro GetNameMap(Class,Instance,typ)
Class#Instance#.typ
EndMacro
NewInstancMap(test,12,point)
GetNameMap(test,12,point)("pos1")\x = 10
GetNameMap(test,12,point)("pos1")\y = 11
GetNameMap(test,12,point)("pos2")\x = 13
GetNameMap(test,12,point)("pos2")\y = 14
ForEach GetNameMap(test,12,point)()
Debug GetNameMap(test,12,point)()\x
Debug GetNameMap(test,12,point)()\y
Debug "---------"
Next
Code: Alles auswählen
Class Test
Public NewMap myMap.struc0()
Public Method Save(var.i)
This\myMap("pos",var)
EndMethod
EndClass
*t.test = NewObject
*t\Save(12)
Debug *t\myMap("pos")
*a.test = NewObject
*a\myMap("pos") = 10
Code: Alles auswählen
! Macro copyMap_g Map,TempMap{ ; global
! MOV eax,[v_#Map] ; eax fuer x86, rax fuer 64 bit
! MOV [m_#TempMap],eax ; eax fuer x86, rax fuer 64 bit
!}
! Macro copyMap_p Map,TempMap{ ; proc
! MOV eax,[p.v_#Map] ; eax fuer x86, rax fuer 64 bit
! MOV [m_#TempMap],eax ; eax fuer x86, rax fuer 64 bit
!}
Macro ChangeMapProc(_a,_b)
!copyMap_p _a,_b
EndMacro
Macro ChangeMapGlobal(_a,_b)
!copyMap_g _a,_b
EndMacro
;-------------test
Procedure CreateMyClassMap()
Global NewMap temp_map() ;hier muss man noch die Struktur anpassen, je nachdem welcher Typ die Map haben soll
!mov eax,[m_temp_map] ; eax fuer x86, rax fuer 64 bit
ProcedureReturn
EndProcedure
Global NewMap myClassMap() ;hier muss man noch die Struktur anpassen, je nachdem welcher Typ die Map haben soll
Procedure Methode(Map) : ChangeMapProc(Map,myClassMap)
myClassMap("1") = Random(10)
myClassMap("2") = Random(10)
myClassMap("3") = Random(10)
EndProcedure
Procedure Methode2(Map) : ChangeMapProc(Map,myClassMap)
ForEach myClassMap()
Debug myClassMap()
Next
EndProcedure
myMapVar1 = CreateMyClassMap() : ChangeMapGlobal(myMapVar1,myClassMap)
Methode(myMapVar1)
myMapVar2 = CreateMyClassMap() : ChangeMapGlobal(myMapVar2,myClassMap)
Methode(myMapVar2)
Methode2(myMapVar1)
Debug "------"
Methode2(myMapVar2)
Debug "------"
Methode2(myMapVar1)
Code: Alles auswählen
module Component1
def comp1hallo
puts "hallo1"
end
end
module Component2
def comp2hallo
puts "hallo2"
end
end
module Component3
def comp2hallo
puts "hallo3"
end
end
class Class1
include Component1
include Component2
end
class Class2
include Component1
include Component3
end
c1 = Class1.new
c2 = Class2.new
c1.comp1hallo
c1.comp2hallo
c2.comp1hallo
c2.comp2hallo
Code: Alles auswählen
hallo1
hallo2
hallo1
hallo3