home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************
- * *
- * The SB-Prolog System *
- * Copyright SUNY at Stony Brook, 1986; University of Arizona, 1987 *
- * *
- ************************************************************************/
-
- /*-----------------------------------------------------------------
- SB-Prolog is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY. No author or distributor
- accepts responsibility to anyone for the consequences of using it
- or for whether it serves any particular purpose or works at all,
- unless he says so in writing. Refer to the SB-Prolog General Public
- License for full details.
-
- Everyone is granted permission to copy, modify and redistribute
- SB-Prolog, but only under the conditions described in the
- SB-Prolog General Public License. A copy of this license is
- supposed to have been given to you along with SB-Prolog so you
- can know your rights and responsibilities. It should be in a
- file named COPYING. Among other things, the copyright notice
- and this notice must be preserved on all copies.
- ------------------------------------------------------------------ */
-
- /* sim.h */
-
- #include <stdio.h>
- #include <math.h>
-
-
- #define maxregs 257
- #define maxtraps 2
- #define WRITEFLAG 1
- #define READFLAG 0
- #define max_len 1280
- #define bucket_chain 53
- #define null 0
- #define true 1
- #define false 0
- #define PERM 1
- #define TEMP 0
- #define CAR 1
- #define CDR 0
-
- #define T_ORDI 0 /* constant-type: no ep definition */
- #define T_DYNA 1 /* constant-type: dynamic, code in buffer */
- #define T_PRED 2 /* constant-type: ep points to compiled code */
- #define T_BUFF 3 /* constant-type: no ep field at all */
- #define T_TEMP_PRED 15 /* psc entry for predicate containing offset
- entry point */
-
- #define MAXINT 268435455
-
- /* ------------ Type Specifiers --------------------------------------- */
-
- typedef unsigned char byte;
- typedef unsigned long word;
- typedef byte *pb;
- typedef word *pw;
-
- struct psc_rec {
- byte entry_type;
- byte arity;
- unsigned short length;
- char *nameptr;
- byte *ep; /* entry point, various meaning */
- };
-
-
- /* --------- External variable declarations -------------------------------- */
-
- extern int maxmem, maxpspace, maxtrail;
-
- extern word *memory; /* heap, local stack */
- extern word *pspace; /* psc records, instructions, p-names */
- extern word *tstack;
- extern word reg[maxregs]; /* registers */
- extern byte *trap_vector[maxtraps];
- extern word *hash_table[bucket_chain][2];
-
- extern word *local_bottom;
- extern word *heap_bottom;
- extern word *trail_bottom;
-
- extern byte *curr_fence; /* ptr to next free byte in perm space */
- extern byte *max_fence; /* ptr to last+1 free byte in perm space */
- extern byte *inst_begin; /* ptr to the beginning of inst. array */
-
- extern word *ereg; /* last activation record */
- extern word *breg; /* last choice point */
- extern word *hreg; /* top of heap */
- extern word *trreg; /* top of trail stack */
- extern word *hbreg; /* heap back track point */
- extern word *sreg; /* current build or unify field */
- extern byte *cpreg; /* return point register */
- extern byte *pcreg; /* program counter */
-
- extern word oprnd1, oprnd2, oprnd3;
-
- extern byte flag; /* read/write mode flag */
-
- extern word flags[10]; /* user flags, -u[0-9], from command line */
- extern byte trace; /* 1 = trace on, 0 = trace off */
- extern byte hitrace; /* 1 = hitrace on, 0 = hitrace off */
- extern byte overflow_f; /* 1 = ignore stack overflow */
- extern byte disassem;
- extern byte trace_sta; /* 1 = keep max stack size stats */
- extern byte call_intercept; /* hitrace or trace_sta for efficiency */
-
- extern word term ; /* defined in "unsafe.c" ?? */
-
- extern int pcstop; /* used in "dis.c" ?? */
-
- extern int num_line;
-
- extern word nil_sym, list_str;
-
- extern struct psc_rec *interrupt_psc;
- extern struct psc_rec *list_psc;
- extern struct psc_rec *comma_psc;
-
- extern int pspace_used; /* heap_used, stack_used, trail_used; */
- extern pw mheaptop, mlocaltop, mtrailtop;
-
- extern byte *sav_pcreg, *sav_ereg; /* to save old values of pcreg and ereg to handle
- saving of Prolog states correctly */
-
- extern int interrupt_code;
-
-
-
-