1: /* Fundamental definitions for GNU Emacs Lisp interpreter.
   2:    Copyright (C) 1985 Richard M. Stallman.
   3: 
   4: This file is part of GNU Emacs.
   5: 
   6: GNU Emacs is distributed in the hope that it will be useful,
   7: but WITHOUT ANY WARRANTY.  No author or distributor
   8: accepts responsibility to anyone for the consequences of using it
   9: or for whether it serves any particular purpose or works at all,
  10: unless he says so in writing.  Refer to the GNU Emacs General Public
  11: License for full details.
  12: 
  13: Everyone is granted permission to copy, modify and redistribute
  14: GNU Emacs, but only under the conditions described in the
  15: GNU Emacs General Public License.   A copy of this license is
  16: supposed to have been given to you along with GNU Emacs so you
  17: can know your rights and responsibilities.  It should be in a
  18: file named COPYING.  Among other things, the copyright notice
  19: and this notice must be preserved on all copies.  */
  20: 
  21: 
  22: /* Define the fundamental Lisp data structures */
  23: 
  24: /* This is the set of Lisp data types */
  25: 
  26: enum Lisp_Type
  27:   {
  28:     /* Integer.  object.v.integer is the integer value. */
  29:     Lisp_Int,
  30: 
  31:     /* Symbol.  object.v.symbol points to a struct Lisp_Symbol. */
  32:     Lisp_Symbol,
  33: 
  34:     /* Marker (editor pointer).  object.v.marker points to a struct Lisp_Marker. */
  35:     Lisp_Marker,
  36: 
  37:     /* String.  object.v.string points to a struct Lisp_String.
  38:        The length of the string, and its contents, are stored therein. */
  39:     Lisp_String,
  40: 
  41:     /* Vector of Lisp objects.  object.v.vector points to a struct Lisp_Vector.
  42:        The length of the vector, and its contents, are stored therein. */
  43:     Lisp_Vector,
  44: 
  45:     /* Cons.  object.v.cons points to a struct Lisp_Cons. */
  46:     Lisp_Cons,
  47: 
  48:     /* Treated like vector in GC, except do not set its mark bit.
  49:        Used for internal data blocks that will be explicitly freed
  50:        but which, while active, are reached by GC mark exactly once
  51:        and should be marked through like a vector.  */
  52:     Lisp_Temp_Vector,
  53: 
  54:     /* Editor buffer.  obj.v.buffer points to a struct buffer.
  55:        No buffer is ever truly freed; they can be "killed", but this
  56:        just marks them as dead. */
  57:     Lisp_Buffer,
  58: 
  59:     /* Built-in function.  obj.v.subr points to a struct Lisp_Subr
  60:        which describes how to call the function, and its documentation,
  61:        as well as pointing to the code. */
  62:     Lisp_Subr,
  63: 
  64:     /* Internal value return by subroutines of read.
  65:        The user never sees this data type.
  66:        Its value is just a number. */
  67:     Lisp_Internal,
  68: 
  69:     /* Forwarding pointer to an int variable.
  70:        This is allowed only in the value cell of a symbol,
  71:        and it means that the symbol's value really lives in the
  72:        specified int variable.
  73:        obj.v.intptr points to the int variable. */
  74:     Lisp_Intfwd,
  75: 
  76:     /* Boolean forwarding pointer to an int variable.
  77:        This is like Lisp_Intfwd except that the ostensible "value" of the symbol
  78:        is t if the int variable is nonzero, nil if it is zero.
  79:        obj.v.intptr points to the int variable. */
  80:     Lisp_Boolfwd,
  81: 
  82:     /* Object describing a connection to a subprocess.
  83:        It points to storage of type  struct Lisp_Process  */
  84:     Lisp_Process,
  85: 
  86:     /* Forwarding pointer to a Lisp_Object variable.
  87:        This is allowed only in the value cell of a symbol,
  88:        and it means that the symbol's value really lives in the
  89:        specified variable.
  90:        obj.v.objfwd points to the Lisp_Object variable. */
  91:     Lisp_Objfwd,
  92: 
  93:     /* Used when the core address of a function needs to be passed
  94:        in an argument of type Lisp_Object.
  95:        obj.v.function is the pointer-to-function.
  96:        The user will never see this data type. */
  97:     Lisp_Internal_Function,
  98: 
  99:     /* Used when a FILE * value needs to be passed
 100:        in an argument of type Lisp_Object.
 101:        You must do (FILE *) obj.v.integer to get the value.
 102:        The user will never see this data type. */
 103:     Lisp_Internal_Stream,
 104: 
 105:     /* Used in a symbol value cell when the symbol's value is per-buffer.
 106:         The actual contents are a cons cell which starts a list like this:
 107:         (REALVALUE BUFFER CURRENT-ALIST-ELEMENT . DEFAULT-VALUE)).
 108: 
 109: 	BUFFER is the last buffer for which this symbol's value was
 110: 	made up to date.
 111: 
 112:         CURRENT-ALIST-ELEMENT is a pointer to an element of BUFFER's
 113: 	b_local_var_alist, that being the element whose car is this variable.
 114:         Or it can be a pointer to the (CURRENT-ALIST-ELEMENT . DEFAULT-VALUE), if BUFFER
 115: 	does not have an element in its alist for this variable
 116: 	(that is, if BUFFER sees the default value of this variable).
 117: 
 118: 	If we want to examine or set the value and BUFFER is current,
 119: 	we just examine or set REALVALUE.
 120: 	If BUFFER is not current, we store the current REALVALUE value into
 121: 	CURRENT-ALIST-ELEMENT, then find the appropriate alist element for
 122: 	the buffer now current and set up CURRENT-ALIST-ELEMENT.
 123: 	Then we set REALVALUE out of that element, and store into BUFFER.
 124: 
 125: 	If we are setting the variable and the current buffer does not have
 126: 	an alist entry for this variable, an alist entry is created.
 127: 
 128: 	Note that REALVALUE can be a forwarding pointer.
 129: 	Each time it is examined or set, forwarding must be done.  */
 130:     Lisp_Buffer_Local_Value,
 131: 
 132:     /* Like Lisp_Buffer_Local_Value with one difference:
 133: 	merely setting the variable while some buffer is current
 134: 	does not cause that buffer to have its own local value of this variable.
 135: 	Only make-local-variable does that.  */
 136:     Lisp_Some_Buffer_Local_Value,
 137: 
 138: 
 139:     /* Like Lisp_Objfwd except that value lives in a slot
 140:        in the current buffer.  Value is byte index of slot within buffer */
 141:     Lisp_Buffer_Objfwd,
 142: 
 143:     /* In symbol value cell, means var is unbound.
 144:        In symbol function cell, means function name is undefined. */
 145:     Lisp_Void,
 146: 
 147:     /* Window used for Emacs display.
 148:        Data inside looks like a Lisp_Vector.  */
 149:     Lisp_Window
 150:   };
 151: 
 152: #ifndef NO_UNION_TYPE
 153: 
 154: #ifndef BIG_ENDIAN
 155: 
 156: /* Definition of Lisp_Object for little-endian machines.  */
 157: 
 158: typedef
 159: union Lisp_Object
 160:   {
 161:     /* Used for comparing two Lisp_Objects;
 162:        also, positive integers can be accessed fast this way. */
 163:     int i;
 164: 
 165:     struct
 166:       {
 167:     int val: 24;
 168:     char type;
 169:       } s;
 170:     struct
 171:       {
 172:     unsigned int val: 24;
 173:     char type;
 174:       } u;
 175:     struct
 176:       {
 177:     unsigned int val: 24;
 178:     enum Lisp_Type type: 7;
 179:     /* The markbit is not really part of the value of a Lisp_Object,
 180: 	   and is always zero except during garbage collection.  */
 181:     unsigned int markbit: 1;
 182:       } gu;
 183:   }
 184: Lisp_Object;
 185: 
 186: #else /* If BIG_ENDIAN */
 187: 
 188: typedef
 189: union Lisp_Object
 190:   {
 191:     /* Used for comparing two Lisp_Objects;
 192:        also, positive integers can be accessed fast this way. */
 193:     int i;
 194: 
 195:     struct
 196:       {
 197:     char type;
 198:     int val: 24;
 199:       } s;
 200:     struct
 201:       {
 202:     char type;
 203:     unsigned int val: 24;
 204:       } u;
 205:     struct
 206:       {
 207:     /* The markbit is not really part of the value of a Lisp_Object,
 208: 	   and is always zero except during garbage collection.  */
 209:     unsigned int markbit: 1;
 210:     enum Lisp_Type type: 7;
 211:     unsigned int val: 24;
 212:       } gu;
 213:   }
 214: Lisp_Object;
 215: 
 216: #endif BIG_ENDIAN
 217: 
 218: #endif NO_UNION_TYPE
 219: 
 220: 
 221: /* If union type is not wanted, define Lisp_Object as just a number
 222:    and define the macros below to extract fields by shifting */
 223: 
 224: #ifdef NO_UNION_TYPE
 225: 
 226: #define Lisp_Object int
 227: 
 228: /* These values are overridden by the m- file on some machines.  */
 229: #ifndef VALBITS
 230: #define VALBITS 24
 231: #endif
 232: 
 233: #ifndef GCTYPEBITS
 234: #define GCTYPEBITS 7
 235: #endif
 236: 
 237: #define VALMASK ((1<<VALBITS) - 1)
 238: #define GCTYPEMASK ((1<<GCTYPEBITS) - 1)
 239: #define MARKBIT (1 << (VALBITS + GCTYPEBITS))
 240: 
 241: #endif NO_UNION_TYPE
 242: 
 243: /* These macros extract various sorts of values from a Lisp_Object.
 244:  For example, if tem is a Lisp_Object whose type is Lisp_Cons,
 245:  XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons. */
 246: 
 247: #ifdef NO_UNION_TYPE
 248: 
 249: #define XTYPE(a) ((enum Lisp_Type) ((a) >> VALBITS))
 250: #define XSETTYPE(a, b) ((a)  =  ((a) & VALMASK)  +  ((int)(b) << VALBITS))
 251: 
 252: /* Use XFASTINT for fast retrieval and storage of integers known
 253:   to be positive.  This takes advantage of the fact that Lisp_Int is 0.  */
 254: #define XFASTINT(a) (a)
 255: 
 256: #define XINT(a) (((a) << INTBITS-VALBITS) >> INTBITS-VALBITS)
 257: #define XUINT(a) ((a) & VALMASK)
 258: 
 259: #define XSETINT(a, b) ((a) = ((a) & ~VALMASK)  +  ((b) & VALMASK))
 260: #define XSETUINT(a, b) ((a) = ((a) & ~VALMASK)  +  ((b) & VALMASK))
 261: 
 262: #define XSET(var, type, ptr) \
 263:    ((var) = ((int)(type) << VALBITS) + ((int) (ptr) & VALMASK))
 264: 
 265: /* During garbage collection, XGCTYPE must be used for extracting types
 266:  so that the mark bit is ignored.  XMARKBIT access the markbit.
 267:  Markbits are used only in particular slots of particular structure types.
 268:  Other markbits are always zero.
 269:  Outside of garbage collection, all mark bits are always zero.  */
 270: 
 271: #define XGCTYPE(a) ((enum Lisp_Type) (((a) >> VALBITS) & GCTYPEMASK))
 272: #define XMARKBIT(a) ((a) & MARKBIT)
 273: #define XSETMARKBIT(a,b) ((a) = ((a) & ~MARKBIT) + (b))
 274: #define XMARK(a) ((a) |= MARKBIT)
 275: #define XUNMARK(a) ((a) &= ~MARKBIT)
 276: 
 277: #endif
 278: 
 279: #ifndef NO_UNION_TYPE
 280: 
 281: #define XTYPE(a) ((enum Lisp_Type) (a).u.type)
 282: #define XSETTYPE(a, b) ((a).u.type = (char) (b))
 283: 
 284: /* Use XFASTINT for fast retrieval and storage of integers known
 285:   to be positive.  This takes advantage of the fact that Lisp_Int is 0.  */
 286: #define XFASTINT(a) ((a).i)
 287: 
 288: #ifdef EXPLICIT_SIGN_EXTEND
 289: /* Make sure we sign-extend; compilers have been known to fail to do so.  */
 290: #define XINT(a) (((a).i << 8) >> 8)
 291: #else
 292: #define XINT(a) ((a).s.val)
 293: #endif
 294: 
 295: #define XUINT(a) ((a).u.val)
 296: #define XSETINT(a, b) ((a).s.val = (int) (b))
 297: #define XSETUINT(a, b) ((a).s.val = (int) (b))
 298: 
 299: #define XSET(var, vartype, ptr) \
 300:    (((var).s.type = ((char) (vartype))), ((var).s.val = ((int) (ptr))))
 301: 
 302: /* During garbage collection, XGCTYPE must be used for extracting types
 303:  so that the mark bit is ignored.  XMARKBIT access the markbit.
 304:  Markbits are used only in particular slots of particular structure types.
 305:  Other markbits are always zero.
 306:  Outside of garbage collection, all mark bits are always zero.  */
 307: 
 308: #define XGCTYPE(a) ((a).gu.type)
 309: #define XMARKBIT(a) ((a).gu.markbit)
 310: #define XSETMARKBIT(a,b) (XMARKBIT(a) = (b))
 311: #define XMARK(a) (XMARKBIT(a) = 1)
 312: #define XUNMARK(a) (XMARKBIT(a) = 0)
 313: 
 314: #endif NO_UNION_TYPE
 315: 
 316: 
 317: #define XCONS(a) ((struct Lisp_Cons *) XUINT(a))
 318: #define XBUFFER(a) ((struct buffer *) XUINT(a))
 319: #define XVECTOR(a) ((struct Lisp_Vector *) XUINT(a))
 320: #define XSUBR(a) ((struct Lisp_Subr *) XUINT(a))
 321: #define XSTRING(a) ((struct Lisp_String *) XUINT(a))
 322: #define XSYMBOL(a) ((struct Lisp_Symbol *) XUINT(a))
 323: #define XFUNCTION(a) ((Lisp_Object (*)()) XUINT(a))
 324: #define XMARKER(a) ((struct Lisp_Marker *) XUINT(a))
 325: #define XOBJFWD(a) ((Lisp_Object *) XUINT(a))
 326: #define XINTPTR(a) ((int *) XUINT(a))
 327: #define XWINDOW(a) ((struct window *) XUINT(a))
 328: #define XPROCESS(a) ((struct Lisp_Process *) XUINT(a))
 329: 
 330: #define XSETCONS(a, b) XSETUINT(a, (int) (b))
 331: #define XSETBUFFER(a, b) XSETUINT(a, (int) (b))
 332: #define XSETVECTOR(a, b) XSETUINT(a, (int) (b))
 333: #define XSETSUBR(a, b) XSETUINT(a, (int) (b))
 334: #define XSETSTRING(a, b) XSETUINT(a, (int) (b))
 335: #define XSETSYMBOL(a, b) XSETUINT(a, (int) (b))
 336: #define XSETFUNCTION(a, b) XSETUINT(a, (int) (b))
 337: #define XSETMARKER(a, b) XSETUINT(a, (int) (b))
 338: #define XSETOBJFWD(a, b) XSETUINT(a, (int) (b))
 339: #define XSETINTPTR(a, b) XSETUINT(a, (int) (b))
 340: #define XSETWINDOW(a, b) XSETUINT(a, (int) (b))
 341: #define XSETPROCESS(a, b) XSETUINT(a, (int) (b))
 342: 
 343: /* In a cons, the markbit of the car is the gc mark bit */
 344: 
 345: struct Lisp_Cons
 346:   {
 347:     Lisp_Object car, cdr;
 348:   };
 349: 
 350: /* Like a cons, but records info on where the text lives that it was read from */
 351: /* This is not really in use now */
 352: 
 353: struct Lisp_Buffer_Cons
 354:   {
 355:     Lisp_Object car, cdr;
 356:     struct buffer *buffer;
 357:     int bufpos;
 358:   };
 359: 
 360: /* In a string or vector, the sign bit of the `size' is the gc mark bit */
 361: 
 362: struct Lisp_String
 363:   {
 364:     int size;
 365:     unsigned char data[1];
 366:   };
 367: 
 368: struct Lisp_Vector
 369:   {
 370:     int size;
 371:     struct Lisp_Vector *next;
 372:     Lisp_Object contents[1];
 373:   };
 374: 
 375: /* In a symbol, the markbit of the plist is used as the gc mark bit */
 376: 
 377: struct Lisp_Symbol
 378:   {
 379:     struct Lisp_String *name;
 380:     Lisp_Object value;
 381:     Lisp_Object function;
 382:     Lisp_Object plist;
 383:     struct Lisp_Symbol *next;   /* -> next symbol in this obarray bucket */
 384:   };
 385: 
 386: struct Lisp_Subr
 387:   {
 388:     Lisp_Object (*function) ();
 389:     short min_args, max_args;
 390:     char *symbol_name;
 391:     char *prompt;
 392:     char *doc;
 393:   };
 394: 
 395: /* In a marker, the markbit of the chain field is used as the gc mark bit */
 396: 
 397: struct Lisp_Marker
 398:   {
 399:     struct buffer *buffer;
 400:     Lisp_Object chain;
 401:     int bufpos;
 402:     int modified;
 403:   };
 404: 
 405: /* Data type checking */
 406: 
 407: #define NULL(x)  (XFASTINT (x) == XFASTINT (Qnil))
 408: #define LISTP(x) (XTYPE ((x)) == Lisp_Cons)
 409: #define EQ(x, y) (XFASTINT (x) == XFASTINT (y))
 410: 
 411: #define CHECK_STRING(x, i) \
 412:   { if (XTYPE ((x)) != Lisp_String) x = wrong_type_argument (Qstringp, (x)); }
 413: 
 414: #define CHECK_SYMBOL(x, i) \
 415:   { if (XTYPE ((x)) != Lisp_Symbol) x = wrong_type_argument (Qsymbolp, (x)); }
 416: 
 417: #define CHECK_VECTOR(x, i) \
 418:   { if (XTYPE ((x)) != Lisp_Vector) x = wrong_type_argument (Qvectorp, (x)); }
 419: 
 420: #define CHECK_BUFFER(x, i) \
 421:   { if (XTYPE ((x)) != Lisp_Buffer) x = wrong_type_argument (Qbufferp, (x)); }
 422: 
 423: #define CHECK_WINDOW(x, i) \
 424:   { if (XTYPE ((x)) != Lisp_Window) x = wrong_type_argument (Qwindowp, (x)); }
 425: 
 426: #define CHECK_PROCESS(x, i) \
 427:   { if (XTYPE ((x)) != Lisp_Process) x = wrong_type_argument (Qprocessp, (x)); }
 428: 
 429: #define CHECK_NUMBER(x, i) \
 430:   { if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qintegerp, (x)); }
 431: 
 432: #define CHECK_MARKER(x, i) \
 433:   { if (XTYPE ((x)) != Lisp_Marker) x = wrong_type_argument (Qmarkerp, (x)); }
 434: 
 435: #define CHECK_NUMBER_COERCE_MARKER(x, i) \
 436:   { if (XTYPE ((x)) == Lisp_Marker) XFASTINT (x) = marker_position (x); \
 437:     else if (XTYPE ((x)) != Lisp_Int) x = wrong_type_argument (Qinteger_or_marker_p, (x)); }
 438: 
 439: #ifdef VIRT_ADDR_VARIES
 440: /* For machines like APOLLO where text and data can go anywhere
 441:    in virtual memory.  */
 442: #define CHECK_IMPURE(obj) \
 443:   { extern int pure[]; \
 444:     if (XUINT (obj) < (int) ((char *) pure + PURESIZE) \
 445:     && XUINT (obj) >= (int) pure) \
 446:       pure_write_error (); }
 447: 
 448: #else /* not VIRT_ADDR_VARIES */
 449: 
 450: #define CHECK_IMPURE(obj) \
 451:   { extern int my_edata; \
 452:     if (XUINT (obj) < (unsigned int) &my_edata) \
 453:       pure_write_error (); }
 454: #endif /* not VIRT_ADDR_VARIES */
 455: 
 456: /* Define a built-in function for calling from Lisp.
 457:  `lname' should be the name to give the function in Lisp,
 458:     as a null-terminated C string.
 459:  `fnname' should be the name of the function in C.
 460:     By convention, it starts with F.
 461:  `sname' should be the name for the C constant structure
 462:     that records information on this function for internal use.
 463:     By convention, it should be the same as `fnname' but with S instead of F.
 464:     It's too bad that C macros can't compute this from `fnname'.
 465:  `minargs' should be a number, the minimum number of arguments allowed.
 466:  `maxargs' should be a number, the maximum number of arguments allowed,
 467:     or else MANY or UNEVALLED.
 468:     MANY means pass a vector of evaluated arguments,
 469: 	 in the form of an integer number-of-arguments
 470: 	 followed by the address of a vector of Lisp_Objects
 471: 	 which contains the argument values.
 472:     UNEVALLED means pass the list of unevaluated arguments
 473:  `prompt' says how to read arguments for an interactive call.
 474:     This can be zero or a C string.
 475:     Zero means that interactive calls are not allowed.
 476:     A string is interpreted in a hairy way:
 477:      it should contain one line for each argument to be read, terminated by \n.
 478:      The first character of the line controls the type of parsing:
 479:        s  --  read a string.
 480:        S  --  read a symbol.
 481:        k  --  read a key sequence and return it as a string.
 482:        a  --  read a function name (symbol) with completion.
 483:        C  --  read a command name (symbol) with completion.
 484:        v  --  read a variable name (symbol) with completion.
 485:        b  --  read a buffer name (a string) with completion.
 486:        B  --  buffer name, may be existing buffer or may not be.
 487:        f  --  read a file name, file must exist.
 488:        F  --  read a file name, file need not exist.
 489:        n  --  read a number.
 490:        c  --  read a character and return it as a number.
 491:        p  --  use the numeric value of the prefix argument.
 492:        P  --  use raw value of prefix - can be nil, -, (NUMBER) or NUMBER.
 493:        x  --  read a Lisp object from the minibuffer.
 494:        X  --  read a Lisp form from the minibuffer and use its value.
 495:     A null string means call interactively with no arguments.
 496:  `doc' is documentation for the user.
 497: */
 498: 
 499: #define DEFUN(lname, fnname, sname, minargs, maxargs, prompt, doc) \
 500:   Lisp_Object fnname (); \
 501:   struct Lisp_Subr sname = {fnname, minargs, maxargs, lname, prompt, 0}; \
 502:   Lisp_Object fnname
 503: 
 504: /* defsubr (Sname);
 505:  is how we define the symbol for function `name' at start-up time. */
 506: extern void defsubr ();
 507: 
 508: #define MANY -2
 509: #define UNEVALLED -1
 510: 
 511: #define DEFSIMPLE(lname, fnname, sname, doc, valtype, setcomp, exp) \
 512:   DEFUN (lname, fnname, sname, 0, 0, 0, 0) () \
 513:   { \
 514:     Lisp_Object val; \
 515:     XSET (val, valtype, exp); \
 516:     return val; }
 517: 
 518: #define DEFPRED(lname, fnname, sname, doc, boolexp) \
 519:   DEFUN (lname, fnname, sname, 0, 0, 0, 0) () \
 520:   { if (boolexp) return Qt; return Qnil; }
 521: 
 522: /* Structure for recording Lisp call stack for backtrace purposes */
 523: 
 524: struct specbinding
 525:   {
 526:     Lisp_Object symbol, old_value;
 527:   };
 528: 
 529: extern struct specbinding *specpdl;
 530: extern struct specbinding *specpdl_ptr;
 531: extern int specpdl_size;
 532: 
 533: struct handler
 534:   {
 535:     Lisp_Object handler;
 536:     Lisp_Object var;
 537:     struct catchtag *tag;
 538:     struct handler *next;
 539:   };
 540: 
 541: extern struct handler *handlerlist;
 542: 
 543: /* Check quit-flag and quit if it is non-nil. */
 544: 
 545: #define QUIT \
 546:   if (!NULL (Vquit_flag) && NULL (Vinhibit_quit)) \
 547:     { Vquit_flag = Qnil; Fsignal (Qquit, Qnil); }
 548: 
 549: /* number of bytes of structure consed since last GC */
 550: 
 551: extern int consing_since_gc;
 552: 
 553: /* threshold for doing another gc */
 554: 
 555: extern int gc_cons_threshold;
 556: 
 557: /* Structure for recording stack slots that need marking */
 558: 
 559: /* This is a chain of structures, each of which points at a Lisp_Object variable
 560:  whose value should be marked in garbage collection.
 561:  Normally every link of the chain is an automatic variable of a function,
 562:  and its `val' points to some argument or local variable of the function.
 563:  On exit to the function, the chain is set back to the value it had on entry.
 564:  This way, no link remains in the chain when the stack frame containing the link disappears.
 565: 
 566:  Every function that can call Feval must protect in this fashion all
 567:  Lisp_Object variables whose contents will be used again. */
 568: 
 569: extern struct gcpro *gcprolist;
 570: 
 571: struct gcpro
 572:   {
 573:     struct gcpro *next;
 574:     Lisp_Object *var;       /* Address of first protected variable */
 575:     int nvars;          /* Number of consecutive protected variables */
 576:   };
 577: 
 578: #define GCPRO1(varname) \
 579:  {gcpro1.next = gcprolist; gcpro1.var = &varname; gcpro1.nvars = 1; \
 580:   gcprolist = &gcpro1; }
 581: 
 582: #define GCPRO2(varname1, varname2) \
 583:  {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
 584:   gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
 585:   gcprolist = &gcpro2; }
 586: 
 587: #define GCPRO3(varname1, varname2, varname3) \
 588:  {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
 589:   gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
 590:   gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
 591:   gcprolist = &gcpro3; }
 592: 
 593: #define GCPRO4(varname1, varname2, varname3, varname4) \
 594:  {gcpro1.next = gcprolist; gcpro1.var = &varname1; gcpro1.nvars = 1; \
 595:   gcpro2.next = &gcpro1; gcpro2.var = &varname2; gcpro2.nvars = 1; \
 596:   gcpro3.next = &gcpro2; gcpro3.var = &varname3; gcpro3.nvars = 1; \
 597:   gcpro4.next = &gcpro3; gcpro4.var = &varname4; gcpro4.nvars = 1; \
 598:   gcprolist = &gcpro4; }
 599: 
 600: /* Call staticpro (&var) to protect static variable `var'. */
 601: 
 602: void staticpro();
 603: 
 604: #define UNGCPRO (gcprolist = gcpro1.next)
 605: 
 606: /* Defined in data.c */
 607: extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
 608: extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
 609: extern Lisp_Object Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
 610: extern Lisp_Object Qvoid_variable, Qvoid_function;
 611: extern Lisp_Object Qsetting_constant, Qinvalid_read_syntax;
 612: extern Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
 613: extern Lisp_Object Qend_of_file, Qarith_error;
 614: extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
 615: 
 616: extern Lisp_Object Qintegerp, Qnatnump, Qsymbolp, Qlistp, Qconsp;
 617: extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp;
 618: extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qvectorp;
 619: extern Lisp_Object Qinteger_or_marker_p, Qboundp, Qfboundp;
 620: extern Lisp_Object Qcdr;
 621: 
 622: extern Lisp_Object Feq (), Fnull (), Flistp (), Fconsp (), Fatom (), Fnlistp ();
 623: extern Lisp_Object Fintegerp (), Fnatnump (), Fsymbolp ();
 624: extern Lisp_Object Fvectorp (), Fstringp (), Farrayp (), Fsequencep ();
 625: extern Lisp_Object Fbufferp (), Fmarkerp (), Fsubrp (), Fchar_or_string_p ();
 626: extern Lisp_Object Finteger_or_marker_p ();
 627: 
 628: extern Lisp_Object Fcar (), Fcar_safe(), Fcdr (), Fcdr_safe();
 629: extern Lisp_Object Fsetcar (), Fsetcdr ();
 630: extern Lisp_Object Fboundp (), Ffboundp (), Fmakunbound (), Ffmakunbound ();
 631: extern Lisp_Object Fsymbol_function (), Fsymbol_plist (), Fsymbol_name ();
 632: extern Lisp_Object Ffset (), Fsetplist ();
 633: extern Lisp_Object Fsymbol_value (), Fset ();
 634: extern Lisp_Object Fdefault_value (), Fset_default ();
 635: 
 636: extern Lisp_Object Faref (), Faset (), Farray_length ();
 637: 
 638: extern Lisp_Object Fstring_to_int (), Fint_to_string ();
 639: extern Lisp_Object Feqlsign (), Fgtr (), Flss (), Fgeq (), Fleq (), Fneq (), Fzerop ();
 640: extern Lisp_Object Fplus (), Fminus (), Ftimes (), Fquo (), Frem (), Fmax (), Fmin ();
 641: extern Lisp_Object Flogand (), Flogior (), Flogxor (), Flognot (), Flsh (), Fash ();
 642: extern Lisp_Object Fadd1 (), Fsub1 ();
 643: 
 644: extern Lisp_Object make_number ();
 645: extern Lisp_Object wrong_type_argument ();
 646: 
 647: /* Defined in fns.c */
 648: extern Lisp_Object Qstring_lessp;
 649: extern Lisp_Object Vfeatures;
 650: extern Lisp_Object Fidentity (), Frandom ();
 651: extern Lisp_Object Flength (), Fstring_equal (), Fstring_lessp ();
 652: extern Lisp_Object Fappend (), Fconcat (), Fvconcat (), Fcopy_sequence (), Fsubstring ();
 653: extern Lisp_Object Fnth (), Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
 654: extern Lisp_Object Frassq (), Fdelq (), Fsort ();
 655: extern Lisp_Object Freverse (), Fnreverse (), Fget (), Fput (), Fequal ();
 656: extern Lisp_Object Ffillarray (), Fnconc (), Fmapcar (), Fmapconcat ();
 657: extern Lisp_Object Fy_or_n_p (), Fyes_or_no_p ();
 658: extern Lisp_Object Ffeaturep (), Frequire () , Fprovide ();
 659: extern Lisp_Object concat2 (), nconc2 ();
 660: 
 661: /* Defined in alloc.c */
 662: extern Lisp_Object Vpurify_flag;
 663: extern Lisp_Object Fcons (), Flist(), Fmake_list ();
 664: extern Lisp_Object Fmake_vector (), Fvector (), Fmake_symbol (), Fmake_marker ();
 665: extern Lisp_Object Fmake_string (), build_string (), make_string();
 666: extern Lisp_Object Fpurecopy (), make_pure_string ();
 667: extern Lisp_Object pure_cons (), make_pure_vector ();
 668: extern Lisp_Object Fgarbage_collect ();
 669: 
 670: /* Defined in print.c */
 671: extern Lisp_Object Vprin1_to_string_buffer;
 672: extern Lisp_Object Fprin1 (), Fprin1_to_string (), Fprinc ();
 673: extern Lisp_Object Fterpri (), Fprint ();
 674: extern Lisp_Object Vstandard_output, Qstandard_output;
 675: extern temp_output_buffer_setup (), temp_output_buffer_show ();
 676: 
 677: /* Defined in read.c */
 678: extern Lisp_Object Qvariable_documentation;
 679: extern Lisp_Object Vobarray, Vstandard_input;
 680: extern Lisp_Object Fread (), Fread_from_string ();
 681: extern Lisp_Object Fintern (), Fintern_soft (), Fload ();
 682: extern Lisp_Object Fget_file_char (), Fread_char ();
 683: extern Lisp_Object Feval_current_buffer (), Feval_region ();
 684: extern Lisp_Object intern (), oblookup ();
 685: 
 686: /* Defined in eval.c */
 687: extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
 688: extern Lisp_Object Vinhibit_quit, Vquit_flag;
 689: extern Lisp_Object Vmocklisp_arguments, Qmocklisp, Qmocklisp_arguments;
 690: extern Lisp_Object Vautoload_queue;
 691: extern Lisp_Object Fand (), For (), Fif (), Fprogn (), Fprog1 (), Fprog2 ();
 692: extern Lisp_Object Fsetq (), Fquote ();
 693: extern Lisp_Object Fuser_variable_p ();
 694: extern Lisp_Object Fdefun (), Flet (), FletX (), Fwhile ();
 695: extern Lisp_Object Fcatch (), Fthrow (), Funwind_protect ();
 696: extern Lisp_Object Fcondition_case (), Fsignal ();
 697: extern Lisp_Object Ffunction_type (), Fautoload (), Fdocumentation (), Fcommandp ();
 698: extern Lisp_Object Feval (), Fapply (), Ffuncall ();
 699: extern Lisp_Object Fglobal_set (), Fglobal_value (), Fbacktrace ();
 700: extern Lisp_Object call1 (), call2 (), call3 ();
 701: extern Lisp_Object apply_lambda ();
 702: extern Lisp_Object internal_catch ();
 703: extern Lisp_Object internal_condition_case ();
 704: extern void unbind_to ();
 705: extern void error ();
 706: 
 707: /* Defined in editfns.c */
 708: extern Lisp_Object Vprefix_arg, Qminus, Vcurrent_prefix_arg;
 709: extern Lisp_Object Finteractive_p (), Fgoto_char ();
 710: extern Lisp_Object Fpoint_min_marker (), Fpoint_max_marker ();
 711: extern Lisp_Object Fpoint_min (), Fpoint_max ();
 712: extern Lisp_Object Fpoint (), Fmark (), Fpoint_marker (), Fmark_marker ();
 713: extern Lisp_Object Ffollchar (), Fprevchar (), Fchar_after (), Finsert ();
 714: extern Lisp_Object Feolp (), Feobp (), Fbolp (), Fbobp (), Fset_mark ();
 715: extern Lisp_Object Fformat (), format1 ();
 716: extern Lisp_Object Fgetenv ();
 717: extern Lisp_Object Fbuffer_substring (), Fbuffer_string ();
 718: extern Lisp_Object save_excursion_save (), save_restriction_save ();
 719: extern Lisp_Object save_excursion_restore (), save_restriction_restore ();
 720: extern Lisp_Object Fchar_to_string ();
 721: 
 722: /* defined in buffer.c */
 723: extern Lisp_Object Vbuffer_alist;
 724: extern Lisp_Object Fget_buffer (), Fget_buffer_create (), Fset_buffer ();
 725: extern Lisp_Object Fbarf_if_buffer_read_only ();
 726: extern Lisp_Object Fcurrent_buffer (), Fswitch_to_buffer (), Fpop_to_buffer ();
 727: extern Lisp_Object Fother_buffer ();
 728: extern struct buffer *all_buffers;
 729: 
 730: /* defined in marker.c */
 731: 
 732: extern Lisp_Object Fmarker_position (), Fmarker_buffer ();
 733: extern Lisp_Object Fcopy_marker ();
 734: 
 735: /* Defined in fileio.c */
 736: 
 737: extern Lisp_Object Qfile_error;
 738: extern Lisp_Object Fexpand_file_name (), Ffile_name_nondirectory ();
 739: extern Lisp_Object Fsubstitute_in_file_name ();
 740: extern Lisp_Object Ffile_symlink_p ();
 741: 
 742: /* Defined in abbrev.c */
 743: 
 744: extern Lisp_Object Vfundamental_mode_abbrev_table;
 745: 
 746: /* defined in search.c */
 747: 
 748: extern Lisp_Object Fstring_match ();
 749: extern Lisp_Object Fscan_buffer ();
 750: 
 751: /* defined in minibuf.c */
 752: 
 753: extern Lisp_Object last_minibuf_string;
 754: extern Lisp_Object read_minibuf_string (), Fcompleting_read ();
 755: extern Lisp_Object Fread_from_minibuffer ();
 756: extern Lisp_Object Fread_variable ();
 757: extern Lisp_Object Fread_minibuffer (), Feval_minibuffer ();
 758: extern Lisp_Object Fread_string (), Fread_file_name ();
 759: extern Lisp_Object Fread_no_blanks_input ();
 760: 
 761: /* Defined in callint.c */
 762: 
 763: extern Lisp_Object Vcommand_history;
 764: extern Lisp_Object Qcall_interactively;
 765: extern Lisp_Object Fcall_interactively ();
 766: extern Lisp_Object Fprefix_numeric_value ();
 767: 
 768: /* defined in casefiddle.c */
 769: 
 770: extern Lisp_Object Fdowncase (), Fupcase (), Fcapitalize ();
 771: 
 772: /* defined in keyboard.c */
 773: 
 774: extern Lisp_Object Vhelp_form, Vtop_level;
 775: extern Lisp_Object Fdiscard_input (), Frecursive_edit ();
 776: extern Lisp_Object Fcommand_execute (), Finput_pending_p ();
 777: 
 778: /* defined in keymap.c */
 779: 
 780: extern Lisp_Object Qkeymap;
 781: extern Lisp_Object Fkey_description (), Fsingle_key_description ();
 782: extern Lisp_Object Fwhere_is_internal ();
 783: extern Lisp_Object access_keymap (), store_in_keymap ();
 784: extern Lisp_Object get_keyelt (), get_keymap();
 785: 
 786: /* defined in indent.c */
 787: extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
 788: 
 789: /* defined in window.c */
 790: extern Lisp_Object Qwindowp;
 791: extern Lisp_Object Fget_buffer_window ();
 792: extern Lisp_Object Fsave_window_excursion ();
 793: extern Lisp_Object save_window_save ();
 794: extern Lisp_Object  save_window_restore ();
 795: 
 796: /* defined in emacs.c */
 797: extern Lisp_Object decode_env_path ();
 798: /* Nonzero means don't do interactive redisplay and don't change tty modes */
 799: extern int noninteractive;
 800: 
 801: /* defined in process.c */
 802: extern Lisp_Object Fget_process (), Fget_buffer_process (), Fprocessp ();
 803: extern Lisp_Object Fprocess_status (), Fkill_process ();
 804: 
 805: /* defined in callproc.c */
 806: extern Lisp_Object Vexec_path, Vexec_directory;
 807: 
 808: /* defined in doc.c */
 809: extern Lisp_Object Vdoc_file_name;
 810: extern Lisp_Object Fsubstitute_command_keys ();
 811: 
 812: /* defined in bytecode.c */
 813: extern Lisp_Object Qbytecode;
 814: 
 815: /* defined in macros.c */
 816: extern Lisp_Object Fexecute_kbd_macro ();
 817: 
 818: extern void debugger ();
 819: 
 820: extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd ();
 821: extern long *xmalloc (), *xrealloc ();

Defined struct's

Lisp_Buffer_Cons defined in line 353; never used
Lisp_Cons defined in line 345; used 18 times
Lisp_String defined in line 362; used 16 times
Lisp_Subr defined in line 386; used 4 times
Lisp_Symbol defined in line 377; used 12 times
handler defined in line 533; used 20 times
specbinding defined in line 524; used 26 times

Defined union's

Lisp_Object defined in line 189; never used

Defined enum's

Lisp_Type defined in line 26; used 8 times

Defined typedef's

Lisp_Object defined in line 184; used 1501 times

Defined macros

CHECK_IMPURE defined in line 450; used 3 times
CHECK_MARKER defined in line 432; used 5 times
CHECK_PROCESS defined in line 426; used 11 times
DEFPRED defined in line 518; never used
DEFSIMPLE defined in line 511; never used
DEFUN defined in line 499; used 2 times
EQ defined in line 409; used 184 times
GCPRO4 defined in line 593; used 2 times
GCTYPEBITS defined in line 234; used 3 times
GCTYPEMASK defined in line 238; used 1 times
Lisp_Object defined in line 226; used 2 times
MARKBIT defined in line 239; used 4 times
NULL defined in line 407; used 630 times
VALBITS defined in line 230; used 9 times
VALMASK defined in line 237; used 7 times
XFASTINT defined in line 286; used 459 times
XFUNCTION defined in line 323; used 1 times
XINT defined in line 292; used 297 times
XINTPTR defined in line 326; used 8 times
XMARK defined in line 311; used 6 times
XMARKBIT defined in line 309; used 11 times
XPROCESS defined in line 328; used 50 times
XSETCONS defined in line 330; used 2 times
XSETFUNCTION defined in line 336; used 1 times
XSETINTPTR defined in line 339; never used
XSETMARKBIT defined in line 310; used 1 times
XSETMARKER defined in line 337; used 1 times
XSETOBJFWD defined in line 338; never used
XSETPROCESS defined in line 341; never used
XSETSUBR defined in line 333; never used
XSETUINT defined in line 297; used 12 times
XSETVECTOR defined in line 332; never used
XSETWINDOW defined in line 340; never used
XSTRING defined in line 321; used 369 times
XTYPE defined in line 281; used 286 times
XUINT defined in line 295; used 23 times
XUNMARK defined in line 312; used 7 times

Usage of this include

lisp.h used 37 times
Last modified: 1986-03-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1412
Valid CSS Valid XHTML 1.0 Strict