|
|
1.1 ! root 1: #include <stdio.h> ! 2: ! 3: double *test1; ! 4: double gamma(); ! 5: /* ! 6: * A P L ! 7: */ ! 8: ! 9: /* ! 10: * Magic numbers ! 11: */ ! 12: ! 13: #define OPERBOXSIZE 75 ! 14: ! 15: #define MRANK 8 /* Size of dimension buffer */ ! 16: #define CANBS 300 /* Size of input buffer */ ! 17: #define STKS 50 /* Size of stack increment */ ! 18: #define NLS 100 /* Size of namelist */ ! 19: #define NAMS 23 /* Size of name buffer */ ! 20: #define OBJS 500 /* Size of compiled expr buffer */ ! 21: #define MAGIC 0100554 /* Magic word for WS file */ ! 22: ! 23: /* ! 24: * Magic words ! 25: */ ! 26: ! 27: #define EDIT_ED "/usr/bin/ed" ! 28: #define EDIT_EX "/usr/bin/ex" ! 29: #define EDIT_VI "/usr/bin/vi" ! 30: ! 31: /* ! 32: * Debug modes ! 33: */ ! 34: #define FULLD 1 ! 35: ! 36: #ifdef FULLD ! 37: #define SOMED SOMED ! 38: #endif ! 39: ! 40: #ifdef SHORTD ! 41: #define SOMED SOMED ! 42: #endif ! 43: ! 44: /* ! 45: * Derived constants ! 46: */ ! 47: ! 48: #define SDAT sizeof datum ! 49: #define SINT sizeof integ ! 50: ! 51: /* ! 52: * Interpreter Op Codes ! 53: */ ! 54: ! 55: #define EOF (-1) ! 56: #define EOL 0 ! 57: ! 58: #define ADD 1 ! 59: #define PLUS 2 ! 60: #define SUB 3 ! 61: #define MINUS 4 ! 62: #define MUL 5 ! 63: #define SGN 6 ! 64: #define DIV 7 ! 65: #define RECIP 8 ! 66: #define MOD 9 ! 67: #define ABS 10 ! 68: #define MIN 11 ! 69: #define FLOOR 12 ! 70: #define MAX 13 ! 71: #define CEIL 14 ! 72: #define PWR 15 ! 73: #define EXP 16 ! 74: #define LOG 17 ! 75: #define LOGE 18 ! 76: #define CIR 19 ! 77: #define PI 20 ! 78: #define COMB 21 ! 79: #define FAC 22 ! 80: ! 81: #define DEAL 23 ! 82: #define RAND 24 ! 83: #define DRHO 25 ! 84: #define MRHO 26 ! 85: #define DIOT 27 ! 86: #define MIOT 28 ! 87: #define ROT0 29 ! 88: #define REV0 30 ! 89: #define DTRN 31 ! 90: #define MTRN 32 ! 91: #define DIBM 33 ! 92: #define MIBM 34 ! 93: ! 94: #define GDU 35 ! 95: #define GDUK 36 ! 96: #define GDD 37 ! 97: #define GDDK 38 ! 98: #define EXD 39 ! 99: #define SCAN 40 ! 100: #define EXDK 41 ! 101: #define SCANK 42 ! 102: #define IPROD 43 ! 103: #define OPROD 44 ! 104: #define QUAD 45 ! 105: #define QQUAD 46 ! 106: #define BRAN0 47 ! 107: #define BRAN 48 ! 108: #define DDOM 49 ! 109: #define MDOM 50 ! 110: ! 111: #define COM 51 ! 112: #define RED 52 ! 113: #define COMK 53 ! 114: #define REDK 54 ! 115: #define ROT 55 ! 116: #define REV 56 ! 117: #define ROTK 57 ! 118: #define REVK 58 ! 119: #define CAT 59 ! 120: #define RAV 60 ! 121: #define CATK 61 ! 122: #define RAVK 62 ! 123: ! 124: #define PRINT 63 ! 125: #define QUOT 64 ! 126: #define ELID 65 ! 127: #define CQUAD 66 ! 128: #define COMNT 67 ! 129: #define INDEX 68 ! 130: #define HPRINT 69 ! 131: ! 132: #define LT 71 ! 133: #define LE 72 ! 134: #define GT 73 ! 135: #define GE 74 ! 136: #define EQ 75 ! 137: #define NE 76 ! 138: #define AND 77 ! 139: #define OR 78 ! 140: #define NAND 79 ! 141: #define NOR 80 ! 142: #define NOT 81 ! 143: #define EPS 82 ! 144: #define MEPS 83 ! 145: #define REP 84 ! 146: #define TAKE 85 ! 147: #define DROP 86 ! 148: #define ASGN 88 ! 149: #define IMMED 89 ! 150: ! 151: ! 152: #define NAME 90 ! 153: #define CONST 91 ! 154: #define FUN 92 ! 155: #define ARG1 93 ! 156: #define ARG2 94 ! 157: #define AUTO 95 ! 158: #define REST 96 ! 159: ! 160: #define COM0 97 ! 161: #define RED0 98 ! 162: #define EXD0 99 ! 163: #define SCAN0 100 ! 164: #define BASE 101 ! 165: #define MENC 102 /* monadic encode */ ! 166: ! 167: /* ! 168: * Immediate sub-op codes ! 169: */ ! 170: ! 171: #define CLEAR 1 ! 172: #define DIGITS 2 ! 173: #define ED_IT 3 ! 174: #define ERASE 4 ! 175: #define FNS 5 ! 176: #define FUZZ 6 ! 177: #define READ 7 ! 178: #define ORIGIN 8 ! 179: #define VARS 9 ! 180: #define WIDTH 10 ! 181: #define DEBUG 11 ! 182: #define OFF 12 ! 183: #define LOAD 13 ! 184: #define SAVE 14 ! 185: #define COPY 15 ! 186: #define CONTIN 16 ! 187: #define LIB 17 ! 188: #define DROPC 18 ! 189: #ifdef SOMED ! 190: #define SYMBOLS 19 ! 191: #endif ! 192: #define EX_IT 20 ! 193: #define EX_VI 21 ! 194: #define ASCII 22 ! 195: #define APL 23 ! 196: ! 197: /* ! 198: * Types ! 199: */ ! 200: ! 201: #define DA 1 /* Numeric data (?) */ ! 202: #define CH 2 /* Character data (?) */ ! 203: #define LV 3 /* Used for most data items */ ! 204: #define QD 4 /* Quad (assignment to (?)) */ ! 205: #define QQ 5 /* Quote-quad */ ! 206: #define IN 6 /* ??? */ ! 207: #define EL 7 /* Literal data (??) */ ! 208: #define NF 8 /* Name of function with no args */ ! 209: #define MF 9 /* Monadic function */ ! 210: #define DF 10 /* Dyadic function */ ! 211: #define QC 11 ! 212: ! 213: /* ! 214: * Idiosyncracies ! 215: */ ! 216: ! 217: #define data double ! 218: #define unsignd unsigned ! 219: ! 220: /* ! 221: * Structures ! 222: */ ! 223: ! 224: struct { ! 225: char c[8]; ! 226: }; ! 227: ! 228: struct env { ! 229: double fuzz; ! 230: int iorg; ! 231: int digits; ! 232: int width; ! 233: } thread; ! 234: ! 235: struct item { ! 236: char rank; ! 237: char type; ! 238: int size; ! 239: int index; ! 240: data *datap; ! 241: int dim[MRANK]; ! 242: }; ! 243: ! 244: struct nlist { ! 245: char use; ! 246: char type; /* == LV */ ! 247: int *itemp; ! 248: char *namep; ! 249: int label; ! 250: } nlist[NLS]; ! 251: ! 252: struct lablist { ! 253: char *lname; ! 254: int lno; ! 255: struct lablist *nextll; ! 256: } labldefs; ! 257: ! 258: struct { ! 259: char rank; ! 260: char type; ! 261: int size; ! 262: int dimk; ! 263: int delk; ! 264: int dim[MRANK]; ! 265: int del[MRANK]; ! 266: int idx[MRANK]; ! 267: } idx; ! 268: ! 269: struct { ! 270: char *name; ! 271: int line; ! 272: } now_xeq; ! 273: ! 274: struct item **sp, **stack, **staktop; /* Internal run-time stack */ ! 275: ! 276: /* ! 277: * Externals ! 278: */ ! 279: ! 280: data zero; ! 281: data one; ! 282: data pi; ! 283: data maxexp; ! 284: data datum; ! 285: data getdat(); ! 286: ! 287: int cs_size; /* Current stack size */ ! 288: ! 289: int (*exop[])(); ! 290: ! 291: double floor(); ! 292: double ceil(); ! 293: double log(); ! 294: double sin(); ! 295: double cos(); ! 296: double atan(); ! 297: double atan2(); ! 298: double sqrt(); ! 299: double exp(); ! 300: double gamma(); ! 301: double ltod(); ! 302: ! 303: int integ; ! 304: int signgam; ! 305: int column; ! 306: int intflg; ! 307: int echoflg; ! 308: int ifile; ! 309: int wfile; ! 310: int ofile; ! 311: int funlc; ! 312: int debug; ! 313: int ttystat[3]; ! 314: int stime[2]; ! 315: char *pcp; ! 316: int rowsz; ! 317: int mencflg; ! 318: char *mencptr; ! 319: char *memstart; ! 320: int pt; ! 321: int syze; ! 322: int pas1; ! 323: ! 324: char *continu; ! 325: ! 326: struct charbox { ! 327: char a1,a2; ! 328: }; ! 329: ! 330: struct asoperbox { ! 331: unsigned char letters[2]; ! 332: int returnchar ! 333: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.