From b41971a4ee7ab45d9a7a303f895d6fcc9bc305af Mon Sep 17 00:00:00 2001 From: Adrian Sutherland Date: Sat, 22 Feb 2020 11:31:59 +0000 Subject: [PATCH] Autobuild checkin --- .github/workflows/build.yml | 91 ++++++++++++++++++++++++++++ license => LICENSE | 0 readme.md => README.md | 0 bitxor.c | 8 +-- changelog.txt | 7 +++ cmsbuild.sh | 68 +++++++++++++++++++++ cmsinstall.sh | 70 ++++++++++++++++++++++ config.h | 6 +- cp2vm370.bat | 16 +++++ d2c.c | 4 +- hashvalu.c | 2 +- interpre.c | 2 +- ldefs.h | 2 +- mkbrexx.exec | 43 ++++++++++---- nextsymb.c | 2 +- nextsymb.h | 2 +- rexx.helpcmd | 114 ++++++++++++++++++++++++++++++++++++ rexx.helpcmd2 | 12 ++++ rexxtry.exec | 38 ++++++++++++ rxmath.c | 2 +- verify.c | 2 +- 21 files changed, 463 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/build.yml rename license => LICENSE (100%) rename readme.md => README.md (100%) create mode 100644 changelog.txt create mode 100644 cmsbuild.sh create mode 100644 cmsinstall.sh create mode 100644 cp2vm370.bat create mode 100644 rexx.helpcmd create mode 100644 rexx.helpcmd2 create mode 100644 rexxtry.exec diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..79eb7f4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,91 @@ +name: Build GCCLIB + +on: [push] + +jobs: + +#**************************************************# + build-cms: + name: Build for CMS + runs-on: [ubuntu-latest] + container: adriansutherland/vm370:1.4.1 + + steps: + + - name: Checkout + uses: actions/checkout@v2 + + - name: Move Source + run: | + mkdir /opt/hercules/vm370/io + mv * /opt/hercules/vm370/io + shell: bash + + - name: Build + working-directory: /opt/hercules/vm370 + run: | + chmod -R ugo+rw * + hercules -f hercules.conf -d >/dev/null 2>/dev/null & + cd io + chmod +x cmsbuild.sh + echo "Running CMSBUILD" + ./cmsbuild.sh + shell: bash + + - name: Get Executable + run: | + mkdir -p exe + cp /opt/hercules/vm370/io/brexxbin.aws exe + cp /opt/hercules/vm370/io/LICENSE exe + cp /opt/hercules/vm370/io/README.md exe + cp /opt/hercules/vm370/io/cmsinstall.sh exe + cp /opt/hercules/vm370/io/changelog.txt exe + chmod -R ugo+r exe + shell: bash + + - name: Upload Executable + if: startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v1 + with: + name: BREXX + path: ./exe + +#**************************************************# + release: + if: startsWith(github.ref, 'refs/tags/') + name: Release + needs: [build-cms] + runs-on: [ubuntu-latest] + steps: + - uses: actions/checkout@v1 + + - name: Get CMS binary + uses: actions/download-artifact@v1 + with: + name: BREXX + + - name: ZIP CMS binary + run: + zip -r BREXX.zip BREXX + + - name: Create Release + id: create_release + uses: actions/create-release@v1.0.0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: true + prerelease: true + + - name: Upload Release Asset - CMS + id: upload-release-asset-CMS + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./BREXX.zip + asset_name: BREXX.zip + asset_content_type: application/zip diff --git a/license b/LICENSE similarity index 100% rename from license rename to LICENSE diff --git a/readme.md b/README.md similarity index 100% rename from readme.md rename to README.md diff --git a/bitxor.c b/bitxor.c index f178483..caf0ae2 100644 --- a/bitxor.c +++ b/bitxor.c @@ -30,19 +30,19 @@ Lbitxor( const PLstr to, const PLstr s1, const PLstr s2, if (LLEN(*s1) < LLEN(*s2)) { Lstrcpy(to,s2); for (i=0; itmp; read mark tmp +cat yata.txt >> tmp +netcat -q 0 localhost 3505 < tmp +rm tmp +herccontrol -w "HHCRD012I" -f $mark +herccontrol "/" -w "RDR FILE" +herccontrol "/read *" -w "^Ready;" + +# Build +herccontrol "/yata -x -d f" -w "^Ready;" +herccontrol "/erase yata txt a" -w "^Ready;" +herccontrol "/mkbrexx" -w "^Ready;" +herccontrol "/rename * * e = = e2" -w "^Ready;" + +# Sanity test +herccontrol "/copy * * e = = a" -w "^Ready;" +herccontrol "/copy sysprof exec s = = a" -w "^Ready;" +herccontrol "/ipl cms" -w "^CMS VERSION" +herccontrol "/" -w "^Ready;" +herccontrol "/rexxtry" -w "^Rexxtry;" +herccontrol "/parse version myver" -w "^Rexxtry;" +herccontrol "/say myver" -w "^Rexxtry;" +herccontrol "/exit" -w "^Ready;" + +# Make and load Tape +herccontrol "/cp disc" -w "^VM/370 Online" +herccontrol "/logon operator operator" -w "RECONNECTED AT" +hetinit -n -d brexxbin.aws +herccontrol "devinit 480 io/brexxbin.aws" -w "^HHCPN098I" +herccontrol "/attach 480 to cmsuser as 181" -w "TAPE 480 ATTACH TO CMSUSER" +herccontrol "/cp disc" -w "^VM/370 Online" + +# Write to tape +herccontrol "/logon cmsuser cmsuser" -w "RECONNECTED AT" +herccontrol "/begin" +herccontrol "/tape dump * * e" -w "^Ready;" +herccontrol "/detach 181" -w "^Ready;" + +# Clean Up +herccontrol "/erase brexx * a" -w "^Ready;" +herccontrol "/erase rexxtry exec a" -w "^Ready;" +herccontrol "/erase sysprof exec a" -w "^Ready;" + +# LOGOFF +herccontrol "/logoff" -w "^VM/370 Online" + +# SHUTDOWN +herccontrol "/logon operator operator" -w "RECONNECTED AT" +herccontrol "/shutdown" -w "^HHCCP011I" diff --git a/cmsinstall.sh b/cmsinstall.sh new file mode 100644 index 0000000..0a6f079 --- /dev/null +++ b/cmsinstall.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# Install BREXX on CMS + +# Exit if there is an error +set -e + +# IPL +herccontrol -v +herccontrol "ipl 141" -w "USER DSC LOGOFF AS AUTOLOG1" + +# LOGON MAINT AND READ TAPE +herccontrol "/cp disc" -w "^VM/370 Online" +herccontrol "/logon maint cpcms" -w "^CMS VERSION" +herccontrol "/" -w "^Ready;" +herccontrol "devinit 480 io/brexxbin.aws" -w "^HHCPN098I" +herccontrol "/attach 480 to maint as 181" -w "TAPE 480 ATTACH" + +# MAINT 19D DISK +herccontrol "/access 19D z" -w "^Ready;" +herccontrol "/tape load * helpcmd z" -w "^Ready;" +herccontrol "/tape rew" -w "^Ready;" +herccontrol "/tape load * helpcmd2 z" -w "^Ready;" +herccontrol "/tape rew" -w "^Ready;" +herccontrol "/release z" -w "^Ready;" + +# MAINT 19E DISK +herccontrol "/access 19E z" -w "^Ready;" +herccontrol "/tape load rexxtry exec z" -w "^Ready;" +herccontrol "/tape rew" -w "^Ready;" +herccontrol "/release z" -w "^Ready;" + +# MAINT 190 CMS SYSTEM DISK +herccontrol "/access 190 z" -w "^Ready;" +herccontrol "/tape load brexx module z" -w "^Ready;" +herccontrol "/tape rew" -w "^Ready;" +herccontrol "/tape load brexx text z" -w "^Ready;" +herccontrol "/tape rew" -w "^Ready;" +herccontrol "/release z" -w "^Ready;" + +# Done with tape +herccontrol "/detach 181" -w "^Ready;" + +# Regenerate System +herccontrol "/define storage 16m" -w "^CP ENTERED" +herccontrol "/ipl 190" -w "^CMS VERSION" +herccontrol "/access ( noprof" -w "^Ready;" +herccontrol "/access 093 b" -w "^Ready;" +herccontrol "/access 193 c" -w "^Ready;" +herccontrol "/cmsxgen f00000 cmsseg" -w "^Ready;" +herccontrol "/ipl 190" -w "^CMS VERSION" +herccontrol "/savesys cms" -w "^CMS VERSION" +herccontrol "/" -w "^Ready;" +herccontrol "/logoff" -w "^VM/370 Online" + +# LOGON CMSUSER +herccontrol "/logon cmsuser cmsuser" -w "^CMS VERSION" +herccontrol "/" -w "^Ready;" + +# Sanity test +herccontrol "/rexxtry" -w "^Rexxtry;" +herccontrol "/parse version myver" -w "^Rexxtry;" +herccontrol "/say myver" -w "^Rexxtry;" +herccontrol "/exit" -w "^Ready;" + +# LOGOFF +herccontrol "/logoff" -w "^VM/370 Online" + +# SHUTDOWN +herccontrol "/logon operator operator" -w "RECONNECTED AT" +herccontrol "/shutdown" -w "^HHCCP011I" diff --git a/config.h b/config.h index 5a107e0..68c803a 100644 --- a/config.h +++ b/config.h @@ -128,13 +128,13 @@ #define PACKAGE_NAME "VM/370 SixPack bREXX Interpreter" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "bREXX 2.1.8" +#define PACKAGE_STRING "bREXX 2.1.9" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "bREXX" /* Define to the version of this package. */ -#define PACKAGE_VERSION "2.1.8" +#define PACKAGE_VERSION "2.1.9" /* Remove the trailing CR from system commands */ #define RMLAST 1 @@ -155,7 +155,7 @@ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ -#define VERSION "2.1.8" +#define VERSION "2.1.9" /* Enable debuging information */ /* #undef __DEBUG__ */ diff --git a/cp2vm370.bat b/cp2vm370.bat new file mode 100644 index 0000000..f4f0e52 --- /dev/null +++ b/cp2vm370.bat @@ -0,0 +1,16 @@ +REM Copy and build source files to VM370 +yata -c -f tmp.txt +echo USERID CMSUSER > yata.txt +echo :READ YATA TXT >> yata.txt +type tmp.txt >> yata.txt +docker cp yata.txt vm370:/opt/hercules/vm370/io +erase yata.txt +erase tmp.txt +docker exec vm370 bash -c "cd /opt/hercules/vm370/io && yata -x" +docker exec vm370 bash -c "rm /opt/hercules/vm370/io/yata.txt" + +docker cp cmsbuild.sh vm370:/opt/hercules/vm370/io +docker exec vm370 bash -c "cd /opt/hercules/vm370/io && ./cmsbuild.sh" + +docker cp cmsinstall.sh vm370:/opt/hercules/vm370/io +docker exec vm370 bash -c "cd /opt/hercules/vm370/io && ./cmsinstall.sh" diff --git a/d2c.c b/d2c.c index 38dd269..57b6bc8 100644 --- a/d2c.c +++ b/d2c.c @@ -47,13 +47,13 @@ Ld2c( const PLstr to, const PLstr from, long n ) for (i=0; num && i>= 8; } if (i==0) { LSTR(*to)[i] = 0x00; if (negative) - LSTR(*to)[i] ?= 0xFF; + LSTR(*to)[i] ^= 0xFF; i++; } diff --git a/hashvalu.c b/hashvalu.c index ba648de..ef7bbcd 100644 --- a/hashvalu.c +++ b/hashvalu.c @@ -50,7 +50,7 @@ Lhashvalue( const PLstr str ) value = 31*value + LSTR(*str)[i]; /* for (i=0; i>3) | (value<<29); } */ diff --git a/interpre.c b/interpre.c index 40c0364..7c2625c 100644 --- a/interpre.c +++ b/interpre.c @@ -1792,7 +1792,7 @@ RxInterpret( void ) case OP_XOR: DEBUGDISPLAY2("XOR"); a = STACKP(2); - LICPY(*a, Lbool(STACKP(1)) ? Lbool(STACKTOP)); + LICPY(*a, Lbool(STACKP(1)) ^ Lbool(STACKTOP)); RxStckTop -= 2; goto chk4trace; diff --git a/ldefs.h b/ldefs.h index 414e770..0ce5942 100644 --- a/ldefs.h +++ b/ldefs.h @@ -98,7 +98,7 @@ typedef int bool; #endif #define CTL(a) (('a') & 0x1F) -#define SWAP(a,b) a ?= b ?= a ?= b; +#define SWAP(a,b) a ^= b ^= a ^= b; #define DIMENSION(p) (sizeof(p) / sizeof(p[0])) #define ABS(a) (((a)<0)?-(a):(a)) diff --git a/mkbrexx.exec b/mkbrexx.exec index 5ec6a9e..088ab72 100644 --- a/mkbrexx.exec +++ b/mkbrexx.exec @@ -1,13 +1,18 @@ &CONTROL OFF NOMSG * This EXEC builds BREXX. * Robert O'Hara, Redmond Washington, July 2010. - + * Set &DISK to the mode of the disk containing the BREXX sources. Must be R/W. &DISK = F + +* Set &BDISK to the mode of the build outputs +&BDISK = E + &RESULT = 0 - + +COPYFILE * ASSEMBLE &DISK (RECFM F LRECL 80 GLOBAL TXTLIB GCCLIB - + * Stack the assembler files to process. &BEGSTACK ALL CMSDIAG @@ -27,9 +32,9 @@ CMSDIAG &IF &RETCODE > 0 &RESULT = &RETCODE -ENDA &I = &I + 1 -ENDAA - + * Stack the C files to process. - + &BEGSTACK ALL ABBREV ABS ADD ADDRESS BINTREE BITAND BITOR BITXOR BMEM BOOL BUILTIN B2X CENTER CHANGEST CHARIN @@ -45,7 +50,7 @@ SUBSTR SUBWORD TEMPLATE TRACE TRANSLAT TRUNC UPPER VARIABLE VERIFY WORD WORDIDX WORDLEN WORDPOS WORDS WRITE XRANGE X2B X2C X2D &END - + &LOOP -ENDCC &READFLAG = CONSOLE &READ ARGS &I = 1 @@ -59,13 +64,13 @@ XRANGE X2B X2C X2D -ENDC &I = &I + 1 -ENDCC &IF &RESULT > 0 &EXIT &RESULT - + -Link * &GOTO -NewLink - + EMIT Loading BREXX... &STACK HT - + LOAD MAIN EXECUTIL WRITE LOAD MAP A5 (Loading ABBREV) INCLUDE ABBREV @@ -261,14 +266,16 @@ EXECUTIL WRITE LOAD MAP A5 (Loading CMSDIAG) &STACK RT INCLUDE CMSDIAG * &IF &RETCODE > 0 &EXIT &RETCODE - + EMIT Creating BREXX MODULE... GENMOD BREXX &IF &RETCODE > 0 &EXIT &RETCODE COPYFILE LOAD MAP A BREXX MAP &DISK (REPLACE - + +COPYFILE BREXX MODULE A = = &BDISK (REPLACE + -NewLink - + * Now build BREXX TEXT. EMIT Creating BREXX TEXT for resident loading... COPYFILE MAIN TEXT A BREXX TEXT &DISK (REPLACE @@ -465,4 +472,16 @@ COPYFILE X2D TEXT A BREXX TEXT &DISK (APPEND &IF &RETCODE NE 0 &EXIT &RETCODE COPYFILE CMSDIAG TEXT A BREXX TEXT &DISK (APPEND &IF &RETCODE NE 0 &EXIT &RETCODE + +COPYFILE BREXX TEXT &DISK = = &BDISK (REPLACE +COPYFILE REXX HELPCMD &DISK = = &BDISK (REPLACE +COPYFILE REXX HELPCMD2 &DISK = = &BDISK (REPLACE +COPYFILE REXXTRY EXEC &DISK = = &BDISK (REPLACE + +* CLEANUP +ERASE * TEXT A +ERASE BREXX MODULE A +ERASE * LISTING A +ERASE * MAP A + &EXIT diff --git a/nextsymb.c b/nextsymb.c index bb39040..26210e7 100644 --- a/nextsymb.c +++ b/nextsymb.c @@ -208,7 +208,7 @@ nextsymbol(void) break; case '~': - case '?': + case '^': case '\\': NEXTCHAR; switch (*symbolptr) { diff --git a/nextsymb.h b/nextsymb.h index 8cdac29..e17afd8 100644 --- a/nextsymb.h +++ b/nextsymb.h @@ -44,7 +44,7 @@ enum symboltype { ,not_sy /* ? or \ */ /* ------------ */ ,eq_sy ,deq_sy /* = == */ /* eq_sy - first */ - ,ne_sy ,dne_sy /* ?= ?== */ + ,ne_sy ,dne_sy /* ^= ^== */ ,le_sy ,ge_sy /* <= => */ ,lt_sy ,gt_sy /* < > */ ,dle_sy ,dge_sy /* <<= =>> */ diff --git a/rexx.helpcmd b/rexx.helpcmd new file mode 100644 index 0000000..82f72f5 --- /dev/null +++ b/rexx.helpcmd @@ -0,0 +1,114 @@ +REXX Overview + +Version 2.1.9 - 22 Feb 2020 + +The VM/370 Sixpack features an integrated version of BREXX. REXX procedures +have a filetype of EXEC, and must begin with "/* on the first line. + +Note that this is an incomplete port of BREXX to VM/370. In particular the +external variable and subcommand interfaces are not operational. + + +The following instructions are supported (except for those marked with **): + ADDRESS CMS + ADDRESS SYSTEM + ARG [template] + CALL name [expression] [,expression] ... + DO [repetitor] [conditional]; [statement-list] END [symbol] + DROP name [name] ... + EXIT [expression] + IF expression THEN statement1; [ELSE statement2] + INTERPRET expression + ITERATE [symbol] + LEAVE [symbol] + NOP + NUMERIC DIGITS [expression] + NUMERIC FORM [form] + NUMERIC FUZZ [expression] + PARSE [UPPER] source [template] + PROCEDURE [EXPOSE name [name] ...] + PULL [template] + PUSH [expression] + QUEUE [expression] + RETURN [expression] + SAY [expression] + SELECT; when-list [OTHERWISE [statement-list]] END + SIGNAL name +** SIGNAL VALUE expression +** SIGNAL ON condition [NAME handler] +** SIGNAL OFF condition + TRACE [VALUE] expression + +The following built-in functions are provided: + ABBREV(string1, string2, [length]) + ABS(number) + ADDRESS() + ARG([argument-number], [option]) + BITAND(string1, [string2], [pad]) + BITOR(string1, [string2], [pad]) + BITXOR(string1, [string2], [pad]) + B2X(binary-string) + CENTER(string, length, [pad]) + CHANGESTR(substring, string, substring) + CHARIN([name], [start], [length]) + CHAROUT([name], [string], [start]) *** 'start' is ignored, treated as 1 + CHARS([name]) + CMSFLAG(flag) + COMPARE(string1, string2, [pad]) + CONDITION([option]) + COPIES(string, count) + COUNTSTR(substring, string) + C2D(data, [length]) + C2X(data) + DATATYPE(string, [type]) + DATE([option]) + DELSTR(string, start, [length]) + DELWORD(string, start, [length]) + DIGITS() + D2C(number, [length]) + D2X(number, [length]) + ERRORTEXT(number) + FORM() + FORMAT(number, [m], [n], [exp1], [exp2]) + FUZZ() + INSERT(string1, string2, [pos], [length], [pad]) + LASTPOS(target, string, [start]) + LEFT(string, length, [pad]) + LENGTH(string) + LINEIN([name], [line], [count]) + LINEOUT([name], [string], [line]) *** 'line' is ignored, treated as 1 + LINES([name]) + LINESIZE() + MAX(number, [number], ...) + MIN(number, [number], ...) + OVERLAY(string1, string2, [pos], length], [pad]) + POS(target, string, [start]) + QUEUED() + RANDOM([min], [max], [seed]) + REVERSE(string) + RIGHT(string, length, [pad]) + SIGN(number) + SOURCELINE([number]) + SPACE(string, [count], [pad]) + SQRT(number) + STORAGE() + STRIP(string, [option], [character]) + SUBSTR(string, start, [length], [pad]) + SUBWORD(string, start, [length]) + SYMBOL(name) + TIME([option]) + TRACE([type]) + TRANSLATE(string, [output], [input], [pad]) + TRUNC(number, [digits]) + VALUE(]name, [value], [type]) + VERIFY(string, search, [option], [start]) + USERID() + WORD(string, number) + WORDINDEX(string, number) + WORDLENGTH(string, number) + WORDPOS(phrase, string, [start]) + WORDS(string) + XRANGE([first], [last]) + X2B(hex-string) (not working) + X2C(hex-string) + X2D(hex-string, [length]) diff --git a/rexx.helpcmd2 b/rexx.helpcmd2 new file mode 100644 index 0000000..2fce566 --- /dev/null +++ b/rexx.helpcmd2 @@ -0,0 +1,12 @@ +Usage Notes: + +1. The BREXX interpreter is somewhat flaky. Please report any problems you + encounter to the H390-VM group on Yahoo. Try out REXXTRY EXEC! + +2. Note that loading REXX and the GCCLIB runtime (required for REXX) into + memory consumes 250K of memory. Thus you may want to run in a larger + virtual machine than you previously used. You can remove these programs + from memory by using the RESLIB commands: + RESLIB DELETE DMSREX + RESLIB DELETE GCCLIB + Doing this of course means that you cannot run REXX EXECs. diff --git a/rexxtry.exec b/rexxtry.exec new file mode 100644 index 0000000..2dd9fe7 --- /dev/null +++ b/rexxtry.exec @@ -0,0 +1,38 @@ +/* Read from the keyboard and interpret REXX instructions. */ + +PARSE ARG yourMotherShouldKnow /* any instruction entered with the command? */ +IF yourMotherShouldKnow <> "" THEN DO /* just execute it and quit */ + INTERPRET yourMotherShouldKnow + EXIT + END + +Start: +PARSE VERSION rexxinfo +SAY "REXX interpreter running ("rexxinfo")" +SAY "Enter any valid REXX instruction... type EXIT to quit." +SIGNAL ON ERROR +SIGNAL ON HALT +SIGNAL ON NOVALUE +SIGNAL ON SYNTAX + +DO FOREVER + SAY "Rexxtry;" + PARSE PULL yourMotherShouldKnow + INTERPRET yourMotherShouldKnow + END + +Error: + SAY "REXX:- Application returned an errorlevel" rc + SIGNAL Start + +Syntax: + SAY 'REXX:-' errortext(rc) '(error' rc')' + SIGNAL Start + +NoValue: + SAY 'REXX:- uninitialized variable, or failure in system service' + SIGNAL Start + +Halt: + SAY 'REXX:- HX intercepted' + SIGNAL Start diff --git a/rxmath.c b/rxmath.c index b7ebc65..6498cfe 100644 --- a/rxmath.c +++ b/rxmath.c @@ -173,7 +173,7 @@ R_bitwise( const int func ) if (func==f_or) LINT(*ARGR) |= num; else - LINT(*ARGR) ?= num; + LINT(*ARGR) ^= num; } } /* R_bitwise */ diff --git a/verify.c b/verify.c index d823de3..a906538 100644 --- a/verify.c +++ b/verify.c @@ -47,7 +47,7 @@ Lverify( const PLstr str, const PLstr ref, const bool match, long start ) for (; start