comparison src/lisp.h @ 1290:9b0ddca4773b

* lisp.h: Conditionally define interval structure and macros. Add DECLARE_INTERVALS to struct Lisp_String.
author Joseph Arceneaux <jla@gnu.org>
date Thu, 01 Oct 1992 01:00:41 +0000
parents 61f4bd399f61
children 01d973b5d81b
comparison
equal deleted inserted replaced
1289:74b26ab86df4 1290:9b0ddca4773b
423 #define XSETINTPTR(a, b) XSETPNTR(a, (int) (b)) 423 #define XSETINTPTR(a, b) XSETPNTR(a, (int) (b))
424 #define XSETWINDOW(a, b) XSETPNTR(a, (int) (b)) 424 #define XSETWINDOW(a, b) XSETPNTR(a, (int) (b))
425 #define XSETPROCESS(a, b) XSETPNTR(a, (int) (b)) 425 #define XSETPROCESS(a, b) XSETPNTR(a, (int) (b))
426 #define XSETFLOAT(a, b) XSETPNTR(a, (int) (b)) 426 #define XSETFLOAT(a, b) XSETPNTR(a, (int) (b))
427 427
428 #ifdef USE_TEXT_PROPERTIES
429 /* Basic data type for use of intervals. See the macros in intervals.h */
430
431 struct interval
432 {
433 /* The first group of entries deal with the tree structure. */
434
435 unsigned int total_length; /* Length of myself and both children. */
436 unsigned int position; /* Cache of interval's character position */
437 struct interval *left; /* Intervals which precede me. */
438 struct interval *right; /* Intervals which succeed me. */
439 struct interval *parent; /* Parent in the tree, or the Lisp_Object
440 containing this interval tree. */
441
442 /* The remaining components are `properties' of the interval.
443 The first four are duplicates for things which can be on the list,
444 for purposes of speed. */
445
446 unsigned char write_protect; /* Non-zero means can't modify. */
447 unsigned char visible; /* Zero means don't display. */
448 unsigned char front_hungry; /* Non-zero means text inserted just
449 before this interval goes into it. */
450 unsigned char rear_hungry; /* Likewise for just after it. */
451
452 Lisp_Object plist; /* Properties of this interval. */
453 };
454
455 typedef struct interval *INTERVAL;
456
457 /* Complain if object is not string or buffer type */
458 #define CHECK_STRING_OR_BUFFER(x, i) \
459 { if (XTYPE ((x)) != Lisp_String && XTYPE ((x)) != Lisp_Buffer) \
460 x = wrong_type_argument (Qbuffer_or_string_p, (x)); }
461
462 /* Macro used to conditionally compile intervals into certain data
463 structures. See, e.g., struct Lisp_String below. */
464 #define DECLARE_INTERVALS INTERVAL intervals;
465
466 /* Macro used to condionally compile interval initialization into
467 certain code. See, e.g., alloc.c. */
468 #define INITIALIZE_INTERVAL(ptr,val) ptr->intervals = val
469
470 #else /* No text properties */
471
472 /* If no intervals are used, make the above definitions go away. */
473
474 #define CHECK_STRING_OR_BUFFER(x, i)
475
476 #define INTERVAL
477 #define DECLARE_INTERVALS
478 #define INITIALIZE_INTERVAL(ptr,val)
479
480 #endif /* USE_TEXT_PROPERTIES */
481
428 /* In a cons, the markbit of the car is the gc mark bit */ 482 /* In a cons, the markbit of the car is the gc mark bit */
429 483
430 struct Lisp_Cons 484 struct Lisp_Cons
431 { 485 {
432 Lisp_Object car, cdr; 486 Lisp_Object car, cdr;
445 /* In a string or vector, the sign bit of the `size' is the gc mark bit */ 499 /* In a string or vector, the sign bit of the `size' is the gc mark bit */
446 500
447 struct Lisp_String 501 struct Lisp_String
448 { 502 {
449 int size; 503 int size;
504 DECLARE_INTERVALS /* `data' field must be last. */
450 unsigned char data[1]; 505 unsigned char data[1];
451 }; 506 };
452 507
453 struct Lisp_Vector 508 struct Lisp_Vector
454 { 509 {