This file is indexed.

/usr/include/geomview/lisp.h is in libgeomview-dev 1.9.5-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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
/* 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 {
  void *p;
  int i;
  unsigned long l;
  float f;
  double d;
} LCell;

struct LType
{
  /* name of type */
  const 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 */
  const char *initial, *prefix, *suffix; /* printf format strings */
} Lake;

#define POOL(lake)  ((lake)->river)

/* Return true if the next character starts a new S-expr, i.e. if the
 * next character is an opening parenthesis.
 */
static inline bool LakeNewSexpr(Lake *lake)
{
  return (iobfnextc(lake->streamin, 0) == '(');
}

/* Return true if the next token is NOT a closing parenthesis. */
static inline bool LakeMore(Lake *lake)
{
  int c;
  
  return (c = iobfnextc(lake->streamin,0)) != ')' && c != EOF;
}

/* Return the next token from LAKE or NULL.  If the token was quoted
 * then store the quote character in *QUOTE.
 */
static inline const char *LakeNextToken(Lake *lake, int *quote)
{
  return iobfquotedelimtok("()", lake->streamin, 0, quote);
}

/************************ end of lake stuff ***********************************/

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.
 */

/* A symbol is just a string which can be bound to a value in a lambda
 * expression. Symbols can be parsed into strings.
 */
extern LType LSymbolp;
#define LSYMBOL (&LSymbolp)
#define LSYMBOLVAL(obj) ((char*)((obj)->cell.p))

/* A string is just a symbol which cannot be bound to a value in a
 * lambda expression. Strings can be parsed into symbols, however.
 */
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 LLongp;
#define LLONG (&LLongp)
#define LLONGVAL(obj) ((obj)->cell.l)

extern LType LFloatp;
#define LFLOAT (&LFloatp)
#define LFLOATVAL(obj) ((obj)->cell.f)

extern LType LDoublep;
#define LDOUBLE (&LDoublep)
#define LDOUBLEVAL(obj) ((obj)->cell.d)

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)

/* Convenience functions for generating objects */
static inline LObject *LLISTTOOBJ(LList *list)
{
  return LTOOBJ(LLIST)(&list);
}
static inline LObject *LSYMBOLTOOBJ(const char *string)
{
  return LTOOBJ(LSYMBOL)(&string);
}
static inline LObject *LSTRINGTOOBJ(const char *string)
{
  return LTOOBJ(LSTRING)(&string);
}
static inline LObject *LINTTOOBJ(int value)
{
  return LTOOBJ(LINT)(&value);
}
static inline LObject *LLONGTOOBJ(long value)
{
  return LTOOBJ(LLONG)(&value);
}
static inline LObject *LFLOATTOOBJ(float value)
{
  return LTOOBJ(LFLOAT)(&value);
}
static inline LObject *LDOUBLETOOBJ(double value)
{
  return LTOOBJ(LDOUBLE)(&value);
}

static inline bool LSTRINGFROMOBJ(LObject *obj, char **str)
{
  if (obj->type == LSTRING || obj->type == LSYMBOL) {
    *str = LSTRINGVAL(obj);
    return true;
  }
  return false;
}

/*
 * Function definition stuff:
 */

enum lparseresult {
  LASSIGN_GOOD,
  LASSIGN_BAD,
  LPARSE_GOOD,
  LPARSE_BAD
};

typedef enum lparseresult LParseResult;

#define LPARSEMODE (lake != NULL)
#define LEVALMODE  (!LPARSEMODE)

#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, 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 *       LLiteral(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(const char *name, Lake *lake, LList *args, ...);
bool            LDefun(const char *name, LObjectFunc func, const char *help);
void            LListWrite(FILE *fp, LList *list);
LInterest *     LInterestList(const char *funcname);
LObject *       LEvalFunc(const char *name, ...);
bool            LArgClassValid(LType *type);
void            LHelpDef(const char *key, const char *message);
const char *    LakeName(Lake *lake);
const char *    LSummarize(LObject *obj);
const char *    LListSummarize(LList *list);
LObject *       LMakeArray(LType *basetype, char *data, int count);

static inline LObject *LRefIncr(LObject *obj)
{
  ++(obj->ref);
  return obj;
}

static inline int LRefDecr(LObject *obj)
{
  return --(obj->ref);
}

static inline void LFree(LObject *obj)
{
  extern void _LFree(LObject *);
  if (obj == NULL || obj == Lnil || obj == Lt) return;
  if (LRefDecr(obj) == 0) {
    _LFree(obj);
  }
}

static inline LObject *LCopy(LObject *obj)
{
  if (obj == Lnil) return Lnil;
  if (obj == Lt) return Lt;
  return LTOOBJ(obj->type)(&(obj->cell));
}

void LShow(LObject *obj);	/* for debugging; writes obj to stderr */
void LListShow(LList *list);
void LWriteFile(const 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: ***
 */