diff options
| author | Ken Raeburn | 2000-03-29 22:14:34 +0000 |
|---|---|---|
| committer | Ken Raeburn | 2000-03-29 22:14:34 +0000 |
| commit | e0b8c689e2b1d80da6ed235ae400ad10d117b706 (patch) | |
| tree | f54bb195d821f61b0f7c3fbf4eae79b72978fdbe /src/lisp.h | |
| parent | 141384bdd2a332b79b36d118cd13becaf0b326b9 (diff) | |
| download | emacs-e0b8c689e2b1d80da6ed235ae400ad10d117b706.tar.gz emacs-e0b8c689e2b1d80da6ed235ae400ad10d117b706.zip | |
Stop assuming interval pointers and lisp objects can be distinguished by
inspection. Beginnings of support for expensive internal consistency checks.
* config.in (ENABLE_CHECKING): Undef.
* lisp.h (struct interval): Replace "parent" field with a union of interval
pointer and Lisp_Object; add new bitfield to use as discriminant. Change other
flag fields to bitfields.
(CHECK): New macro for consistency checking. If ENABLE_CHECKING is defined and
the supplied test fails, print a message and abort.
(eassert): New macro. Use CHECK to provide an assert-like facility.
* intervals.h (NULL_INTERVAL_P): Now applies only to real interval pointers;
abort if the value looks like a lisp object.
(NULL_INTERVAL_P, NULL_PARENT, HAS_PARENT, HAS_OBJECT, SET_PARENT, SET_OBJECT,
INTERVAL_PARENT, GET_INTERVAL_OBJECT, COPY_PARENT): Modify for new interval
parent definition.
* alloc.c (mark_interval_tree, MARK_INTERVAL_TREE, UNMARK_BALANCE_INTERVALS):
Update references that need an addressable lisp object in the interval
structure.
(die): New function.
(suppress_checking): New variable.
* intervals.c (interval_start_pos): Just return 0 if there's no parent object.
Diffstat (limited to 'src/lisp.h')
| -rw-r--r-- | src/lisp.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/lisp.h b/src/lisp.h index af1ddb7a460..0e1cfff61ab 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -46,6 +46,23 @@ Boston, MA 02111-1307, USA. */ | |||
| 46 | #endif | 46 | #endif |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | /* Extra internal type checking? */ | ||
| 50 | extern int suppress_checking; | ||
| 51 | #ifdef ENABLE_CHECKING | ||
| 52 | extern void die P_((const char *, const char *, int)); | ||
| 53 | #define CHECK(check,msg) ((check || suppress_checking ? 0 : die (msg, __FILE__, __LINE__)), 0) | ||
| 54 | #else | ||
| 55 | /* Produce same side effects and result, but don't complain. */ | ||
| 56 | #define CHECK(check,msg) ((check),0) | ||
| 57 | #endif | ||
| 58 | /* Define an Emacs version of "assert", since some system ones are | ||
| 59 | flaky. */ | ||
| 60 | #if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__) | ||
| 61 | #define eassert(cond) CHECK(cond,"assertion failed: " #cond) | ||
| 62 | #else | ||
| 63 | #define eassert(cond) CHECK(cond,"assertion failed") | ||
| 64 | #endif | ||
| 65 | |||
| 49 | /* Define the fundamental Lisp data structures. */ | 66 | /* Define the fundamental Lisp data structures. */ |
| 50 | 67 | ||
| 51 | /* This is the set of Lisp data types. */ | 68 | /* This is the set of Lisp data types. */ |
| @@ -494,17 +511,22 @@ struct interval | |||
| 494 | You'd think we could store this information in the parent object | 511 | You'd think we could store this information in the parent object |
| 495 | somewhere (after all, that should be visited once and then | 512 | somewhere (after all, that should be visited once and then |
| 496 | ignored too, right?), but strings are GC'd strangely. */ | 513 | ignored too, right?), but strings are GC'd strangely. */ |
| 497 | struct interval *parent; | 514 | union |
| 515 | { | ||
| 516 | struct interval *interval; | ||
| 517 | Lisp_Object obj; | ||
| 518 | } up; | ||
| 519 | unsigned int up_obj : 1; | ||
| 498 | 520 | ||
| 499 | /* The remaining components are `properties' of the interval. | 521 | /* The remaining components are `properties' of the interval. |
| 500 | The first four are duplicates for things which can be on the list, | 522 | The first four are duplicates for things which can be on the list, |
| 501 | for purposes of speed. */ | 523 | for purposes of speed. */ |
| 502 | 524 | ||
| 503 | unsigned char write_protect; /* Non-zero means can't modify. */ | 525 | unsigned int write_protect : 1; /* Non-zero means can't modify. */ |
| 504 | unsigned char visible; /* Zero means don't display. */ | 526 | unsigned int visible : 1; /* Zero means don't display. */ |
| 505 | unsigned char front_sticky; /* Non-zero means text inserted just | 527 | unsigned int front_sticky : 1; /* Non-zero means text inserted just |
| 506 | before this interval goes into it. */ | 528 | before this interval goes into it. */ |
| 507 | unsigned char rear_sticky; /* Likewise for just after it. */ | 529 | unsigned int rear_sticky : 1; /* Likewise for just after it. */ |
| 508 | 530 | ||
| 509 | /* Properties of this interval. | 531 | /* Properties of this interval. |
| 510 | The mark bit on this field says whether this particular interval | 532 | The mark bit on this field says whether this particular interval |