private.h revision f765521f
15dfecf96Smrg/*
25dfecf96Smrg * Copyright (c) 2001 by The XFree86 Project, Inc.
35dfecf96Smrg *
45dfecf96Smrg * Permission is hereby granted, free of charge, to any person obtaining a
55dfecf96Smrg * copy of this software and associated documentation files (the "Software"),
65dfecf96Smrg * to deal in the Software without restriction, including without limitation
75dfecf96Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
85dfecf96Smrg * and/or sell copies of the Software, and to permit persons to whom the
95dfecf96Smrg * Software is furnished to do so, subject to the following conditions:
105dfecf96Smrg *
115dfecf96Smrg * The above copyright notice and this permission notice shall be included in
125dfecf96Smrg * all copies or substantial portions of the Software.
135dfecf96Smrg *
145dfecf96Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155dfecf96Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165dfecf96Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
175dfecf96Smrg * THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
185dfecf96Smrg * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
195dfecf96Smrg * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
205dfecf96Smrg * SOFTWARE.
215dfecf96Smrg *
225dfecf96Smrg * Except as contained in this notice, the name of the XFree86 Project shall
235dfecf96Smrg * not be used in advertising or otherwise to promote the sale, use or other
245dfecf96Smrg * dealings in this Software without prior written authorization from the
255dfecf96Smrg * XFree86 Project.
265dfecf96Smrg *
275dfecf96Smrg * Author: Paulo César Pereira de Andrade
285dfecf96Smrg */
295dfecf96Smrg
30f14f4646Smrg/* $XdotOrg: xc/programs/xedit/lisp/private.h,v 1.2 2004/04/23 19:54:44 eich Exp $ */
315dfecf96Smrg/* $XFree86: xc/programs/xedit/lisp/private.h,v 1.41 2003/05/27 22:27:04 tsi Exp $ */
325dfecf96Smrg
335dfecf96Smrg#ifndef Lisp_private_h
345dfecf96Smrg#define Lisp_private_h
355dfecf96Smrg
365dfecf96Smrg#include <X11/Xos.h>
375dfecf96Smrg#include <stdio.h>
385dfecf96Smrg#include <stdlib.h>
395dfecf96Smrg#include <string.h>
405dfecf96Smrg#if defined(X_POSIX_C_SOURCE)
415dfecf96Smrg#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
425dfecf96Smrg#include <setjmp.h>
435dfecf96Smrg#undef _POSIX_C_SOURCE
445dfecf96Smrg#else
455dfecf96Smrg#include <setjmp.h>
465dfecf96Smrg#endif
475dfecf96Smrg#include <unistd.h>
485dfecf96Smrg#include <sys/time.h>
495dfecf96Smrg#include "lisp/internal.h"
505dfecf96Smrg
515dfecf96Smrg#include "lisp/core.h"
525dfecf96Smrg#ifdef DEBUGGER
535dfecf96Smrg#include "lisp/debugger.h"
545dfecf96Smrg#endif
555dfecf96Smrg#include "lisp/helper.h"
565dfecf96Smrg#include "lisp/string.h"
575dfecf96Smrg#include "lisp/struct.h"
585dfecf96Smrg
595dfecf96Smrg/*
605dfecf96Smrg * Defines
615dfecf96Smrg */
625dfecf96Smrg#define	STRTBLSZ		23
635dfecf96Smrg#define MULTIPLE_VALUES_LIMIT	127
645dfecf96Smrg#define MAX_STACK_DEPTH		16384
655dfecf96Smrg
665dfecf96Smrg#define FEATURES							\
675dfecf96Smrg    (lisp__data.features->data.atom->a_object ?				\
685dfecf96Smrg	(LispObj *)lisp__data.features->data.atom->property->value :	\
695dfecf96Smrg	NIL)
705dfecf96Smrg#define PACK	lisp__data.packlist
71f765521fSmrg#undef PACKAGE /* avoid conflicts with autoconf's #define in config.h */
725dfecf96Smrg#define PACKAGE	lisp__data.package->data.atom->property->value
735dfecf96Smrg#define MOD	lisp__data.modlist
745dfecf96Smrg#define COD	lisp__data.codlist
755dfecf96Smrg#define RUN	lisp__data.runlist
765dfecf96Smrg#define RES	lisp__data.reslist
775dfecf96Smrg#define DBG	lisp__data.dbglist
785dfecf96Smrg#define BRK	lisp__data.brklist
795dfecf96Smrg#define PRO	lisp__data.prolist
805dfecf96Smrg
815dfecf96Smrg#define SINPUT	lisp__data.input
825dfecf96Smrg#define SOUTPUT	lisp__data.output
835dfecf96Smrg#define STANDARD_INPUT						\
845dfecf96Smrg    lisp__data.standard_input->data.atom->property->value
855dfecf96Smrg#define STANDARD_OUTPUT						\
865dfecf96Smrg    lisp__data.standard_output->data.atom->property->value
875dfecf96Smrg#define STANDARDSTREAM(file, desc, flags)			\
885dfecf96Smrg	LispNewStandardStream(file, desc, flags)
895dfecf96Smrg
905dfecf96Smrg/*
915dfecf96Smrg * Types
925dfecf96Smrg */
935dfecf96Smrgtypedef struct _LispStream LispStream;
945dfecf96Smrgtypedef struct _LispBlock LispBlock;
955dfecf96Smrgtypedef struct _LispOpaque LispOpaque;
965dfecf96Smrgtypedef struct _LispModule LispModule;
975dfecf96Smrgtypedef struct _LispProperty LispProperty;
985dfecf96Smrgtypedef struct _LispObjList LispObjList;
995dfecf96Smrgtypedef struct _LispStringHash LispStringHash;
1005dfecf96Smrgtypedef struct _LispCharInfo LispCharInfo;
1015dfecf96Smrg
1025dfecf96Smrg
1035dfecf96Smrg/* Normal function/macro arguments */
1045dfecf96Smrgtypedef struct _LispNormalArgs {
1055dfecf96Smrg    int num_symbols;
1065dfecf96Smrg    LispObj **symbols;		/* symbol names */
1075dfecf96Smrg} LispNormalArgs;
1085dfecf96Smrg
1095dfecf96Smrg/* &optional function/macro arguments */
1105dfecf96Smrgtypedef struct _LispOptionalArgs {
1115dfecf96Smrg    int num_symbols;
1125dfecf96Smrg    LispObj **symbols;		/* symbol names */
1135dfecf96Smrg    LispObj **defaults;		/* default values, when unspecifed */
1145dfecf96Smrg    LispObj **sforms;		/* T if variable specified, NIL otherwise */
1155dfecf96Smrg} LispOptionalArgs;
1165dfecf96Smrg
1175dfecf96Smrg/* &key function/macro arguments */
1185dfecf96Smrgtypedef struct _LispKeyArgs {
1195dfecf96Smrg    int num_symbols;
1205dfecf96Smrg    LispObj **symbols;		/* symbol names */
1215dfecf96Smrg    LispObj **defaults;		/* default values */
1225dfecf96Smrg    LispObj **sforms;		/* T if variable specified, NIL otherwise */
1235dfecf96Smrg    LispObj **keys;		/* key names, for special keywords */
1245dfecf96Smrg} LispKeyArgs;
1255dfecf96Smrg
1265dfecf96Smrg/* &aux function/macro arguments */
1275dfecf96Smrgtypedef struct _LispAuxArgs {
1285dfecf96Smrg    int num_symbols;
1295dfecf96Smrg    LispObj **symbols;		/* symbol names */
1305dfecf96Smrg    LispObj **initials;		/* initial values */
1315dfecf96Smrg} LispAuxArgs;
1325dfecf96Smrg
1335dfecf96Smrg/* characters in the field description have the format:
1345dfecf96Smrg *	'.'	normals has a list of normal arguments
1355dfecf96Smrg *	'o'	optionals has a list of &optional arguments
1365dfecf96Smrg *	'k'	keys has a list of &key arguments
1375dfecf96Smrg *	'r'	rest is a valid pointer to a &rest symbol
1385dfecf96Smrg *	'a'	auxs has a list of &aux arguments
1395dfecf96Smrg */
1405dfecf96Smrgtypedef struct _LispArgList {
1415dfecf96Smrg    LispNormalArgs normals;
1425dfecf96Smrg    LispOptionalArgs optionals;
1435dfecf96Smrg    LispKeyArgs keys;
1445dfecf96Smrg    LispObj *rest;
1455dfecf96Smrg    LispAuxArgs auxs;
1465dfecf96Smrg    int num_arguments;
1475dfecf96Smrg    char *description;
1485dfecf96Smrg} LispArgList;
1495dfecf96Smrg
1505dfecf96Smrgtypedef enum _LispDocType_t {
1515dfecf96Smrg    LispDocVariable,
1525dfecf96Smrg    LispDocFunction,
1535dfecf96Smrg    LispDocStructure,
1545dfecf96Smrg    LispDocType,
1555dfecf96Smrg    LispDocSetf
1565dfecf96Smrg} LispDocType_t;
1575dfecf96Smrg
1585dfecf96Smrgstruct _LispProperty {
1595dfecf96Smrg    /* may be used by multiple packages */
1605dfecf96Smrg    unsigned int refcount;
1615dfecf96Smrg
1625dfecf96Smrg    /* package where the property was created */
1635dfecf96Smrg    LispPackage *package;
1645dfecf96Smrg
1655dfecf96Smrg    /* value of variable attached to symbol */
1665dfecf96Smrg    LispObj *value;
1675dfecf96Smrg
1685dfecf96Smrg    union {
1695dfecf96Smrg	/* function attached to symbol */
1705dfecf96Smrg	LispObj *function;
1715dfecf96Smrg	/* builtin function attached to symbol*/
1725dfecf96Smrg	LispBuiltin *builtin;
1735dfecf96Smrg    } fun;
1745dfecf96Smrg    /* function/macro argument list description */
1755dfecf96Smrg    LispArgList *alist;
1765dfecf96Smrg
1775dfecf96Smrg    /* symbol properties list */
1785dfecf96Smrg    LispObj *properties;
1795dfecf96Smrg
1805dfecf96Smrg    /* setf method */
1815dfecf96Smrg    LispObj *setf;
1825dfecf96Smrg    /* setf argument list description */
1835dfecf96Smrg    LispArgList *salist;
1845dfecf96Smrg
1855dfecf96Smrg    /* structure information */
1865dfecf96Smrg    struct {
1875dfecf96Smrg	LispObj *definition;
1885dfecf96Smrg#define STRUCT_NAME		-3
1895dfecf96Smrg#define STRUCT_CHECK		-2
1905dfecf96Smrg#define STRUCT_CONSTRUCTOR	-1
1915dfecf96Smrg	int function;		/* if >= 0, it is a structure field index */
1925dfecf96Smrg    } structure;
1935dfecf96Smrg};
1945dfecf96Smrg
1955dfecf96Smrgstruct _LispAtom {
196f14f4646Smrg    hash_key *key;
197f14f4646Smrg    struct _LispAtom *next;
198f14f4646Smrg
1995dfecf96Smrg    /* hint: dynamically binded variable */
2005dfecf96Smrg    unsigned int dyn : 1;
2015dfecf96Smrg
2025dfecf96Smrg    /* Property has useful data in value field */
2035dfecf96Smrg    unsigned int a_object : 1;
2045dfecf96Smrg    /* Property has useful data in fun.function field */
2055dfecf96Smrg    unsigned int a_function : 1;
2065dfecf96Smrg    /* Property has useful data in fun.builtin field */
2075dfecf96Smrg    unsigned int a_builtin : 1;
2085dfecf96Smrg    /* Property has useful data in fun.function field */
2095dfecf96Smrg    unsigned int a_compiled : 1;
2105dfecf96Smrg    /* Property has useful data in properties field */
2115dfecf96Smrg    unsigned int a_property : 1;
2125dfecf96Smrg    /* Property has useful data in setf field */
2135dfecf96Smrg    unsigned int a_defsetf : 1;
2145dfecf96Smrg    /* Property has useful data in defstruct field */
2155dfecf96Smrg    unsigned int a_defstruct : 1;
2165dfecf96Smrg
2175dfecf96Smrg    /* Symbol is extern */
2185dfecf96Smrg    unsigned int ext : 1;
2195dfecf96Smrg
2205dfecf96Smrg    /* Symbol must be quoted with '|' to be allow reading back */
2215dfecf96Smrg    unsigned int unreadable : 1;
2225dfecf96Smrg
2235dfecf96Smrg    /* Symbol value may need special handling when changed */
2245dfecf96Smrg    unsigned int watch : 1;
2255dfecf96Smrg
2265dfecf96Smrg    /* Symbol value is constant, cannot be changed */
2275dfecf96Smrg    unsigned int constant : 1;
2285dfecf96Smrg
2295dfecf96Smrg    LispObj *object;		/* backpointer to object ATOM */
2305dfecf96Smrg    int offset;			/* in the environment list */
2315dfecf96Smrg    LispObj *package;		/* package home of symbol */
2325dfecf96Smrg    LispObj *function;		/* symbol function */
2335dfecf96Smrg    LispObj *name;		/* symbol string */
2345dfecf96Smrg    LispProperty *property;
2355dfecf96Smrg
2365dfecf96Smrg    LispObj *documentation[5];
2375dfecf96Smrg};
2385dfecf96Smrg
2395dfecf96Smrgstruct _LispObjList {
2405dfecf96Smrg    LispObj **pairs;		/* name0 ... nameN */
2415dfecf96Smrg    int length;			/* number of objects */
2425dfecf96Smrg    int space;			/* space allocated in field pairs */
2435dfecf96Smrg};
2445dfecf96Smrg
2455dfecf96Smrgstruct _LispPackage {
2465dfecf96Smrg    LispObjList glb;		/* global symbols in package */
2475dfecf96Smrg    LispObjList use;		/* inherited packages */
248f14f4646Smrg    hash_table *atoms;		/* atoms in this package */
2495dfecf96Smrg};
2505dfecf96Smrg
2515dfecf96Smrgstruct _LispOpaque {
252f14f4646Smrg    hash_key *desc;
2535dfecf96Smrg    LispOpaque *next;
254f14f4646Smrg    int type;
2555dfecf96Smrg};
2565dfecf96Smrg
2575dfecf96Smrgtypedef enum _LispBlockType {
2585dfecf96Smrg    LispBlockNone,	/* no block */
2595dfecf96Smrg    LispBlockTag,	/* may become "invisible" */
2605dfecf96Smrg    LispBlockCatch,	/* can be used to jump across function calls */
2615dfecf96Smrg    LispBlockClosure,	/* hides blocks of type LispBlockTag bellow it */
2625dfecf96Smrg    LispBlockProtect,	/* used by unwind-protect */
2635dfecf96Smrg    LispBlockBody	/* used by tagbody and go */
2645dfecf96Smrg} LispBlockType;
2655dfecf96Smrg
2665dfecf96Smrgstruct _LispBlock {
2675dfecf96Smrg    LispBlockType type;
2685dfecf96Smrg    LispObj *tag;
2695dfecf96Smrg    jmp_buf jmp;
2705dfecf96Smrg    int stack;
2715dfecf96Smrg    int protect;
2725dfecf96Smrg    int block_level;
2735dfecf96Smrg#ifdef DEBUGGER
2745dfecf96Smrg    int debug_level;
2755dfecf96Smrg    int debug_step;
2765dfecf96Smrg#endif
2775dfecf96Smrg};
2785dfecf96Smrg
2795dfecf96Smrgstruct _LispModule {
2805dfecf96Smrg    LispModule *next;
2815dfecf96Smrg    void *handle;
2825dfecf96Smrg    LispModuleData *data;
2835dfecf96Smrg};
2845dfecf96Smrg
2855dfecf96Smrgtypedef struct _LispUngetInfo {
2865dfecf96Smrg    char buffer[16];
2875dfecf96Smrg    int offset;
2885dfecf96Smrg} LispUngetInfo;
2895dfecf96Smrg
2905dfecf96Smrgstruct _LispMac {
2915dfecf96Smrg    /* stack for builtin function arguments */
2925dfecf96Smrg    struct {
2935dfecf96Smrg	LispObj **values;
2945dfecf96Smrg	int base;		/* base of arguments to function */
2955dfecf96Smrg	int length;
2965dfecf96Smrg	int space;
2975dfecf96Smrg    } stack;
2985dfecf96Smrg
2995dfecf96Smrg    /* environment */
3005dfecf96Smrg    struct {
3015dfecf96Smrg	LispObj **values;
3025dfecf96Smrg	Atom_id *names;
3035dfecf96Smrg	int lex;		/* until where variables are visible */
3045dfecf96Smrg	int head;		/* top of environment */
3055dfecf96Smrg	int length;		/* number of used pairs */
3065dfecf96Smrg	int space;		/* number of objects in pairs */
3075dfecf96Smrg    } env;
3085dfecf96Smrg
3095dfecf96Smrg    struct {
3105dfecf96Smrg	LispObj **values;
3115dfecf96Smrg	int count;
3125dfecf96Smrg    } returns;
3135dfecf96Smrg
3145dfecf96Smrg    struct {
3155dfecf96Smrg	LispObj **objects;
3165dfecf96Smrg	int length;
3175dfecf96Smrg	int space;
3185dfecf96Smrg    } protect;
3195dfecf96Smrg
3205dfecf96Smrg    LispObj *package;		/* package object */
3215dfecf96Smrg    LispPackage *pack;		/* pointer to lisp__data.package->data.package.package */
3225dfecf96Smrg
3235dfecf96Smrg    /* fast access to the KEYWORD package */
3245dfecf96Smrg    LispObj *keyword;
3255dfecf96Smrg    LispPackage *key;
3265dfecf96Smrg
3275dfecf96Smrg    /* the LISP package */
3285dfecf96Smrg    LispObj *lisp;
3295dfecf96Smrg
3305dfecf96Smrg    /* only used if the package was changed, but an error generated
3315dfecf96Smrg     * before returning to the toplevel */
3325dfecf96Smrg    LispObj *savepackage;
3335dfecf96Smrg    LispPackage *savepack;
3345dfecf96Smrg
3355dfecf96Smrg    struct {
3365dfecf96Smrg	int block_level;
3375dfecf96Smrg	int block_size;
3385dfecf96Smrg	LispObj *block_ret;
3395dfecf96Smrg	LispBlock **block;
3405dfecf96Smrg    } block;
3415dfecf96Smrg
3425dfecf96Smrg    sigjmp_buf jmp;
3435dfecf96Smrg
3445dfecf96Smrg    struct {
3455dfecf96Smrg	unsigned int expandbits : 3;	/* code doesn't look like reusing cells
3465dfecf96Smrg					 * so try to have a larger number of
3475dfecf96Smrg					 * free cells */
3485dfecf96Smrg	unsigned int immutablebits : 1;	/* need to reset immutable bits */
3495dfecf96Smrg	unsigned int timebits : 1;	/* update gctime counter */
3505dfecf96Smrg	unsigned int count;
3515dfecf96Smrg	long gctime;
3525dfecf96Smrg	int average;			/* of cells freed after gc calls */
3535dfecf96Smrg    } gc;
3545dfecf96Smrg
355f14f4646Smrg    hash_table	*strings;
356f14f4646Smrg    hash_table	*opqs;
3575dfecf96Smrg    int opaque;
3585dfecf96Smrg
3595dfecf96Smrg    LispObj *standard_input, *input, *input_list;
3605dfecf96Smrg    LispObj *standard_output, *output, *output_list;
3615dfecf96Smrg    LispObj *error_stream;
3625dfecf96Smrg    LispUngetInfo **unget;
3635dfecf96Smrg    int iunget, nunget;
3645dfecf96Smrg    int eof;
3655dfecf96Smrg
3665dfecf96Smrg    int interactive;
3675dfecf96Smrg    int errexit;
3685dfecf96Smrg
3695dfecf96Smrg    struct {
3705dfecf96Smrg	int index;
3715dfecf96Smrg	int level;
3725dfecf96Smrg	int space;
3735dfecf96Smrg	void **mem;
3745dfecf96Smrg    } mem;		/* memory from Lisp*Alloc, to be release in error */
3755dfecf96Smrg    LispModule *module;
3765dfecf96Smrg    LispObj *modules;
377f765521fSmrg    const char *prompt;
3785dfecf96Smrg
3795dfecf96Smrg    LispObj *features;
3805dfecf96Smrg
3815dfecf96Smrg    LispObj *modlist;		/* module list */
3825dfecf96Smrg    LispObj *packlist;		/* list of packages */
3835dfecf96Smrg    LispObj *codlist;		/* current code */
3845dfecf96Smrg    LispObj *runlist[3];	/* +, ++, and +++ */
3855dfecf96Smrg    LispObj *reslist[3];	/* *, **, and *** */
3865dfecf96Smrg#ifdef DEBUGGER
3875dfecf96Smrg    LispObj *dbglist;		/* debug information */
3885dfecf96Smrg    LispObj *brklist;		/* breakpoints information */
3895dfecf96Smrg#endif
3905dfecf96Smrg    LispObj *prolist;		/* protect objects list */
3915dfecf96Smrg
3925dfecf96Smrg    void (*sigint)(int);
3935dfecf96Smrg    void (*sigfpe)(int);
3945dfecf96Smrg
3955dfecf96Smrg    int destroyed;		/* reached LispDestroy, used by unwind-protect */
3965dfecf96Smrg    int running;		/* there is somewhere to siglongjmp */
3975dfecf96Smrg
3985dfecf96Smrg    int ignore_errors;		/* inside a ignore-errors block */
3995dfecf96Smrg    LispObj *error_condition;	/* actually, a string */
4005dfecf96Smrg
4015dfecf96Smrg    int debugging;		/* debugger enabled? */
4025dfecf96Smrg#ifdef DEBUGGER
4035dfecf96Smrg    int debug_level;		/* almost always the same as lisp__data.level */
4045dfecf96Smrg    int debug_step;		/* control for stoping and printing output */
4055dfecf96Smrg    int debug_break;		/* next breakpoint number */
4065dfecf96Smrg    LispDebugState debug;
4075dfecf96Smrg#endif
4085dfecf96Smrg};
4095dfecf96Smrg
4105dfecf96Smrgstruct _LispCharInfo {
411f765521fSmrg    const char * const *names;
4125dfecf96Smrg};
4135dfecf96Smrg
4145dfecf96Smrg
4155dfecf96Smrg/*
4165dfecf96Smrg * Prototypes
4175dfecf96Smrg */
4185dfecf96Smrgvoid LispUseArgList(LispArgList*);
4195dfecf96Smrgvoid LispFreeArgList(LispArgList*);
420f765521fSmrgLispArgList *LispCheckArguments(LispFunType, LispObj*, const char*, int);
4215dfecf96SmrgLispObj *LispListProtectedArguments(LispArgList*);
4225dfecf96Smrg
4235dfecf96SmrgLispObj *LispGetDoc(LispObj*);
4245dfecf96SmrgLispObj *LispGetVar(LispObj*);
4255dfecf96Smrg#ifdef DEBUGGER
4265dfecf96Smrgvoid *LispGetVarAddr(LispObj*);	/* used by debugger */
4275dfecf96Smrg#endif
4285dfecf96SmrgLispObj *LispAddVar(LispObj*, LispObj*);
4295dfecf96SmrgLispObj *LispSetVar(LispObj*, LispObj*);
4305dfecf96Smrgvoid LispUnsetVar(LispObj*);
4315dfecf96Smrg
4325dfecf96Smrg	/* only used at initialization time */
4335dfecf96SmrgLispObj *LispNewStandardStream(LispFile*, LispObj*, int);
4345dfecf96Smrg
4355dfecf96Smrg	/* create a new package */
4365dfecf96SmrgLispObj *LispNewPackage(LispObj*, LispObj*);
4375dfecf96Smrg	/* add package to use-list of current, and imports all extern symbols */
4385dfecf96Smrgvoid LispUsePackage(LispObj*);
4395dfecf96Smrg	/* make symbol extern in the current package */
4405dfecf96Smrgvoid LispExportSymbol(LispObj*);
4415dfecf96Smrg	/* imports symbol to current package */
4425dfecf96Smrgvoid LispImportSymbol(LispObj*);
4435dfecf96Smrg
4445dfecf96Smrg	/* always returns the same string */
445f765521fSmrghash_key *LispGetAtomKey(const char*, int);
4465dfecf96Smrg
4475dfecf96Smrg/* destructive fast reverse, note that don't receive a LispMac* argument */
4485dfecf96SmrgLispObj *LispReverse(LispObj *list);
4495dfecf96Smrg
4505dfecf96Smrgchar *LispIntToOpaqueType(int);
4515dfecf96Smrg
4525dfecf96Smrg/* (print) */
4535dfecf96Smrgvoid LispPrint(LispObj*, LispObj*, int);
4545dfecf96Smrg
4555dfecf96SmrgLispBlock *LispBeginBlock(LispObj*, LispBlockType);
4565dfecf96Smrg#define BLOCKJUMP(block)				\
4575dfecf96Smrg    lisp__data.stack.length = (block)->stack;		\
4585dfecf96Smrg    lisp__data.protect.length = (block)->protect;	\
4595dfecf96Smrg    longjmp((block)->jmp, 1)
4605dfecf96Smrgvoid LispEndBlock(LispBlock*);
4615dfecf96Smrg	/* if unwind-protect active, jump to cleanup code, else do nothing */
4625dfecf96Smrgvoid LispBlockUnwind(LispBlock*);
4635dfecf96Smrg
4645dfecf96Smrgvoid LispUpdateResults(LispObj*, LispObj*);
4655dfecf96Smrgvoid LispTopLevel(void);
4665dfecf96Smrg
467f765521fSmrgLispAtom *LispDoGetAtom(const char *str, int);
4685dfecf96Smrg	/* get value from atom's property list */
4695dfecf96SmrgLispObj *LispGetAtomProperty(LispAtom*, LispObj*);
4705dfecf96Smrg	/* put value in atom's property list */
4715dfecf96SmrgLispObj *LispPutAtomProperty(LispAtom*, LispObj*, LispObj*);
4725dfecf96Smrg	/* remove value from atom's property list */
4735dfecf96SmrgLispObj *LispRemAtomProperty(LispAtom*, LispObj*);
4745dfecf96Smrg	/* replace atom's property list */
4755dfecf96SmrgLispObj *LispReplaceAtomPropertyList(LispAtom*, LispObj*);
4765dfecf96Smrg
4775dfecf96Smrg	/* returns function associated with symbol */
4785dfecf96SmrgLispObj *LispSymbolFunction(LispObj*);
4795dfecf96Smrg	/* returns symbol string name */
4805dfecf96SmrgLispObj *LispSymbolName(LispObj*);
4815dfecf96Smrg
4825dfecf96Smrg	/* define byte compiled function, or replace definition */
4835dfecf96Smrgvoid LispSetAtomCompiledProperty(LispAtom*, LispObj*);
4845dfecf96Smrg	/* remove byte compiled function property */
4855dfecf96Smrgvoid LispRemAtomCompiledProperty(LispAtom*);
4865dfecf96Smrg	/* define function, or replace function definition */
4875dfecf96Smrgvoid LispSetAtomFunctionProperty(LispAtom*, LispObj*, LispArgList*);
4885dfecf96Smrg	/* remove function property */
4895dfecf96Smrgvoid LispRemAtomFunctionProperty(LispAtom*);
4905dfecf96Smrg	/* define builtin, or replace builtin definition */
4915dfecf96Smrgvoid LispSetAtomBuiltinProperty(LispAtom*, LispBuiltin*, LispArgList*);
4925dfecf96Smrg	/* remove builtin property */
4935dfecf96Smrgvoid LispRemAtomBuiltinProperty(LispAtom*);
4945dfecf96Smrg	/* define setf macro, or replace current definition */
4955dfecf96Smrgvoid LispSetAtomSetfProperty(LispAtom*, LispObj*, LispArgList*);
4965dfecf96Smrg	/* remove setf macro */
4975dfecf96Smrgvoid LispRemAtomSetfProperty(LispAtom*);
4985dfecf96Smrg	/* create or change structure property */
4995dfecf96Smrgvoid LispSetAtomStructProperty(LispAtom*, LispObj*, int);
5005dfecf96Smrg	/* remove structure property */
5015dfecf96Smrgvoid LispRemAtomStructProperty(LispAtom*);
5025dfecf96Smrg
5035dfecf96Smrgvoid LispProclaimSpecial(LispObj*, LispObj*, LispObj*);
5045dfecf96Smrgvoid LispDefconstant(LispObj*, LispObj*, LispObj*);
5055dfecf96Smrg
5065dfecf96Smrgvoid LispAddDocumentation(LispObj*, LispObj*, LispDocType_t);
5075dfecf96Smrgvoid LispRemDocumentation(LispObj*, LispDocType_t);
5085dfecf96SmrgLispObj *LispGetDocumentation(LispObj*, LispDocType_t);
5095dfecf96Smrg
5105dfecf96Smrg/* increases storage for functions returning multiple values */
5115dfecf96Smrgvoid LispMoreReturns(void);
5125dfecf96Smrg
5135dfecf96Smrg/* increases storage for temporarily protected data */
5145dfecf96Smrgvoid LispMoreProtects(void);
5155dfecf96Smrg
5165dfecf96Smrg/* Initialization */
5175dfecf96Smrgextern int LispArgList_t;
518f765521fSmrgextern const LispCharInfo LispChars[256];
5195dfecf96Smrg
5205dfecf96Smrg/* This function will return if the interpreter cannot be stopped */
5215dfecf96Smrgextern void LispSignal(int);
5225dfecf96Smrg
5235dfecf96Smrgvoid LispDisableInterrupts(void);
5245dfecf96Smrgvoid LispEnableInterrupts(void);
5255dfecf96Smrg#define DISABLE_INTERRUPTS()	LispDisableInterrupts()
5265dfecf96Smrg#define ENABLE_INTERRUPTS()	LispEnableInterrupts()
5275dfecf96Smrg
5285dfecf96Smrg/* Value returned by LispBegin, used everywhere in the code.
5295dfecf96Smrg * Only one interpreter instance allowed. */
5305dfecf96Smrgextern LispMac lisp__data;
5315dfecf96Smrg
5325dfecf96Smrg#endif /* Lisp_private_h */
533