/usr/include/geomview/lisp.h is in libgeomview-dev 1.9.4-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | /* Copyright (C) 1992-1998 The Geometry Center
* Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips
*
* This file is part of Geomview.
*
* Geomview is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Geomview is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Geomview; see the file COPYING. If not, write
* to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
* USA, or visit http://www.gnu.org.
*/
/* Authors: Stuart Levy, Tamara Munzner, Mark Phillips */
#ifndef LISP_H
#define LISP_H
#include <stdarg.h>
#include "ooglutil.h"
#include "fsa.h"
#include "streampool.h"
typedef struct LType LType;
typedef struct LObject LObject;
typedef union {
int i;
float f;
void *p;
unsigned long ul;
} LCell;
struct LType
{
/* name of type */
char *name;
/* size of corresponding C type */
int size;
/* extract cell value from obj */
bool (*fromobj)(/* LObject *obj, void *x */);
/* create a new LObject of this type */
LObject *(*toobj)(/* void *x */);
/* free a cell of this type */
void (*free)(/* void *x */);
/* write a cell value to a stream */
void (*write)(/* FILE *fp, void *x */);
/* test equality of two cells of this type */
bool (*match)(/* void *a, void *b */);
/* pull a cell value from a va_list */
void (*pull)(/* va_list *a_list, void *x */);
/* parse an object of this type */
LObject *(*parse)(/* Lake *lake */);
/* magic number; always set to LTypeMagic */
int magic;
};
#define LTypeMagic 314159
#define LNAME(type) (type->name)
#define LSIZE(type) (type->size)
#define LFROMOBJ(type) (*(type->fromobj))
#define LTOOBJ(type) (*(type->toobj))
#define LFREE(type) (*(type->free))
#define LMATCH(type) (*(type->match))
#define LWRITE(type) (*(type->write))
#define LPULL(type) (*(type->pull))
#define LPARSE(type) (*(type->parse))
struct LObject {
LType *type;
int ref;
LCell cell;
};
typedef struct Lake {
IOBFILE *streamin;
FILE *streamout;
Pool *river;
int timing_interests; /* Are we time-stamping interest reports? */
float deltatime; /* delta time between timestamps */
float nexttime; /* Pool time when next timestamp'll be needed */
char *initial, *prefix, *suffix; /* printf format strings */
} Lake;
#define LakeMore(lake,c) ((c=iobfnextc(lake->streamin,0)) != ')' && c != EOF)
#define POOL(lake) ((lake)->river)
typedef struct LList {
LObject * car;
struct LList *cdr;
} LList;
typedef LObject *(*LObjectFunc)();
typedef struct LInterest {
Lake *lake;
LList *filter;
struct LInterest *next;
} LInterest;
typedef struct {
enum { ANY, /* match anything */
VAL, /* match only our value */
NIL /* match anything but report nil */
} flag;
LObject *value;
} LFilter;
#define LFILTERVAL(lobject) ((LFilter *)(lobject->cell.p))
extern LType LFilterp;
#define LFILTER (&LFilterp)
/*
* Built-in objects: Lnil and Lt:
*/
extern LObject *Lnil, *Lt;
/*
* Built-in object types: string, list, and function. Function type
* is only used internally. See lisp.c for the code that initializes
* these type pointers.
*/
extern LType LStringp;
#define LSTRING (&LStringp)
#define LSTRINGVAL(obj) ((char*)((obj)->cell.p))
extern LType LIntp;
#define LINT (&LIntp)
#define LINTVAL(obj) ((obj)->cell.i)
extern LType LULongp;
#define LULONG (&LULongp)
#define LULONGVAL(obj) ((obj)->cell.ul)
extern LType LFloatp;
#define LFLOAT (&LFloatp)
#define LFLOATVAL(obj) ((obj)->cell.f)
extern LType LListp;
#define LLIST (&LListp)
#define LLISTVAL(obj) ((LList*)((obj)->cell.p))
#define LLAKEVAL(obj) ((Lake*)(obj->cell.p))
extern LType LLakep;
#define LLAKE (&LLakep)
extern LType LObjectp;
#define LLOBJECT (&LObjectp)
/*
* Function definition stuff:
*/
enum lparseresult {
LASSIGN_GOOD,
LASSIGN_BAD,
LPARSE_GOOD,
LPARSE_BAD
};
typedef enum lparseresult LParseResult;
#define LDECLARE(stuff) \
switch (LParseArgs stuff) { \
case LASSIGN_BAD: case LPARSE_BAD: return Lnil; \
case LPARSE_GOOD: return Lt; \
default: case LASSIGN_GOOD: break; \
}
extern LType Larray;
#define LARRAY (&Larray)
extern LType Lvararray;
#define LVARARRAY (&Lvararray)
extern LType Lend;
#define LEND (&Lend)
extern LType Lhold;
#define LHOLD (&Lhold)
extern LType Lliteral;
#define LLITERAL (&Lliteral)
extern LType Loptional;
#define LOPTIONAL (&Loptional)
extern LType Lrest;
#define LREST (&Lrest)
/*
* Function prototypes:
*/
void RemoveLakeInterests(Lake *lake);
void LInit();
Lake * LakeDefine(IOBFILE *streamin, FILE *streamout, void *river);
void LakeFree(Lake *lake);
LObject * _LNew(LType *type, LCell *cell);
#define LNew(type,cell) _LNew(type,(LCell*)(void *)cell)
LObject * LRefIncr(LObject *obj);
void LRefDecr(LObject *obj);
void LWrite(FILE *fp, LObject *obj);
void LFree(LObject *obj);
LObject * LCopy(LObject *obj);
LObject * LSexpr(Lake *lake);
LObject * LEvalSexpr(Lake *lake);
LObject * LEval(LObject *obj);
LList * LListNew();
LList * LListAppend(LList *list, LObject *obj);
void LListFree(LList *list);
LList * LListCopy(LList *list);
LObject * LListEntry(LList *list, int n);
int LListLength(LList *list);
LParseResult LParseArgs(char *name, Lake *lake, LList *args, ...);
bool LDefun(char *name, LObjectFunc func, char *help);
void LListWrite(FILE *fp, LList *list);
LInterest * LInterestList(char *funcname);
LObject * LEvalFunc(char *name, ...);
bool LArgClassValid(LType *type);
void LHelpDef(char *key, char *message);
void LHelpRedef(char *key, char *newmessage);
char * LakeName(Lake *lake);
char * LSummarize(LObject *obj);
LObject * LMakeArray(LType *basetype, char *data, int count);
void LShow(LObject *obj); /* for debugging; writes obj to stderr */
void LListShow(LList *list);
void LWriteFile(char *fname, LObject *obj);
#include "clisp.h"
/*
LDEFINE(name, ltype, doc) is the header used to declare a lisp
function. It should be followed by the body of a function
(beginning with '{' and ending with '}'). LDEFINE delcares the
function's name to be "Lname" (the "name" argument with "L"
prepended to it). It also defines a string named "Hname"
initialized to "doc". The "ltype" argument gives the lisp object
type returned by the function (all functions defined via DEFILE
*must* return a lisp object.) LDEFINE actually ignores this but
read the next paragraph.
LDEFINE is intended for use in conjunction with the "lisp2c" shell
script which searches for calls to LDEFINE and builds a C language
interface to the functions so defined. This script makes use of all
3 arguments to LDEFINE, plus the use of the LDECLARE macro in the
function body that follows, to build the files clang.c and clang.h.
It makes certain assumptions about the way LDEFINE and LDECLARE
are used. See the comments at the top of lisp2c for details.
(I don't want to write the assumptions down here because if they
change I'll forget to update this comment!).
*/
#if defined(__STDC__) || defined(__ANSI_CPP__)
#define LDEFINE( name, ltype, doc ) \
char H##name[] = doc ; LObject *L##name(Lake *lake, LList *args)
#else
#define LDEFINE( name, ltype, doc ) \
char H/**/name[] = doc ; LObject *L/**/name(Lake *lake, LList *args)
#endif
#define LBEGIN lake, args
#endif /* ! LISP_H */
/*
* Local Variables: ***
* mode: c ***
* c-basic-offset: 2 ***
* End: ***
*/
|