1: #include "defs" 2: #include "tokdefs" 3: 4: kwinit() 5: { 6: struct key { char *keyn; int keyval; } *p; 7: static struct key keys[] = { 8: "common", COMMON, 9: "internal", INTERNAL, 10: "external", EXTERNAL, 11: "automatic", AUTOMATIC, 12: "static", STATIC, 13: "value", VALUE, 14: "procedure", PROCEDURE, 15: "blockdata", BLOCKDATA, 16: "subroutine", PROCEDURE /* NB */, 17: "function", PROCEDURE /* NB */, 18: "option", OPTION, 19: "include", INCLUDE, 20: "define", DEFINE, 21: "end", END, 22: "integer", INTEGER, 23: "real", REAL, 24: "complex", COMPLEX, 25: "logical", LOGICAL, 26: "character", CHARACTER, 27: "struct", STRUCT, 28: "field", FIELD, 29: "array", ARRAY, 30: "dimension", DIMENSION, 31: "long", LONG, 32: "short", SHORT, 33: "initial", INITIAL, 34: "equivalence", EQUIVALENCE, 35: "implicit", IMPLICIT, 36: "debug", DEBUG, 37: "if", IF, 38: "else", ELSE, 39: "while", WHILE, 40: "until", UNTIL, 41: "repeat", REPEAT, 42: "do", DO, 43: "for", FOR, 44: "switch", SWITCH, 45: "select", SWITCH, 46: "case", CASE, 47: "default", DEFAULT, 48: "go", GO, 49: "goto", GOTO, 50: "break", BREAK, 51: "exit", EXIT, 52: "next", NEXT, 53: "return", RETURN, 54: "continue", CONTINUE, 55: "call", CALL, 56: "double", DOUBLE, 57: "precision", PRECISION, 58: "doubleprecision", DOUBLEPRECISION, 59: "sizeof", SIZEOF, 60: "lengthof", LENGTHOF, 61: "read", READ, 62: "write", WRITE, 63: "readbin", READBIN, 64: "writebin", WRITEBIN, 65: "true", TRUE, 66: "false", FALSE, 67: 0, 0 } ; 68: 69: for(p = keys ; p->keyn ; ++p) 70: mkkeywd(p->keyn, p->keyval); 71: } 72: 73: 74: 75: geninit() 76: { 77: struct gen { char *genn; int restype; char *specn; int argtype; } *p; 78: static struct gen gens[] = { 79: "abs", TYINT, "iabs", TYINT, 80: "abs", TYREAL, "abs", TYREAL, 81: "abs", TYLREAL, "dabs", TYLREAL, 82: "abs", TYCOMPLEX, "cabs", TYREAL, 83: 84: "sin", TYREAL, "sin", TYREAL, 85: "sin", TYLREAL, "dsin", TYLREAL, 86: "sin", TYCOMPLEX, "csin", TYCOMPLEX, 87: 88: "cos", TYREAL, "cos", TYREAL, 89: "cos", TYLREAL, "dcos", TYLREAL, 90: "cos", TYCOMPLEX, "ccos", TYCOMPLEX, 91: 92: "atan", TYREAL, "atan", TYREAL, 93: "atan", TYLREAL, "datan", TYLREAL, 94: 95: "atan2", TYREAL, "atan2", TYREAL, 96: "atan2", TYLREAL, "datan2", TYLREAL, 97: 98: "sqrt", TYREAL, "sqrt", TYREAL, 99: "sqrt", TYLREAL, "dsqrt", TYLREAL, 100: "sqrt", TYCOMPLEX, "csqrt", TYCOMPLEX, 101: 102: "log", TYREAL, "alog", TYREAL, 103: "log", TYLREAL, "dlog", TYLREAL, 104: "log", TYCOMPLEX, "clog", TYCOMPLEX, 105: 106: "log10", TYREAL, "alog10", TYREAL, 107: "log10", TYLREAL, "dlog10", TYLREAL, 108: 109: "exp", TYREAL, "exp", TYREAL, 110: "exp", TYLREAL, "dexp", TYLREAL, 111: "exp", TYCOMPLEX, "cexp", TYCOMPLEX, 112: 113: "int", TYREAL, "int", TYINT, 114: "int", TYLREAL, "idint", TYINT, 115: 116: "mod", TYINT, "mod", TYINT, 117: "mod", TYREAL, "amod", TYREAL, 118: "mod", TYLREAL, "dmod", TYLREAL, 119: 120: "min", TYINT, "min0", TYINT, 121: "min", TYREAL, "amin1", TYREAL, 122: "min", TYLREAL, "dmin1", TYLREAL, 123: 124: "max", TYINT, "max0", TYINT, 125: "max", TYREAL, "amax1", TYREAL, 126: "max", TYLREAL, "dmax1", TYLREAL, 127: 128: "sign", TYREAL, "sign", TYREAL, 129: "sign", TYINT, "isign", TYINT, 130: "sign", TYLREAL, "dsign", TYLREAL, 131: 0, 0, 0, 0 } ; 132: 133: for(p = gens ; p->genn ; ++p) 134: mkgeneric(p->genn, p->restype, p->specn, p->argtype); 135: } 136: 137: knowninit() 138: { 139: struct known { char *knownn; int knowntype; } *p; 140: static struct known knowns[ ] = { 141: "abs", TYREAL, 142: "iabs", TYINT, 143: "dabs", TYLREAL, 144: "aint", TYREAL, 145: "int", TYINT, 146: "idint", TYINT, 147: "amod", TYREAL, 148: "mod", TYINT, 149: "amax0", TYREAL, 150: "amax1", TYREAL, 151: "max0", TYINT, 152: "max1", TYINT, 153: "dmax1", TYLREAL, 154: "amin0", TYREAL, 155: "amin1", TYREAL, 156: "min0", TYINT, 157: "min1", TYINT, 158: "dmin1", TYLREAL, 159: "float", TYREAL, 160: "ifix", TYINT, 161: "sign", TYREAL, 162: "isign", TYINT, 163: "dsign", TYLREAL, 164: "dim", TYREAL, 165: "idim", TYINT, 166: "sngl", TYREAL, 167: "real", TYREAL, 168: "aimag", TYREAL, 169: "dble", TYLREAL, 170: "cmplx", TYCOMPLEX, 171: "conjg", TYCOMPLEX, 172: "exp", TYREAL, 173: "dexp", TYLREAL, 174: "cexp", TYCOMPLEX, 175: "alog", TYREAL, 176: "dlog", TYLREAL, 177: "clog", TYCOMPLEX, 178: "alog10", TYREAL, 179: "dlog10", TYLREAL, 180: "sin", TYREAL, 181: "dsin", TYLREAL, 182: "csin", TYCOMPLEX, 183: "cos", TYREAL, 184: "dcos", TYLREAL, 185: "ccos", TYCOMPLEX, 186: "tanh", TYREAL, 187: "sqrt", TYREAL, 188: "dsqrt", TYLREAL, 189: "csqrt", TYCOMPLEX, 190: "atan", TYREAL, 191: "datan", TYLREAL, 192: "atan2", TYREAL, 193: "datan2", TYLREAL, 194: "dmod", TYLREAL, 195: "cabs", TYREAL, 196: 0, 0 }; 197: 198: for(p = knowns ; p->knownn ; ++p) 199: mkknown(p->knownn, p->knowntype); 200: }