Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!cbmvax!carolyn From: carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) Newsgroups: net.micro.amiga Subject: Keyword arguments in batch files Message-ID: <636@cbmvax.cbmvax.cbm.UUCP> Date: Sat, 16-Aug-86 01:02:29 EDT Article-I.D.: cbmvax.636 Posted: Sat Aug 16 01:02:29 1986 Date-Received: Sun, 17-Aug-86 10:46:53 EDT Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner) Organization: Commodore Technology, West Chester, PA Lines: 251 Keyword Arguments for Amiga Batch Command Files ----------------------------------------------- The CLI Execute command has the capability of passing both positional and keyword parameters to a batch command file. Keyword parameters are set in the Execute command line by assigning values to variables with the same names as the arguments in the .key line of the batch file. Default values can be assigned within the batch file and command line assignments may be used to replace any or all of the default values. The following listings show the use of keyword parameters in my cc script. I have a single cc script that is executed by one-line special purpose scripts. The one-liners modify the default values of the cc for Amiga compile, Amiga compile and link, Lattice compile, Lattice compile and link, and compile then Atomize. I have also used one-liners to specify additional object modules or libraries for the cc's Alink. Usage of the one-liners is (for example) ex lcl filename (to compile and link filename.c). I have included a listing of my startup-sequence which does some of the setup for my scripts. Also note that all of the commands for compiling are in my c directory, I have a lib directory containing all startup.obj's and .lib's, all scripts are in my s directory, and I have renamed c:Execute to c:ex. My startup cd's me to ram: where I usually work. The scripts compile files in your current directory unless given a specific path on a filename. In addition, I have included a script called swapsys (usage - swapsys volumename:). I use this script to switch to all control to another system disk (such as my assembler system disk) without rebooting. Carolyn Scheppner CBM ----- file s:cc ---------------------------------------------------------- .key fn/a,lc1flags,lc2flags,atomize,atomopts,startup,ofiles, libraries,linkopts,nolink,linkonly,dsave . === NOTE - The two lines above must be typed as a single long line === .def startup "LIB:Lstartup.obj" .def libraries "LIB:LC.lib,LIB:Amiga.lib" .def atomize "0" .def nolink "0" .def linkonly "0" .def dsave "0" . =================================================================== . Compile (Link) Single C Source File C. Scheppner v 1.1 . =================================================================== if eq "usage" echo " " echo "USAGE: ex(ecute) cc filename [string=value]... [flag=value]..." echo " " echo " Defaults:" echo " Strings: lc1flags = " echo " lc2flags = " echo " atomopts = " echo " startup = " echo " ofiles = (other than filename.o)" echo " libraries = " echo " linkopts = " echo " Flags: atomize = " echo " nolink = " echo " linkonly = " echo " dsave = " echo " " echo "Set flags to 0 (FALSE) or 1 (TRUE)" echo "Set other arguments to desired string" echo " " skip done endif . ===== Directory assignments ===== assign T: :T assign LIB: df0:lib . ===== Skip to link if linkonly=1 ===== if eq "1" skip link endif . ===== Abort if source file not found ===== if not exists .c echo "File .c does not exist." skip abort endif . ===== Save source to temp disk file if dsave=1 ===== if eq "1" if exists df1:t echo "Copying .c to df1:t/lastcc.c" copy .c to df1:t/lastcc.c endif endif . ===== If old .q or .o files exist, delete them ===== if exists .q delete .q endif if exists .o delete .o endif . ===== First compiler pass ===== echo " " lc1 -idf1:include/ . ===== Check for failure ===== if not exists .q echo " " echo "LC1 failed. ABORTING CC ..." skip abort endif . ===== Second compiler pass ===== echo " " lc2 . ===== Check for failure ===== if not exists .o echo " " echo "LC2 failed. ABORTING CC ..." skip abort endif . ===== Atomize object if atomize=1 ===== if eq "1" echo " " echo "Atomizing .o ..." rename .o .preAtom Atom .preAtom .o endif . ===== Save object to temp disk file if dsave=1, nolink=1 ===== if eq "1" if eq "1" if exists df1:t echo "Copying .o to df1:t/lastcc.o" copy .o to df1:t/lastcc.o endif endif endif . ===== Alink if nolink=0 ===== lab link if eq "0" echo " " alink ,.o, TO LIBRARY endif . ===== Save executable to temp disk file if dsave=1 ===== if eq "1" if exists df1:t echo " " echo "Copying executable to df1:t/lastcc.exe..." copy to df1:t/lastcc.exe endif endif . ===== Successful CC ===== echo " " echo "CC DONE" skip done . ===== CC Failed ===== lab abort echo " " echo "CC FAILED" lab done ----- file s:ac ---------------------------------------------------------- .key fn/a . ===== Amiga compile only single C source (stack-checking disabled) ===== ex cc lc2flags="-v" nolink=1 ----- file s:ac.atom ----------------------------------------------------- .key fn/a . ===== Lattice compile and atomize single C source file ===== ex cc lc2flags="-v" nolink=1 atomize=1 atomopts="-I" ----- file s:acl --------------------------------------------------------- .key fn/a . ===== Amiga compile and link single C source file ===== ex cc lc2flags="-v" startup=LIB:AStartup.obj libraries=LIB:Amiga.lib ----- file s:lc ---------------------------------------------------------- .key fn/a . ===== Lattice compile only single C source file ===== ex cc nolink=1 ----- file s:lc.atom ----------------------------------------------------- .key fn/a . ===== Lattice compile and atomize single C source file ===== ex cc nolink=1 atomize=1 atomopts="-I" ----- file s:lcl --------------------------------------------------------- .key fn/a . ===== Lattice compile and link single C source file ===== ex cc startup=LIB:LStartup.obj libraries="LIB:LC.lib,LIB:Amiga.lib" ----- file s:startup-sequence -------------------------------------------- echo "CSYS1.2B8" echo " " stack 10000 cd ram: makedir ram:t assign T: ram:t assign LIB: df0:lib ----- file s:swapsys ----------------------------------------------------- .key volumename/a . Swap development system disks USAGE: ex(ecute) SwapSys volumename assign C: :c assign SYS: : assign S: :s assign L: :l assign FONTS: :fonts assign DEVS: :devs assign LIBS: :libs if exists :lib assign LIB: :lib endif ----------------------------------------------------------------------- -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CBM >>Amiga Technical Support<< UUCP ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=