mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +00:00
correct intermediate code output of pointers in arrayvalues
This commit is contained in:
parent
ce8853ab50
commit
f3c1783bf2
@ -459,13 +459,23 @@ class IntermediateProgram(val name: String, var loadAddress: Int, val heap: Heap
|
||||
out.println("%end_memory")
|
||||
out.println("%heap")
|
||||
heap.allEntries().forEach {
|
||||
out.print("${it.key} ${it.value.type.name.toLowerCase()} ")
|
||||
when {
|
||||
it.value.str!=null ->
|
||||
out.println("${it.key} ${it.value.type.name.toLowerCase()} \"${escape(it.value.str!!)}\"")
|
||||
it.value.array!=null ->
|
||||
out.println("${it.key} ${it.value.type.name.toLowerCase()} ${it.value.array!!.toList()}")
|
||||
out.println("\"${escape(it.value.str!!)}\"")
|
||||
it.value.array!=null -> {
|
||||
// this array can contain both normal integers, and pointer values
|
||||
val arrayvalues = it.value.array!!.map { av ->
|
||||
when {
|
||||
av.integer!=null -> av.integer.toString()
|
||||
av.pointerOf!=null -> "&${av.pointerOf.identifier}"
|
||||
else -> throw CompilerException("weird array value")
|
||||
}
|
||||
}
|
||||
out.println(arrayvalues)
|
||||
}
|
||||
it.value.doubleArray!=null ->
|
||||
out.println("${it.key} ${it.value.type.name.toLowerCase()} ${it.value.doubleArray!!.toList()}")
|
||||
out.println(it.value.doubleArray!!.toList())
|
||||
else -> throw CompilerException("invalid heap entry $it")
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
~ main {
|
||||
|
||||
sub start() {
|
||||
;aggregates()
|
||||
pointers()
|
||||
aggregates()
|
||||
;pointers()
|
||||
}
|
||||
|
||||
sub aggregates() {
|
||||
@ -51,7 +51,7 @@
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print_uw(min(uwa))
|
||||
c64.CHROUT(' ')
|
||||
c64flt.print_f(min(fa)) ; @todo fix min(floatarray)
|
||||
c64flt.print_f(min(fa)) ; @todo fix min(floatarray) (vm is ok)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
c64scr.print_b(max(ba))
|
||||
@ -62,7 +62,7 @@
|
||||
c64.CHROUT(' ')
|
||||
c64scr.print_uw(max(uwa))
|
||||
c64.CHROUT(' ')
|
||||
c64flt.print_f(max(fa)) ; @todo fix max(floatarray)
|
||||
c64flt.print_f(max(fa)) ; @todo fix max(floatarray) (vm is ok)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
c64scr.print_uw(sum(ba))
|
||||
@ -110,9 +110,9 @@
|
||||
;ptrsubasm("moet werken") ; @todo rewrite ast into pointer-of expression (and remove special cases from Compiler)
|
||||
;pointersub("moet werken") ; @todo rewrite ast into pointer-of expression (and remove special cases from Compiler)
|
||||
|
||||
myprintasm("moet werken3")
|
||||
myprintasm("moet werken3")
|
||||
myprintasm("moet werken4")
|
||||
;myprintasm("moet werken3")
|
||||
;myprintasm("moet werken3")
|
||||
;myprintasm("moet werken4")
|
||||
|
||||
c64.CHROUT('\n')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user