O2 now supports multidimensional arrays. To be compatible with thinBasic and PowerBasic it must use Column-major order for which there is a switch: #minormajor. Otherwise, the default is row-major as in C and FreeBasic: #majorminor
uses "oxygen"
'SHARED VARIABLES
'================
dim as string src
dim as single v(4,4)
'
'OXYGENBASIC SECTION
'===================
src="
#minormajor 'thinBasic and Powerbasic mode
indexbase 1
overlay single v(4,4)
@v=#v 'link to host variable v
dim as long w,x,y
for y=1 to 4
for x=1 to 4
w++
v(x,y)=w 'fill 1 to 16
next
next
"
'COMPILE
'=======
o2_basic src
if o2_errno then
msgbox 0,o2_error
stop
else
o2_exec
'msgbox 0,"ok"
end if
'MAIN THINBASIC SECTION
'======================
'array Order: 1, 2, 3, 4
msgbox 0,"Order: "+v(1,1)+", "+v(2,1)+", "+v(3,1)+", "+v(4,1)
Bookmarks