Compare commits
2 Commits
d3ff38642a
...
f43498c9ad
Author | SHA1 | Date | |
---|---|---|---|
f43498c9ad | |||
9e75aaad84 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
__pycache__/
|
||||
*.rdbx
|
||||
.idea/
|
||||
|
||||
|
BIN
docs/oodguide.pdf
Normal file
BIN
docs/oodguide.pdf
Normal file
Binary file not shown.
BIN
docs/oodialog.pdf
Normal file
BIN
docs/oodialog.pdf
Normal file
Binary file not shown.
BIN
docs/oorexxbuild.pdf
Normal file
BIN
docs/oorexxbuild.pdf
Normal file
Binary file not shown.
BIN
docs/oosqlite.pdf
Normal file
BIN
docs/oosqlite.pdf
Normal file
Binary file not shown.
BIN
docs/orxncurses.pdf
Normal file
BIN
docs/orxncurses.pdf
Normal file
Binary file not shown.
BIN
docs/rexxapi.pdf
Normal file
BIN
docs/rexxapi.pdf
Normal file
Binary file not shown.
BIN
docs/rexxextensions.pdf
Normal file
BIN
docs/rexxextensions.pdf
Normal file
Binary file not shown.
BIN
docs/rexxpg.pdf
Normal file
BIN
docs/rexxpg.pdf
Normal file
Binary file not shown.
BIN
docs/rexxref.pdf
Normal file
BIN
docs/rexxref.pdf
Normal file
Binary file not shown.
BIN
docs/rxftp.pdf
Normal file
BIN
docs/rxftp.pdf
Normal file
Binary file not shown.
BIN
docs/rxmath.pdf
Normal file
BIN
docs/rxmath.pdf
Normal file
Binary file not shown.
BIN
docs/rxsock.pdf
Normal file
BIN
docs/rxsock.pdf
Normal file
Binary file not shown.
BIN
docs/unixextensions.pdf
Normal file
BIN
docs/unixextensions.pdf
Normal file
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
Say '1'+'1'
|
||||
Say "2" * 2
|
66
projects/oorexx/address-test.rex
Normal file → Executable file
66
projects/oorexx/address-test.rex
Normal file → Executable file
@ -1,7 +1,67 @@
|
||||
#!/usr/bin/env rexx
|
||||
|
||||
/* Rexx */
|
||||
Address system "pwd" with output stem pwd.
|
||||
.environment~pwd = pwd.1
|
||||
|
||||
Address "zsh" "ls -lA" With output stem dir.
|
||||
|
||||
Address system "ls -lAh "||.environment~pwd With output stem dir.
|
||||
dirlist1 = .array~new()
|
||||
Do i = 1 to dir.0
|
||||
say dir.i
|
||||
if dir.i~StartsWith("total") then nop
|
||||
Else call add_to_array1(dir.i)
|
||||
End
|
||||
dirjson1 = .json~new()~toJSON(dirlist1)
|
||||
|
||||
say dirjson1~e
|
||||
|
||||
Say " "
|
||||
call SysFileTree .environment~pwd||"/", file., 'BL'
|
||||
dirlist2 = .array~new()
|
||||
do i = 1 to file.0
|
||||
call add_to_array2(file.i)
|
||||
end
|
||||
dirjson2 = .json~new()~toJSON(dirlist2)
|
||||
Say dirjson2
|
||||
|
||||
Exit
|
||||
|
||||
add_to_array1: PROCEDURE expose dirlist1
|
||||
parse arg attrs filecnt . . filesz . . . filenm
|
||||
dirlist1~append(.directory~new())
|
||||
|
||||
dirlist1[dirlist1~last]['name'] = filenm
|
||||
|
||||
if attrs~startsWith("d") then dirlist1[dirlist1~last]['type'] = 'dir'
|
||||
else dirlist1[dirlist1~last]['type'] = 'file'
|
||||
|
||||
if attrs~startsWith("d") then NOP
|
||||
else dirlist1[dirlist1~last]['bytes'] = filesz
|
||||
Return dirlist1
|
||||
|
||||
add_to_array2: PROCEDURE expose dirlist2
|
||||
/* 3/16/25 2:29p 558 -rwxrwxr-x /home/gmgauthier/Projects/rexx-things/projects/oorexx/params.rex */
|
||||
parse arg . . filesz attrs filepath
|
||||
|
||||
filenm = parse_filename(filepath)
|
||||
|
||||
dirlist2~append(.directory~new())
|
||||
dirlist2[dirlist2~last]['name'] = filenm
|
||||
|
||||
if attrs~startsWith("d") then dirlist2[dirlist2~last]['type'] = 'dir'
|
||||
else dirlist2[dirlist2~last]['type'] = 'file'
|
||||
|
||||
if attrs~startsWith("d") then NOP
|
||||
else dirlist2[dirlist2~last]['bytes'] = filesz
|
||||
Return dirlist2
|
||||
|
||||
parse_filename: procedure
|
||||
parse arg filepath
|
||||
|
||||
/* Parse the filepath to get just the filename */
|
||||
parse var filepath . '/' filename
|
||||
do while pos('/', filename) > 0
|
||||
parse var filename . '/' filename
|
||||
end
|
||||
return filename
|
||||
|
||||
::requires 'json.cls'
|
||||
|
39
projects/oorexx/csv-file-test.rex
Executable file
39
projects/oorexx/csv-file-test.rex
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env rexx
|
||||
/* Rexx */
|
||||
|
||||
csv = .csvStream~new('headered.csv', .true)
|
||||
csv~open
|
||||
|
||||
/* Stream class defaults to both ie:readWrite */
|
||||
myTable = .table~new
|
||||
myTable~put('red','colour')
|
||||
myTable~put('stop','action')
|
||||
|
||||
csv~CSVLineout(myTable)
|
||||
myTable~put('green','colour')
|
||||
myTable~put('go','action')
|
||||
|
||||
csv~CSVLineout(mytable)
|
||||
myTable~put('yellow', 'colour')
|
||||
myTable~put('decelerate', 'action')
|
||||
|
||||
csv~CSVLineout(myTable)
|
||||
csv~close
|
||||
|
||||
/* Read it back */
|
||||
Csv~open('read')
|
||||
Do while csv~chars > 0
|
||||
Csv~csvLineIn
|
||||
Say 'new record'
|
||||
Do field over csv~values
|
||||
Say field':' csv~values~at(field) /* colour: green */
|
||||
End
|
||||
End
|
||||
/*======================*/
|
||||
csv~close
|
||||
|
||||
Exit
|
||||
|
||||
::requires 'csvStream.cls'
|
||||
|
||||
|
4
projects/oorexx/functions.rex
Normal file
4
projects/oorexx/functions.rex
Normal file
@ -0,0 +1,4 @@
|
||||
tabs:
|
||||
parse arg count
|
||||
tab = X2C("09")
|
||||
return copies(tab, count)
|
4
projects/oorexx/headered.csv
Normal file
4
projects/oorexx/headered.csv
Normal file
@ -0,0 +1,4 @@
|
||||
"colour","action"
|
||||
"red","stop"
|
||||
"green","go"
|
||||
"yellow","decelerate"
|
|
@ -3,6 +3,10 @@ call RxFuncAdd 'SysGetPid', 'rxunixsys', 'SysGetPid'
|
||||
call RxFuncAdd 'SysGethostname', 'rxunixsys', 'SysGethostname'
|
||||
call RxFuncAdd 'SysUname', 'rxunixsys', 'SysUname'
|
||||
*/
|
||||
|
||||
Address system "pwd" with output stem pwd.
|
||||
say pwd.1
|
||||
|
||||
If RxFuncQuery("SockDropFuncs") then
|
||||
Do
|
||||
rc = RxFuncAdd("SockLoadFuncs","rxsock","SockLoadFuncs")
|
||||
|
38
projects/oorexx/jabberwocky.txt
Normal file
38
projects/oorexx/jabberwocky.txt
Normal file
@ -0,0 +1,38 @@
|
||||
Jabberwocky
|
||||
|
||||
'Twas brillig, and the slithy toves
|
||||
Did gyre and gimble in the wabe:
|
||||
All mimsy were the borogoves,
|
||||
And the mome raths outgrabe.
|
||||
|
||||
'Beware the Jabberwock, my son!
|
||||
The jaws that bite, the claws that catch!
|
||||
Beware the Jubjub bird, and shun
|
||||
The frumious Bandersnatch!'
|
||||
|
||||
He took his vorpal sword in hand:
|
||||
Long time the manxome foe he sought --
|
||||
So rested he by the Tumtum tree,
|
||||
And stood a while in thought.
|
||||
|
||||
And, as in uffish thought he stood,
|
||||
The Jabberwock, with eyes of flame,
|
||||
Came whiffling through the tulgey wood,
|
||||
And burbled as it came!
|
||||
|
||||
One two! One two! And through and through
|
||||
The vorpal blade went snicker-snack!
|
||||
He left it dead, and with its head
|
||||
He went galumphing back.
|
||||
|
||||
'And hast thou slain the Jabberwock?
|
||||
Come to my arms, my beamish boy!
|
||||
Oh frabjous day! Callooh! Callay!'
|
||||
He chortled in his joy.
|
||||
|
||||
'Twas brillig, and the slithy toves
|
||||
Did gyre and gimble in the wabe:
|
||||
All mimsy were the borogoves,
|
||||
And the mome raths outgrabe.
|
||||
|
||||
Lewis Carroll
|
5
projects/oorexx/one-plus1.rex
Normal file
5
projects/oorexx/one-plus1.rex
Normal file
@ -0,0 +1,5 @@
|
||||
/* Rexx */
|
||||
|
||||
Say '1'+ "1" + 1 + d2c(49)
|
||||
|
||||
Say "8.4" / (3.1 - '2') * (D2C(57) + D2C(53))
|
@ -1,9 +1,14 @@
|
||||
#!/usr/bin/env rexx
|
||||
|
||||
|
||||
/* Rexx */
|
||||
Address system
|
||||
parse arg parms
|
||||
|
||||
Address system "pwd" with output stem pwd.
|
||||
say pwd.1
|
||||
|
||||
|
||||
call parse_argv
|
||||
|
||||
say "Instruction: " || instr
|
||||
@ -17,7 +22,7 @@ parse_argv: procedure expose parms instr parm
|
||||
return
|
||||
|
||||
HELP:
|
||||
"clear"
|
||||
/* "clear" */
|
||||
say "********************************************************"
|
||||
say "* YOUR STRINGS WERE EMPTY. HOW DARE YOU. *"
|
||||
say "********************************************************"
|
||||
|
10
projects/oorexx/regex-test.rex
Normal file
10
projects/oorexx/regex-test.rex
Normal file
@ -0,0 +1,10 @@
|
||||
str = "<p>Paragraph 1</p><p>Paragraph 2</p>"
|
||||
re1 = .RegularExpression~new("<p>?*</p>", "MINIMAL")
|
||||
re1~match(str)
|
||||
re2 = .RegularExpression~new("<p>?*</p>", "MAXIMAL")
|
||||
re2~match(str)
|
||||
say "re1 (minimal) matched" str~substr(1, re1~position)
|
||||
say "re2 (maximal) matched" str~substr(1, re2~position)
|
||||
EXIT
|
||||
|
||||
::requires "rxregexp.cls"
|
5
projects/oorexx/sayos.rex
Executable file
5
projects/oorexx/sayos.rex
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env rexx
|
||||
|
||||
parse source os
|
||||
|
||||
say os
|
@ -1,11 +1,9 @@
|
||||
#!/usr/bin/env rexx
|
||||
|
||||
::requires "ncurses.cls"
|
||||
|
||||
lf = .window~ASCII_LF~d2c()
|
||||
bs = .window~ASCII_BS~d2c()
|
||||
|
||||
text = .array~of('Do', 'you', 'find', 'this', 'silly?')
|
||||
text = .array~of('One', 'Two', 'Three', 'Four', 'Five')
|
||||
|
||||
scr = .window~new()
|
||||
do a = 1 to text~items()
|
||||
@ -24,3 +22,6 @@ scr~endwin
|
||||
|
||||
Exit
|
||||
|
||||
::requires "ncurses.cls"
|
||||
|
||||
|
||||
|
11
projects/oorexx/tso-emu.rex
Executable file
11
projects/oorexx/tso-emu.rex
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env rexx
|
||||
|
||||
address hostemu 'execio * diskr "jabberwocky.txt" (finis stem jby.'
|
||||
|
||||
Do x = 1 to jby.0
|
||||
Say jby.x
|
||||
End
|
||||
|
||||
Exit
|
||||
|
||||
::requires "hostemu" LIBRARY
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env rexx
|
||||
parse arg loc
|
||||
if loc = "" then loc="Cowley,UK"
|
||||
Parse Arg loc
|
||||
If loc = "" Then loc="Cowley,UK"
|
||||
Address system "ansiweather -l "||loc||" -u imperial -s true -i false -a true"
|
||||
|
Loading…
Reference in New Issue
Block a user