summaryrefslogtreecommitdiff
path: root/java/netrexx/files/NetRexxC.cmd.new
diff options
context:
space:
mode:
Diffstat (limited to 'java/netrexx/files/NetRexxC.cmd.new')
-rw-r--r--java/netrexx/files/NetRexxC.cmd.new109
1 files changed, 109 insertions, 0 deletions
diff --git a/java/netrexx/files/NetRexxC.cmd.new b/java/netrexx/files/NetRexxC.cmd.new
new file mode 100644
index 000000000000..54c16a5a4f7a
--- /dev/null
+++ b/java/netrexx/files/NetRexxC.cmd.new
@@ -0,0 +1,109 @@
+/*usr/bin/true; exec rexx "$0" "$@" # REXX program */
+/* Translate and compile a NetRexx program */
+/* */
+/* use as: NetRexxC hello [file2]... */
+/* */
+/* which will use the NetRexx translator to */
+/* translate hello.nrx to hello.java */
+/* then will use javac to compile hello.java */
+/* */
+/* Any OPTIONS keywords, indicated by a prefix '-', */
+/* may be added before, after, or between file */
+/* specification(s), along with the following extra */
+/*flags: */
+/* */
+/* -run = run class after compilation */
+/* -keep = keep the java file after successful */
+/* compilation (as xxx.java.keep) */
+/* -nocompile = only translate, do not compile */
+/* */
+/* Multiple programs may be specified; in this case */
+/* they are all run (if requested) after all compiles. */
+/* */
+/* ---------- */
+/* 1996.09.02 -- handle Warnings from NetRexxC (rc=1) */
+/* 1996.12.14 -- use COM.ibm.netrexx.process */
+/* 1998.05.25 -- pass NETREXX_JAVA setting to java.exe */
+
+parse arg args
+w=wordpos('-run', args)
+if w>0 then do; run=1; args=delword(args,w,1); end; else run=0
+w=wordpos('-nocompile', args)
+if w>0 then do; noc=1; end; else noc=0
+
+/* ----- Translate & Compile ----- */
+parse source system .
+select /* system-specific options */
+ when system='OS/2' then do
+ '@echo off'
+ /* Add option -norestart for OS/2s 1.0.2+ java.exe, for better display */
+ 'java -version 2>&1|rxqueue'; parse pull '1.' subv ' '
+ if subv>=0.2 then javaopts='-norestart'; else javaopts='-noasyncgc'
+
+ /* Add any options from NETREXX_JAVA environment variable */
+ nrjava=value('NETREXX_JAVA',,'OS2ENVIRONMENT')
+ if nrjava\='' then javaopts=javaopts nrjava
+ end
+ otherwise
+ /* Add any options from NETREXX_JAVA environment variable */
+ javaopts=value('NETREXX_JAVA',,'ENVIRONMENT')
+
+ /* JAVAVM MUST be set to the native jdk 1.1.8 */
+ /* it might work with a later, native jdk */
+ /* it will NOT work with a linux jdk */
+ javavm=value('JAVAVM',,'ENVIRONMENT')
+ if javavm = "" then
+ do
+ say "NetRexx will not function unless: "
+ say ""
+ say " JAVAVM is set to"
+ say ""
+ say " /usr/local/jdk1.1.8/bin/java"
+ say ""
+ say "and"
+ say ""
+ say " CLASSPATH is set to"
+ say ""
+ say " .:/usr/local/jdk1.1.8/lib/classes.zip:/usr/local/jdk1.1.8/lib/NetRexxC.zip"
+ say ""
+ say "or"
+ say ""
+ say " NETREXX_JAVA is set to"
+ say ""
+ say " -classpath <and the above-pathes>"
+ exit
+ end
+ end
+
+/* NOTE: This won't work if NetRexx.cmd or nrc is executed from the */
+/* same directory as java is located in */
+'java -ms4M' javaopts 'COM.ibm.netrexx.process.NetRexxC' args
+
+/* ----- Run ----- */
+if rc<=1 & run then do
+ if noc then say 'Run option ignored as -nocompile specified'
+ else do
+ do forever /* find the file parameters */
+ parse var args file args
+ if file='' then leave
+ if left(file,1)='-' then iterate
+ filename=filespec('n', file); parse var filename fn '.' fe
+ /* Now determine the exact case of the class, for java commands */
+ file=fn'.class'
+ 'ls -l' file ' | rxstack' /* use ls to get exact case */
+ if queued()<>1 then do
+ if queued()=0 then say 'Cannot find file:' file
+ if queued()>1 then do; do queued(); parse pull .; end
+ say 'File "'file'" is not a unique specification'
+ end
+ exit 1; end
+ parse pull file /* is now correct case */
+ parse var file fn '.' fe
+ say 'Running' fn '...'
+ 'java' fn
+ end
+ end
+ end
+
+exit rc
+