[net.lang.prolog] Prolog on Apollos

schachte@ittvax.UUCP (Peter Schachte) (04/25/85)

Has anyone out there succeeded in porting C-Prolog to Apollos?  We
tried porting it ourselves, but the Apollo C compiler didn't like the
sources for some reason; before we spend a lot of time trying to find
the problem we'd like to know that nobody has already done it.

Also, does anyone out there know of any other Prologs that run on
Apollos?

Of course, any info would be appreciated.

-- 
				Peter Schachte
				(decvax!ittvax!schachte)

cpd@ucla-cs.UUCP (05/03/85)

> Has anyone out there succeeded in porting C-Prolog to Apollos?  We
> tried porting it ourselves, but the Apollo C compiler didn't like the
> sources for some reason; before we spend a lot of time trying to find
> the problem we'd like to know that nobody has already done it.
> 
> Also, does anyone out there know of any other Prologs that run on
> Apollos?
> 
> Of course, any info would be appreciated.
> 
> -- 
> 				Peter Schachte
> 				(decvax!ittvax!schachte)
We have ported C-Prolog.1.4 to the apollos at UCLA. At the end of this
message I have included a script of 'diff'ing the files with the original
C-Prolog sources. The only extra information I can give is with regards
to the use of SAVED states. On the apollos, programs run in the same adddress
space with the shell from which they are invoked. The means that the
shell under which the saved state was created must be the one under which
C-prolog will be run. Also there will be different starting address for
different node DN300,DN460,DN550. I personally perfer to have the SAVED state
for C-Prolog running from a CP command to the display manager,

The 'diff' script follows (it is quite long).


1
$ find_diff
./find_diff
/bin/diff /tools/sources/cprolog/npl/arith.c arith.c
/bin/diff /tools/sources/cprolog/npl/auxfn.c auxfn.c
/bin/diff /tools/sources/cprolog/npl/compare.c compare.c
/bin/diff /tools/sources/cprolog/npl/dbase.c dbase.c
/bin/diff /tools/sources/cprolog/npl/evalp.c evalp.c
/bin/diff /tools/sources/cprolog/npl/main.c main.c
25d24
< #define MAX_CORE_SIZE 1024*1024           /* SRG 10/15/84 */
328d326
< #	define WasPtr(c)	SC(c,<,0)	/* !IsPrim(c) */
335d332
< #	define WasPtr(c)	SC(c,>=,0)	/* !IsPrim(c) */
354c351
< 	    if (WasPtr(t)) REMAP2(*tp,t,Ratom);
---
> 	    if (!IsPrim(t)) REMAP2(*tp,t,Ratom);
447c444
< 			if (WasPtr(elem)) REMAPp(elem,
---
> 			if (!IsPrim(elem)) REMAPp(elem,
498a496,497
> 			    /*  Check for self-loops (e.g. repeat). */
> 			    if (remapcl->altofcl == ClauseP(factp)) break;
503,504d501
< 			    /*  Check for self-loops (e.g. repeat). */
< 			    if (remapcl->altofcl == ClauseP(factp)) break;
616d612
<     set_sbrk_size(MAX_CORE_SIZE);    /* SRG 10/15/84  for apollo */
/bin/diff /tools/sources/cprolog/npl/parms.c parms.c
79c79
< 		BootFile[] = "/tools/sources/cprolog/npl/pl/init",
---
> 		BootFile[] = "/usr/local/src/prolog/pl/init",
82c82
< 		SavedFmt[] = "/tools/sources/cprolog/lib/saved_states.d/%s";
---
> 		SavedFmt[] = "/usr/lib/prolog/saved_states.d/%s";
/bin/diff /tools/sources/cprolog/npl/rewrite.c rewrite.c
/bin/diff /tools/sources/cprolog/npl/space.c space.c
/bin/diff /tools/sources/cprolog/npl/sysbits.c sysbits.c
/bin/diff /tools/sources/cprolog/npl/unify.c ufify.c
diff: ufify.c: No such file or directory
/bin/diff /tools/sources/cprolog/nplarith.h arith.h
diff: /tools/sources/cprolog/nplarith.h: No such file or directory
/bin/diff /tools/sources/cprolog/npl/evalp.h evalp.h
/bin/diff /tools/sources/cprolog/npl/pl.h pl.h
2,16c2,16
< *                                                                       *
< *                  C Prolog    pl.h                                     *
< *                  ========    ----                                     *
< *                                                                       *
< *  By Fernando Pereira, July 1982.                                      *
< *  EdCAAD, Dept. of Architecture, University of Edinburgh.              *
< *                                                                       *
< *  Based on the Prolog system written in IMP by Luis Damas for ICL      *
< *  2900 computers, with some contributions by Lawrence Byrd.            *
< *                                                                       *
< *  Copyright (C) 1982 Fernando Pereira, Luis Damas and Lawrence Byrd.   *
< *  Beautified, made type-correct, and given additional registers in     *
< *  1983 by Richard O'Keefe, DAI Edinburgh.  Made to work on GEC-63s     *
< *  and other BACKWARDS machines in 1984 by the same.                    *
< *                                                                       *
---
> *									*
> *                  C Prolog    pl.h					*
> *                  ========    ----					*
> *									*
> *  By Fernando Pereira, July 1982.					*
> *  EdCAAD, Dept. of Architecture, University of Edinburgh.		*
> *									*
> *  Based on the Prolog system written in IMP by Luis Damas for ICL	*
> *  2900 computers, with some contributions by Lawrence Byrd.		*
> *									*
> *  Copyright (C) 1982 Fernando Pereira, Luis Damas and Lawrence Byrd.	*
> *  Beautified, made type-correct, and given additional registers in	*
> *  1983 by Richard O'Keefe, DAI Edinburgh.  Made to work on GEC-63s	*
> *  and other BACKWARDS machines in 1984 by the same.			*
> *									*
21,22c21,22
< #undef  NULL
< #define NULL    0L              /* used for 32-bit pointers */
---
> #undef	NULL
> #define	NULL	0L		/* used for 32-bit pointers */
24,25c24,25
< #define TRUE    1
< #define FALSE   0
---
> #define TRUE	1
> #define FALSE	0
27,29c27,29
< #ifdef  perq    
< #   define PIPER 1              /* I'm not sure why this was thought necessary */
< #   define void int             /* why in the name of sanity did ICL forget void? */
---
> #ifdef	perq	
> #   define PIPER 1		/* I'm not sure why this was thought necessary */
> #   define void	int		/* why in the name of sanity did ICL forget void? */
32,33c32,33
< #   define Ignore (void)        /* make Lint shut up */
< #endif  perq
---
> #   define Ignore (void)	/* make Lint shut up */
> #endif	perq
37,38c37,38
< #define MaxInt  268435455       /* largest integer = 2**28-1 */
< #define MinInt  -268435456      /* smallest integer = -2**28 */
---
> #define MaxInt	268435455	/* largest integer = 2**28-1 */
> #define MinInt	-268435456	/* smallest integer = -2**28 */
54,55c54,55
< typedef unsigned long **PTR;    /* anonymous pointers */
< typedef unsigned char byte;     /* used for small counts */
---
> typedef unsigned long **PTR;	/* anonymous pointers */
> typedef unsigned char byte;	/* used for small counts */
59,64c59,64
< typedef struct  ATOM            *ATOMP;
< typedef struct  CLAUSEREC       *CLAUSEP;
< typedef struct  FRAME           *FRAMEP;
< typedef struct  FUNCTOR         *FUNCTORP;
< typedef struct  MOL             *MOLP;
< typedef struct  SKEL            *SKELP;
---
> typedef	struct	ATOM		*ATOMP;
> typedef	struct	CLAUSEREC	*CLAUSEP;
> typedef	struct	FRAME		*FRAMEP;
> typedef	struct	FUNCTOR		*FUNCTORP;
> typedef	struct	MOL		*MOLP;
> typedef	struct	SKEL		*SKELP;
68,79c68,79
< #define CellP(p)        ((PTR*)(p))
< #define AtomP(p)        ((ATOMP)(p))
< #define FunctorP(p)     ((FUNCTORP)(p))
< #define FrameP(p)       ((FRAMEP)(p))
< #define ClauseP(p)      ((CLAUSEP)(p))
< #define MolP(p)         ((MOLP)(p))
< #define SkelP(p)        ((SKELP)(p))
< #define Signed(p)       ((long)(p))
< #define Unsigned(p)     ((unsigned long)(p))
< #define CharP(p)        ((char*)(p))
< #define SkelFuncP(t)    (SkelP(t)->Fn)
< #define SkelAtomP(t)    (SkelP(t)->Fn->atoffe)
---
> #define CellP(p)	((PTR*)(p))
> #define AtomP(p)	((ATOMP)(p))
> #define FunctorP(p)	((FUNCTORP)(p))
> #define FrameP(p)	((FRAMEP)(p))
> #define ClauseP(p)	((CLAUSEP)(p))
> #define MolP(p)		((MOLP)(p))
> #define SkelP(p)	((SKELP)(p))
> #define Signed(p)	((long)(p))
> #define Unsigned(p)	((unsigned long)(p))
> #define CharP(p)	((char*)(p))
> #define SkelFuncP(t)	(SkelP(t)->Fn)
> #define SkelAtomP(t)	(SkelP(t)->Fn->atoffe)
81c81
< #define Addr(p)         ((PTR)&(p))     /* PTRise an address */
---
> #define Addr(p)		((PTR)&(p))	/* PTRise an address */
83c83
< #define NextArg(p)      (*(PTR*)++p)
---
> #define NextArg(p)	(*(PTR*)++p)
106,122c106,122
<         -2^31:          +------------------------+
<                         |integers, floats, dbrefs|
<         0:              +------------------------+
<                         :                        :
<         auxstk0:        +------------------------+
<                         |    Auxiliary stack     |
<         tr0:            +------------------------+
<                         |    Trail               |
<         atom0:          +------------------------+
<                         |    Atoms               |
<         heap0:          +------------------------+
<                         |    Heap (input terms)  |
<         glb0:           +------------------------+
<                         |    Global stack        |
<         lcl0:           +------------------------+
<                         |    Local stack         |
<                         +------------------------+
---
> 	-2^31:		+------------------------+
> 			|integers, floats, dbrefs|
> 	0:		+------------------------+
> 			:			 :
> 	auxstk0:	+------------------------+
> 			|    Auxiliary stack	 |
> 	tr0:		+------------------------+
> 			|    Trail		 |
> 	atom0:  	+------------------------+
> 			|    Atoms		 |
> 	heap0:		+------------------------+
> 			|    Heap (input terms)	 |
> 	glb0:		+------------------------+
> 			|    Global stack	 |
> 	lcl0:		+------------------------+
> 			|    Local stack	 |
> 			+------------------------+
128,134c128,134
<                               tag bits
<                               31 30 29
<                 =============+==+==+==
<                 int           1  1  1
<                 float         1  1  0
<                 ptr to clause 1  0  0
<                 ptr to record 1  0  1
---
> 			      tag bits
> 			      31 30 29
> 		=============+==+==+==
> 		int           1  1  1
> 		float         1  1  0
> 		ptr to clause 1  0  0
> 		ptr to record 1  0  1
144,160c144,160
<         auxstk0:        +------------------------+
<                         |    Auxiliary stack     |
<         tr0:            +------------------------+
<                         |    Trail               |
<         glb0:           +------------------------+
<                         |    Global stack        |
<         lcl0:           +------------------------+
<                         |    Local stack         |
<         heap0:          +------------------------+
<                         |    Heap (input terms)  |
<         atom0:          +------------------------+
<                         |    Atoms               |
<                         +------------------------+
<                         :                        :
<         0:              +------------------------+
<                         |integers, floats, dbrefs|
<         2^31-1:         +------------------------+
---
> 	auxstk0:	+------------------------+
> 			|    Auxiliary stack	 |
> 	tr0:		+------------------------+
> 			|    Trail		 |
> 	glb0:		+------------------------+
> 			|    Global stack	 |
> 	lcl0:		+------------------------+
> 			|    Local stack	 |
> 	heap0:		+------------------------+
> 			|    Heap (input terms)	 |
> 	atom0:  	+------------------------+
> 			|    Atoms		 |
> 			+------------------------+
> 			:			 :
> 	0:		+------------------------+
> 			|integers, floats, dbrefs|
> 	2^31-1:		+------------------------+
174,180c174,180
<                               tag bits
<                               31 30 29
<                 =============+==+==+==
<                 int           0  0  0
<                 float         0  0  1
<                 ptr to clause 0  1  0
<                 ptr to record 0  1  1
---
> 			      tag bits
> 			      31 30 29
> 		=============+==+==+==
> 		int           0  0  0
> 		float         0  0  1
> 		ptr to clause 0  1  0
> 		ptr to record 0  1  1
186c186
< #define SC(x,r,y) (Signed(x) r Signed(y))
---
> #define	SC(x,r,y) (Signed(x) r Signed(y))
190c190
< #define UM(x,m,v) ((Unsigned(x)&Unsigned(m)) == Unsigned(v))
---
> #define	UM(x,m,v) ((Unsigned(x)&Unsigned(m)) == Unsigned(v))
208c208
< #if     vax | orion
---
> #if	vax | orion
212,221c212,221
< #if     ~USEREGS
< #   define      atomREG atom0
< #   define      heapREG heap0
< #   define      glbREG  glb0
< #   define      DeclRegisters
< #   define      InitRegisters
< #else   USEREGS
< #if     BACKWARDS
< #   define      DeclRegisters   register PTR heapREG, atomREG;
< #   define      InitRegisters   heapREG = heap0, atomREG = atom0;
---
> #if	~USEREGS
> #   define	atomREG atom0
> #   define	heapREG	heap0
> #   define	glbREG  glb0
> #   define	DeclRegisters
> #   define	InitRegisters
> #else	USEREGS
> #if	BACKWARDS
> #   define	DeclRegisters	register PTR heapREG, atomREG;
> #   define	InitRegisters	heapREG = heap0, atomREG = atom0;
223,226c223,226
< #   define      DeclRegisters   register PTR glbREG, heapREG;
< #   define      InitRegisters   glbREG = glb0, heapREG = heap0;
< #endif  BACKWARDS
< #endif  USEREGS
---
> #   define	DeclRegisters	register PTR glbREG, heapREG;
> #   define	InitRegisters	glbREG = glb0, heapREG = heap0;
> #endif	BACKWARDS
> #endif	USEREGS
229,237c229,237
< |                                                                       |
< |    VARIABLES IN THE STACKS                                            |
< |       The relative order of global and local variables is the same    |
< |       whether the OS is BACKWARDS or not.  We use ordinary pointer    |
< |       comparisons throughout the whole of C Prolog for comparing a    |
< |       pair of variables, this had better be unsigned comparison. A    |
< |       variable whose value is 0 (which is otherwise meaningless in    |
< |       C-Prolog) is understood to be unbound.                          |
< |                                                                       |
---
> |									|
> |    VARIABLES IN THE STACKS						|
> |	The relative order of global and local variables is the same	|
> |	whether the OS is BACKWARDS or not.  We use ordinary pointer	|
> |	comparisons throughout the whole of C Prolog for comparing a	|
> |	pair of variables, this had better be unsigned comparison. A	|
> |	variable whose value is 0 (which is otherwise meaningless in	|
> |	C-Prolog) is understood to be unbound.				|
> |									|
240,242c240,242
< #if     BACKWARDS
< #   define IsRef(c)     SC(c,<,heap0)   /* Prolog variable */
< #   define IsaRef(c)    SC(c,<,heapREG)
---
> #if	BACKWARDS
> #   define IsRef(c)	SC(c,<,heap0)	/* Prolog variable */
> #   define IsaRef(c)	SC(c,<,heapREG)
244,246c244,246
< #   define IsRef(c)     SC(c,>=,glb0)   /* Prolog variable */
< #   define IsaRef(c)    SC(c,>=,glbREG)
< #endif  BACKWARDS
---
> #   define IsRef(c)	SC(c,>=,glb0)	/* Prolog variable */
> #   define IsaRef(c)	SC(c,>=,glbREG)
> #endif	BACKWARDS
248,250c248,250
< #define Undef(c)        ((c) == NULL)   /* undefined value */
< #define IsUnbound(c)    (*(c) == NULL)  /* unbound variable */
< #define VarVal(p)       (*(PTR*)(p))    /* variable's binding */
---
> #define Undef(c)	((c) == NULL)	/* undefined value */
> #define	IsUnbound(c)	(*(c) == NULL)	/* unbound variable */
> #define VarVal(p)	(*(PTR*)(p))	/* variable's binding */
254c254
< #define GrowLocal(n)    (V = FrameP(v+(n)))
---
> #define GrowLocal(n)	(V = FrameP(v+(n)))
256c256
< #define GrowGlobal(n)   (v1 += (n))
---
> #define GrowGlobal(n)	(v1 += (n))
258,260c258,260
< #define InitGlobal(n,k) {   register PTR p = v1; \
<                             k = p, p += n, v1 = p; \
<                             while (p > k) *--p = NULL;  }
---
> #define InitGlobal(n,k)	{   register PTR p = v1; \
> 			    k = p, p += n, v1 = p; \
> 			    while (p > k) *--p = NULL;	}
264c264
< #define ConsaMol(s,e,t,v) t=v1,v1+=MolSz,MolP(t)->Sk=s,MolP(t)->Env=e,VarVal(v)=t
---
> #define	ConsaMol(s,e,t,v) t=v1,v1+=MolSz,MolP(t)->Sk=s,MolP(t)->Env=e,VarVal(v)=t
273,274c273,274
<     define TrailVar(t)  { PTR tt = (t); \
<                           if (tt < vv1 || (lcl0 <= tt && tt < vv)) TrailPtr(tt)}
---
>     define TrailVar(t)	{ PTR tt = (t); \
> 			  if (tt < vv1 || (lcl0 <= tt && tt < vv)) TrailPtr(tt)}
277,279c277,279
< #define TrailPtr(t)     {if (tr > trmax) NoSpace(TrailId); *(PTR *)tr++ = (t);}
< #define TrailGlo(r)     {if (r < vv1) TrailPtr(r)}
< #define TrailReg(r)     {if (r < vv1 || (r >= lcl0 && r < vv)) TrailPtr(r)}
---
> #define TrailPtr(t)	{if (tr > trmax) NoSpace(TrailId); *(PTR *)tr++ = (t);}
> #define TrailGlo(r)	{if (r < vv1) TrailPtr(r)}
> #define TrailReg(r)	{if (r < vv1 || (r >= lcl0 && r < vv)) TrailPtr(r)}
283,307c283,307
< |                                                                       |
< |   VARIABLES IN SKELETONS                                              |
< |       are represented as Base+Offset, where Base is GLOVAR0 for a     |
< |       global variable or LCLVAR0 for a local variable, and Offset     |
< |       is the amount to be added to a global frame pointer (i.e. a     |
< |       value of V1) or a local frame pointer (i.e. a value of V,X)     |
< |       to get a machine pointer to a runtime variable.   Note that     |
< |       the offset is NOT a variable number.  For a global variable     |
< |       it is a variable number multiplied by the number of address     |
< |       units per word (4 on a VAX, 2 on a Perq, 1 on an Orion) and     |
< |       for a local variable it is that plus a further offset which     |
< |       results from the fact that local frames contain more things     |
< |       than just variables.   It is the task of the SkelGlobal and     |
< |       SkelLocal macros to do the conversion (which doesn't happen     |
< |       very often, so that FrameVar and FrameGlo can use unscaled&     |
< |       unoffset integer addition (and they happen a lot).  GLOVAR0     |
< |       and LCLVAR0 have to look like IsRefs so that they aren't at     |
< |       all like anything else that can be in a skeleton.  Any such     |
< |       value will do, as real IsRefs can't occur in clauses.  Like     |
< |       TrailGlo -vs- TrailVar, there are two macros for handling a     |
< |       skeleton variable: FrameVar(var, glofr, lclfr) takes a var,     |
< |       a global frame pointer, and a local frame pointer, and uses     |
< |       whichever frame the variable wants, FrameGlo knows that the     |
< |       variable is global so just takes a global frame pointer.        |
< |                                                                       |
---
> |									|
> |   VARIABLES IN SKELETONS						|
> |	are represented as Base+Offset, where Base is GLOVAR0 for a	|
> |	global variable or LCLVAR0 for a local variable, and Offset	|
> |	is the amount to be added to a global frame pointer (i.e. a	|
> |	value of V1) or a local frame pointer (i.e. a value of V,X)	|
> |	to get a machine pointer to a runtime variable.   Note that	|
> |	the offset is NOT a variable number.  For a global variable	|
> |	it is a variable number multiplied by the number of address	|
> |	units per word (4 on a VAX, 2 on a Perq, 1 on an Orion) and	|
> |	for a local variable it is that plus a further offset which	|
> |	results from the fact that local frames contain more things	|
> |	than just variables.   It is the task of the SkelGlobal and	|
> |	SkelLocal macros to do the conversion (which doesn't happen	|
> |	very often, so that FrameVar and FrameGlo can use unscaled&	|
> |	unoffset integer addition (and they happen a lot).  GLOVAR0	|
> |	and LCLVAR0 have to look like IsRefs so that they aren't at	|
> |	all like anything else that can be in a skeleton.  Any such	|
> |	value will do, as real IsRefs can't occur in clauses.  Like	|
> |	TrailGlo -vs- TrailVar, there are two macros for handling a	|
> |	skeleton variable: FrameVar(var, glofr, lclfr) takes a var,	|
> |	a global frame pointer, and a local frame pointer, and uses	|
> |	whichever frame the variable wants, FrameGlo knows that the	|
> |	variable is global so just takes a global frame pointer.	|
> |									|
310,313c310,313
< #if     BACKWARDS
< #   define GLOVAR0      0x80000000      /* Offset for global variables */
< #   define LCLVAR0      0x80010000      /* Offset for local  variables */
< #   define IsVar(c)     (Signed(c) < 0x80020000)
---
> #if	BACKWARDS
> #   define GLOVAR0	0x80000000	/* Offset for global variables */
> #   define LCLVAR0	0x80010000	/* Offset for local  variables */
> #   define IsVar(c)	(Signed(c) < 0x80020000)
315,318c315,318
< #   define GLOVAR0      0x7ffe0000      /* Offset for global variables */
< #   define LCLVAR0      0x7fff0000      /* Offset for local  variables */
< #   define IsVar(c)     (Signed(c) >= GLOVAR0)
< #endif  BACKWARDS
---
> #   define GLOVAR0	0x7ffe0000	/* Offset for global variables */
> #   define LCLVAR0	0x7fff0000	/* Offset for local  variables */
> #   define IsVar(c)	(Signed(c) >= GLOVAR0)
> #endif	BACKWARDS
320c320
< #define IsaVar(c)       IsaRef(c)       /* Fast "hack" version of IsVar */
---
> #define	IsaVar(c)	IsaRef(c)	/* Fast "hack" version of IsVar */
329,330c329,330
< #define FrameGlo(V,G)   (PTR)(Unsigned(G)+(Unsigned(V)&0xffff))
< #define FrameVar(V,G,L) FrameGlo(V,Signed(V) >= LCLVAR0 ? L : G)
---
> #define FrameGlo(V,G)	(PTR)(Unsigned(G)+(Unsigned(V)&0xffff))
> #define	FrameVar(V,G,L)	FrameGlo(V,Signed(V) >= LCLVAR0 ? L : G)
341,359c341,359
< |                                                                       |
< |   ATOMIC OBJECTS (ATOMS AND PRIMITIVES)                               |
< |       Atomic includes atoms, integers, floats, and data base refs.    |
< |       By virtue of including the value 0 in its range it also can     |
< |       include unbound variables' values, which we use on occasion.    |
< |       We even use the fact that it includes the range 0..255 (the     |
< |       range of primitive predicates) to avoid putting proper tags     |
< |       on these values.  (The trick works on BACKWARDS machines as     |
< |       well.  The IsAtomic test is made a lot, so it helps to have     |
< |       the boundary in a register on most machines.  Note that the     |
< |       boundary is *different* on BACKWARDS machines.                  |
< |       There are four main ranges:                                     |
< |               global and local variables: IsRef(c)                    |
< |               skeletons & clauses: !IsRef(c) && !IsAtomic(c)          |
< |               atoms: IsAtomic(c) && !IsPrim(c)                        |
< |               integers, floats, dbrefs: IsPrim(c)                     |
< |       There are other things in the address space, but Prolog has     |
< |       no occasion to point to them (trail pointers in frames apart).  |
< |                                                                       |
---
> |									|
> |   ATOMIC OBJECTS (ATOMS AND PRIMITIVES)				|
> |	Atomic includes atoms, integers, floats, and data base refs.	|
> |	By virtue of including the value 0 in its range it also can	|
> |	include unbound variables' values, which we use on occasion.	|
> |	We even use the fact that it includes the range 0..255 (the	|
> |	range of primitive predicates) to avoid putting proper tags	|
> |	on these values.  (The trick works on BACKWARDS machines as	|
> |	well.  The IsAtomic test is made a lot, so it helps to have	|
> |	the boundary in a register on most machines.  Note that the	|
> |	boundary is *different* on BACKWARDS machines.			|
> |	There are four main ranges:					|
> |		global and local variables: IsRef(c)			|
> |		skeletons & clauses: !IsRef(c) && !IsAtomic(c)		|
> |		atoms: IsAtomic(c) && !IsPrim(c)			|
> |		integers, floats, dbrefs: IsPrim(c)			|
> |	There are other things in the address space, but Prolog has	|
> |	no occasion to point to them (trail pointers in frames apart).	|
> |									|
362,365c362,365
< #if     BACKWARDS
< #   define IsPrim(c)    SC(c,>=,0)      /* number or db reference */
< #   define IsAtomic(c)  SC(c,>=,atom0)  /* atomic term */
< #   define IsaAtomic(c) SC(c,>=,atomREG)
---
> #if	BACKWARDS
> #   define IsPrim(c)	SC(c,>=,0)	/* number or db reference */
> #   define IsAtomic(c)	SC(c,>=,atom0)	/* atomic term */
> #   define IsaAtomic(c)	SC(c,>=,atomREG)
367,371c367,371
< #   define IsPrim(c)    SC(c,<,0)
< #   define IsAtomic(c)  SC(c,<,heap0)
< #   define IsaAtomic(c) SC(c,<,heapREG)
< #endif  BACKWARDS
< #define IsAtom(c)       (!IsPrim(c) && IsAtomic(c))
---
> #   define IsPrim(c)	SC(c,<,0)
> #   define IsAtomic(c)	SC(c,<,heap0)
> #   define IsaAtomic(c)	SC(c,<,heapREG)
> #endif	BACKWARDS
> #define IsAtom(c)	(!IsPrim(c) && IsAtomic(c))
374,385c374,385
< |                                                                       |
< |   INTEGERS.                                                           |
< |       The coding is such that the bottom 29 bits of the integer are   |
< |       already in twos-complement form.  If << and >> are arithmetic   |
< |       shifts it doesn't matter what the tag is.  This seems to work   |
< |       on the VAX, Perq, and Orion, and is true on the PDP-11.  When   |
< |       this doesn't work the alternative is quite a bit slower.  Two   |
< |       special cases are handled: XtrByte is used when you know that   |
< |       the integer lies between 0 and 255, or when you only want the   |
< |       bottom 8 bits.  XtrPosInt is used when you know the integer's   |
< |       positive.  Note that INT0 and INT1 are just masks.              |
< |                                                                       |
---
> |									|
> |   INTEGERS.								|
> |	The coding is such that the bottom 29 bits of the integer are	|
> |	already in twos-complement form.  If << and >> are arithmetic	|
> |	shifts it doesn't matter what the tag is.  This seems to work	|
> |	on the VAX, Perq, and Orion, and is true on the PDP-11.  When	|
> |	this doesn't work the alternative is quite a bit slower.  Two	|
> |	special cases are handled: XtrByte is used when you know that	|
> |	the integer lies between 0 and 255, or when you only want the	|
> |	bottom 8 bits.  XtrPosInt is used when you know the integer's	|
> |	positive.  Note that INT0 and INT1 are just masks.		|
> |									|
388,390c388,390
< #define SIGN            0x10000000      /* sign bit on a constructed number */
< #define INT0            0xe0000000      /* mask for primitive tag bits */
< #define INT1            0xf0000000      /* combines INT0 and SIGN */
---
> #define SIGN		0x10000000	/* sign bit on a constructed number */
> #define INT0		0xe0000000	/* mask for primitive tag bits */
> #define INT1		0xf0000000	/* combines INT0 and SIGN */
392,394c392,394
< #if     BACKWARDS
< #   define IsInt(c)     UM(c,INT0,0)
< #   define IsPosInt(c)  UM(c,INT1,0)
---
> #if	BACKWARDS
> #   define IsInt(c)	UM(c,INT0,0)
> #   define IsPosInt(c)	UM(c,INT1,0)
396c396
< #   define ConsInt(i)   ((PTR)((i) &~ INT0))
---
> #   define ConsInt(i)	((PTR)((i) &~ INT0))
398,402c398,402
< #   define IsInt(c)     UM(c,INT0,INT0)
< #   define IsPosInt(c)  UM(c,INT1,INT0)
< #   define IsByteInt(c) (Signed(c) >= INT0 && Signed(c) <= (INT0|255))
< #   define ConsInt(i)   ((PTR)(INT0|(i)))
< #endif  BACKWARDS
---
> #   define IsInt(c)	UM(c,INT0,INT0)
> #   define IsPosInt(c)	UM(c,INT1,INT0)
> #   define IsByteInt(c)	(Signed(c) >= INT0 && Signed(c) <= (INT0|255))
> #   define ConsInt(i)	((PTR)(INT0|(i)))
> #endif	BACKWARDS
404,406c404,406
< #define XtrByte(c)      (Signed(c)&255)
< #define XtrPosInt(c)    (Signed(c) &~ INT1)
< #define XtrInt(c)       ((Signed(c)<<3)>>3)
---
> #define XtrByte(c)	(Signed(c)&255)
> #define XtrPosInt(c)	(Signed(c) &~ INT1)
> #define	XtrInt(c)	((Signed(c)<<3)>>3)
409c409
<     define XtrInt(c)    (Signed(c)&SIGN ? Signed(c) &~ INT0 : Signed(c) | INT0)
---
>     define XtrInt(c)	(Signed(c)&SIGN ? Signed(c) &~ INT0 : Signed(c) | INT0)
413,422c413,422
< |                                                                       |
< |   FLOATING-POINT NUMBERS.                                             |
< |       The bulk of the work of encoding and decoding floats left to    |
< |       the file arith.c.  One problem is that we need to take three    |
< |       least significant bits away, and their location varies among    |
< |       machines.   Arith.c knows about the IEEE and VAX-11 formats.    |
< |       IsNumber(c) recognises any sort of number.  C-Prolog doesn't    |
< |       offer a float(X) predicate because it will store a number as    |
< |       an integer if it possibly can.                                  |
< |                                                                       |
---
> |									|
> |   FLOATING-POINT NUMBERS.						|
> |	The bulk of the work of encoding and decoding floats left to	|
> |	the file arith.c.  One problem is that we need to take three	|
> |	least significant bits away, and their location varies among	|
> |	machines.   Arith.c knows about the IEEE and VAX-11 formats.	|
> |	IsNumber(c) recognises any sort of number.  C-Prolog doesn't	|
> |	offer a float(X) predicate because it will store a number as	|
> |	an integer if it possibly can.					|
> |									|
425,427c425,427
< #if     BACKWARDS
< #   define FRM0         0x00000000      /* tag for frame information word */
< #   define FLT0         0x20000000      /* floating-point tag */
---
> #if	BACKWARDS
> #   define FRM0		0x00000000	/* tag for frame information word */
> #   define FLT0		0x20000000	/* floating-point tag */
429,431c429,431
< #   define FRM0         0xc0000000      /* tag for frame information word */
< #   define FLT0         0xc0000000      /* floating-point tag */
< #endif  BACKWARDS
---
> #   define FRM0		0xc0000000	/* tag for frame information word */
> #   define FLT0		0xc0000000	/* floating-point tag */
> #endif	BACKWARDS
433,435c433,435
< #define FLT1            0xc0000000      /* primitive? number? */
< #define IsFloat(c)      UM(c,INT0,FLT0) /* is a floating point number */
< #define IsNumber(c)     UM(c,FLT1,FLT0&FLT1)
---
> #define FLT1		0xc0000000	/* primitive? number? */
> #define	IsFloat(c)	UM(c,INT0,FLT0)	/* is a floating point number */
> #define	IsNumber(c)	UM(c,FLT1,FLT0&FLT1)
441,454c441,454
< |                                                                       |
< |   DATA BASE REFERENCES.                                               |
< |       Data base references are basically just pointers to clauses or  |
< |       to records.  I am not at all sure why Fernando decided to tell  |
< |       them apart by tagging the pointers, we could just as well flag  |
< |       the clauses or records themselves.  (There are enough bits and  |
< |       to spare in infofcl.)  If the heap were under the atom area we  |
< |       we could then use the pointers themselves as primitives.  What  |
< |       happens now is that the word offset of a clause or record from  |
< |       the start of the heap is taken as an integer value and tagged.  |
< |       It is worth spending some effort on the coding as DBreferences  |
< |       are pushed onto the trail fairly often so that retracted stuff  |
< |       won't vanish while it's still in use.                           |
< |                                                                       |
---
> |									|
> |   DATA BASE REFERENCES.						|
> |	Data base references are basically just pointers to clauses or	|
> |	to records.  I am not at all sure why Fernando decided to tell	|
> |	them apart by tagging the pointers, we could just as well flag	|
> |	the clauses or records themselves.  (There are enough bits and	|
> |	to spare in infofcl.)  If the heap were under the atom area we	|
> |	we could then use the pointers themselves as primitives.  What	|
> |	happens now is that the word offset of a clause or record from	|
> |	the start of the heap is taken as an integer value and tagged.	|
> |	It is worth spending some effort on the coding as DBreferences	|
> |	are pushed onto the trail fairly often so that retracted stuff	|
> |	won't vanish while it's still in use.				|
> |									|
457,459c457,459
< #if     BACKWARDS
< #   define IsDBRef(c)   SC(c,>=,REF0)   /* clause or record pointer */
< #   define REF0         0x40000000      /* origin of data base references */
---
> #if	BACKWARDS
> #   define IsDBRef(c)	SC(c,>=,REF0)	/* clause or record pointer */
> #   define REF0		0x40000000	/* origin of data base references */
461,465c461,465
< #   define IsDBRef(c)   SC(c,<,FLT0)    /* clause or record pointer */
< #   define REF0         0x80000000      /* origin of data base references */
< #endif  BACKWARDS
< #define RECORD          0x20000000      /* reference to a record */
< #define CLAUSE          0L              /* reference to a clause (clear) */
---
> #   define IsDBRef(c)	SC(c,<,FLT0)	/* clause or record pointer */
> #   define REF0		0x80000000	/* origin of data base references */
> #endif	BACKWARDS
> #define RECORD		0x20000000	/* reference to a record */
> #define CLAUSE		0L		/* reference to a clause (clear) */
467,469c467,469
< #define XtrDBRef(c)     ((CLAUSEP)(heap0+(Unsigned(c)&~INT0)))
< #define ConsDBRef(p,k)  ((PTR)(((PTR)(p)-heap0)|(REF0|(k))))
< #define IsClause(c)     !(Unsigned(c)&RECORD)
---
> #define XtrDBRef(c)	((CLAUSEP)(heap0+(Unsigned(c)&~INT0)))
> #define ConsDBRef(p,k)	((PTR)(((PTR)(p)-heap0)|(REF0|(k))))
> #define IsClause(c)	!(Unsigned(c)&RECORD)
472,473c472,473
< #define XtraDB(c)       ((CLAUSEP)(heapREG+(Unsigned(c)&~INT0)))
< #define ConsaDB(p,k)    ((PTR)(((PTR)(p)-heapREG)|(REF0|(k))))
---
> #define XtraDB(c)	((CLAUSEP)(heapREG+(Unsigned(c)&~INT0)))
> #define ConsaDB(p,k)	((PTR)(((PTR)(p)-heapREG)|(REF0|(k))))
479,480c479,480
< #define Unsafe(z)       crit=1
< #define Safe(z)         if (crit==2) crit=0,Event(ABORT); crit=0
---
> #define	Unsafe(z)	crit=1
> #define Safe(z)		if (crit==2) crit=0,Event(ABORT); crit=0
488c488
< #define HashSize        256
---
> #define	HashSize	256
490c490
< typedef struct ATOM                     /* atom block */
---
> typedef struct ATOM			/* atom block */
492,504c492,504
<         ATOMP    atofae;                /* self pointer */
<         byte     arityofae;             /* arity ( = 0 ) */
<         byte     flgsofae;              /* flags field */
<         short    infxofae;              /* infix priority */
<         CLAUSEP  defsofae;              /* chain of definitions */
<         CLAUSEP  dbofae;                /* chain of records */
<         FUNCTORP fcofae;                /* functor chain */
<         ATOMP    nxtofae;               /* hash chain */
<         short    prfxofae;              /* priority as prefix op */
<         short    psfxofae;              /* priority as postfix op */
<         char     stofae[1];             /* string for atom */
<     }   ATOM;
<                                         /* size of atom block (excluding name) */
---
> 	ATOMP	 atofae;		/* self pointer */
> 	byte	 arityofae;		/* arity ( = 0 ) */
> 	byte	 flgsofae;		/* flags field */
> 	short	 infxofae;		/* infix priority */
> 	CLAUSEP	 defsofae;		/* chain of definitions */
> 	CLAUSEP	 dbofae;		/* chain of records */
> 	FUNCTORP fcofae;		/* functor chain */
> 	ATOMP	 nxtofae;		/* hash chain */
> 	short	 prfxofae;		/* priority as prefix op */
> 	short	 psfxofae;		/* priority as postfix op */
> 	char	 stofae[1];		/* string for atom */
>     }	ATOM;
> 					/* size of atom block (excluding name) */
508c508
< typedef struct FUNCTOR                  /* functor block */
---
> typedef struct FUNCTOR			/* functor block */
510,520c510,520
<         ATOMP    atoffe;                /* atom for this functor */
<         byte     arityoffe;             /* arity */
<         byte     flgsoffe;              /* flags field */
<         short    moreflgs;              /* to be used by arithmetic operators */
<         CLAUSEP  defsoffe;              /* clauses for this functor */
<         CLAUSEP  dboffe;                /* data base entries under functor */
<         FUNCTORP nxtoffe;               /* chain of functors with same name */
<         PTR      gtoffe;                /* start of general skeleton for this */
<     }   FUNCTOR;                        /* term. points to this entry. */
<                                         /* size of functor entry (+ arity) in PTRs */
< #define szoffe  (sizeof(FUNCTOR)/sizeof(PTR))
---
> 	ATOMP	 atoffe;		/* atom for this functor */
> 	byte	 arityoffe;		/* arity */
> 	byte	 flgsoffe;		/* flags field */
> 	short	 moreflgs;		/* to be used by arithmetic operators */
> 	CLAUSEP	 defsoffe;		/* clauses for this functor */
> 	CLAUSEP  dboffe;		/* data base entries under functor */
> 	FUNCTORP nxtoffe;		/* chain of functors with same name */
> 	PTR	 gtoffe;		/* start of general skeleton for this */
>     }	FUNCTOR;			/* term. points to this entry. */
> 					/* size of functor entry (+ arity) in PTRs */
> #define szoffe	(sizeof(FUNCTOR)/sizeof(PTR))
523,524c523,524
< #define MaxArity 200                    /* maximum arity of any functor */
< #define MaxVar   255                    /* highest possible variable number */
---
> #define	MaxArity 200			/* maximum arity of any functor */
> #define	MaxVar	 255    		/* highest possible variable number */
526c526
< typedef struct CLAUSEREC                /* clause or record block */
---
> typedef struct CLAUSEREC		/* clause or record block */
528,539c528,539
<         byte     infofcl;               /* general inf. */
<         byte     ltofcl;                /* no. of local and temp. variables */
<         byte     lvofcl;                /* no. of local vars */
<         byte     gvofcl;                /* no. of global vars */
<         long     refcofcl;              /* reference count */
<         PTR      hdofcl;                /* clause head */
<         PTR      bdyofcl;               /* body of clause */
<         CLAUSEP  altofcl;               /* alternatives */
<         CLAUSEP  prevofcl;              /* previous clause */
<     }   CLAUSEREC;
<                                         /* size of clause block in PTRs */
< #define szofcl  (sizeof(CLAUSEREC)/sizeof(PTR))
---
> 	byte	 infofcl;		/* general inf. */
> 	byte	 ltofcl;		/* no. of local and temp. variables */
> 	byte     lvofcl;		/* no. of local vars */
> 	byte     gvofcl;		/* no. of global vars */
> 	long	 refcofcl;		/* reference count */
> 	PTR	 hdofcl;		/* clause head */
> 	PTR	 bdyofcl;		/* body of clause */
> 	CLAUSEP	 altofcl;		/* alternatives */
> 	CLAUSEP	 prevofcl;		/* previous clause */
>     }	CLAUSEREC;
> 					/* size of clause block in PTRs */
> #define szofcl	(sizeof(CLAUSEREC)/sizeof(PTR))
542c542
< typedef struct FRAME                    /*  local frame  */
---
> typedef struct FRAME			/*  local frame  */
544,551c544,551
<         PTR      gofcf;                 /* goal */
<         FRAMEP   gfofcf;                /* goal's local frame */
<         FRAMEP   lcpofcf;               /* previous choice point */
<         PTR      gsofcf;                /* global frame associated with this frame */
<         PTR      trofcf;                /* tr at entry */
<         long     infofcf;               /* general information */
<         PTR      cofcf;                 /* continuation on entry */
<         CLAUSEP* altofcf;               /* alternatives */
---
> 	PTR	 gofcf;			/* goal */
> 	FRAMEP	 gfofcf;		/* goal's local frame */
> 	FRAMEP	 lcpofcf;		/* previous choice point */
> 	PTR	 gsofcf;		/* global frame associated with this frame */
> 	PTR	 trofcf;		/* tr at entry */
> 	long	 infofcf;		/* general information */
> 	PTR	 cofcf;			/* continuation on entry */
> 	CLAUSEP* altofcf;		/* alternatives */
553,558c553,558
<         PTR      v1ofcf;                /* variables */
<         PTR      v2ofcf;                /* if more variables are added, */
<         PTR      v3ofcf;                /* adjust the constant 5 in the */
<         PTR      v4ofcf;                /* definition of szofcf */
<         PTR      v5ofcf;
<     }   FRAME;
---
> 	PTR	 v1ofcf;		/* variables */
> 	PTR	 v2ofcf;		/* if more variables are added, */
> 	PTR	 v3ofcf;		/* adjust the constant 5 in the */
> 	PTR	 v4ofcf;		/* definition of szofcf */
> 	PTR	 v5ofcf;
>     }	FRAME;
560,563c560,563
<                                         /* frame size in PTRs */
< #define szofcf  (sizeof(FRAME)/sizeof(PTR)-5)
<                                         /* greatest possible frame size */
< #define MaxFrame (szofcf+MaxVar+1)
---
> 					/* frame size in PTRs */
> #define szofcf	(sizeof(FRAME)/sizeof(PTR)-5)
> 					/* greatest possible frame size */
> #define	MaxFrame (szofcf+MaxVar+1)
574,578c574,578
< #define LEVEL           0xfff   /* recursion level mask */
< #define LEVEL_WIDTH     12      /* width of the level field */
< #define CALL_NUMBER     0x3ffff /* invocation number mask */
< #define CALL_WIDTH      18      /* width of the call number field */
< #define IsVisible(info) (info&(CALL_NUMBER<<LEVEL_WIDTH))
---
> #define	LEVEL		0xfff	/* recursion level mask */
> #define LEVEL_WIDTH	12	/* width of the level field */
> #define CALL_NUMBER	0x3ffff	/* invocation number mask */
> #define CALL_WIDTH	18	/* width of the call number field */
> #define IsVisible(info)	(info&(CALL_NUMBER<<LEVEL_WIDTH))
582,584c582,584
< #define x               (PTR)X
< #define v               (PTR)V
< #define vv              (PTR)VV
---
> #define x		(PTR)X
> #define v		(PTR)V
> #define	vv		(PTR)VV
593,596c593,596
<         FUNCTORP Fn;
<         PTR      Arg1;
<         PTR      Arg2;
<     }   SKEL;
---
> 	FUNCTORP Fn;
> 	PTR	 Arg1;
> 	PTR	 Arg2;
>     }	SKEL;
598c598
< #define SkelSz(n)       ((n)+1) /* size of n arg. skeleton */
---
> #define SkelSz(n)	((n)+1)	/* size of n arg. skeleton */
605,606c605,606
<         PTR Sk;         /* normally SKELP, but can be ATOMP */
<         PTR Env;
---
> 	PTR Sk;		/* normally SKELP, but can be ATOMP */
> 	PTR Env;
609c609
< #define MolSz   2       /* NB: size in PTRs, not in bytes */
---
> #define MolSz	2	/* NB: size in PTRs, not in bytes */
613,614c613,614
< #define ERASED  1               /* erased but not yet removed */
< #define IN_USE  2               /* in use in a proof, cannot be deleted yet */
---
> #define ERASED	1		/* erased but not yet removed */
> #define IN_USE	2		/* in use in a proof, cannot be deleted yet */
629,634c629,634
< #define RESERVED        0xe0    /* cannot be modified */
< #define HIDDEN          0xc0    /* Protected or Transparent */
< #define PROTECTED       0x80    /* cannot be listed, traced, or modified */
< #define INVISIBLE       0x40    /* invisible to tracing and recursion level */
< #define UNTRACEABLE     0x20    /* cannot be traced */
< #define SPY_ME          0x10    /* is a spypoint */
---
> #define RESERVED	0xe0	/* cannot be modified */
> #define HIDDEN		0xc0	/* Protected or Transparent */
> #define PROTECTED	0x80	/* cannot be listed, traced, or modified */
> #define INVISIBLE	0x40	/* invisible to tracing and recursion level */
> #define UNTRACEABLE	0x20	/* cannot be traced */
> #define SPY_ME		0x10	/* is a spypoint */
639,644c639,644
< #define COLD_START      0       /* first thing in the morning */
< #define ABORT           1       /* 'abort' evaluable predicate */
< #define IO_ERROR        2       /* every STDIO failure that is not */
< #define END_OF_FILE     3       /* end of file on input */
< #define ARITH_ERROR     4       /* incorrect args. to 'is", =:=, etc. */
< #define GEN_ERROR       5       /* all others report here */
---
> #define COLD_START	0	/* first thing in the morning */
> #define ABORT		1	/* 'abort' evaluable predicate */
> #define IO_ERROR	2	/* every STDIO failure that is not */
> #define END_OF_FILE	3	/* end of file on input */
> #define ARITH_ERROR	4	/* incorrect args. to 'is", =:=, etc. */
> #define GEN_ERROR	5	/* all others report here */
648,652c648,652
< #define InBoot  State[IN_BOOT]
< #define IN_BOOT 0
< #define DEBUG   1
< #define QUIET   2
< #define TRACE   3
---
> #define	InBoot	State[IN_BOOT]
> #define IN_BOOT	0
> #define DEBUG	1
> #define QUIET	2
> #define TRACE	3
656,658c656,658
< #define STDIN   0
< #define STDOUT  1
< #define STDERR  2
---
> #define	STDIN	0
> #define STDOUT	1
> #define	STDERR	2
664,670c664,670
< #if     BACKWARDS
< #   define AuxId        0
< #   define TrailId      1
< #   define GlobalId     2
< #   define LocalId      3
< #   define HeapId       4
< #   define AtomId       5
---
> #if	BACKWARDS
> #   define AuxId	0
> #   define TrailId 	1
> #   define GlobalId	2
> #   define LocalId	3
> #   define HeapId	4
> #   define AtomId	5
672,679c672,679
< #   define AuxId        0
< #   define TrailId      1
< #   define AtomId       2
< #   define HeapId       3
< #   define GlobalId     4
< #   define LocalId      5
< #endif  BACKWARDS
< #define NAreas          6       /* number of work areas/stacks */
---
> #   define AuxId	0
> #   define TrailId	1
> #   define AtomId	2
> #   define HeapId	3
> #   define GlobalId	4
> #   define LocalId	5
> #endif	BACKWARDS
> #define NAreas		6	/* number of work areas/stacks */
683,688c683,688
< #define auxstk0 Origin[AuxId]
< #define tr0     Origin[TrailId]
< #define atom0   Origin[AtomId]
< #define heap0   Origin[HeapId]
< #define glb0    Origin[GlobalId]
< #define lcl0    Origin[LocalId]
---
> #define auxstk0	Origin[AuxId]
> #define tr0	Origin[TrailId]
> #define atom0	Origin[AtomId]
> #define heap0	Origin[HeapId]
> #define glb0	Origin[GlobalId]
> #define lcl0	Origin[LocalId]
692,697c692,697
< #define auxmax  Limit[AuxId]
< #define trmax   Limit[TrailId]
< #define atmax   Limit[AtomId]
< #define hpmax   Limit[HeapId]
< #define v1max   Limit[GlobalId]
< #define vmax    Limit[LocalId]
---
> #define auxmax	Limit[AuxId]
> #define trmax	Limit[TrailId]
> #define atmax	Limit[AtomId]
> #define hpmax	Limit[HeapId]
> #define v1max	Limit[GlobalId]
> #define vmax	Limit[LocalId]
701,718c701,718
< #define atomnil         (PTR)nilatom
< #define nilatom         BasicAtom[0]            /* []           */
< #define commaatom       BasicAtom[1]            /* ,            */
< #define bracesatom      BasicAtom[2]            /* {}           */
< #define LessThan        BasicAtom[3]            /* <            */
< #define Equal           BasicAtom[4]            /* =            */
< #define GreaterThan     BasicAtom[5]            /* >            */
< #define Minus           BasicAtom[6]            /* -            */
< #define semicatom       BasicAtom[7]            /* ;            */
< /*  The remaining atoms are only used in main.c, as terms.      */
< /*  'user' is also used in sysbits.c, but has to be a term too. */
< #define EndOfFile  (PTR)BasicAtom[8]            /* end_of_file  */
< #define atomtrue   (PTR)BasicAtom[9]            /* true         */
< #define user       (PTR)BasicAtom[10]           /* user         */
< #define Yes             BasicAtom[11]           /* $yes         */
< #define No              BasicAtom[12]           /* $no          */
< #define live       (PTR)BasicAtom[13]           /* $live        */
< #define breakat    (PTR)BasicAtom[14]           /* $break       */
---
> #define	atomnil		(PTR)nilatom
> #define nilatom		BasicAtom[0]		/* []		*/
> #define commaatom	BasicAtom[1]		/* ,		*/
> #define bracesatom	BasicAtom[2]		/* {}		*/
> #define LessThan	BasicAtom[3]		/* <		*/
> #define Equal		BasicAtom[4]		/* =		*/
> #define GreaterThan	BasicAtom[5]		/* >		*/
> #define Minus		BasicAtom[6]		/* -		*/
> #define semicatom	BasicAtom[7]		/* ;		*/
> /*  The remaining atoms are only used in main.c, as terms.	*/
> /*  'user' is also used in sysbits.c, but has to be a term too.	*/
> #define EndOfFile  (PTR)BasicAtom[8]		/* end_of_file	*/
> #define atomtrue   (PTR)BasicAtom[9]		/* true		*/
> #define user	   (PTR)BasicAtom[10]		/* user		*/
> #define Yes	        BasicAtom[11]		/* $yes		*/
> #define No	        BasicAtom[12]		/* $no		*/
> #define live	   (PTR)BasicAtom[13]		/* $live	*/
> #define breakat    (PTR)BasicAtom[14]		/* $break	*/
722,728c722,728
< #define calltag         BasicFunctor[0]         /* call(G)      */
< #define commatag        BasicFunctor[1]         /* A,B          */
< #define assertfunc      BasicFunctor[2]         /* {G}          */
< #define listfunc        BasicFunctor[3]         /* [H|T]        */
< #define arrowtag        BasicFunctor[4]         /* H:-B         */
< #define provefunc       BasicFunctor[5]         /* :-Q          */
< #define HiddenCall      BasicFunctor[6]         /* $hidden_call */
---
> #define calltag		BasicFunctor[0]		/* call(G)	*/
> #define commatag	BasicFunctor[1]		/* A,B		*/
> #define assertfunc	BasicFunctor[2]		/* {G}		*/
> #define listfunc	BasicFunctor[3]		/* [H|T]	*/
> #define arrowtag	BasicFunctor[4]		/* H:-B		*/
> #define provefunc	BasicFunctor[5]		/* :-Q		*/
> #define HiddenCall	BasicFunctor[6]		/* $hidden_call	*/
740c740
< #define CtrlZ   '\032'
---
> #define	CtrlZ	'\032'
745c745
<         BasicAtom[];
---
> 	BasicAtom[];
748c748
<          BasicFunctor[];
---
> 	 BasicFunctor[];
751c751
<         X, V, VV;
---
> 	X, V, VV;
754,755c754,755
<         FileAtom[], Limit[], Origin[],
<         x1, v1, v1f, vv1, tr, atomfp, hasha, list10, vra, vrz;
---
> 	FileAtom[], Limit[], Origin[],
> 	x1, v1, v1f, vv1, tr, atomfp, hasha, list10, vra, vrz;
758c758
<         *AreaName[], *ErrorMess, OutBuf[], PlPrompt[];
---
> 	*AreaName[], *ErrorMess, OutBuf[], PlPrompt[];
761c761
<         Size[];
---
> 	Size[];
764,765c764,765
<         AllFloat, Input, Output, State[],
<         crit, debug, errno, lc, quoteia, running, saveversion, sklev;
---
> 	AllFloat, Input, Output, State[],
> 	crit, debug, errno, lc, quoteia, running, saveversion, sklev;
770c770
<         CpuTime();
---
> 	CpuTime();
773c773
<         HeapUsed(), icompare(), intval();
---
> 	HeapUsed(), icompare(), intval();
776,779c776,779
<         CallShell(), ChDir(), CurLineNo(), Exists(),
<         GetChType(), Narrow(), NumberString(), SetChType(),
<         clause_number(), erase(), erased(), gunify(),
<         instance(), numcompare(), unifyarg();
---
> 	CallShell(), ChDir(), CurLineNo(), Exists(),
> 	GetChType(), Narrow(), NumberString(), SetChType(),
> 	clause_number(), erase(), erased(), gunify(),
> 	instance(), numcompare(), unifyarg();
782c782
<         fentry();
---
> 	fentry();
785c785
<         lookup(), acompare(), kcompare();
---
> 	lookup(), acompare(), kcompare();
788,795c788,795
<         ArithError(), CSee(), CatchSignals(), CloseFiles(), CreateStacks(),
<         Event(), Flush(), Halt(), InitIO(), InitHeap(),
<         LockChannels(), NoSpace(),
<         PClose(), Prompt(), PromptIfUser(), Put(), PutString(),
<         RelocHeap(), Remove(), Rename(),
<         See(), Seen(), SetPlPrompt(), Statistics(), Stop(), SyntErrPos(),
<         Tell(), Told(),
<         abolish(), backtrace(), hide(), pwrite(), release();
---
> 	ArithError(), CSee(), CatchSignals(), CloseFiles(), CreateStacks(),
> 	Event(), Flush(), Halt(), InitIO(), InitHeap(),
> 	LockChannels(), NoSpace(),
> 	PClose(), Prompt(), PromptIfUser(), Put(), PutString(),
> 	RelocHeap(), Remove(), Rename(),
> 	See(), Seen(), SetPlPrompt(), Statistics(), Stop(), SyntErrPos(),
> 	Tell(), Told(),
> 	abolish(), backtrace(), hide(), pwrite(), release();
798,800c798,800
<         Telling(), Seeing(),
<         apply(), arg(), argv(), getsp(), makelist(),
<         numeval(), pread(), record(), recorded(), vvalue();
---
> 	Telling(), Seeing(),
> 	apply(), arg(), argv(), getsp(), makelist(),
> 	numeval(), pread(), record(), recorded(), vvalue();
803,804c803,804
<         *AtomToFile(), Get(), *SysError(), ToEOL(),
<         *crack(), *num2chars();
---
> 	*AtomToFile(), Get(), *SysError(), ToEOL(),
> 	*crack(), *num2chars();
806,807c806,807
< extern char             /* these are just to make Lint shut up */
<         *sprintf(), *strcpy();
---
> extern char		/* these are just to make Lint shut up */
> 	*sprintf(), *strcpy();
$ diff /tools/sources/cprolog/npl/arith.h arith.h
/bin/diff /tools/sources/cprolog/npl/arith.h arith.h
$ diff /tools/sources/cprolog/npl/unify.c unify.c
/bin/diff /tools/sources/cprolog/npl/unify.c unify.c
$