From: GWDVMS::MOELLER [moeller@gwdvms.dnet.gwdg.de] Sent: Friday, June 11, 1999 1:49 PM To: Info-VAX@Mvb.Saic.Com Subject: DCLDIET ? (was: re: VMSINSTAL[L] ...) Hoff Hoffman writes: >[...] > The version > of VMSINSTAL that ships is not something that should be considered when > initially learning to write DCL command procedures, having been the > target of the DCLDIET tool. DCL command procedures targeted by DCLDIET > are smaller and execute faster, but at the expense of comprehensibility... >[...] What & where is DCLDIET ? Should I claim that it is the `sed' script shown below, for the entertainment of INFO-VAX readers & assorted UNIX-haters? :-) :-) (Likely it's not too well debugged, but it "knows" more about DCL's behaviour than the average DCL dictionary :-) Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de GWDG, D-37077 Goettingen, F.R.Germany | Disclaimer: No claim intended! ----- ----- ----- cut here ----------------------------------------------------------------- # sed: remove DCL comments (unless significant) and concatenate ... # ... continuation lines # wjm 31-oct-1990 # # NOTE: this file contains significant embedded TABs # # obscure cases handled: # (1) comment-only line treated as continuation. # bugs: # lines with no "$" in column1 are considered data, $DECK not recognized. # lines longer than 255 bytes may be generated. # ascii LF ("\n") must not be embedded in the input file! ################################################################################ ## check new statement for leading "$", leave it alone if none (maybe data), ## else remove whitespace following leading '$' s/^\$[ ]*/$/ t dcl b end :dcl # (come here after appending continuation line) ## convert tabs into spaces, compress whitespace into a single space :begin s/^\(\([^" ]*"[^"]*"\)*[^" ]*\) +/\1 / s/^\(\([^"]*"[^"]*"\)*[^"]*\) +/\1 / t begin ## check for significant comments, branch when found ("!" replaced by \n) s/^\(\([^"!]*"[^"]*"\)*[^"!]*\)!.*\('f$v\(e\(r\(i\(fy?\)?\)?\)?\)?(.*\)$/\1\ \3/ t fverify ## remove comments s/^\(\([^"!]*"[^"]*"\)*[^"!]*\)!.*$/\1/ ## remove trailing whitespace s/^\(\([^"]*"[^"]*"\)*\([^"]*[^" ]\)?\) +$/\1/ ## remove trailing '-', branch when found :dummy2 t dummy2 s/^\(\([^"]*"[^"]*"\)*[^"]*\)-$/\1/ t contd ## finally, drop lines containing '$' only s/^\$$// t empty b end :empty d ## read a continuation line, then start over :contd N # obscure case (1) s/\n[ ]*\(\$[ ]*\)?!/-!/ s/\n// b begin ## (significant comment found, ! => \n) ## remove some nonsignificant part of comment, and restore ! :fverify s/ *\n.*\('f$v\(e\(r\(i\(fy?\)?\)?\)?\)?(.*)\)[^)]*$/!\1/ ## check for continuation, else just output :dummy3 t dummy3 s/^\(\([^"!]*"[^"]*"\)*[^"!]*\)- *!.*$/&/ t cont3 b end ## continuation + significant comment: output current line, read continuation :cont3 N P s/^.*\n// # obscure case (1) s/^[ ]*\(\$[ ]*\)?!/-!/ b begin ## output what we have, then read new statement :end ----- cut here ----------------------------------------------------------------- Wolfgang J. Moeller, Tel. +49 551 2011516 or -510, moeller@gwdvms.dnet.gwdg.de GWDG, D-37077 Goettingen, F.R.Germany | Disclaimer: No claim intended! ----- -----