![]() ![]() | ![]() |
--CHANGES BY ISAAC-- - fixed Unit parsing to allow m/m == 1 - added new function init_array to delete all elements from an array - fixed parser coded so it can be compiled with bison - started addition of new functions to compute new random distributions
1: #!/bin/sh 2: 3: VER=5.1 4: BUGFIX=0 5: TEST_DIR=testing7 6: CC="cc" # -DDMALLOC -DDMALLOC_FUNC_CHECK" 7: 8: #FLEX="/usr/user1/capadvt/BIN/flex -Cfa -s" 9: #FLEX="flex -Cfa -s" 10: FLEX="/usr/user1/capadvt/BIN/flex -Cfa -s" 11: #YACC="/usr/bin/byacc" 12: YACC="/usr/user1/capadvt/BIN/bison" 13: MV="mv" 14: 15: 16: #echo "${CC}" 17: ARCH=`uname` 18: #echo "${ARCH}" 19: # have to put " around the multiple line string 20: 21: PAR_OBJ="${ARCH}/capaCommon.o ${ARCH}/capaLexerFun.o \ 22: ${ARCH}/capaParserFun.o ${ARCH}/capaFunction.o ${ARCH}/capaParserUtils.o \ 23: ${ARCH}/capaMapExpr.o ${ARCH}/capaUnit.o ${ARCH}/com.o ${ARCH}/linpack.o ${ARCH}/ranlib.o \ 24: ${ARCH}/capaCgiUtils.o ${ARCH}/capaRQO.o ${ARCH}/capaFormulaLexer.o ${ARCH}/capaFormulaParser.o \ 25: ${ARCH}/capaSubjective.o" 26: 27: #echo "OBJ:${PAR_OBJ}" 28: 29: 30: prefix="" 31: CCFLAG="-g -DUSE_DYNAMIC_SYMBOLS" 32: 33: PLIBS="-ll -lm -lcurses -ltermcap" 34: 35: 36: 37: if [ ${ARCH} = "AIX" ] 38: then 39: CCFLAG="-O3 -DAIX" 40: fi 41: 42: if [ ${ARCH} = "OSF1" ] 43: then 44: #CCFLAG="-O3 -Olimit 1024 -DUSE_DYNAMIC_SYMBOLS -DUSE_DYNAMIC_LEXBUFS" 45: CCFLAG="-O3 -Olimit 2048 -DUSE_DYNAMIC_SYMBOLS -DCAPA_VER=\"${VER}.${BUGFIX}\" -DCOMPILE_DATE=\"`date +'%b-%d-%Y'`\"" 46: fi 47: 48: if [ ${ARCH} = "NEXTSTEP" ] 49: then 50: CCFLAG="-arch i386 -arch m68k" 51: fi 52: 53: if [ ${ARCH} = "SunOS" ] 54: then 55: CCFLAG="-xO3" 56: fi 57: 58: if [ ${ARCH} = "HP-UX" ] 59: then 60: CCFLAG="-O -Ae -Dhpux" 61: fi 62: 63: if [ ${ARCH} = "IRIX" ] 64: then 65: CCFLAG="-O2 -DIRIX" 66: fi 67: 68: 69: # echo "ALL: $*" 70: # echo "ONE: $1" 71: # echo "TWO: $2" 72: 73: compileUnits() 74: { 75: 76: ofile="${ARCH}/capaUnit.o" 77: cfile="capaUnit.c" 78: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 79: echo $cmd 80: $cmd 81: } 82: 83: lexCAPA() 84: { 85: echo "${FLEX} capaLexerDef.flex" 86: # 87: ${FLEX} capaLexerDef.flex 88: 89: echo "mv lex.yy.c capaLexerFun.c" 90: mv lex.yy.c capaLexerFun.c 91: 92: ofile="${ARCH}/capaLexerFun.o" 93: cfile="capaLexerFun.c" 94: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 95: echo $cmd 96: $cmd 97: } 98: 99: lexCAPAdmalloc() 100: { 101: echo "${FLEX} capaLexerDef.flex" 102: # 103: ${FLEX} capaLexerDef.flex 104: 105: echo "mv lex.yy.c capaLexerFun.c" 106: mv lex.yy.c capaLexerFun.c 107: 108: ofile="${ARCH}/capaLexerFun.o" 109: cfile="capaLexerFun.c" 110: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 111: echo $cmd 112: $cmd 113: } 114: 115: lexCAPAdbug() 116: { 117: echo "${FLEX} capaLexerDef.flex" 118: # 119: ${FLEX} capaLexerDef.flex 120: 121: echo "mv lex.yy.c capaLexerFun.c" 122: mv lex.yy.c capaLexerFun.c 123: 124: ofile="${ARCH}/capaLexerFun.o" 125: cfile="capaLexerFun.c" 126: cmd="${CC} $CCFLAG -DLEX_DBUG -c $cfile -o $ofile" 127: echo $cmd 128: $cmd 129: } 130: 131: yaccCAPA() 132: { 133: echo "${YACC} capaGrammarDef.y 134: # -ocapaParserFun.c" 135: # 136: ${YACC} -d capaGrammarDef.y 137: # mv y.tab.c capaParserFun.c 138: echo "mv capaGrammarDef.tab.c capaParserFun.c" 139: mv capaGrammarDef.tab.c capaParserFun.c 140: 141: ofile="${ARCH}/capaParserFun.o" 142: cfile="capaParserFun.c" 143: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 144: echo $cmd 145: $cmd 146: } 147: 148: yaccCAPAdmalloc() 149: { 150: echo "${YACC} capaGrammarDef.y 151: # -ocapaParserFun.c" 152: # 153: ${YACC} -d capaGrammarDef.y 154: echo "mv y.tab.c capaParserFun.c" 155: mv y.tab.c capaParserFun.c 156: 157: ofile="${ARCH}/capaParserFun.o" 158: cfile="capaParserFun.c" 159: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 160: echo $cmd 161: $cmd 162: } 163: 164: yaccCAPAdbug() 165: { 166: echo "${YACC} capaGrammarDef.y -ocapaParserFun.c" 167: # 168: ${YACC} -d capaGrammarDef.y 169: 170: #-ocapaParserFun.c 171: 172: echo "mv y.tab.c capaParserFun.c" 173: # 174: mv y.tab.c capaParserFun.c 175: 176: echo "mv y.tab.h capaToken.h" 177: mv y.tab.h capaToken.h 178: 179: ofile="${ARCH}/capaParserFun.o" 180: cfile="capaParserFun.c" 181: cmd="${CC} $CCFLAG -DYACC_DBUG -c $cfile -o $ofile" 182: echo $cmd 183: $cmd 184: } 185: 186: formulaParser() 187: { 188: 189: echo "${YACC} -p fml_ -d capaFormula.y" 190: ${YACC} -b fma -p fml_ -d capaFormula.y 191: 192: echo "MV fma.tab.c capaFormulaParser.c" 193: echo "MV fma.tab.h capaFormula.h" 194: 195: ${MV} fma.tab.c capaFormulaParser.c 196: ${MV} fma.tab.h capaFormula.h 197: 198: ofile="${ARCH}/capaFormulaParser.o" 199: cfile="capaFormulaParser.c" 200: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 201: echo $cmd 202: $cmd 203: 204: } 205: 206: formulaDbug() 207: { 208: 209: echo "YACC -p fml_ -d capaFormula.y" 210: ${YACC} -b fma -p fml_ -d capaFormula.y 211: 212: echo "MV fma.tab.c capaFormulaParser.c" 213: echo "MV fma.tab.h capaFormula.h" 214: 215: ${MV} fma.tab.c capaFormulaParser.c 216: ${MV} fma.tab.h capaFormula.h 217: 218: ofile="${ARCH}/capaFormulaParser.o" 219: cfile="capaFormulaParser.c" 220: cmd="${CC} $CCFLAG -DFML_DBUG -c $cfile -o $ofile" 221: echo $cmd 222: $cmd 223: 224: ofile="${ARCH}/capaParserUtils.o" 225: cfile="capaParserUtils.c" 226: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 227: echo $cmd 228: $cmd 229: } 230: 231: 232: 233: symboldbug() 234: { 235: echo "${YACC} capaGrammarDef.y " 236: # 237: ${YACC} capaGrammarDef.y 238: 239: echo "mv y.tab.c capaParserFun.c" 240: # 241: mv y.tab.c capaParserFun.c 242: 243: ofile="${ARCH}/capaParserFun.o" 244: cfile="capaParserFun.c" 245: cmd="${CC} $CCFLAG -DSYMBOL_DBUG -c $cfile -o $ofile" 246: echo $cmd 247: $cmd 248: ofile="${ARCH}/capaParserUtils.o" 249: cfile="capaParserUtils.c" 250: cmd="${CC} $CCFLAG -DSYMBOL_DBUG -c $cfile -o $ofile" 251: echo $cmd 252: $cmd 253: # ofile="${ARCH}/capaFunction.o" 254: # cfile="capaFunction.c" 255: # cmd="${CC} $CCFLAG -DSYMBOL_DBUG -c $cfile -o $ofile" 256: # echo $cmd 257: # $cmd 258: } 259: 260: dynamicsymbol() 261: { 262: echo "${FLEX} capaLexerDef.flex" 263: # 264: ${FLEX} capaLexerDef.flex 265: 266: echo "mv lex.yy.c capaLexerFun.c" 267: # 268: mv lex.yy.c capaLexerFun.c 269: 270: ofile="${ARCH}/capaLexerFun.o" 271: cfile="capaLexerFun.c" 272: cmd="${CC} $CCFLAG -DUSE_DYNAMIC_SYMBOLS -c $cfile -o $ofile" 273: echo $cmd 274: $cmd 275: ofile="${ARCH}/capaParserUtils.o" 276: cfile="capaParserUtils.c" 277: cmd="${CC} $CCFLAG -DUSE_DYNAMIC_SYMBOLS -c $cfile -o $ofile" 278: echo $cmd 279: $cmd 280: ofile="${ARCH}/capaCommon.o" 281: cfile="capaCommon.c" 282: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 283: echo $cmd 284: $cmd 285: } 286: 287: arraysymbol() 288: { 289: echo "${FLEX} capaLexerDef.flex" 290: # 291: ${FLEX} capaLexerDef.flex 292: 293: echo "mv lex.yy.c capaLexerFun.c" 294: # 295: mv lex.yy.c capaLexerFun.c 296: 297: ofile="${ARCH}/capaLexerFun.o" 298: cfile="capaLexerFun.c" 299: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 300: echo $cmd 301: $cmd 302: ofile="${ARCH}/capaParserUtils.o" 303: cfile="capaParserUtils.c" 304: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 305: echo $cmd 306: $cmd 307: ofile="${ARCH}/capaCommon.o" 308: cfile="capaCommon.c" 309: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 310: echo $cmd 311: $cmd 312: } 313: 314: CAPAParserUtilsdbug() 315: { 316: ofile="${ARCH}/capaParserUtils.o" 317: cfile="capaParserUtils.c" 318: cmd="${CC} $CCFLAG -DPARSER_DBUG -c $cfile -o $ofile" 319: echo $cmd 320: $cmd 321: } 322: 323: CAPAParserUtils() 324: { 325: ofile="${ARCH}/capaParserUtils.o" 326: cfile="capaParserUtils.c" 327: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 328: echo $cmd 329: $cmd 330: } 331: 332: CAPAFunction() 333: { 334: ofile="${ARCH}/capaFunction.o" 335: cfile="capaFunction.c" 336: cmd="${CC} $CCFLAG -c $cfile -o $ofile" 337: echo $cmd 338: $cmd 339: } 340: createCAPAlib() 341: { 342: 343: if [ -f ${ARCH}/libcapa${VER}.a ] 344: then 345: rm ${ARCH}/libcapa${VER}.a 346: fi 347: 348: echo "ar q ${ARCH}/libcapa${VER}.a ${PAR_OBJ}" 349: 350: ar q ${ARCH}/libcapa${VER}.a ${PAR_OBJ} 351: 352: } 353: 354: compileLexTest() 355: { 356: if [ -f ${TEST_DIR}/testL ] 357: then 358: rm ${TEST_DIR}/testL 359: fi 360: 361: (cd ${TEST_DIR}; make testL) 362: 363: } 364: 365: compileParseTest() 366: { 367: if [ -f ${TEST_DIR}/testP ] 368: then 369: rm ${TEST_DIR}/testP 370: fi 371: 372: (cd ${TEST_DIR}; make testP) 373: 374: } 375: 376: compileParseTestDmalloc() 377: { 378: if [ -f ${TEST_DIR}/testP ] 379: then 380: rm ${TEST_DIR}/testP 381: fi 382: 383: (cd ${TEST_DIR}; make testPdmalloc) 384: 385: } 386: 387: compileLoginTest() 388: { 389: if [ -f ${TEST_DIR}/testLogin ] 390: then 391: rm ${TEST_DIR}/testLogin 392: fi 393: 394: ofile="${ARCH}/capaLoginTest.o" 395: cfile="capalogin.c" 396: cmd="${CC} $CCFLAG -DLOGIN_DBUG -c $cfile -o $ofile" 397: echo $cmd 398: $cmd 399: 400: cmd="${CC} $CCFLAG -Wall ${ARCH}/libcapa${VER}.a $ofile -L${ARCH} -lcapa${VER} ${PLIBS} -o ${TEST_DIR}/testLogin" 401: echo $cmd 402: $cmd 403: 404: } 405: 406: compileFormulaTest() 407: { 408: if [ -f ${TEST_DIR}/testFormula ] 409: then 410: rm ${TEST_DIR}/testFormula 411: fi 412: 413: ofile="${ARCH}/capaTestFormula.o" 414: cfile="${TEST_DIR}/tformula_main.c" 415: cmd="${CC} $CCFLAG -DLOGIN_DBUG -I. -I.. -c $cfile -o $ofile" 416: echo $cmd 417: $cmd 418: 419: cmd="${CC} $CCFLAG ${ARCH}/libcapa${VER}.a $ofile -L${ARCH} -lcapa${VER} ${PLIBS} -o 420: ${TEST_DIR}/testFormula" 421: echo $cmd 422: $cmd 423: 424: } 425: 426: for i in $* ; do 427: case "$i" in 428: *FP) 429: formulaParser 430: createCAPAlib 431: ;; 432: *LD) 433: lexCAPAdmalloc 434: ;; 435: *L) 436: lexCAPA 437: ## createCAPAlib 438: ;; 439: *X) 440: ## lexCAPAdbug 441: ## createCAPAlib 442: ;; 443: *P) 444: yaccCAPAdbug 445: createCAPAlib 446: ;; 447: *YD) 448: echo "Hi There" 449: yaccCAPAdmalloc 450: ;; 451: *Y) 452: yaccCAPA 453: ## createCAPAlib 454: ;; 455: *PD) 456: CAPAParserUtilsdbug 457: ;; 458: *PU) 459: CAPAParserUtils 460: CAPAFunction 461: ;; 462: *SS) 463: symboldbug 464: ;; 465: *DS) 466: dynamicsymbol 467: ;; 468: *AS) 469: arraysymbol 470: ;; 471: *D) 472: formulaDbug 473: createCAPAlib 474: ;; 475: esac 476: done 477: 478: ## createCAPAlib 479: 480: for i in $* ; do 481: case "$i" in 482: *LD|*YD) 483: createCAPAlib 484: compileParseTestDmalloc 485: ;; 486: *L|*X) 487: compileParseTest 488: ;; 489: *PU|*Y|*SS|*DS|*AS) 490: createCAPAlib 491: compileParseTest 492: ;; 493: *O|*o) 494: compileLoginTest 495: ;; 496: *F|*f) 497: compileFormulaTest 498: ;; 499: *U|*u) 500: compileUnits 501: ;; 502: *lib|*Lib) 503: createCAPAlib 504: ;; 505: esac 506: done 507: 508: echo " " 509: exit 0 510: