/* This is an example of how I use frx myself. What this does is compile and link a program using Aztec C 5.0; I use it for small programs with one source file, and use make for larger projects. I call this program COMPILE.REXX and use it with the alias command XC, defined with alias xc frx rexx:compile [] The template is rather complex. Set the cliplist variable COMPILE-TEMPLATE to: SOURCE,OB,-D/K,-T/S,-W/S,M/S,F/S,NO/S,IN/S,SD/S,16/S,L/S,P/S,C/S,A/S The first arg is the name of the source file to compile, WITHOUT the .c on the end. It must be in the current directory. Next, optionally, you can name an extra object file to link in. The source is also optional; if you supply no source then this script repeats the compilation it did last time you used it. It echoes what the arguments you used before, to remind you. The third arg is used to throw an extra #define into the compile. Example: xc foo -d DEBUG would compile foo.c including all those parts preceded by #ifdef DEBUG. The rest of the arguments are option switches. -T and -W are linker options, respectively telling it to make an ascii symbol table, and to include symbols for use with the debugger DB. M means use mathieeedoub(bas|trans).library floating point, F means use math(ffp|trans).library floating point (overrides option M), SD means make SDB debugging info, 16 means use short ints, L means use large code and data, P means set the resulting program's Pure bit. A means assemble instead of compile. The command "xc a foo" assembles the source file foo.asm (actually my version assumes the source is named foo.a rather than foo.asm). The C switch causes the linker to NOT include the standard library c.lib (or cl.lib or c16.lib etc as appropriate); this is most often used with the A option. I almost always use a precompiled header file with the most common include file information in it. I call the file w:II (or w:II16 for the short int version), and this script is set up to use it by default. the NO option makes it use no precompiled header. The IN option makes it use a different header file which adds intuition information to the usual includes; this file is called w:INTU or w:INTU16. You may want to remove these sections, or at least change the names of the header files to be those you use. This thing is set up to put the resulting executable into RAM:. It puts the intermediate object file into T:, which is usually also in the ramdisk. The source file should be in the current directory. (I don't keep my source files in ramdisk; too risky.) If you actually want to use this program you should remove this big comment to make it smaller and quicker. It can be adapted with no great trouble for Aztec 3.6, and probably for Lattice with more effort. This may seem awfully complicated to serve just as an example for frx, but it is this very complexity which shows frx's value. Doing something like this without frx would be a LOT more work. I once did so ... I originally implemented this as a shell script, if you can believe that. Boy was it slow! This rexx program is placed in the public domain by Paul Kienitz. */ parse arg source,object,define,ot,ow,om,of,ono,oin,osd,o16,ol,op,oc,oa if source == "" then do script = getclip("compile-cmds") peat = getclip("compile-opts") if script == "" then do say "No previous compile to repeat!" exit 10 end say " xc" peat end; else do pops = ot ow om of ono oin osd o16 ol op oc oa if define == "" then peat = source object pops else peat = source object "-d" define pops tail = ol || o16 if oa ~== "" then do /* assembly language */ if ol ~== "" then ol = " -c -d" if define ~== "" then define = " -e" || define compilecmd = "as -n -o t:"source".o" || ol || define source".asm" end; else do /* I name my source files #?.a not #?.asm ^^^ */ if osd ~== "" then osd = " -bs -s0f0n" if of ~== "" then mathness = " -ff" /* mathffp.library */ else if om ~== "" then mathness = " -fa" /* #?ieee#?.library */ else mathness = "" if ol ~== "" then ol = " -mcd" if o16 ~== "" then shortness = " -ps" else shortness = "" if oin ~== "" then header = " -hi w:INTU" || o16 /* else if ono == "" then header = " -hi w:II" || o16 else header = "" if define ~== "" then define = " -d " || define compilecmd = "cc -o t:"source".o" || osd || mathness || ol , || shortness || header || define source".c" end if osd ~== "" then osd = " -g" if of ~== "" then mathness = " -lmf" || tail else if om ~== "" then mathness = " -lma" || tail else mathness = "" if oc == "" then libness = " -lc" || tail else libness = "" linkcmd = "ln +q -m -o ram:"source "t:"source".o" || osd ot ow object, || libness || mathness if op == "" then tailcmd = "dr -l ram:"source"#?" else tailcmd = "protect ram:"source" +p" || '0A'x || "dr -l ram:"source"#?" script = "failat 1" || '0A'x || compilecmd || '0A'x || linkcmd , || '0A'x || tailcmd setclip("compile-cmds", script) setclip("compile-opts", peat) end address command script return rc