internal.h revision 24dcb1c7
1f14f4646Smrg/* $XdotOrg: xc/programs/xedit/lisp/internal.h,v 1.2 2004/04/23 19:54:44 eich Exp $ */
25dfecf96Smrg/*
35dfecf96Smrg * Copyright (c) 2001 by The XFree86 Project, Inc.
45dfecf96Smrg *
55dfecf96Smrg * Permission is hereby granted, free of charge, to any person obtaining a
65dfecf96Smrg * copy of this software and associated documentation files (the "Software"),
75dfecf96Smrg * to deal in the Software without restriction, including without limitation
85dfecf96Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
95dfecf96Smrg * and/or sell copies of the Software, and to permit persons to whom the
105dfecf96Smrg * Software is furnished to do so, subject to the following conditions:
115dfecf96Smrg *
125dfecf96Smrg * The above copyright notice and this permission notice shall be included in
135dfecf96Smrg * all copies or substantial portions of the Software.
145dfecf96Smrg *
155dfecf96Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
165dfecf96Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
175dfecf96Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
185dfecf96Smrg * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
195dfecf96Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
205dfecf96Smrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
215dfecf96Smrg * SOFTWARE.
225dfecf96Smrg *
235dfecf96Smrg * Except as contained in this notice, the name of the XFree86 Project shall
245dfecf96Smrg * not be used in advertising or otherwise to promote the sale, use or other
255dfecf96Smrg * dealings in this Software without prior written authorization from the
265dfecf96Smrg * XFree86 Project.
275dfecf96Smrg *
285dfecf96Smrg * Author: Paulo César Pereira de Andrade
295dfecf96Smrg */
305dfecf96Smrg
315dfecf96Smrg/* $XFree86: xc/programs/xedit/lisp/internal.h,v 1.50tsi Exp $ */
325dfecf96Smrg
335dfecf96Smrg#ifndef Lisp_internal_h
345dfecf96Smrg#define Lisp_internal_h
355dfecf96Smrg
365dfecf96Smrg#include <stdio.h>
375dfecf96Smrg#include "lisp/lisp.h"
385dfecf96Smrg
395dfecf96Smrg#include "mp.h"
405dfecf96Smrg#include "re.h"
415dfecf96Smrg
42f14f4646Smrg#include "util.h"
43f14f4646Smrg
445dfecf96Smrg/*
455dfecf96Smrg * Defines
465dfecf96Smrg */
475dfecf96Smrgtypedef struct _LispMac LispMac;
485dfecf96Smrg
495dfecf96Smrg#define STREAM_READ		0x01
505dfecf96Smrg#define STREAM_WRITE		0x02
515dfecf96Smrg#define STREAM_BINARY		0x20
525dfecf96Smrg
535dfecf96Smrg#define RPLACA(cons, object)	(CAR(cons) = object)
545dfecf96Smrg#define RPLACD(cons, object)	(CDR(cons) = object)
555dfecf96Smrg
565dfecf96Smrg#define	CAR(list)		((list)->data.cons.car)
575dfecf96Smrg#define	CAAR(list)		((list)->data.cons.car->data.cons.car)
585dfecf96Smrg#define	CADR(list)		((list)->data.cons.cdr->data.cons.car)
595dfecf96Smrg#define CDR(list)		((list)->data.cons.cdr)
605dfecf96Smrg#define CDAR(list)		((list)->data.cons.car->data.cons.cdr)
615dfecf96Smrg#define CDDR(list)		((list)->data.cons.cdr->data.cons.cdr)
625dfecf96Smrg#define CONS(car, cdr)		LispNewCons(car, cdr)
635dfecf96Smrg#define EVAL(list)		LispEval(list)
645dfecf96Smrg#define APPLY(fun, args)	LispFuncall(fun, args, 0)
655dfecf96Smrg#define APPLY1(fun, arg)	LispApply1(fun, arg)
665dfecf96Smrg#define APPLY2(fun, arg1, arg2)	LispApply2(fun, arg1, arg2)
675dfecf96Smrg#define APPLY3(f, a1, a2, a3)	LispApply3(f, a1, a2, a3)
685dfecf96Smrg#define EXECUTE(string)		LispExecute(string)
695dfecf96Smrg#define SYMBOL(atom)		LispNewSymbol(atom)
705dfecf96Smrg#define ATOM(string)		LispNewAtom(string, 1)
715dfecf96Smrg#define UNINTERNED_ATOM(string)	LispNewAtom(string, 0)
725dfecf96Smrg#define FUNCTION(symbol)	LispNewFunction(symbol)
735dfecf96Smrg#define FUNCTION_QUOTE(symbol)	LispNewFunctionQuote(symbol)
745dfecf96Smrg
755dfecf96Smrg	/* atom string is a static variable */
765dfecf96Smrg#define ATOM2(string)		LispNewSymbol(LispGetPermAtom(string))
775dfecf96Smrg
785dfecf96Smrg	/* make a gc never released variable with a static string argument */
795dfecf96Smrg#define STATIC_ATOM(string)	LispNewStaticAtom(string)
805dfecf96Smrg
81f765521fSmrg#define STRING(str)		LispNewString(str, strlen(str))
82f765521fSmrg#define LSTRING(str, size)	LispNewString(str, size)
835dfecf96Smrg
845dfecf96Smrg	/* string must be from the LispXXX allocation functions,
855dfecf96Smrg	 * and LispMused not yet called on it */
86f765521fSmrg#define STRING2(str)		LispNewStringAlloced(str, strlen(str))
87f765521fSmrg#define LSTRING2(str, size)	LispNewStringAlloced(str, size)
885dfecf96Smrg
895dfecf96Smrg#define VECTOR(objects)		LispNewVector(objects)
905dfecf96Smrg
915dfecf96Smrg	/* STRINGSTREAM2 and LSTRINGSTREAM2 require that the
925dfecf96Smrg	 * string be allocated from the LispXXX allocation functions,
935dfecf96Smrg	 * and LispMused not yet called on it */
945dfecf96Smrg#define STRINGSTREAM(str, flag)			\
95f765521fSmrg	LispNewStringStream(str, flag, strlen(str))
965dfecf96Smrg#define STRINGSTREAM2(str, flag)		\
97f765521fSmrg	LispNewStringStreamAlloced(str, flag, strlen(str))
985dfecf96Smrg#define LSTRINGSTREAM(str, flag, length)	\
99f765521fSmrg	LispNewStringStream(str, flag, length)
1005dfecf96Smrg#define LSTRINGSTREAM2(str, flag, length)	\
101f765521fSmrg	LispNewStringStreamAlloced(str, flag, length)
1025dfecf96Smrg
1035dfecf96Smrg#define FILESTREAM(file, path, flag)	\
1045dfecf96Smrg	LispNewFileStream(file, path, flag)
1055dfecf96Smrg#define PIPESTREAM(file, path, flag)	\
1065dfecf96Smrg	LispNewPipeStream(file, path, flag)
1075dfecf96Smrg
1085dfecf96Smrg#define CHECKO(obj, typ)						\
1095dfecf96Smrg	((obj)->type == LispOpaque_t && 				\
1105dfecf96Smrg	 ((obj)->data.opaque.type == typ || (obj)->data.opaque.type == 0))
1115dfecf96Smrg#define PROTECT(key, list)	LispProtect(key, list)
1125dfecf96Smrg#define UPROTECT(key, list)	LispUProtect(key, list)
1135dfecf96Smrg
1145dfecf96Smrg/* create a new unique static atom string */
115f14f4646Smrg#define GETATOMID(string)	LispGetAtomKey(string, 1)
1165dfecf96Smrg
1175dfecf96Smrg#define	GCDisable()		++gcpro
1185dfecf96Smrg#define	GCEnable()		--gcpro
1195dfecf96Smrg
1205dfecf96Smrg
1215dfecf96Smrg/* pointer to something unique to all atoms with the same print representation */
122f14f4646Smrg#define ATOMID(object)		(object)->data.atom->key
1235dfecf96Smrg
1245dfecf96Smrg
1255dfecf96Smrg
1265dfecf96Smrg#define NIL_BIT			0x01
1275dfecf96Smrg#define FIXNUM_BIT		0x02
1285dfecf96Smrg#define FIXNUM_MASK		0x03
1295dfecf96Smrg#define SCHAR_BIT		0x04
1305dfecf96Smrg#define SCHAR_MASK		0x05
1315dfecf96Smrg#define BIT_COUNT		4
1325dfecf96Smrg#define BIT_MASK		0x0f
1335dfecf96Smrg#define POINTERP(object)						\
1345dfecf96Smrg    (((unsigned long)(object) & NIL_BIT) == 0)
1355dfecf96Smrg
1365dfecf96Smrg#define MOST_POSITIVE_FIXNUM	((1L << (sizeof(long) * 8 - 5)) - 1)
13724dcb1c7Sjoerg#define MOST_NEGATIVE_FIXNUM	(-(1L << (sizeof(long) * 8 - 5)))
1385dfecf96Smrg
1395dfecf96Smrg#define SCHAR(value)							\
1405dfecf96Smrg    ((LispObj*)(((long)(value) << BIT_COUNT) | SCHAR_MASK))
1415dfecf96Smrg#define SCHAR_VALUE(object)	FIXNUM_VALUE(object)
1425dfecf96Smrg#define SCHARP(object)							\
1435dfecf96Smrg    (((unsigned long)(object) & BIT_MASK) == SCHAR_MASK)
1445dfecf96Smrg#define CHECK_SCHAR(object)						\
1455dfecf96Smrg    if (!SCHARP(object))						\
1465dfecf96Smrg	LispDestroy("%s: %s is not a character",			\
1475dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
1485dfecf96Smrg
1495dfecf96Smrg#define XOBJECT_TYPE(object)	((object)->type)
1505dfecf96Smrg#define OBJECT_TYPE(object)	(POINTERP(object) ?			\
1515dfecf96Smrg				XOBJECT_TYPE(object) :			\
1525dfecf96Smrg				(LispType)((long)(object) & BIT_MASK))
1535dfecf96Smrg
1545dfecf96Smrg
1555dfecf96Smrg#define NIL			(LispObj*)0x00000001
1565dfecf96Smrg#define T			(LispObj*)0x00000011
1575dfecf96Smrg#define DOT			(LispObj*)0x00000021
1585dfecf96Smrg/* unmatched ')' */
1595dfecf96Smrg#define	EOLIST			(LispObj*)0x00000031
1605dfecf96Smrg#define READLABEL_MASK		0x00000041
1615dfecf96Smrg/* unspecified argument */
1625dfecf96Smrg#define UNSPEC			(LispObj*)0x00000051
1635dfecf96Smrg#define INVALIDP(object)						\
1645dfecf96Smrg    ((object) == NULL || (object) == EOLIST || (object) == DOT)
1655dfecf96Smrg
1665dfecf96Smrg
1675dfecf96Smrg/* cons */
1685dfecf96Smrg#define XCONSP(object)		((object)->type == LispCons_t)
1695dfecf96Smrg#define CONSP(object)		(POINTERP(object) && XCONSP(object))
1705dfecf96Smrg#define CHECK_CONS(object)						\
1715dfecf96Smrg    if (!CONSP(object))							\
1725dfecf96Smrg	LispDestroy("%s: %s is not of type cons",			\
1735dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
1745dfecf96Smrg#define LISTP(object)		(object == NIL || CONSP(object))
1755dfecf96Smrg#define CHECK_LIST(object)						\
1765dfecf96Smrg    if (!LISTP(object))							\
1775dfecf96Smrg	LispDestroy("%s: %s is not a list",				\
1785dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
1795dfecf96Smrg
1805dfecf96Smrg/* fixnum */
1815dfecf96Smrg#define FIXNUM(value)							\
18224dcb1c7Sjoerg    ((LispObj*)(((long)(value) * (1 << BIT_COUNT)) | FIXNUM_MASK))
1835dfecf96Smrg#define FIXNUM_VALUE(object)	((long)(object) >> BIT_COUNT)
1845dfecf96Smrg#define FIXNUMP(object)							\
1855dfecf96Smrg    (((unsigned long)(object) & BIT_MASK) == FIXNUM_MASK)
1865dfecf96Smrg#define CHECK_FIXNUM(object)						\
1875dfecf96Smrg    if (!FIXNUMP(object))						\
1885dfecf96Smrg	LispDestroy("%s: %s is not a fixnum",				\
1895dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
1905dfecf96Smrg#define INDEXP(object)							\
1915dfecf96Smrg    (FIXNUMP(object) && FIXNUM_VALUE(object) >= 0)
1925dfecf96Smrg#define CHECK_INDEX(object)						\
1935dfecf96Smrg    if (!INDEXP(object))						\
1945dfecf96Smrg	LispDestroy("%s: %s is not a positive fixnum",			\
1955dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
1965dfecf96Smrg
1975dfecf96Smrg
1985dfecf96Smrg/* long int integer */
1995dfecf96Smrg#define XINTP(object)		((object)->type == LispInteger_t)
2005dfecf96Smrg#define INTP(objet)		(POINTERP(object) && XINTP(object))
2015dfecf96Smrg#define INT_VALUE(object)	(object)->data.integer
2025dfecf96Smrg
2035dfecf96Smrg
2045dfecf96Smrg/* values that fit in a machine long int but not in a fixnum */
2055dfecf96Smrg#define LONGINTP(object)						\
2065dfecf96Smrg    (POINTERP(object) ? XINTP(object) : FIXNUMP(object))
2075dfecf96Smrg#define LONGINT_VALUE(object)						\
2085dfecf96Smrg    (POINTERP(object) ? INT_VALUE(object) : FIXNUM_VALUE(object))
2095dfecf96Smrg#define CHECK_LONGINT(object)						\
2105dfecf96Smrg    if (!LONGINTP(object))						\
2115dfecf96Smrg	LispDestroy("%s: %s is not an integer",				\
2125dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
2135dfecf96Smrg
2145dfecf96Smrg
2155dfecf96Smrg/* bignum */
2165dfecf96Smrg#define XBIGNUMP(object)	((object)->type == LispBignum_t)
2175dfecf96Smrg#define BIGNUMP(object)		(POINTERP(object) && XBIGNUMP(object))
2185dfecf96Smrg#define BIGNUM(object)		LispNewBignum(object)
2195dfecf96Smrg
2205dfecf96Smrg
2215dfecf96Smrg/* generic integer */
2225dfecf96Smrg#define INTEGER(integer)	LispNewInteger(integer)
2235dfecf96Smrg#define INTEGERP(object)						\
2245dfecf96Smrg    (POINTERP(object) ? XINTP(object) || XBIGNUMP(object) : FIXNUMP(object))
2255dfecf96Smrg#define CHECK_INTEGER(object)						\
2265dfecf96Smrg    if (!INTEGERP(object))						\
2275dfecf96Smrg	LispDestroy("%s: %s is not an integer",				\
2285dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
2295dfecf96Smrg
2305dfecf96Smrg
2315dfecf96Smrg/* ratio */
2325dfecf96Smrg#define XRATIOP(object)		((object)->type == LispRatio_t)
2335dfecf96Smrg#define RATIOP(object)		(POINTERP(object) && XRATIOP(object))
2345dfecf96Smrg#define RATIO(num, den)		LispNewRatio(num, den)
2355dfecf96Smrg
2365dfecf96Smrg
2375dfecf96Smrg/* bigratio */
2385dfecf96Smrg#define XBIGRATIOP(object)	((object)->type == LispBigratio_t)
2395dfecf96Smrg#define BIGRATIOP(object)	(POINTERP(object) && XBIGRATIOP(object))
2405dfecf96Smrg#define BIGRATIO(ratio)		LispNewBigratio(ratio)
2415dfecf96Smrg
2425dfecf96Smrg
2435dfecf96Smrg/* generic rational */
2445dfecf96Smrg#define RATIONALP(object)						\
2455dfecf96Smrg    (POINTERP(object) ? XINTP(object) || XRATIOP(object) ||		\
2465dfecf96Smrg			XBIGNUMP(object) || XBIGRATIOP(object) :	\
2475dfecf96Smrg			FIXNUMP(object))
2485dfecf96Smrg
2495dfecf96Smrg
2505dfecf96Smrg/* double float */
2515dfecf96Smrg#define XDFLOATP(object)	((object)->type == LispDFloat_t)
2525dfecf96Smrg#define DFLOATP(object)		(POINTERP(object) && XDFLOATP(object))
2535dfecf96Smrg#define DFLOAT_VALUE(object)	(object)->data.dfloat
2545dfecf96Smrg#define CHECK_DFLOAT(object)						\
2555dfecf96Smrg    if (!DFLOATP(object))						\
2565dfecf96Smrg	LispDestroy("%s: %s is not a float number",			\
2575dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
2585dfecf96Smrg#define DFLOAT(value)		LispNewDFloat(value)
2595dfecf96Smrg
2605dfecf96Smrg
2615dfecf96Smrg/* generic float - currently only double float supported */
2625dfecf96Smrg#define FLOATP(object)		DFLOATP(object)
2635dfecf96Smrg
2645dfecf96Smrg
2655dfecf96Smrg/* real number */
2665dfecf96Smrg#define REALP(object)							\
2675dfecf96Smrg    (POINTERP(object) ? XINTP(object) || XDFLOATP(object) ||		\
2685dfecf96Smrg			XRATIOP(object) || XBIGNUMP(object) ||		\
2695dfecf96Smrg			XBIGRATIOP(object) :				\
2705dfecf96Smrg			FIXNUMP(object))
2715dfecf96Smrg#define CHECK_REAL(object)						\
2725dfecf96Smrg    if (!REALP(object))							\
2735dfecf96Smrg	LispDestroy("%s: %s is not a real number",			\
2745dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
2755dfecf96Smrg
2765dfecf96Smrg
2775dfecf96Smrg/* complex */
2785dfecf96Smrg#define XCOMPLEXP(object)	((object)->type == LispComplex_t)
2795dfecf96Smrg#define COMPLEXP(object)	(POINTERP(object) && XCOMPLEXP(object))
2805dfecf96Smrg#define COMPLEX(real, imag)	LispNewComplex(real, imag)
2815dfecf96Smrg
2825dfecf96Smrg
2835dfecf96Smrg/* generic number */
2845dfecf96Smrg#define NUMBERP(object)							\
2855dfecf96Smrg    (POINTERP(object) ? XINTP(object) || XDFLOATP(object) ||		\
2865dfecf96Smrg			XRATIOP(object) || XBIGNUMP(object) ||		\
2875dfecf96Smrg			XBIGRATIOP(object) || XCOMPLEXP(object) :	\
2885dfecf96Smrg			FIXNUMP(object))
2895dfecf96Smrg#define CHECK_NUMBER(object)						\
2905dfecf96Smrg    if (!NUMBERP(object))						\
2915dfecf96Smrg	LispDestroy("%s: %s is not a number",				\
2925dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
2935dfecf96Smrg
2945dfecf96Smrg
2955dfecf96Smrg/* symbol */
2965dfecf96Smrg#define XSYMBOLP(object)	((object)->type == LispAtom_t)
2975dfecf96Smrg#define SYMBOLP(object)		(POINTERP(object) && XSYMBOLP(object))
2985dfecf96Smrg#define CHECK_SYMBOL(object)						\
2995dfecf96Smrg    if (!SYMBOLP(object))						\
3005dfecf96Smrg	LispDestroy("%s: %s is not a symbol",				\
3015dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3025dfecf96Smrg
3035dfecf96Smrg
3045dfecf96Smrg/* keyword */
3055dfecf96Smrg#define XKEYWORDP(object)						\
3065dfecf96Smrg    ((object)->data.atom->package == lisp__data.keyword)
3075dfecf96Smrg#define KEYWORDP(object)						\
3085dfecf96Smrg    (POINTERP(object) && XSYMBOLP(object) && XKEYWORDP(object))
3095dfecf96Smrg#define KEYWORD(string)		LispNewKeyword(string)
3105dfecf96Smrg#define CHECK_KEYWORD(object)						\
3115dfecf96Smrg    if (!KEYWORDP(object))						\
3125dfecf96Smrg	LispDestroy("%s: %s is not a keyword",				\
3135dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3145dfecf96Smrg#define CHECK_CONSTANT(object)						\
3155dfecf96Smrg    if ((object)->data.atom->constant)					\
3165dfecf96Smrg	LispDestroy("%s: %s is a constant",				\
3175dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3185dfecf96Smrg
3195dfecf96Smrg#define SETVALUE(atom, object)	((atom)->property->value = object)
3205dfecf96Smrg
3215dfecf96Smrg
3225dfecf96Smrg/* function */
3235dfecf96Smrg#define XFUNCTIONP(object)	((object)->type == LispFunction_t)
3245dfecf96Smrg#define FUNCTIONP(object)	(POINTERP(object) && XFUNCTIONP(object))
3255dfecf96Smrg
3265dfecf96Smrg
3275dfecf96Smrg/* lambda */
3285dfecf96Smrg#define XLAMBDAP(object)	((object)->type == LispLambda_t)
3295dfecf96Smrg#define LAMBDAP(object)		(POINTERP(object) && XLAMBDAP(object))
3305dfecf96Smrg
3315dfecf96Smrg
3325dfecf96Smrg/* string - currently only simple 8 bit characters */
3335dfecf96Smrg#define XSTRINGP(object)	((object)->type == LispString_t)
3345dfecf96Smrg#define STRINGP(object)		(POINTERP(object) && XSTRINGP(object))
3355dfecf96Smrg#define THESTR(object)		(object)->data.string.string
3365dfecf96Smrg#define STRLEN(object)		(object)->data.string.length
3375dfecf96Smrg#define CHECK_STRING(object)						\
3385dfecf96Smrg    if (!STRINGP(object))						\
3395dfecf96Smrg	LispDestroy("%s: %s is not a string",				\
3405dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3415dfecf96Smrg#define CHECK_STRING_WRITABLE(object)					\
3425dfecf96Smrg    if (!object->data.string.writable)					\
3435dfecf96Smrg	LispDestroy("%s: %s is readonly",				\
3445dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3455dfecf96Smrg
3465dfecf96Smrg
3475dfecf96Smrg/* array/vector */
3485dfecf96Smrg#define XARRAYP(object)		((object)->type == LispArray_t)
3495dfecf96Smrg#define ARRAYP(object)		(POINTERP(object) && XARRAYP(object))
3505dfecf96Smrg#define CHECK_ARRAY(object)						\
3515dfecf96Smrg    if (!ARRAYP(object))						\
3525dfecf96Smrg	LispDestroy("%s: %s is not an array",				\
3535dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3545dfecf96Smrg
3555dfecf96Smrg
3565dfecf96Smrg/* quote */
3575dfecf96Smrg#define XQUOTEP(object)		((object)->type == LispQuote_t)
3585dfecf96Smrg#define QUOTEP(object)		(POINTERP(object) && XQUOTEP(object))
3595dfecf96Smrg#define QUOTE(object)		LispNewQuote(object)
3605dfecf96Smrg
3615dfecf96Smrg#define XBACKQUOTEP(object)	((object)->type == LispBackquote_t)
3625dfecf96Smrg#define BACKQUOTEP(object)	(POINTERP(object) && XBACKQUOTEP(object))
3635dfecf96Smrg#define BACKQUOTE(object)	LispNewBackquote(object)
3645dfecf96Smrg
3655dfecf96Smrg#define XCOMMAP(object)		((object)->type == LispComma_t)
3665dfecf96Smrg#define COMMAP(object)		(POINTERP(object) && XCOMMAP(object))
3675dfecf96Smrg#define COMMA(object, at)	LispNewComma(object, at)
3685dfecf96Smrg
3695dfecf96Smrg
3705dfecf96Smrg/* package */
3715dfecf96Smrg#define XPACKAGEP(object)	((object)->type == LispPackage_t)
3725dfecf96Smrg#define PACKAGEP(object)	(POINTERP(object) && XPACKAGEP(object))
3735dfecf96Smrg
3745dfecf96Smrg
3755dfecf96Smrg/* pathname */
3765dfecf96Smrg#define XPATHNAMEP(object)	((object)->type == LispPathname_t)
3775dfecf96Smrg#define PATHNAMEP(object)	(POINTERP(object) && XPATHNAMEP(object))
3785dfecf96Smrg#define PATHNAME(object)	LispNewPathname(object)
3795dfecf96Smrg#define CHECK_PATHNAME(object)						\
3805dfecf96Smrg    if (!PATHNAMEP(object))						\
3815dfecf96Smrg	LispDestroy("%s: %s is not a pathname",				\
3825dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3835dfecf96Smrg
3845dfecf96Smrg
3855dfecf96Smrg/* stream */
3865dfecf96Smrg#define XSTREAMP(object)	((object)->type == LispStream_t)
3875dfecf96Smrg#define STREAMP(object)		(POINTERP(object) && XSTREAMP(object))
3885dfecf96Smrg#define CHECK_STREAM(object)						\
3895dfecf96Smrg    if (!STREAMP(object))						\
3905dfecf96Smrg	LispDestroy("%s: %s is not a stream",				\
3915dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
3925dfecf96Smrg
3935dfecf96Smrg
3945dfecf96Smrg/* hastable */
3955dfecf96Smrg#define XHASHTABLEP(object)	((object)->type == LispHashTable_t)
3965dfecf96Smrg#define HASHTABLEP(object)	(POINTERP(object) && XHASHTABLEP(object))
3975dfecf96Smrg#define CHECK_HASHTABLE(object)						\
3985dfecf96Smrg    if (!HASHTABLEP(object))						\
3995dfecf96Smrg	LispDestroy("%s: %s is not a hash-table",			\
4005dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
4015dfecf96Smrg
4025dfecf96Smrg
4035dfecf96Smrg/* regex */
4045dfecf96Smrg#define XREGEXP(object)		((object)->type == LispRegex_t)
4055dfecf96Smrg#define REGEXP(object)		(POINTERP(object) && XREGEXP(object))
4065dfecf96Smrg#define CHECK_REGEX(object)						\
4075dfecf96Smrg    if (!REGEXP(object))						\
4085dfecf96Smrg	LispDestroy("%s: %s is not a regexp",				\
4095dfecf96Smrg		    STRFUN(builtin), STROBJ(object))
4105dfecf96Smrg
4115dfecf96Smrg
4125dfecf96Smrg/* bytecode */
4135dfecf96Smrg#define XBYTECODEP(object)	((object)->type == LispBytecode_t)
4145dfecf96Smrg#define BYTECODEP(object)	(POINTERP(object) && XBYTECODEP(object))
4155dfecf96Smrg
4165dfecf96Smrg
4175dfecf96Smrg/* opaque */
4185dfecf96Smrg#define XOPAQUEP(object)	((object)->type == LispOpaque_t)
4195dfecf96Smrg#define OPAQUEP(object)		(POINTERP(object) && XOPAQUEP(object))
4205dfecf96Smrg#define OPAQUE(data, type)	LispNewOpaque((void*)((long)data), type)
4215dfecf96Smrg
4225dfecf96Smrg
4235dfecf96Smrg
4245dfecf96Smrg#define SSTREAMP(str)		((str)->data.stream.source.string)
4255dfecf96Smrg
4265dfecf96Smrg#define FSTREAMP(str)		((str)->data.stream.source.file)
4275dfecf96Smrg
4285dfecf96Smrg#define PSTREAMP(str)		((str)->data.stream.source.program)
4295dfecf96Smrg#define PIDPSTREAMP(str)	((str)->data.stream.source.program->pid)
4305dfecf96Smrg#define IPSTREAMP(str)		((str)->data.stream.source.program->input)
4315dfecf96Smrg#define OPSTREAMP(str)		((str)->data.stream.source.program->output)
4325dfecf96Smrg#define EPSTREAMP(str)		\
4335dfecf96Smrg	FSTREAMP((str)->data.stream.source.program->errorp)
4345dfecf96Smrg
4355dfecf96Smrg#define LispFileno(file)	((file)->descriptor)
4365dfecf96Smrg
437f14f4646Smrg#define STRFUN(builtin)		ATOMID(builtin->symbol)->value
4385dfecf96Smrg#define STROBJ(obj)		LispStrObj(obj)
4395dfecf96Smrg
4405dfecf96Smrg/* fetch builtin function/macro argument value
4415dfecf96Smrg */
4425dfecf96Smrg#define ARGUMENT(index)							\
4435dfecf96Smrg	lisp__data.stack.values[lisp__data.stack.base + (index)]
4445dfecf96Smrg
4455dfecf96Smrg#define RETURN(index)	lisp__data.returns.values[(index)]
4465dfecf96Smrg#define RETURN_COUNT	lisp__data.returns.count
4475dfecf96Smrg#define RETURN_CHECK(value)						\
4485dfecf96Smrg    value < MULTIPLE_VALUES_LIMIT ?					\
4495dfecf96Smrg	value : MULTIPLE_VALUES_LIMIT
4505dfecf96Smrg
4515dfecf96Smrg#define GC_ENTER()		int gc__protect = lisp__data.protect.length
4525dfecf96Smrg
4535dfecf96Smrg#define GC_PROTECT(object)						\
4545dfecf96Smrg    if (lisp__data.protect.length >= lisp__data.protect.space)		\
4555dfecf96Smrg	LispMoreProtects();						\
4565dfecf96Smrg    lisp__data.protect.objects[lisp__data.protect.length++] = object
4575dfecf96Smrg
4585dfecf96Smrg#define GC_LEAVE()		lisp__data.protect.length = gc__protect
4595dfecf96Smrg
4605dfecf96Smrg
4615dfecf96Smrg#define ERROR_CHECK_SPECIAL_FORM(atom)					\
462f14f4646Smrg    if ((atom)->property->fun.builtin->compile)				\
4635dfecf96Smrg	LispDestroy("%s: the special form %s cannot be redefined",	\
464f14f4646Smrg		    STRFUN(builtin), (atom)->key->value)
4655dfecf96Smrg
4665dfecf96Smrg
4675dfecf96Smrg
4685dfecf96Smrg#define CONSTANTP(object)						\
4695dfecf96Smrg    (!POINTERP(object) ||						\
4705dfecf96Smrg     XOBJECT_TYPE(object) < LispAtom_t ||				\
4715dfecf96Smrg     (XSYMBOLP(object) && XKEYWORDP(object)))
4725dfecf96Smrg
4735dfecf96Smrg/* slightly faster test, since keywords are very uncommon as eval arguments */
4745dfecf96Smrg#define NCONSTANTP(object)						\
4755dfecf96Smrg    (OBJECT_TYPE(object) >= LispAtom_t)
4765dfecf96Smrg
4775dfecf96Smrg
4785dfecf96Smrg/*
4795dfecf96Smrg * Types
4805dfecf96Smrg */
4815dfecf96Smrgtypedef struct _LispObj LispObj;
4825dfecf96Smrgtypedef struct _LispAtom LispAtom;
4835dfecf96Smrgtypedef struct _LispBuiltin LispBuiltin;
4845dfecf96Smrgtypedef struct _LispModuleData LispModuleData;
4855dfecf96Smrgtypedef struct _LispFile LispFile;
4865dfecf96Smrgtypedef struct _LispString LispString;
4875dfecf96Smrgtypedef struct _LispPackage LispPackage;
4885dfecf96Smrgtypedef struct _LispBytecode LispBytecode;
4895dfecf96Smrgtypedef struct _LispHashTable LispHashTable;
4905dfecf96Smrg
4915dfecf96Smrg/* Bytecode compiler data */
4925dfecf96Smrgtypedef struct _LispCom LispCom;
4935dfecf96Smrg
494f14f4646Smrgtypedef hash_key *Atom_id;
4955dfecf96Smrg
4965dfecf96Smrgtypedef enum _LispType {
4975dfecf96Smrg    /* objects encoded in the LispObj pointer */
4985dfecf96Smrg    LispNil_t = 1,
4995dfecf96Smrg    LispFixnum_t = 3,
5005dfecf96Smrg    LispSChar_t = 5,
5015dfecf96Smrg
5025dfecf96Smrg    /* objects that have a structure */
5035dfecf96Smrg    LispInteger_t = 16,
5045dfecf96Smrg    LispDFloat_t,
5055dfecf96Smrg    LispString_t,
5065dfecf96Smrg    LispRatio_t,
5075dfecf96Smrg    LispOpaque_t,
5085dfecf96Smrg
5095dfecf96Smrg    /* simple access for marking */
5105dfecf96Smrg    LispBignum_t,
5115dfecf96Smrg    LispBigratio_t,
5125dfecf96Smrg
5135dfecf96Smrg    LispAtom_t,
5145dfecf96Smrg    LispFunction_t,
5155dfecf96Smrg    LispFunctionQuote_t,
5165dfecf96Smrg
5175dfecf96Smrg    LispLambda_t,
5185dfecf96Smrg
5195dfecf96Smrg    LispComplex_t,
5205dfecf96Smrg    LispCons_t,
5215dfecf96Smrg    LispQuote_t,
5225dfecf96Smrg    LispArray_t,
5235dfecf96Smrg    LispStruct_t,
5245dfecf96Smrg    LispStream_t,
5255dfecf96Smrg    LispBackquote_t,
5265dfecf96Smrg    LispComma_t,
5275dfecf96Smrg    LispPathname_t,
5285dfecf96Smrg    LispPackage_t,
5295dfecf96Smrg    LispRegex_t,
5305dfecf96Smrg    LispBytecode_t,
5315dfecf96Smrg    LispHashTable_t
5325dfecf96Smrg} LispType;
5335dfecf96Smrg
5345dfecf96Smrgtypedef enum _LispFunType {
5355dfecf96Smrg    LispLambda,
5365dfecf96Smrg    LispFunction,
5375dfecf96Smrg    LispMacro,
5385dfecf96Smrg    LispSetf
5395dfecf96Smrg} LispFunType;
5405dfecf96Smrg
5415dfecf96Smrgtypedef enum _LispStreamType {
5425dfecf96Smrg    LispStreamString,
5435dfecf96Smrg    LispStreamFile,
5445dfecf96Smrg    LispStreamStandard,
5455dfecf96Smrg    LispStreamPipe
5465dfecf96Smrg} LispStreamType;
5475dfecf96Smrg
5485dfecf96Smrgtypedef struct {
5495dfecf96Smrg    int pid;			/* process id of program */
5505dfecf96Smrg    LispFile *input;		/* if READABLE: stdout of program */
5515dfecf96Smrg    LispFile *output;		/* if WRITABLE: stdin of program */
5525dfecf96Smrg    LispObj *errorp;		/* ALWAYS (ONLY) READABLE: stderr of program */
5535dfecf96Smrg} LispPipe;
5545dfecf96Smrg
5555dfecf96Smrg/* silly IBM compiler */
5565dfecf96Smrg#ifdef AIXV5 /* probably want !gcc too */
5575dfecf96Smrg#define LispType int
5585dfecf96Smrg#define LispFunType int
5595dfecf96Smrg#define LispStreamType int
5605dfecf96Smrg#endif
5615dfecf96Smrg
5625dfecf96Smrgstruct _LispObj {
5635dfecf96Smrg    LispType type : 6;
5645dfecf96Smrg    unsigned int mark : 1;	/* gc protected */
5655dfecf96Smrg    unsigned int prot: 1;	/* protection for constant/unamed variables */
5665dfecf96Smrg    LispFunType funtype : 4;	/* this is subject to change in the future */
5675dfecf96Smrg    union {
5685dfecf96Smrg	LispAtom *atom;
5695dfecf96Smrg	struct {
5705dfecf96Smrg	    char *string;
5715dfecf96Smrg	    long length;
5725dfecf96Smrg	    unsigned int writable : 1;
5735dfecf96Smrg	} string;
5745dfecf96Smrg	long integer;
5755dfecf96Smrg	double dfloat;
5765dfecf96Smrg	LispObj *quote;
5775dfecf96Smrg	LispObj *pathname;	/* don't use quote generic name,
5785dfecf96Smrg				 * to avoid confusing code */
5795dfecf96Smrg	struct {
5805dfecf96Smrg	    long numerator;
5815dfecf96Smrg	    long denominator;
5825dfecf96Smrg	} ratio;
5835dfecf96Smrg	union {
5845dfecf96Smrg	    mpi *integer;
5855dfecf96Smrg	    mpr *ratio;
5865dfecf96Smrg	} mp;
5875dfecf96Smrg	struct {
5885dfecf96Smrg	    LispObj *real;
5895dfecf96Smrg	    LispObj *imag;
5905dfecf96Smrg	} complex;
5915dfecf96Smrg	struct {
5925dfecf96Smrg	    LispObj *car;
5935dfecf96Smrg	    LispObj *cdr;
5945dfecf96Smrg	} cons;
5955dfecf96Smrg	struct {
5965dfecf96Smrg	    LispObj *name;
5975dfecf96Smrg	    LispObj *code;
5985dfecf96Smrg	    LispObj *data;		/* extra data to protect */
5995dfecf96Smrg	} lambda;
6005dfecf96Smrg	struct {
6015dfecf96Smrg	    LispObj *list;		/* stored as a linear list */
6025dfecf96Smrg	    LispObj *dim;		/* dimensions of array */
6035dfecf96Smrg	    unsigned int rank : 8;	/* i.e. array-rank-limit => 256 */
6045dfecf96Smrg	    unsigned int type : 7;	/* converted to LispType, if not
6055dfecf96Smrg					 * Lisp_Nil_t only accepts given
6065dfecf96Smrg					 * type in array fields */
6075dfecf96Smrg	    unsigned int zero : 1;	/* at least one of the dimensions
6085dfecf96Smrg					 * is zero */
6095dfecf96Smrg	} array;
6105dfecf96Smrg	struct {
6115dfecf96Smrg	    LispObj *fields;	/* structure fields */
6125dfecf96Smrg	    LispObj *def;	/* structure definition */
6135dfecf96Smrg	} struc;
6145dfecf96Smrg	struct {
6155dfecf96Smrg	    union {
6165dfecf96Smrg		LispFile *file;
6175dfecf96Smrg		LispPipe *program;
6185dfecf96Smrg		LispString *string;
6195dfecf96Smrg	    } source;
6205dfecf96Smrg	    LispObj *pathname;
6215dfecf96Smrg	    LispStreamType type : 6;
6225dfecf96Smrg	    unsigned int readable : 1;
6235dfecf96Smrg	    unsigned int writable : 1;
6245dfecf96Smrg	} stream;
6255dfecf96Smrg	struct {
6265dfecf96Smrg	    void *data;
6275dfecf96Smrg	    int type;
6285dfecf96Smrg	} opaque;
6295dfecf96Smrg	struct {
6305dfecf96Smrg	    LispObj *eval;
6315dfecf96Smrg	    int atlist;
6325dfecf96Smrg	} comma;
6335dfecf96Smrg	struct {
6345dfecf96Smrg	    LispObj *name;
6355dfecf96Smrg	    LispObj *nicknames;
6365dfecf96Smrg	    LispPackage *package;
6375dfecf96Smrg	} package;
6385dfecf96Smrg	struct {
6395dfecf96Smrg	    re_cod *regex;
6405dfecf96Smrg	    LispObj *pattern;		/* regex string */
6415dfecf96Smrg	    int options;		/* regex compile flags */
6425dfecf96Smrg	} regex;
6435dfecf96Smrg	struct {
6445dfecf96Smrg	    LispBytecode *bytecode;
6455dfecf96Smrg	    LispObj *code;		/* object used to generate bytecode */
6465dfecf96Smrg	    LispObj *name;		/* name of function, or NIL */
6475dfecf96Smrg	} bytecode;
6485dfecf96Smrg	struct {
6495dfecf96Smrg	    LispHashTable *table;
6505dfecf96Smrg	    LispObj *test;
6515dfecf96Smrg	} hash;
6525dfecf96Smrg    } data;
6535dfecf96Smrg};
6545dfecf96Smrg#ifdef AIXV5
6555dfecf96Smrg#undef LispType
6565dfecf96Smrg#undef LispFunType
6575dfecf96Smrg#undef LispStreamType
6585dfecf96Smrg#endif
6595dfecf96Smrg
6605dfecf96Smrgtypedef	LispObj *(*LispFunPtr)(LispBuiltin*);
6615dfecf96Smrgtypedef void (*LispComPtr)(LispCom*, LispBuiltin*);
6625dfecf96Smrg
6635dfecf96Smrgstruct _LispBuiltin {
6645dfecf96Smrg    /* these fields must be set */
6655dfecf96Smrg    LispFunType type;
6665dfecf96Smrg    LispFunPtr function;
667f765521fSmrg    const char *declaration;
6685dfecf96Smrg
6695dfecf96Smrg    /* this field is optional, set if the function returns multiple values */
6705dfecf96Smrg    int multiple_values;
6715dfecf96Smrg
6725dfecf96Smrg    /* this field is also optional, set if the function should not be exported */
6735dfecf96Smrg    int internal;
6745dfecf96Smrg
6755dfecf96Smrg    /* this optional field points to a function of the bytecode compiler */
6765dfecf96Smrg    LispComPtr compile;
6775dfecf96Smrg
6785dfecf96Smrg    /* this field is set at runtime */
6795dfecf96Smrg    LispObj *symbol;
6805dfecf96Smrg};
6815dfecf96Smrg
6825dfecf96Smrgtypedef int (*LispLoadModule)(void);
6835dfecf96Smrgtypedef int (*LispUnloadModule)(void);
6845dfecf96Smrg
6855dfecf96Smrg#define LISP_MODULE_VERSION		1
6865dfecf96Smrgstruct _LispModuleData {
6875dfecf96Smrg    int version;
6885dfecf96Smrg    LispLoadModule load;
6895dfecf96Smrg    LispUnloadModule unload;
6905dfecf96Smrg};
6915dfecf96Smrg
6925dfecf96Smrg/*
6935dfecf96Smrg * Prototypes
6945dfecf96Smrg */
6955dfecf96SmrgLispObj *LispEval(LispObj*);
6965dfecf96SmrgLispObj *LispFuncall(LispObj*, LispObj*, int);
6975dfecf96SmrgLispObj *LispApply1(LispObj*, LispObj*);
6985dfecf96SmrgLispObj *LispApply2(LispObj*, LispObj*, LispObj*);
6995dfecf96SmrgLispObj *LispApply3(LispObj*, LispObj*, LispObj*, LispObj*);
7005dfecf96Smrg
7015dfecf96SmrgLispObj *LispNew(LispObj*, LispObj*);
7025dfecf96SmrgLispObj *LispNewSymbol(LispAtom*);
703f765521fSmrgLispObj *LispNewAtom(const char*, int);
7045dfecf96SmrgLispObj *LispNewFunction(LispObj*);
7055dfecf96SmrgLispObj *LispNewFunctionQuote(LispObj*);
706f765521fSmrgLispObj *LispNewStaticAtom(const char*);
7075dfecf96SmrgLispObj *LispNewDFloat(double);
708f765521fSmrgLispObj *LispNewString(const char*, long);
709f765521fSmrgLispObj *LispNewStringAlloced(char*, long);
7105dfecf96SmrgLispObj *LispNewInteger(long);
7115dfecf96SmrgLispObj *LispNewRatio(long, long);
7125dfecf96SmrgLispObj *LispNewVector(LispObj*);
7135dfecf96SmrgLispObj *LispNewQuote(LispObj*);
7145dfecf96SmrgLispObj *LispNewBackquote(LispObj*);
7155dfecf96SmrgLispObj *LispNewComma(LispObj*, int);
7165dfecf96SmrgLispObj *LispNewCons(LispObj*, LispObj*);
7175dfecf96SmrgLispObj *LispNewLambda(LispObj*, LispObj*, LispObj*, LispFunType);
7185dfecf96SmrgLispObj *LispNewStruct(LispObj*, LispObj*);
7195dfecf96SmrgLispObj *LispNewComplex(LispObj*, LispObj*);
7205dfecf96SmrgLispObj *LispNewOpaque(void*, int);
721f765521fSmrgLispObj *LispNewKeyword(const char*);
7225dfecf96SmrgLispObj *LispNewPathname(LispObj*);
723f765521fSmrgLispObj *LispNewStringStream(const char*, int, long);
724f765521fSmrgLispObj *LispNewStringStreamAlloced(char*, int, long);
7255dfecf96SmrgLispObj *LispNewFileStream(LispFile*, LispObj*, int);
7265dfecf96SmrgLispObj *LispNewPipeStream(LispPipe*, LispObj*, int);
7275dfecf96SmrgLispObj *LispNewBignum(mpi*);
7285dfecf96SmrgLispObj *LispNewBigratio(mpr*);
7295dfecf96Smrg
730f765521fSmrgLispAtom *LispGetAtom(const char*);
7315dfecf96Smrg
7325dfecf96Smrg/* This function does not allocate a copy of it's argument, but the argument
7335dfecf96Smrg * itself. The argument string should never change. */
734f765521fSmrgLispAtom *LispGetPermAtom(const char*);
7355dfecf96Smrg
7365dfecf96Smrgvoid *LispMalloc(size_t);
7375dfecf96Smrgvoid *LispCalloc(size_t, size_t);
7385dfecf96Smrgvoid *LispRealloc(void*, size_t);
739f765521fSmrgchar *LispStrdup(const char*);
7405dfecf96Smrgvoid LispFree(void*);
7415dfecf96Smrg/* LispMused means memory is now safe from LispDestroy, and should not be
7425dfecf96Smrg * freed in case of an error */
7435dfecf96Smrgvoid LispMused(void*);
7445dfecf96Smrg
7455dfecf96Smrgvoid LispGC(LispObj*, LispObj*);
7465dfecf96Smrg
7475dfecf96Smrgchar *LispStrObj(LispObj*);
7485dfecf96Smrg
7495dfecf96Smrg#ifdef __GNUC__
7505dfecf96Smrg#define PRINTF_FORMAT	__attribute__ ((format (printf, 1, 2)))
7515dfecf96Smrg#else
7525dfecf96Smrg#define PRINTF_FORMAT	/**/
7535dfecf96Smrg#endif
754f765521fSmrgvoid LispDestroy(const char *fmt, ...) PRINTF_FORMAT;
7555dfecf96Smrg	/* continuable error */
756f765521fSmrgvoid LispContinuable(const char *fmt, ...) PRINTF_FORMAT;
757f765521fSmrgvoid LispMessage(const char *fmt, ...) PRINTF_FORMAT;
758f765521fSmrgvoid LispWarning(const char *fmt, ...) PRINTF_FORMAT;
7595dfecf96Smrg#undef PRINTF_FORMAT
7605dfecf96Smrg
761f765521fSmrgLispObj *LispSetVariable(LispObj*, LispObj*, const char*, int);
7625dfecf96Smrg
763f765521fSmrgint LispRegisterOpaqueType(const char*);
7645dfecf96Smrg
7655dfecf96Smrgvoid LispProtect(LispObj*, LispObj*);
7665dfecf96Smrgvoid LispUProtect(LispObj*, LispObj*);
7675dfecf96Smrg
7685dfecf96Smrg/* this function should be called when a module is loaded, and is called
7695dfecf96Smrg * when loading the interpreter */
7705dfecf96Smrgvoid LispAddBuiltinFunction(LispBuiltin*);
7715dfecf96Smrg
7725dfecf96Smrg/*
7735dfecf96Smrg * Initialization
7745dfecf96Smrg */
7755dfecf96Smrgextern LispObj *UNBOUND;
7765dfecf96Smrgextern int gcpro;
7775dfecf96Smrg
7785dfecf96Smrgextern LispObj *Okey, *Orest, *Ooptional, *Oaux, *Olambda;
7795dfecf96Smrgextern Atom_id Snil, St, Skey, Srest, Soptional, Saux;
7805dfecf96Smrgextern Atom_id Sand, Sor, Snot;
7815dfecf96Smrgextern Atom_id Satom, Ssymbol, Sinteger, Scharacter, Sstring, Slist,
7825dfecf96Smrg	       Scons, Svector, Sarray, Sstruct, Skeyword, Sfunction, Spathname,
7835dfecf96Smrg	       Srational, Sfloat, Scomplex, Sopaque, Sdefault;
7845dfecf96Smrg
7855dfecf96Smrgextern LispObj *Ocomplex, *Oformat, *Kunspecific;
7865dfecf96Smrg
7875dfecf96Smrgextern LispObj *Omake_array, *Kinitial_contents, *Osetf;
7885dfecf96Smrgextern Atom_id Svariable, Sstructure, Stype, Ssetf;
7895dfecf96Smrg
7905dfecf96Smrgextern Atom_id Smake_struct, Sstruct_access, Sstruct_store, Sstruct_type;
7915dfecf96Smrgextern LispObj *Omake_struct, *Ostruct_access, *Ostruct_store, *Ostruct_type;
7925dfecf96Smrg
7935dfecf96Smrgextern LispObj *Oparse_namestring, *Kerror, *Kabsolute, *Krelative, *Oopen,
7945dfecf96Smrg	       *Oclose, *Kif_does_not_exist;
7955dfecf96Smrg
7965dfecf96Smrgextern LispObj *Oequal_;
7975dfecf96Smrg
7985dfecf96Smrgextern LispFile *Stdout, *Stdin, *Stderr;
7995dfecf96Smrg
8005dfecf96Smrg#endif /* Lisp_internal_h */
801