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