comparison src/lisp.h @ 25421:65a7e9c02d4f

(struct Lisp_Cons, XCAR, XCDR, struct Lisp_Float): Change names of structure elements if HIDE_LISP_IMPLEMENTATION is defined, to help detect code that uses knowledge of the Lisp internals that it shouldn't have. (XFLOAT_DATA): New macro.
author Ken Raeburn <raeburn@raeburn.org>
date Sat, 28 Aug 1999 22:15:12 +0000
parents d193b3ae681f
children b5c133b3bfa0
comparison
equal deleted inserted replaced
25420:1026df56062c 25421:65a7e9c02d4f
523 523
524 /* In a cons, the markbit of the car is the gc mark bit */ 524 /* In a cons, the markbit of the car is the gc mark bit */
525 525
526 struct Lisp_Cons 526 struct Lisp_Cons
527 { 527 {
528 /* Please do not use the names of these elements in code other
529 than the core lisp implementation. Use XCAR and XCDR below. */
530 #ifdef HIDE_LISP_IMPLEMENTATION
531 Lisp_Object car_, cdr_;
532 #else
528 Lisp_Object car, cdr; 533 Lisp_Object car, cdr;
534 #endif
529 }; 535 };
530 536
531 /* Take the car or cdr of something known to be a cons cell. */ 537 /* Take the car or cdr of something known to be a cons cell. */
538 #ifdef HIDE_LISP_IMPLEMENTATION
539 #define XCAR(c) (XCONS ((c))->car_)
540 #define XCDR(c) (XCONS ((c))->cdr_)
541 #else
532 #define XCAR(c) (XCONS ((c))->car) 542 #define XCAR(c) (XCONS ((c))->car)
533 #define XCDR(c) (XCONS ((c))->cdr) 543 #define XCDR(c) (XCONS ((c))->cdr)
544 #endif
534 545
535 /* Take the car or cdr of something whose type is not known. */ 546 /* Take the car or cdr of something whose type is not known. */
536 #define CAR(c) \ 547 #define CAR(c) \
537 (CONSP ((c)) ? XCAR ((c)) \ 548 (CONSP ((c)) ? XCAR ((c)) \
538 : NILP ((c)) ? Qnil \ 549 : NILP ((c)) ? Qnil \
1010 /* Optional Lisp floating point type */ 1021 /* Optional Lisp floating point type */
1011 struct Lisp_Float 1022 struct Lisp_Float
1012 { 1023 {
1013 Lisp_Object type; /* essentially used for mark-bit 1024 Lisp_Object type; /* essentially used for mark-bit
1014 and chaining when on free-list */ 1025 and chaining when on free-list */
1026 #ifdef HIDE_LISP_IMPLEMENTATION
1027 double data_;
1028 #else
1015 double data; 1029 double data;
1030 #endif
1016 }; 1031 };
1032
1033 #ifdef HIDE_LISP_IMPLEMENTATION
1034 #define XFLOAT_DATA(f) (XFLOAT (f)->data_)
1035 #else
1036 #define XFLOAT_DATA(f) (XFLOAT (f)->data)
1037 #endif
1017 #endif /* LISP_FLOAT_TYPE */ 1038 #endif /* LISP_FLOAT_TYPE */
1018 1039
1019 /* A character, declared with the following typedef, is a member 1040 /* A character, declared with the following typedef, is a member
1020 of some character set associated with the current buffer. */ 1041 of some character set associated with the current buffer. */
1021 #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ 1042 #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */