tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
50
Task/Runtime-evaluation/OxygenBasic/runtime-evaluation.oxy
Normal file
50
Task/Runtime-evaluation/OxygenBasic/runtime-evaluation.oxy
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
function ExecSeries(string s,double b,e,i) as string
|
||||
'===================================================
|
||||
'
|
||||
sys a,p
|
||||
string v,u,tab,cr,er
|
||||
'
|
||||
'PREPARE OUTPUT BUFFER
|
||||
'
|
||||
p=1
|
||||
cr=chr(13) chr(10)
|
||||
tab=chr(9)
|
||||
v=nuls 4096
|
||||
mid v,p,s+cr+cr
|
||||
p+=4+len s
|
||||
'
|
||||
double x,y,z 'shared variables
|
||||
'
|
||||
'COMPILE
|
||||
'
|
||||
a=compile s
|
||||
er=error
|
||||
if er then
|
||||
print "runtime error: " er : exit function
|
||||
end if
|
||||
'
|
||||
'EXECUTE
|
||||
'
|
||||
for x=b to e step i
|
||||
if p+128>=len v then
|
||||
v+=nuls len(v) 'extend buffer
|
||||
end if
|
||||
call a
|
||||
u=str(x) tab str(y) cr
|
||||
mid v,p,u : p+=len u
|
||||
next
|
||||
'
|
||||
freememory a 'release compiled code
|
||||
'
|
||||
return left v,p-1 'results
|
||||
'
|
||||
end function
|
||||
|
||||
'=====
|
||||
'TESTS
|
||||
'=====
|
||||
|
||||
'Expression, StartVal, EndVal stepVal, Increment
|
||||
|
||||
print ExecSeries "y=x*x*x", 1, 10, 1
|
||||
print ExecSeries "y=sqrt x",1, 9 , 1
|
||||
Loading…
Add table
Add a link
Reference in a new issue