private.h revision 5dfecf96
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 305dfecf96Smrg/* $XdotOrg: app/xedit/lisp/private.h,v 1.3 2004/12/04 00:43:13 kuhn 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 715dfecf96Smrg#define PACKAGE lisp__data.package->data.atom->property->value 725dfecf96Smrg#define MOD lisp__data.modlist 735dfecf96Smrg#define COD lisp__data.codlist 745dfecf96Smrg#define RUN lisp__data.runlist 755dfecf96Smrg#define RES lisp__data.reslist 765dfecf96Smrg#define DBG lisp__data.dbglist 775dfecf96Smrg#define BRK lisp__data.brklist 785dfecf96Smrg#define PRO lisp__data.prolist 795dfecf96Smrg 805dfecf96Smrg#define SINPUT lisp__data.input 815dfecf96Smrg#define SOUTPUT lisp__data.output 825dfecf96Smrg#define STANDARD_INPUT \ 835dfecf96Smrg lisp__data.standard_input->data.atom->property->value 845dfecf96Smrg#define STANDARD_OUTPUT \ 855dfecf96Smrg lisp__data.standard_output->data.atom->property->value 865dfecf96Smrg#define STANDARDSTREAM(file, desc, flags) \ 875dfecf96Smrg LispNewStandardStream(file, desc, flags) 885dfecf96Smrg 895dfecf96Smrg/* 905dfecf96Smrg * Types 915dfecf96Smrg */ 925dfecf96Smrgtypedef struct _LispStream LispStream; 935dfecf96Smrgtypedef struct _LispBlock LispBlock; 945dfecf96Smrgtypedef struct _LispOpaque LispOpaque; 955dfecf96Smrgtypedef struct _LispModule LispModule; 965dfecf96Smrgtypedef struct _LispProperty LispProperty; 975dfecf96Smrgtypedef struct _LispObjList LispObjList; 985dfecf96Smrgtypedef struct _LispStringHash LispStringHash; 995dfecf96Smrgtypedef struct _LispCharInfo LispCharInfo; 1005dfecf96Smrg 1015dfecf96Smrg 1025dfecf96Smrg/* Normal function/macro arguments */ 1035dfecf96Smrgtypedef struct _LispNormalArgs { 1045dfecf96Smrg int num_symbols; 1055dfecf96Smrg LispObj **symbols; /* symbol names */ 1065dfecf96Smrg} LispNormalArgs; 1075dfecf96Smrg 1085dfecf96Smrg/* &optional function/macro arguments */ 1095dfecf96Smrgtypedef struct _LispOptionalArgs { 1105dfecf96Smrg int num_symbols; 1115dfecf96Smrg LispObj **symbols; /* symbol names */ 1125dfecf96Smrg LispObj **defaults; /* default values, when unspecifed */ 1135dfecf96Smrg LispObj **sforms; /* T if variable specified, NIL otherwise */ 1145dfecf96Smrg} LispOptionalArgs; 1155dfecf96Smrg 1165dfecf96Smrg/* &key function/macro arguments */ 1175dfecf96Smrgtypedef struct _LispKeyArgs { 1185dfecf96Smrg int num_symbols; 1195dfecf96Smrg LispObj **symbols; /* symbol names */ 1205dfecf96Smrg LispObj **defaults; /* default values */ 1215dfecf96Smrg LispObj **sforms; /* T if variable specified, NIL otherwise */ 1225dfecf96Smrg LispObj **keys; /* key names, for special keywords */ 1235dfecf96Smrg} LispKeyArgs; 1245dfecf96Smrg 1255dfecf96Smrg/* &aux function/macro arguments */ 1265dfecf96Smrgtypedef struct _LispAuxArgs { 1275dfecf96Smrg int num_symbols; 1285dfecf96Smrg LispObj **symbols; /* symbol names */ 1295dfecf96Smrg LispObj **initials; /* initial values */ 1305dfecf96Smrg} LispAuxArgs; 1315dfecf96Smrg 1325dfecf96Smrg/* characters in the field description have the format: 1335dfecf96Smrg * '.' normals has a list of normal arguments 1345dfecf96Smrg * 'o' optionals has a list of &optional arguments 1355dfecf96Smrg * 'k' keys has a list of &key arguments 1365dfecf96Smrg * 'r' rest is a valid pointer to a &rest symbol 1375dfecf96Smrg * 'a' auxs has a list of &aux arguments 1385dfecf96Smrg */ 1395dfecf96Smrgtypedef struct _LispArgList { 1405dfecf96Smrg LispNormalArgs normals; 1415dfecf96Smrg LispOptionalArgs optionals; 1425dfecf96Smrg LispKeyArgs keys; 1435dfecf96Smrg LispObj *rest; 1445dfecf96Smrg LispAuxArgs auxs; 1455dfecf96Smrg int num_arguments; 1465dfecf96Smrg char *description; 1475dfecf96Smrg} LispArgList; 1485dfecf96Smrg 1495dfecf96Smrgtypedef enum _LispDocType_t { 1505dfecf96Smrg LispDocVariable, 1515dfecf96Smrg LispDocFunction, 1525dfecf96Smrg LispDocStructure, 1535dfecf96Smrg LispDocType, 1545dfecf96Smrg LispDocSetf 1555dfecf96Smrg} LispDocType_t; 1565dfecf96Smrg 1575dfecf96Smrgstruct _LispProperty { 1585dfecf96Smrg /* may be used by multiple packages */ 1595dfecf96Smrg unsigned int refcount; 1605dfecf96Smrg 1615dfecf96Smrg /* package where the property was created */ 1625dfecf96Smrg LispPackage *package; 1635dfecf96Smrg 1645dfecf96Smrg /* value of variable attached to symbol */ 1655dfecf96Smrg LispObj *value; 1665dfecf96Smrg 1675dfecf96Smrg union { 1685dfecf96Smrg /* function attached to symbol */ 1695dfecf96Smrg LispObj *function; 1705dfecf96Smrg /* builtin function attached to symbol*/ 1715dfecf96Smrg LispBuiltin *builtin; 1725dfecf96Smrg } fun; 1735dfecf96Smrg /* function/macro argument list description */ 1745dfecf96Smrg LispArgList *alist; 1755dfecf96Smrg 1765dfecf96Smrg /* symbol properties list */ 1775dfecf96Smrg LispObj *properties; 1785dfecf96Smrg 1795dfecf96Smrg /* setf method */ 1805dfecf96Smrg LispObj *setf; 1815dfecf96Smrg /* setf argument list description */ 1825dfecf96Smrg LispArgList *salist; 1835dfecf96Smrg 1845dfecf96Smrg /* structure information */ 1855dfecf96Smrg struct { 1865dfecf96Smrg LispObj *definition; 1875dfecf96Smrg#define STRUCT_NAME -3 1885dfecf96Smrg#define STRUCT_CHECK -2 1895dfecf96Smrg#define STRUCT_CONSTRUCTOR -1 1905dfecf96Smrg int function; /* if >= 0, it is a structure field index */ 1915dfecf96Smrg } structure; 1925dfecf96Smrg}; 1935dfecf96Smrg 1945dfecf96Smrgstruct _LispAtom { 1955dfecf96Smrg /* hint: dynamically binded variable */ 1965dfecf96Smrg unsigned int dyn : 1; 1975dfecf96Smrg 1985dfecf96Smrg /* Property has useful data in value field */ 1995dfecf96Smrg unsigned int a_object : 1; 2005dfecf96Smrg /* Property has useful data in fun.function field */ 2015dfecf96Smrg unsigned int a_function : 1; 2025dfecf96Smrg /* Property has useful data in fun.builtin field */ 2035dfecf96Smrg unsigned int a_builtin : 1; 2045dfecf96Smrg /* Property has useful data in fun.function field */ 2055dfecf96Smrg unsigned int a_compiled : 1; 2065dfecf96Smrg /* Property has useful data in properties field */ 2075dfecf96Smrg unsigned int a_property : 1; 2085dfecf96Smrg /* Property has useful data in setf field */ 2095dfecf96Smrg unsigned int a_defsetf : 1; 2105dfecf96Smrg /* Property has useful data in defstruct field */ 2115dfecf96Smrg unsigned int a_defstruct : 1; 2125dfecf96Smrg 2135dfecf96Smrg /* Symbol is extern */ 2145dfecf96Smrg unsigned int ext : 1; 2155dfecf96Smrg 2165dfecf96Smrg /* Symbol must be quoted with '|' to be allow reading back */ 2175dfecf96Smrg unsigned int unreadable : 1; 2185dfecf96Smrg 2195dfecf96Smrg /* Symbol value may need special handling when changed */ 2205dfecf96Smrg unsigned int watch : 1; 2215dfecf96Smrg 2225dfecf96Smrg /* Symbol value is constant, cannot be changed */ 2235dfecf96Smrg unsigned int constant : 1; 2245dfecf96Smrg 2255dfecf96Smrg char *string; 2265dfecf96Smrg LispObj *object; /* backpointer to object ATOM */ 2275dfecf96Smrg int offset; /* in the environment list */ 2285dfecf96Smrg LispObj *package; /* package home of symbol */ 2295dfecf96Smrg LispObj *function; /* symbol function */ 2305dfecf96Smrg LispObj *name; /* symbol string */ 2315dfecf96Smrg LispProperty *property; 2325dfecf96Smrg struct _LispAtom *next; 2335dfecf96Smrg 2345dfecf96Smrg LispObj *documentation[5]; 2355dfecf96Smrg}; 2365dfecf96Smrg 2375dfecf96Smrgstruct _LispObjList { 2385dfecf96Smrg LispObj **pairs; /* name0 ... nameN */ 2395dfecf96Smrg int length; /* number of objects */ 2405dfecf96Smrg int space; /* space allocated in field pairs */ 2415dfecf96Smrg}; 2425dfecf96Smrg 2435dfecf96Smrgstruct _LispPackage { 2445dfecf96Smrg LispObjList glb; /* global symbols in package */ 2455dfecf96Smrg LispObjList use; /* inherited packages */ 2465dfecf96Smrg LispAtom *atoms[STRTBLSZ]; /* atoms in this package */ 2475dfecf96Smrg}; 2485dfecf96Smrg 2495dfecf96Smrgstruct _LispOpaque { 2505dfecf96Smrg int type; 2515dfecf96Smrg char *desc; 2525dfecf96Smrg LispOpaque *next; 2535dfecf96Smrg}; 2545dfecf96Smrg 2555dfecf96Smrg/* These strings are never released, they are used to avoid 2565dfecf96Smrg * the need of strcmp() on two symbol names, just compare pointers */ 2575dfecf96Smrgstruct _LispStringHash { 2585dfecf96Smrg char *string; 2595dfecf96Smrg LispStringHash *next; 2605dfecf96Smrg}; 2615dfecf96Smrg 2625dfecf96Smrgtypedef enum _LispBlockType { 2635dfecf96Smrg LispBlockNone, /* no block */ 2645dfecf96Smrg LispBlockTag, /* may become "invisible" */ 2655dfecf96Smrg LispBlockCatch, /* can be used to jump across function calls */ 2665dfecf96Smrg LispBlockClosure, /* hides blocks of type LispBlockTag bellow it */ 2675dfecf96Smrg LispBlockProtect, /* used by unwind-protect */ 2685dfecf96Smrg LispBlockBody /* used by tagbody and go */ 2695dfecf96Smrg} LispBlockType; 2705dfecf96Smrg 2715dfecf96Smrgstruct _LispBlock { 2725dfecf96Smrg LispBlockType type; 2735dfecf96Smrg LispObj *tag; 2745dfecf96Smrg jmp_buf jmp; 2755dfecf96Smrg int stack; 2765dfecf96Smrg int protect; 2775dfecf96Smrg int block_level; 2785dfecf96Smrg#ifdef DEBUGGER 2795dfecf96Smrg int debug_level; 2805dfecf96Smrg int debug_step; 2815dfecf96Smrg#endif 2825dfecf96Smrg}; 2835dfecf96Smrg 2845dfecf96Smrgstruct _LispModule { 2855dfecf96Smrg LispModule *next; 2865dfecf96Smrg void *handle; 2875dfecf96Smrg LispModuleData *data; 2885dfecf96Smrg}; 2895dfecf96Smrg 2905dfecf96Smrgtypedef struct _LispUngetInfo { 2915dfecf96Smrg char buffer[16]; 2925dfecf96Smrg int offset; 2935dfecf96Smrg} LispUngetInfo; 2945dfecf96Smrg 2955dfecf96Smrgstruct _LispMac { 2965dfecf96Smrg /* stack for builtin function arguments */ 2975dfecf96Smrg struct { 2985dfecf96Smrg LispObj **values; 2995dfecf96Smrg int base; /* base of arguments to function */ 3005dfecf96Smrg int length; 3015dfecf96Smrg int space; 3025dfecf96Smrg } stack; 3035dfecf96Smrg 3045dfecf96Smrg /* environment */ 3055dfecf96Smrg struct { 3065dfecf96Smrg LispObj **values; 3075dfecf96Smrg Atom_id *names; 3085dfecf96Smrg int lex; /* until where variables are visible */ 3095dfecf96Smrg int head; /* top of environment */ 3105dfecf96Smrg int length; /* number of used pairs */ 3115dfecf96Smrg int space; /* number of objects in pairs */ 3125dfecf96Smrg } env; 3135dfecf96Smrg 3145dfecf96Smrg struct { 3155dfecf96Smrg LispObj **values; 3165dfecf96Smrg int count; 3175dfecf96Smrg } returns; 3185dfecf96Smrg 3195dfecf96Smrg struct { 3205dfecf96Smrg LispObj **objects; 3215dfecf96Smrg int length; 3225dfecf96Smrg int space; 3235dfecf96Smrg } protect; 3245dfecf96Smrg 3255dfecf96Smrg LispObj *package; /* package object */ 3265dfecf96Smrg LispPackage *pack; /* pointer to lisp__data.package->data.package.package */ 3275dfecf96Smrg 3285dfecf96Smrg /* fast access to the KEYWORD package */ 3295dfecf96Smrg LispObj *keyword; 3305dfecf96Smrg LispPackage *key; 3315dfecf96Smrg 3325dfecf96Smrg /* the LISP package */ 3335dfecf96Smrg LispObj *lisp; 3345dfecf96Smrg 3355dfecf96Smrg /* only used if the package was changed, but an error generated 3365dfecf96Smrg * before returning to the toplevel */ 3375dfecf96Smrg LispObj *savepackage; 3385dfecf96Smrg LispPackage *savepack; 3395dfecf96Smrg 3405dfecf96Smrg struct { 3415dfecf96Smrg int block_level; 3425dfecf96Smrg int block_size; 3435dfecf96Smrg LispObj *block_ret; 3445dfecf96Smrg LispBlock **block; 3455dfecf96Smrg } block; 3465dfecf96Smrg 3475dfecf96Smrg sigjmp_buf jmp; 3485dfecf96Smrg 3495dfecf96Smrg struct { 3505dfecf96Smrg unsigned int expandbits : 3; /* code doesn't look like reusing cells 3515dfecf96Smrg * so try to have a larger number of 3525dfecf96Smrg * free cells */ 3535dfecf96Smrg unsigned int immutablebits : 1; /* need to reset immutable bits */ 3545dfecf96Smrg unsigned int timebits : 1; /* update gctime counter */ 3555dfecf96Smrg unsigned int count; 3565dfecf96Smrg long gctime; 3575dfecf96Smrg int average; /* of cells freed after gc calls */ 3585dfecf96Smrg } gc; 3595dfecf96Smrg 3605dfecf96Smrg LispStringHash *strings[STRTBLSZ]; 3615dfecf96Smrg LispOpaque *opqs[STRTBLSZ]; 3625dfecf96Smrg int opaque; 3635dfecf96Smrg 3645dfecf96Smrg LispObj *standard_input, *input, *input_list; 3655dfecf96Smrg LispObj *standard_output, *output, *output_list; 3665dfecf96Smrg LispObj *error_stream; 3675dfecf96Smrg LispUngetInfo **unget; 3685dfecf96Smrg int iunget, nunget; 3695dfecf96Smrg int eof; 3705dfecf96Smrg 3715dfecf96Smrg int interactive; 3725dfecf96Smrg int errexit; 3735dfecf96Smrg 3745dfecf96Smrg struct { 3755dfecf96Smrg int index; 3765dfecf96Smrg int level; 3775dfecf96Smrg int space; 3785dfecf96Smrg void **mem; 3795dfecf96Smrg } mem; /* memory from Lisp*Alloc, to be release in error */ 3805dfecf96Smrg LispModule *module; 3815dfecf96Smrg LispObj *modules; 3825dfecf96Smrg char *prompt; 3835dfecf96Smrg 3845dfecf96Smrg LispObj *features; 3855dfecf96Smrg 3865dfecf96Smrg LispObj *modlist; /* module list */ 3875dfecf96Smrg LispObj *packlist; /* list of packages */ 3885dfecf96Smrg LispObj *codlist; /* current code */ 3895dfecf96Smrg LispObj *runlist[3]; /* +, ++, and +++ */ 3905dfecf96Smrg LispObj *reslist[3]; /* *, **, and *** */ 3915dfecf96Smrg#ifdef DEBUGGER 3925dfecf96Smrg LispObj *dbglist; /* debug information */ 3935dfecf96Smrg LispObj *brklist; /* breakpoints information */ 3945dfecf96Smrg#endif 3955dfecf96Smrg LispObj *prolist; /* protect objects list */ 3965dfecf96Smrg 3975dfecf96Smrg#ifdef SIGNALRETURNSINT 3985dfecf96Smrg int (*sigint)(int); 3995dfecf96Smrg int (*sigfpe)(int); 4005dfecf96Smrg#else 4015dfecf96Smrg void (*sigint)(int); 4025dfecf96Smrg void (*sigfpe)(int); 4035dfecf96Smrg#endif 4045dfecf96Smrg 4055dfecf96Smrg int destroyed; /* reached LispDestroy, used by unwind-protect */ 4065dfecf96Smrg int running; /* there is somewhere to siglongjmp */ 4075dfecf96Smrg 4085dfecf96Smrg int ignore_errors; /* inside a ignore-errors block */ 4095dfecf96Smrg LispObj *error_condition; /* actually, a string */ 4105dfecf96Smrg 4115dfecf96Smrg int debugging; /* debugger enabled? */ 4125dfecf96Smrg#ifdef DEBUGGER 4135dfecf96Smrg int debug_level; /* almost always the same as lisp__data.level */ 4145dfecf96Smrg int debug_step; /* control for stoping and printing output */ 4155dfecf96Smrg int debug_break; /* next breakpoint number */ 4165dfecf96Smrg LispDebugState debug; 4175dfecf96Smrg#endif 4185dfecf96Smrg}; 4195dfecf96Smrg 4205dfecf96Smrgstruct _LispCharInfo { 4215dfecf96Smrg char **names; 4225dfecf96Smrg}; 4235dfecf96Smrg 4245dfecf96Smrg 4255dfecf96Smrg/* 4265dfecf96Smrg * Prototypes 4275dfecf96Smrg */ 4285dfecf96Smrgvoid LispUseArgList(LispArgList*); 4295dfecf96Smrgvoid LispFreeArgList(LispArgList*); 4305dfecf96SmrgLispArgList *LispCheckArguments(LispFunType, LispObj*, char*, int); 4315dfecf96SmrgLispObj *LispListProtectedArguments(LispArgList*); 4325dfecf96Smrg 4335dfecf96SmrgLispObj *LispGetDoc(LispObj*); 4345dfecf96SmrgLispObj *LispGetVar(LispObj*); 4355dfecf96Smrg#ifdef DEBUGGER 4365dfecf96Smrgvoid *LispGetVarAddr(LispObj*); /* used by debugger */ 4375dfecf96Smrg#endif 4385dfecf96SmrgLispObj *LispAddVar(LispObj*, LispObj*); 4395dfecf96SmrgLispObj *LispSetVar(LispObj*, LispObj*); 4405dfecf96Smrgvoid LispUnsetVar(LispObj*); 4415dfecf96Smrg 4425dfecf96Smrg /* only used at initialization time */ 4435dfecf96SmrgLispObj *LispNewStandardStream(LispFile*, LispObj*, int); 4445dfecf96Smrg 4455dfecf96Smrg /* create a new package */ 4465dfecf96SmrgLispObj *LispNewPackage(LispObj*, LispObj*); 4475dfecf96Smrg /* add package to use-list of current, and imports all extern symbols */ 4485dfecf96Smrgvoid LispUsePackage(LispObj*); 4495dfecf96Smrg /* make symbol extern in the current package */ 4505dfecf96Smrgvoid LispExportSymbol(LispObj*); 4515dfecf96Smrg /* imports symbol to current package */ 4525dfecf96Smrgvoid LispImportSymbol(LispObj*); 4535dfecf96Smrg 4545dfecf96Smrg /* always returns the same string */ 4555dfecf96Smrgchar *LispGetAtomString(char*, int); 4565dfecf96Smrg 4575dfecf96Smrg/* destructive fast reverse, note that don't receive a LispMac* argument */ 4585dfecf96SmrgLispObj *LispReverse(LispObj *list); 4595dfecf96Smrg 4605dfecf96Smrgchar *LispIntToOpaqueType(int); 4615dfecf96Smrg 4625dfecf96Smrg/* (print) */ 4635dfecf96Smrgvoid LispPrint(LispObj*, LispObj*, int); 4645dfecf96Smrg 4655dfecf96SmrgLispBlock *LispBeginBlock(LispObj*, LispBlockType); 4665dfecf96Smrg#define BLOCKJUMP(block) \ 4675dfecf96Smrg lisp__data.stack.length = (block)->stack; \ 4685dfecf96Smrg lisp__data.protect.length = (block)->protect; \ 4695dfecf96Smrg longjmp((block)->jmp, 1) 4705dfecf96Smrgvoid LispEndBlock(LispBlock*); 4715dfecf96Smrg /* if unwind-protect active, jump to cleanup code, else do nothing */ 4725dfecf96Smrgvoid LispBlockUnwind(LispBlock*); 4735dfecf96Smrg 4745dfecf96Smrgvoid LispUpdateResults(LispObj*, LispObj*); 4755dfecf96Smrgvoid LispTopLevel(void); 4765dfecf96Smrg 4775dfecf96Smrg#define STRHASH(string) LispDoHashString(string) 4785dfecf96Smrgint LispDoHashString(char*); 4795dfecf96SmrgLispAtom *LispDoGetAtom(char *str, int); 4805dfecf96Smrg /* get value from atom's property list */ 4815dfecf96SmrgLispObj *LispGetAtomProperty(LispAtom*, LispObj*); 4825dfecf96Smrg /* put value in atom's property list */ 4835dfecf96SmrgLispObj *LispPutAtomProperty(LispAtom*, LispObj*, LispObj*); 4845dfecf96Smrg /* remove value from atom's property list */ 4855dfecf96SmrgLispObj *LispRemAtomProperty(LispAtom*, LispObj*); 4865dfecf96Smrg /* replace atom's property list */ 4875dfecf96SmrgLispObj *LispReplaceAtomPropertyList(LispAtom*, LispObj*); 4885dfecf96Smrg 4895dfecf96Smrg /* returns function associated with symbol */ 4905dfecf96SmrgLispObj *LispSymbolFunction(LispObj*); 4915dfecf96Smrg /* returns symbol string name */ 4925dfecf96SmrgLispObj *LispSymbolName(LispObj*); 4935dfecf96Smrg 4945dfecf96Smrg /* define byte compiled function, or replace definition */ 4955dfecf96Smrgvoid LispSetAtomCompiledProperty(LispAtom*, LispObj*); 4965dfecf96Smrg /* remove byte compiled function property */ 4975dfecf96Smrgvoid LispRemAtomCompiledProperty(LispAtom*); 4985dfecf96Smrg /* define function, or replace function definition */ 4995dfecf96Smrgvoid LispSetAtomFunctionProperty(LispAtom*, LispObj*, LispArgList*); 5005dfecf96Smrg /* remove function property */ 5015dfecf96Smrgvoid LispRemAtomFunctionProperty(LispAtom*); 5025dfecf96Smrg /* define builtin, or replace builtin definition */ 5035dfecf96Smrgvoid LispSetAtomBuiltinProperty(LispAtom*, LispBuiltin*, LispArgList*); 5045dfecf96Smrg /* remove builtin property */ 5055dfecf96Smrgvoid LispRemAtomBuiltinProperty(LispAtom*); 5065dfecf96Smrg /* define setf macro, or replace current definition */ 5075dfecf96Smrgvoid LispSetAtomSetfProperty(LispAtom*, LispObj*, LispArgList*); 5085dfecf96Smrg /* remove setf macro */ 5095dfecf96Smrgvoid LispRemAtomSetfProperty(LispAtom*); 5105dfecf96Smrg /* create or change structure property */ 5115dfecf96Smrgvoid LispSetAtomStructProperty(LispAtom*, LispObj*, int); 5125dfecf96Smrg /* remove structure property */ 5135dfecf96Smrgvoid LispRemAtomStructProperty(LispAtom*); 5145dfecf96Smrg 5155dfecf96Smrgvoid LispProclaimSpecial(LispObj*, LispObj*, LispObj*); 5165dfecf96Smrgvoid LispDefconstant(LispObj*, LispObj*, LispObj*); 5175dfecf96Smrg 5185dfecf96Smrgvoid LispAddDocumentation(LispObj*, LispObj*, LispDocType_t); 5195dfecf96Smrgvoid LispRemDocumentation(LispObj*, LispDocType_t); 5205dfecf96SmrgLispObj *LispGetDocumentation(LispObj*, LispDocType_t); 5215dfecf96Smrg 5225dfecf96Smrg/* increases storage for functions returning multiple values */ 5235dfecf96Smrgvoid LispMoreReturns(void); 5245dfecf96Smrg 5255dfecf96Smrg/* increases storage for temporarily protected data */ 5265dfecf96Smrgvoid LispMoreProtects(void); 5275dfecf96Smrg 5285dfecf96Smrg/* Initialization */ 5295dfecf96Smrgextern int LispArgList_t; 5305dfecf96Smrgextern LispCharInfo LispChars[256]; 5315dfecf96Smrg 5325dfecf96Smrg/* This function will return if the interpreter cannot be stopped */ 5335dfecf96Smrgextern void LispSignal(int); 5345dfecf96Smrg 5355dfecf96Smrgvoid LispDisableInterrupts(void); 5365dfecf96Smrgvoid LispEnableInterrupts(void); 5375dfecf96Smrg#define DISABLE_INTERRUPTS() LispDisableInterrupts() 5385dfecf96Smrg#define ENABLE_INTERRUPTS() LispEnableInterrupts() 5395dfecf96Smrg 5405dfecf96Smrg/* Value returned by LispBegin, used everywhere in the code. 5415dfecf96Smrg * Only one interpreter instance allowed. */ 5425dfecf96Smrgextern LispMac lisp__data; 5435dfecf96Smrg 5445dfecf96Smrg#endif /* Lisp_private_h */ 545