######################################################################## # # # This software is part of the ast package # # Copyright (c) 1989-2011 AT&T Intellectual Property # # and is licensed under the # # Eclipse Public License, Version 1.0 # # by AT&T Intellectual Property # # # # A copy of the License is available at # # http://www.eclipse.org/org/documents/epl-v10.html # # (with md5 checksum b35adb5213ca9657e911e9befb180842) # # # # Information and Software Systems Research # # AT&T Research # # Florham Park NJ # # # # Glenn Fowler # # # ######################################################################## : mam to sh script filter global COMMAND := 'mamsh' matchstr $[shell {getopts '[-][123:xyz]' opt --xyz; echo 0$opt}] { 0123 { global ARGV0 := ""-a $COMMAND"" global USAGE := "$' [-? @(#)$Id: mamsh (AT&T Labs Research) 1994-01-01 $ ] '$USAGE_LICENSE$' [+NAME?mamsh - make abstract machine to shell script conversion filter] [+DESCRIPTION?\bmamsh\b converts \aMAM\a (Make Abstract Machine) instructions on the standard input to a \bsh\b(1) script that updates all targets on the standard output. The script summarily builds each target; use \bmamake\b(1), \bnmake\b(1) or \bgmake\b(1) for target out-of-date testing.] [+SEE ALSO?\bmamake\b(1), \bnmake\b(1)] "' } * { global ARGV0 := ''"" global USAGE := ''"" } } proc usage { global OPTIND := '0' getopts $ARGV0 $USAGE OPT '-?' exit 2 } while getopts $ARGV0 "$USAGE" OPT { matchstr $OPT { * { usage } } } echo ": : generated from makefile abstraction : :" echo 'eval ${1+"$@"}' sed -n -e 's/^[0-9][0-9 ]*//' -e 's/^setv \([^ ]*\) \(.*\)/\1=${\1-\2}/p' -e 's/^exec [^ ]* //p' $(1+"$@") (CommandList children: [ (C {(Lit_Other ":")} {(mam)} {(to)} {(sh)} {(script)} {(filter)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:COMMAND) op:Equal rhs:{(mamsh)} spids:[70])] spids: [70] ) (Case to_match: { (CommandSubPart command_list: (CommandList children: [ (Subshell child: (CommandList children: [ (Sentence child: (C {(getopts)} {(SQ <"[-][123:xyz]">)} {(opt)} {(--xyz)}) terminator: ) (C {(echo)} {(0) ($ VSub_Name "$opt")}) ] ) redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[94])] spids: [76 92] ) ] ) left_token: spids: [75 96] ) } arms: [ (case_arm pat_list: [{(0123)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ARGV0) op: Equal rhs: {(DQ ("-a ") ($ VSub_Name "$COMMAND"))} spids: [103] ) ] spids: [103] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:USAGE) op: Equal rhs: { (SQ <"\n"> <"[-?\n"> <"@(#)$Id: mamsh (AT&T Labs Research) 1994-01-01 $\n"> <"]\n"> ) ($ VSub_Name "$USAGE_LICENSE") (SQ <"\n"> < "[+NAME?mamsh - make abstract machine to shell script conversion filter]\n" > <"[+DESCRIPTION?"> <" converts "> <" (Make Abstract Machine)\n"> <"\tinstructions on the standard input to a "> <"(1) script\n"> <"\tthat updates all targets on the standard output. The script\n"> <"\tsummarily builds each target; use "> <"(1), "> <"(1)\n"> <"\tor "> <"(1) for target out-of-date testing.]\n"> <"[+SEE ALSO?"> <"(1), "> <"(1)]\n"> ) } spids: [110] ) ] spids: [110] ) ] spids: [100 101 162 -1] ) (case_arm pat_list: [{(Lit_Other "*")}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ARGV0) op:Equal rhs:{(DQ )} spids:[167])] spids: [167] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:USAGE) op:Equal rhs:{(DQ )} spids:[172])] spids: [172] ) ] spids: [164 165 177 -1] ) ] spids: [73 98 179] ) (FuncDef name: usage body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:OPTIND) op:Equal rhs:{(0)} spids:[189])] spids: [189] ) (C {(getopts)} {($ VSub_Name "$ARGV0")} {(DQ ($ VSub_Name "$USAGE"))} {(OPT)} {(SQ <"-?">)}) (C {(exit)} {(2)}) ] spids: [186] ) spids: [182 185] ) (While cond: [(C {(getopts)} {($ VSub_Name "$ARGV0")} {(DQ ($ VSub_Name "$USAGE"))} {(OPT)})] body: (DoGroup children: [ (Case to_match: {($ VSub_Name "$OPT")} arms: [ (case_arm pat_list: [{(Lit_Other "*")}] action: [(C {(usage)})] spids: [236 237 241 -1] ) ] spids: [229 233 244] ) ] spids: [227 246] ) ) (C {(echo)} {(DQ (": : generated from makefile abstraction : :"))}) (C {(echo)} {(SQ <"eval ${1+\"$@\"}">)}) (C {(sed)} {(-n)} {(-e)} {(SQ <"s/^[0-9][0-9 \t]*//">)} {(-e)} {(SQ <"s/^setv \\([^ ]*\\) \\(.*\\)/\\1=${\\1-\\2}/p">)} {(-e)} {(SQ <"s/^exec [^ ]* //p">)} { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(DQ ($ VSub_At "$@"))}) spids: [283 289] ) } ) ] )