# /* vim: set filetype=awk : */ -*- awk -*- # requirez(commandLine.awk) BEGIN { Who = "Tim Menzies"; What = "xomo"; When = "2006"; How = "b:cd:hlo:p:s:A:I:M:N:m:P:R:S:CX:"; Why = "generate effort/risk/bug estiamtes for projects "; } function usage() { about(Who,What,When,Why); prints("Usage(ous mod): "What" [FLAGS] "," ", " -A CHAR meta character; default= [" MetaC "]", " -I CHAR marker for the ignore columns; default= ["IgnoreC"]", " -M CHAR marker for columns to be maximized; default= ["MaxC"]", " -N CHAR marker for numeric columns; default= [" NumC "]", " -P WORD perform effort/risk/bug estimation for WORD; default = 'project'", " -R NUM repeat NUM times of times", " -S NUM set the random number seed to NUM", " (use NUM=0 for a randomly selected seed)", " -X NUM run example NUM", " -b NUM pause every NUM interations", " -c show copyright", " -d FILE read default values from FILE; default = 'defaults.dat'", " -h show help", " -l loud mode (print header line)", " -m CHAR marker for columns to be minimized; default= ["MinC"]", " -o CHAR output file sepertor", " -p FILE read project values from FILE, default = 'project.dat'", " -s STRING comma separated string of meta data for special variables", " "); } function defaults( pairs,i) { string2pairs(pairs, "b 100 d defaults.dat p project.dat o , " \ "P system R 30 S 1 m < M > N $ A = I ?", " "); for(i in pairs) set(i,pairs[i]) } function set(x,y) { if (x == "A") {return MetaC = y}; if (x == "I") {return IgnoreC = y}; if (x == "N") {return MaxC = y}; if (x == "M") {return NumC = y}; if (x == "m") {return MinC = y}; if (x == "P") {return Project = y}; if (x == "R") {return Repeats = y}; if (x == "S") {return (y ? srand(y) : srand() ) } if (x == "X") {demo(y); exit}; if (x == "s") {return parseSpec(y,Spec) }; if (x == "b") {return Pause = y}; if (x == "c") {copyleft(); exit}; if (x == "d") {return DefaultData = y}; if (x == "h") {usage(); exit}; if (x == "l") {return Loud = 1}; if (x == "o") {return OFS = y}; if (x == "p") {return ProjectData = y}; bad("?"x": usage: " What " " How); exit; } function parseSpec(str,out, tmp,i,j,k,doomed) { split(str,tmp,","); doomed= "[" IgnoreC MaxC MinC NumC "]"; for(i in tmp) { j = k = tmp[i] gsub(doomed,"",j); Spec[j]=k } }