'-- halProment Basic / Powerbasic, 25-04-2024
'-- ArrayOverlay old powerbasic expl
type DynamicArrays
doubles as pro
singles as pro
longs as pro
end type
function PBMAIN () as long
static d AS DynamicArrays
static ds as pstring
static ss as pstring
static ls as pstring
'----------------------
'create space
ds=string(&h08000,chr(0))
ss=string(&h04000,chr(0))
ls=string(&h04000,chr(0))
'----------------------
'store pointers
d.doubles=strptr(ds)
d.singles=strptr(ss)
d.longs =strptr(ls)
'----------------------
'overlay
static double dn(&hfff) at d.doubles
static single ss(&hfff) at d.singles
static long ll(&hfff) at d.longs
dn(3000)=1234.5
'-----------------------
'redimensioning technique
ds+=string(&h02000,chr(0))
d.doubles=strptr(ds)
'-----------------------
printy dn(3000)
end function
pbmain() '1234.5
' how to make a ? as print command?
' I assume it's an reserved character in oxygen?
' declare ?(string st) as string
' ? = print
sub questionmark(args as string)
dim i as Integer
For i=0 To Len(args)-1
'Print Chr(args[i])
Next
return Print chr(args[i]) 'chr(9)+chr(13)+
End Sub
questionmark("hello world")
'-- simple type example
type thor
one as byte
two as byte
three as byte
four as byte
five as string
end type
thor hammer
hammer.one=20 : hammer.two=40 : hammer.three=60 : hammer.four=80 : hammer.five="heroe"
print hammer.one
print hammer.two
print hammer.three
print hammer.four
print hammer.five
Page created in 0.381 seconds with 14 queries.