home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / SOURCE / EXTERN.SAV < prev    next >
Text File  |  1996-06-16  |  24KB  |  887 lines

  1. /* Copyright 1991 Digital Equipment Corporation.
  2. ** All Rights Reserved.
  3. *****************************************************************/
  4. /*     $Id: extern.h,v 1.9 1995/07/27 20:02:29 duchier Exp $     */
  5.  
  6. #ifndef _LIFE_EXTERN_H_
  7. #define _LIFE_EXTERN_H_
  8.  
  9. #include <stdio.h>
  10. #include <string.h>
  11. #include <math.h>
  12. #include <sys/types.h>
  13. #ifndef OS2_PORT
  14. #include <sys/stat.h>
  15. #include <sys/time.h>
  16. #include <sys/times.h>
  17. #else
  18. #include <time.h>
  19. #define OS2_HOME "e:\\src\\plan\\life\\life-1.02\\lf\\";
  20. #endif
  21. #include <assert.h>
  22. #include <errno.h>
  23. #include <setjmp.h>
  24.  
  25.  
  26. /* Memory Alignment and size */
  27. #define WORD sizeof(long)
  28.  
  29. #ifdef WORDALIGN
  30. #define ALIGN WORD
  31. #else
  32. #define ALIGN 8
  33. #endif
  34.  
  35.  
  36. /* Time stamp technique */
  37. #define TS
  38.  
  39. #ifdef CLIFE
  40. #include "blockdef.h"
  41. #endif /* CLIFE */
  42.  
  43.  
  44. /*************************** CONSTANTS **************************/
  45.  
  46. /* Enable looking first for local set_up file */
  47. /* In the final release, LOCALSETUP should be undefined. */
  48. #define LOCALSETUP
  49. #define LOCALSETUPFILE    "./.set_up"
  50.  
  51.  
  52. /* RM: Mar 1 1994: replaced macros with variables. */
  53.  
  54. /* Memory is determined in words by the variable "alloc_words", this may be
  55.    specified on the command line and defaults to the macro "ALLOC_WORDS". mem_size
  56.    is in bytes and is the product of alloc_words by the size of a machine word.
  57.    This system is thus consistent between 32 and 64-bit architectures: the same
  58.    number of psi-terms can be allocated in either.
  59.    */
  60.  
  61. extern int mem_size;
  62. extern int alloc_words;
  63.  
  64.  
  65.  
  66. /* Garbage collection threshold (1/8 of MEM_SIZE is reasonable). */
  67. #define GC_THRESHOLD (alloc_words>>3) /* number of words */
  68.  
  69. /* Copy threshold (1/8 of GC_THRESHOLD is reasonable) */
  70. #define COPY_THRESHOLD (GC_THRESHOLD>>3)
  71.  
  72.  
  73. /* Which C type to use to represent reals and integers in Wild_Life. */
  74. #define REAL double
  75.  
  76. /* Maximum exactly representable integer (2^53-1 for double IEEE format) */
  77. /* May be incorrect for Alpha - haven't checked. RM: Mar  1 1994  */
  78. #define WL_MAXINT 9007199254740991.0
  79.  
  80. /* Maximum number of syntactic tokens in a pretty-printed output term. */
  81. #define PRETTY_SIZE 20000
  82.  
  83. /* Maximum number of built_ins */
  84. #define MAX_BUILT_INS 300
  85.  
  86. /* Maximum size of file names and input tokens (which includes input strings) */
  87. /* (Note: calculated tokens can be arbitrarily large) */
  88. #define STRLEN 10000
  89.  
  90. /* Initial page width for printing */
  91. #define PAGE_WIDTH 80
  92.  
  93. /* Initial depth limit for printing */
  94. #define PRINT_DEPTH 1000000000
  95.  
  96. /* Power of ten to split printing (REALs are often more precise than ints) */
  97. #define PRINT_SPLIT 1000000000
  98. #define PRINT_POWER 9
  99.  
  100. /* Maximum depth of the parser stack */
  101. /* = maximum depth of embedded brackets etc... */
  102. #define PARSER_STACK_SIZE 10000
  103.  
  104. /* Maximum operator precedence */
  105. #define MAX_PRECEDENCE 1200
  106.  
  107. /* Size of prlong buffer */
  108. #define PRINT_BUFFER 100000
  109.  
  110. /* Head of prompt */
  111. #define PROMPT "> "
  112.  
  113. /* Size of prompt buffer */
  114. #define PROMPT_BUFFER 200
  115. #define MAX_LEVEL ((PROMPT_BUFFER-4-strlen(PROMPT))/2)
  116.  
  117. /* Maximum number of goals executed between event polling */
  118. /* Ideally, this should be a function of machine speed. */
  119. #define XEVENTDELAY 1000
  120.  
  121. /* Maximum goal indentation during tracing */
  122. #define MAX_TRACE_INDENT 40
  123.  
  124. #define HEAP_ALLOC(A) (A *)heap_alloc(sizeof(A))
  125. #define STACK_ALLOC(A) (A *)stack_alloc(sizeof(A))
  126.  
  127. /* True flags for the flags field of psi-terms */
  128. #define QUOTED_TRUE   1
  129. #define UNFOLDED_TRUE 2
  130.  
  131. /* Standard booleans */
  132. #define TRUE      1
  133. #define FALSE     0
  134. #define TRUEMASK  1
  135.  
  136. /* For LIFE boolean calculation built-ins */
  137. #define UNDEF     2
  138.  
  139. #define NOT_CODED 0
  140. #define UN_CODED (CODE)0
  141.  
  142. /* Must be different from NULL, a built-in index, and a pointer */
  143. /* Used to indicate that the rules of the definition are needed. */
  144. #define DEFRULES  -1
  145.  
  146. #define EOLN 10
  147.  
  148. /* How many types can be encoded on one integer */
  149. /* in the transitive closure encoding. */
  150. #define INT_SIZE 8*sizeof(unsigned long)
  151.  
  152. /* Flags to indicate heap or stack allocation */
  153. #define HEAP TRUE
  154. #define STACK FALSE
  155.  
  156. /* Kinds of user inputs */
  157. #define FACT 100
  158. #define QUERY 200
  159. #define ERROR 999
  160.  
  161. /* Bit masks for status field of psi-terms: RMASK is used as a flag to */
  162. /* avoid infinite loops when tracing psi-terms, SMASK masks off the    */
  163. /* status bits.  These are used in the 'mark' routines (copy.c) and in */
  164. /* check_out. */
  165. #define RMASK 256
  166. #define SMASK 255
  167.  
  168. /* Initial value of time stamp (for variable binding) */
  169. #ifdef TS
  170. #define INIT_TIME_STAMP 1
  171. #endif
  172.  
  173. /*  RM: Feb 10 1993  */
  174. /* To distinguish function actual parameters from formal parameters during
  175.    matching:
  176.    */
  177.  
  178. #define FUNC_ARG(t)  ((t)<match_date || (GENERIC)(t)>=heap_pointer)
  179.  
  180.  
  181.  
  182.  
  183.  
  184. /******************************** MACROS *******************************/
  185.  
  186. /* *** Macros for the tokenizer, define the types of ASCII characters. */
  187.  
  188.  
  189. #define DIGIT(C) (C>='0' && C<='9')
  190.  
  191. #define UPPER(C) ((C>='A' && C<='Z') || C=='_')
  192.  
  193. #define LOWER(C) (C>='a' && C<='z')
  194.  
  195. #define ISALPHA(C) (DIGIT(C) || UPPER(C) || LOWER(C))
  196.  
  197. /* Must be single-character tokens (unless surrounded by quotes) */
  198. /* The chars '.', '?', and '`' have been added */
  199. #define SINGLE(C) (C=='(' || C==')' || C=='[' || C==']' || C=='{' || C=='`' ||\
  200.                    C=='}' || C==',' || C=='.' || C==';' || C=='@' ||\
  201.            C=='!')/*  RM: Jul  7 1993  */
  202.  
  203. /* Can be components of multi-character tokens */
  204. #define SYMBOL(C) (C=='#' || C=='$' || C=='%' || C=='&' ||\
  205.                    C=='*' || C=='+' || C=='-' || C=='>' || C=='/' ||\
  206.                    C==':' || C=='<' || C=='=' ||\
  207.                    C=='~' || C=='^' || C=='|' || C=='\\' ||\
  208.            C=='.' || C=='?' /*  RM: Jul  7 1993  */ \
  209.            )
  210. /*C=='!' ||  RM: Jul  7 1993  */
  211.  
  212. /* Returns TRUE iff psi_term A is equal to string B. */
  213. /* This cannot be used on encoded types.  */
  214. #define equ_tok(A,B) (!strcmp(A.type->keyword->symbol,B))
  215. #define equ_tok3(A,B,Q) (Q?FALSE:equ_tok(A,B))
  216.  
  217. /* Returns TRUE iff psi_term A is equal to character B. */
  218. #define equ_tokch(A,B) (A.type->keyword->symbol[0]==B && A.type->keyword->symbol[1]==0)
  219. #define equ_tokch3(A,B,Q) (Q?FALSE:equ_tokch(A,B))
  220.  
  221. /* Returns TRUE iff psi_term A is equal to character B. */
  222. /* Handles also the case where B may be NULL, i.e. A must be empty */
  223. #define equ_tokc(A,B) (B?equ_tokch(A,B):A.type->keyword->symbol[0]==0)
  224. #define equ_tokc3(A,B,Q) (Q?FALSE:equ_tokc(A,B))
  225.  
  226. /* *** Other macros. */
  227.  
  228. /* The cut operation */
  229. /* This ensures that a cut is below choice_stack. */
  230.  
  231.  
  232. #define cut_to(C) { ptr_choice_point cp=choice_stack; \
  233.             while ((GENERIC)cp>(GENERIC)(C)) cp=cp->next; \
  234.             choice_stack=cp; \
  235.           }
  236.  
  237. /*
  238. #define cut_to(C) if ((ptr_choice_point)(C)<=choice_stack) { \
  239.   choice_stack=(ptr_choice_point)(C); \
  240.   }
  241. */
  242.  
  243.  
  244. /* The basic dereference operation. */
  245. /* P must be a pointer to a psi_term.  */
  246. /* (For the other dereference routines, see lefun.c) */
  247. #define deref_ptr(P) while(P->coref) P=P->coref
  248.  
  249. /* Predicates defined in Life whose args should not be evaluated. */
  250. #define noneval(T) (T->type==quote || T->type==listingsym || T->type==loadsym)
  251.  
  252. /* CONSTant used to be a function, */
  253. /* returns TRUE if psi_term S is a constant.  */
  254. #define wl_const(S) ((S).value==NULL && (S).type!=variable)
  255.  
  256. #define equal_types(A,B) ((A)==(B))
  257.  
  258. #define is_top(T) ((T)!=NULL && (T)->type==top && (T)->attr_list==NULL)
  259.  
  260. /* Object is inside Life data space */
  261.  
  262. /* #define VALID_RANGE(A) ((GENERIC)A>=mem_base && (GENERIC)A<mem_limit) \
  263.   ?TRUE \
  264.   :printf("*** Address out of range: %ld, base=%ld, limit=%ld\n",   \
  265.       (unsigned long) A,   \
  266.       (unsigned long) mem_base,   \
  267.       (unsigned long) mem_limit),FALSE;
  268.  
  269.         RM: Jan  4 1993   An idea
  270. */
  271.  
  272. #define VALID_RANGE(A) ((GENERIC)A>=mem_base && (GENERIC)A<mem_limit)
  273.  
  274. /* Object has valid address to be modified in garbage collector */
  275. #ifdef X11
  276. #define VALID_ADDRESS(A) (  VALID_RANGE(A) \
  277.                          || (GENERIC)A==(GENERIC)&xevent_list \
  278.                          || (GENERIC)A==(GENERIC)&xevent_existing \
  279.                          || (GENERIC)A==(GENERIC)&var_tree \
  280.                          )
  281. #else
  282. #define VALID_ADDRESS(A) (  VALID_RANGE(A) \
  283.                          || (GENERIC)A==(GENERIC)&var_tree \
  284.                          )
  285. #endif
  286.  
  287. /******************************* TYPES ************************************/
  288.  
  289. /* GENERIC is the type of a pointer to any type.  This might not work on */
  290. /* some machines, but it should be possible as MALLOC() uses something of */
  291. /* that kind.  ANSI uses "void *" instead.  */
  292.  
  293.  
  294. typedef unsigned long *                    GENERIC;
  295. /* typedef void * GENERIC; */
  296.  
  297.  
  298. typedef char                      string[STRLEN];
  299. typedef struct wl_operator_data *   ptr_operator_data;
  300. typedef struct wl_int_list *        ptr_int_list;
  301. typedef struct wl_resid_list *      ptr_resid_list; /* 21.9 */
  302. typedef struct wl_definition *      ptr_definition;
  303. typedef struct wl_residuation *     ptr_residuation;
  304. typedef struct wl_psi_term *        ptr_psi_term;
  305. typedef struct wl_node *            ptr_node;
  306. typedef struct wl_pair_list *       ptr_pair_list;
  307. typedef struct wl_triple_list *     ptr_triple_list;
  308. typedef struct wl_list *            ptr_list;
  309. typedef struct wl_stack *           ptr_stack;
  310. typedef struct wl_goal *            ptr_goal;
  311. typedef struct wl_choice_point *    ptr_choice_point;
  312.  
  313. /****************************** DATA STRUCTURES **************************/
  314.  
  315. /* Definition of an operator */
  316.  
  317. typedef enum { nop, xf, fx, yf, fy, xfx, /* yfy, */ xfy, yfx } operator;
  318.  
  319. typedef struct wl_operator_data {
  320.   operator type;
  321.   long precedence;
  322.   ptr_operator_data next;
  323. } operator_data;
  324.  
  325. /* List of integers or pointers */
  326. typedef struct wl_int_list {
  327.   GENERIC value;
  328.   ptr_int_list next;
  329. } int_list;
  330.  
  331. /* List of residuation variables */ /* 21.9 */
  332. typedef struct wl_resid_list { 
  333.   ptr_psi_term var;
  334.   ptr_psi_term othervar; /* needed for its sort only */
  335.   ptr_resid_list next;
  336. } resid_list;
  337.  
  338. typedef enum {   undef,
  339.          predicate,
  340.          function,
  341.          type,
  342.          global    /*  RM: Feb  8 1993  */
  343. #ifdef CLIFE
  344.          ,block       /*  AA: Mar  8 1993  */
  345. #endif /* CLIFE */
  346.          } def_type;
  347.  
  348.  
  349.  
  350.  
  351. typedef struct wl_hash_table * ptr_hash_table;
  352.  
  353.  
  354. /************ MODULES **************/
  355. /*        RM: Jan  7 1993          */
  356.  
  357. struct wl_module {
  358.   char *module_name;
  359.   char *source_file;
  360.   ptr_int_list open_modules;
  361.   ptr_int_list inherited_modules;
  362.   ptr_hash_table symbol_table;
  363. };
  364.  
  365.  
  366. typedef struct wl_module * ptr_module;
  367.  
  368. extern ptr_node module_table;        /* The table of modules */
  369. extern ptr_module current_module;    /* The current module for the tokenizer */
  370.  
  371.  
  372. struct wl_keyword {
  373.   ptr_module module;
  374.   char *symbol;
  375.   char *combined_name; /* module#symbol */
  376.   int public;
  377.   int private_feature; /*  RM: Mar 11 1993  */
  378.   ptr_definition definition;
  379. };
  380.  
  381. typedef struct wl_keyword * ptr_keyword;
  382.  
  383. /********* END MODULES *************/
  384.  
  385.  
  386.  
  387. /************ HASH CODED SYMBOL TABLE **************/
  388. /*                RM: Feb  3 1993                  */
  389.  
  390.  
  391. /* Hash tables for keywords */
  392.  
  393. struct wl_hash_table {
  394.   int size;
  395.   int used;
  396.   ptr_keyword *data;
  397. };
  398.  
  399. /*
  400. void           hash_insert(ptr_hash_table table,char *symbol,ptr_keyword data);
  401. ptr_keyword    hash_lookup(ptr_hash_table table,char *symbol);
  402. ptr_hash_table hash_create(int size);
  403. void           hash_expand(ptr_hash_table table,int new_size);
  404. int            hash_code(ptr_hash_table table,char *symbol);
  405. void           hash_display(ptr_hash_table table);
  406. */
  407.  
  408. void           hash_insert();
  409. ptr_keyword    hash_lookup();
  410. ptr_hash_table hash_create();
  411. void           hash_expand();
  412. int            hash_code();
  413. void           hash_display();
  414.  
  415. extern ptr_definition first_definition;
  416.  
  417. /****************** END HASH TABLES *****************/
  418.  
  419.  
  420.  
  421.  
  422. /****************************/
  423. /* Definition of a keyword. */
  424. /* This includes the rules associated to the symbol and how old they are.  */
  425. typedef struct wl_definition {
  426.   long date;
  427.  
  428.   ptr_keyword keyword; /*  RM: Jan 11 1993  */
  429.   
  430.   ptr_pair_list rule;
  431.   ptr_triple_list properties;
  432.  
  433.   ptr_int_list code;
  434.   ptr_int_list parents;
  435.   ptr_int_list children;
  436.  
  437.   def_type type;
  438.   char always_check;  /* TRUE by default */
  439.   char protected;     /* TRUE by default */
  440.   char evaluate_args; /* TRUE by default */
  441.   char already_loaded; /* Cleared at the prompt, set upon loading */
  442.  
  443.   ptr_operator_data op_data;
  444.  
  445.   ptr_psi_term global_value; /*  RM: Feb  8 1993  */
  446.   ptr_psi_term init_value;   /*  RM: Mar 23 1993  */
  447.   
  448. #ifdef CLIFE
  449.   ptr_block_definition block_def; /* AA: Mar 10 1993 */
  450. #endif /* CLIFE */
  451.   
  452.   ptr_definition next;
  453. } definition;
  454.  
  455. /* 22.9 */
  456. typedef struct wl_residuation {
  457.   long sortflag; /* bestsort == if TRUE ptr_definition else ptr_int_list */
  458.   GENERIC bestsort; /* 21.9 */
  459.   GENERIC value; /* to handle psi-terms with a value field 6.10 */
  460.   ptr_goal goal;
  461.   ptr_residuation next;
  462. } residuation;
  463.  
  464. /* PSI_TERM */
  465. typedef struct wl_psi_term {
  466. #ifdef TS
  467.   unsigned long time_stamp; /* Avoid multiple trailing on a choice point. 9.6 */
  468. #endif
  469.   ptr_definition type;
  470.   long status; /* Indicates whether the properties of the type have been */
  471.               /* checked or the function evaluated */
  472.   /* long curried; Distinguish between quoted and curried object 20.5 */
  473.   long flags; /* 14.9 */
  474.   GENERIC value;
  475.   ptr_node attr_list;
  476.   ptr_psi_term coref;
  477.   ptr_residuation resid; /* List of goals to prove if type is narrowed. */
  478. } psi_term;
  479.  
  480. /* Binary tree node. */
  481. /* KEY can be either an integer (a pointer) or a pointer to a string. */
  482. /* DATA is the information accessed under the KEY, in most cases a pointer */
  483. /* to a PSI-TERM.  */
  484.  
  485. typedef struct wl_node {
  486.   char *key;
  487.   ptr_node left;
  488.   ptr_node right;
  489.   GENERIC data;
  490. } node;
  491.  
  492. typedef struct wl_pair_list {
  493.   ptr_psi_term a;
  494.   ptr_psi_term b;
  495.   ptr_pair_list next;
  496. } pair_list;
  497.  
  498. /* Used for type properties */
  499. typedef struct wl_triple_list {
  500.   ptr_psi_term a;   /* Attributes */
  501.   ptr_psi_term b;   /* Constralong */
  502.   ptr_definition c; /* Original type of attribute & constralong */
  503.   ptr_triple_list next;
  504. } triple_list;
  505.  
  506. /*  RM: Dec 15 1992  Away goes the old list structure!!
  507.     typedef struct wl_list {
  508.     ptr_psi_term car;
  509.     ptr_psi_term cdr;
  510.     } list;
  511.     */
  512.  
  513.  
  514. #ifdef CLIFE
  515. #ifdef OS2_PORT
  516. #include "blockstr.h"
  517. #else
  518. #include "blockstruct.h"
  519. #endif
  520. #endif /* CLIFE */
  521.  
  522.  
  523. /* Used to identify the object on the undo_stack */
  524. /* Use define instead of enums because quick masking is important */
  525. typedef long type_ptr;
  526. #define psi_term_ptr    0
  527. #define resid_ptr    1
  528. #define int_ptr        2
  529. #define def_ptr        3
  530. #define code_ptr    4
  531. #define goal_ptr    5
  532. #define cut_ptr         6 /* 22.9 */
  533.  
  534. #ifdef CLIFE
  535. #define block_ptr      12
  536. #define value_ptr      13
  537. #endif /* CLIFE */
  538.  
  539. #define destroy_window    7+32 /* To backtrack on window creation */
  540. #define show_window    8+32 /* To backtrack on show window */
  541. #define hide_window    9+32 /* To backtrack on hide window */
  542. #define show_subwindow  10+32 /* To backtrack on show sub windows RM 8/12/92 */
  543. #define hide_subwindow  11+32 /* To backtrack on hide sub windows RM 8/12/92 */
  544. #define undo_action      32 /* Fast checking for an undo action */
  545.  
  546. typedef struct wl_stack {
  547.   type_ptr type; 
  548.   GENERIC a;
  549.   GENERIC b;
  550.   ptr_stack next;
  551. } stack;
  552.  
  553. typedef enum {
  554.   fail,
  555.   prove,
  556.   unify,
  557.   unify_noeval,
  558.   disj,
  559.   what_next,
  560.   eval,
  561.   eval_cut,
  562.   freeze_cut,
  563.   implies_cut,
  564.   general_cut,
  565.   match,
  566.   type_disj,
  567.   clause,
  568.   del_clause,
  569.   retract,
  570.   load,
  571.   c_what_next /*  RM: Mar 31 1993  */
  572. } goals;
  573.  
  574. typedef struct wl_goal {
  575.   goals type;
  576.   ptr_psi_term a;
  577.   ptr_psi_term b;
  578.   GENERIC c;
  579.   ptr_goal next;
  580.   long pending;
  581. } goal;
  582.  
  583. typedef struct wl_choice_point {
  584.   unsigned long time_stamp;
  585.   ptr_stack undo_point;
  586.   ptr_goal goal_stack;
  587.   ptr_choice_point next;
  588.   GENERIC stack_top;
  589. } choice_point;
  590.  
  591. /***************************** EXTERNAL VARIABLES ************************/
  592.  
  593.  
  594.  
  595. /* Memory-manager variables. */
  596. /* Garbage collection is done when HEAP_POINTER-STACK_POINTER<MEM_LIMIT. */
  597.  
  598. extern int arg_c;
  599. extern char **arg_v;
  600.  
  601. extern GENERIC mem_base;
  602. extern GENERIC heap_pointer;
  603. extern GENERIC mem_limit;
  604. extern GENERIC stack_pointer;
  605. extern GENERIC stack_alloc();
  606. extern GENERIC heap_alloc();
  607.  
  608. extern float garbage_time;
  609. #ifndef OS2_PORT
  610. extern struct tms life_start,life_end;
  611. #else
  612. extern float life_start,life_end;
  613. extern float times(float*);
  614. #endif
  615.  
  616. extern GENERIC other_base;
  617. extern GENERIC other_limit;
  618. extern GENERIC other_pointer;
  619.  
  620. extern ptr_psi_term error_psi_term;
  621. extern long parser_stack_index;
  622.  
  623. extern ptr_node var_tree;
  624. extern ptr_node printed_vars;
  625. extern ptr_node printed_pointers;
  626. extern ptr_node pointer_names;
  627. extern long gen_sym_counter;
  628.  
  629. extern long warningflag;
  630. extern long verbose;
  631. extern long trace,noisy;
  632. extern long types_done;
  633. extern long interrupted;
  634.  
  635. extern FILE *input_stream;
  636. extern long line_count;
  637. extern string input_file_name;
  638. extern FILE *output_stream;
  639. extern char *prompt;
  640. extern long page_width;
  641.  
  642. /* extern ptr_psi_term empty_list; 5.8 */
  643. extern ptr_definition *gamma_table;
  644. extern long type_count;
  645. extern long types_modified;
  646.  
  647. extern long main_loop_ok;
  648. extern ptr_goal aim;
  649. extern ptr_goal goal_stack;
  650. extern ptr_choice_point choice_stack;
  651. /* extern ptr_choice_point prompt_choice_stack; 12.7 */
  652. extern ptr_stack undo_stack;
  653. #ifdef TS
  654. extern unsigned long global_time_stamp; /* 9.6 */
  655. #endif
  656.  
  657. extern long assert_first;
  658. extern long assert_ok;
  659. extern long file_date;
  660.  
  661. /* The following variables are used to make built-in type comparisons */
  662. /* as fast as possible.  They are defined in built_ins.c.  */
  663. extern ptr_definition abortsym; /* 26.1 */
  664. extern ptr_definition aborthooksym; /* 26.1 */
  665.  
  666. extern ptr_definition add_module1;  /*  RM: Mar 12 1993  */
  667. extern ptr_definition add_module2;
  668. extern ptr_definition add_module3;
  669.  
  670. extern ptr_definition and;
  671. extern ptr_definition apply;
  672. extern ptr_definition boolean;
  673. extern ptr_definition boolpredsym;
  674. extern ptr_definition built_in;
  675. extern ptr_definition colonsym;
  676. extern ptr_definition commasym;
  677. extern ptr_definition comment;
  678. /* extern ptr_definition conjunction; 19.8 */
  679. extern ptr_definition constant;
  680. extern ptr_definition cut;
  681. extern ptr_definition disjunction;
  682. extern ptr_definition disj_nil; /*  RM: Feb 16 1993  */
  683. extern ptr_definition eof;
  684. extern ptr_definition eqsym;
  685. extern ptr_definition leftarrowsym; /* PVR 15.9.93 */
  686. extern ptr_definition false;
  687. extern ptr_definition funcsym;
  688. extern ptr_definition functor;
  689. extern ptr_definition iff;
  690. extern ptr_definition integer;
  691. extern ptr_definition alist;
  692. extern ptr_definition life_or; /*  RM: Apr  6 1993  */
  693. extern ptr_definition minus_symbol;/*  RM: Jun 21 1993  */
  694. extern ptr_definition nil;    /*** RM 9 Dec 1992 ***/
  695. extern ptr_definition nothing;
  696. extern ptr_definition predsym;
  697. extern ptr_definition quote;
  698. extern ptr_definition quoted_string;
  699. extern ptr_definition real;
  700. extern ptr_definition stream;
  701. extern ptr_definition succeed;
  702. extern ptr_definition such_that;
  703. extern ptr_definition top;
  704. extern ptr_definition true;
  705. extern ptr_definition timesym;
  706. extern ptr_definition tracesym; /* 26.1 */
  707. extern ptr_definition typesym;
  708. extern ptr_definition variable;
  709. extern ptr_definition opsym;
  710. extern ptr_definition loadsym;
  711. extern ptr_definition dynamicsym;
  712. extern ptr_definition staticsym;
  713. extern ptr_definition encodesym;
  714. extern ptr_definition listingsym;
  715. extern ptr_definition delay_checksym;
  716. extern ptr_definition eval_argsym;
  717. extern ptr_definition inputfilesym;
  718. extern ptr_definition call_handlersym;
  719. extern ptr_definition xf_sym;
  720. extern ptr_definition fx_sym;
  721. extern ptr_definition yf_sym;
  722. extern ptr_definition fy_sym;
  723. extern ptr_definition xfx_sym;
  724. extern ptr_definition xfy_sym;
  725. extern ptr_definition yfx_sym;
  726. extern ptr_definition nullsym;
  727. extern ptr_definition sys_bytedata; /* DENYS: BYTEDATA */
  728. extern ptr_definition sys_bitvector;
  729. extern ptr_definition sys_regexp;
  730. extern ptr_definition sys_stream;
  731. extern ptr_definition sys_file_stream;
  732. extern ptr_definition sys_socket_stream;
  733.  
  734. /*  RM: Jul  7 1993  */
  735. extern ptr_definition final_dot;
  736. extern ptr_definition final_question;
  737.  
  738. extern ptr_psi_term null_psi_term; /* Used to represent an empty parse token */
  739.  
  740. extern char *one;
  741. extern char *two;
  742. extern char *three;
  743. extern char *year_attr;
  744. extern char *month_attr;
  745. extern char *day_attr;
  746. extern char *hour_attr;
  747. extern char *minute_attr;
  748. extern char *second_attr;
  749. extern char *weekday_attr;
  750.  
  751.  
  752. extern ptr_psi_term old_state; /*  RM: Feb 17 1993  */
  753.  
  754. /************************* EXTERNAL FUNCTIONS *************************/
  755.  
  756. extern void init_system(); /* in life.c */ /* 26.1 */
  757.  
  758. extern long (* c_rule[])(); /* in built_ins.c */
  759.  
  760. extern ptr_psi_term stack_psi_term(); /* in lefun.c */
  761. extern ptr_psi_term real_stack_psi_term(); /* in lefun.c */
  762. extern ptr_psi_term heap_psi_term(); /* in lefun.c */
  763.  
  764. #define stack_empty_list()   stack_nil()   /*  RM: Dec 14 1992  */
  765. /* extern ptr_psi_term stack_empty_list(); */
  766.  
  767. /**********************************************************************/
  768.  
  769. /* include files that everyone needs */
  770. #include "types.h"
  771. #include "error.h"
  772.  
  773. /************ VarArg compatibility definitions ************************/
  774.  
  775. /*
  776.  * Author:         Seth Copen Goldstein
  777.  * Version:        11
  778.  * Creation Date:    Tue May 26 16:31:09 1992
  779.  * Filename:        seth.h
  780.  * History:
  781. */
  782.  
  783. #if !defined(wl_SETH_H_FILE_)
  784. #define wl_SETH_H_FILE_
  785.  
  786. #ifdef OS2_PORT
  787. #include <stdarg.h>
  788. #else
  789. #include <varargs.h>
  790. #endif
  791.  
  792. /* function protoype macros for ansi and old compilers */
  793.  
  794. #if defined(__STDC__) || defined(ds3100)
  795. # define    ARGS(args)    args
  796. #else
  797. # define    ARGS(args)    ()
  798. #endif
  799.  
  800. /* varargs macros that understand the difference between stdargs and varargs */
  801.  
  802. #ifndef OS2_PORT
  803. #define VarArgBase    va_alist
  804. #define VarArgBaseDecl    va_dcl
  805. #else
  806. #define VarArgBase l,...
  807. #define VarArgBaseDecl int l;
  808. #endif
  809. #define VarArg        ___va_lp___
  810. #define VarArgDecl    va_list VarArg
  811. /* Added last condition -- see Maurice Keulen */
  812. #if defined(_VARARGS_H) || defined(__VARARGS_H__) || defined(_VARARGS_) || defined(_sys_varargs_h) || __alpha
  813. # define VarArgInit(l)    va_start(VarArg)
  814. #else
  815. # define VarArgInit(l)    va_start(VarArg, l)
  816. #endif
  817. #define VarArgNext(t)    va_arg(VarArg, t)
  818. #define VarArgEnd()    va_end(VarArg)
  819.  
  820. #if 0
  821. /* example usage of vararg macros */
  822.  
  823. foo(var1, var2, VarArgBase)    /* VarArgBase must be last parameter */
  824. type var1;
  825. type var2;
  826. VarArgBaseDecl;            /* must have this as last decl */
  827. {
  828.     VarArgDecl;        /* declares variable that will be used to
  829.                  * run down the list of arguments starting at
  830.                  * VarArgBase
  831.                  */
  832.     typename var3;        /* example variable that gets one of the
  833.                  * arguments from the argument list
  834.                  */
  835.  
  836.     VarArgInit(var2);    /* MUST BE CALLED BEFORE ACCESSING THE
  837.                  * ARGUMENTS, the parameter to this macro is
  838.                  * ALWAYS the parameter preceding VarArgBase
  839.                  */
  840.     
  841.  
  842.     /* usage to send argument list to one of the v-printf functions */
  843.     
  844.     vfprintf(of, format, VarArg);
  845.  
  846.     /* usage to get an element off the argument list */
  847.     
  848.     var3 = VarArgNext(typename);
  849.  
  850.     /* for saftey sake use this to finish up */
  851.  
  852.     VarArgEnd();
  853. }
  854. #endif
  855.  
  856. #endif
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867. /**********************************************************************/
  868.  
  869. /** TEMPORARY ANSI DECLARATIONS 
  870.  
  871. ptr_definition update_symbol(ptr_module m,char *s);
  872.  
  873. void new_built_in(ptr_module m,
  874.           char *s,
  875.           def_type t,
  876.           long (*r)());
  877.  
  878. **/
  879.  
  880.  
  881.  
  882. #ifdef CLIFE
  883. #include "block.h"
  884. #endif /* CLIFE */
  885.  
  886. #endif /* _LIFE_EXTERN_H_ */
  887.