langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
36
Task/Jensens-Device/NetRexx/jensens-device.netrexx
Normal file
36
Task/Jensens-Device/NetRexx/jensens-device.netrexx
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import COM.ibm.netrexx.process.
|
||||
|
||||
class JensensDevice
|
||||
|
||||
properties static
|
||||
interpreter=NetRexxA
|
||||
exp=Rexx ""
|
||||
termMethod=Method
|
||||
|
||||
method main(x=String[]) static
|
||||
say sum('i',1,100,'1/i')
|
||||
|
||||
method sum(i,lo,hi,term) static SIGNALS IOException,NoSuchMethodException,IllegalAccessException,InvocationTargetException
|
||||
sum=0
|
||||
loop iv=lo to hi
|
||||
sum=sum+termeval(i,iv,term)
|
||||
end
|
||||
return sum
|
||||
|
||||
method termeval(i,iv,e) static returns Rexx SIGNALS IOException,NoSuchMethodException,IllegalAccessException,InvocationTargetException
|
||||
if e\=exp then interpreter=null
|
||||
exp=e
|
||||
|
||||
if interpreter=null then do
|
||||
termpgm='method term('i'=Rexx) static returns rexx;return' e
|
||||
fw=FileWriter("termpgm.nrx")
|
||||
fw.write(termpgm,0,termpgm.length)
|
||||
fw.close
|
||||
interpreter=NetRexxA()
|
||||
interpreter.parse([String 'termpgm.nrx'],[String 'nocrossref'])
|
||||
termClass=interpreter.getClassObject(null,'termpgm')
|
||||
classes=[interpreter.getClassObject('netrexx.lang', 'Rexx', 0)]
|
||||
termMethod=termClass.getMethod('term', classes)
|
||||
end
|
||||
|
||||
return Rexx termMethod.invoke(null,[iv])
|
||||
Loading…
Add table
Add a link
Reference in a new issue