comparison src/lisp.h @ 66888:b991cdef1a8d

(struct Lisp_Cons): Make cdr a union. (XCDR_AS_LVALUE): Adjust. (struct Lisp_Float): Make data a union. (XFLOAT_DATA): Adjust.
author Andreas Schwab <schwab@suse.de>
date Tue, 15 Nov 2005 13:53:09 +0000
parents aa81a85c6d8e
children 911421314d0e 03934708f1e9
comparison
equal deleted inserted replaced
66887:a3db1720a101 66888:b991cdef1a8d
598 struct Lisp_Cons 598 struct Lisp_Cons
599 { 599 {
600 /* Please do not use the names of these elements in code other 600 /* Please do not use the names of these elements in code other
601 than the core lisp implementation. Use XCAR and XCDR below. */ 601 than the core lisp implementation. Use XCAR and XCDR below. */
602 #ifdef HIDE_LISP_IMPLEMENTATION 602 #ifdef HIDE_LISP_IMPLEMENTATION
603 Lisp_Object car_, cdr_; 603 Lisp_Object car_;
604 union
605 {
606 Lisp_Object cdr_;
607 struct Lisp_Cons *chain;
608 } u;
604 #else 609 #else
605 Lisp_Object car, cdr; 610 Lisp_Object car;
611 union
612 {
613 Lisp_Object cdr;
614 struct Lisp_Cons *chain;
615 } u;
606 #endif 616 #endif
607 }; 617 };
608 618
609 /* Take the car or cdr of something known to be a cons cell. */ 619 /* Take the car or cdr of something known to be a cons cell. */
610 /* The _AS_LVALUE macros shouldn't be used outside of the minimal set 620 /* The _AS_LVALUE macros shouldn't be used outside of the minimal set
613 fields are not accessible as lvalues. (What if we want to switch to 623 fields are not accessible as lvalues. (What if we want to switch to
614 a copying collector someday? Cached cons cell field addresses may be 624 a copying collector someday? Cached cons cell field addresses may be
615 invalidated at arbitrary points.) */ 625 invalidated at arbitrary points.) */
616 #ifdef HIDE_LISP_IMPLEMENTATION 626 #ifdef HIDE_LISP_IMPLEMENTATION
617 #define XCAR_AS_LVALUE(c) (XCONS ((c))->car_) 627 #define XCAR_AS_LVALUE(c) (XCONS ((c))->car_)
618 #define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr_) 628 #define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr_)
619 #else 629 #else
620 #define XCAR_AS_LVALUE(c) (XCONS ((c))->car) 630 #define XCAR_AS_LVALUE(c) (XCONS ((c))->car)
621 #define XCDR_AS_LVALUE(c) (XCONS ((c))->cdr) 631 #define XCDR_AS_LVALUE(c) (XCONS ((c))->u.cdr)
622 #endif 632 #endif
623 633
624 /* Use these from normal code. */ 634 /* Use these from normal code. */
625 #define XCAR(c) LISP_MAKE_RVALUE(XCAR_AS_LVALUE(c)) 635 #define XCAR(c) LISP_MAKE_RVALUE(XCAR_AS_LVALUE(c))
626 #define XCDR(c) LISP_MAKE_RVALUE(XCDR_AS_LVALUE(c)) 636 #define XCDR(c) LISP_MAKE_RVALUE(XCDR_AS_LVALUE(c))
1273 }; 1283 };
1274 1284
1275 /* Lisp floating point type */ 1285 /* Lisp floating point type */
1276 struct Lisp_Float 1286 struct Lisp_Float
1277 { 1287 {
1288 union
1289 {
1278 #ifdef HIDE_LISP_IMPLEMENTATION 1290 #ifdef HIDE_LISP_IMPLEMENTATION
1279 double data_; 1291 double data_;
1280 #else 1292 #else
1281 double data; 1293 double data;
1282 #endif 1294 #endif
1295 struct Lisp_Float *chain;
1296 } u;
1283 }; 1297 };
1284 1298
1285 #ifdef HIDE_LISP_IMPLEMENTATION 1299 #ifdef HIDE_LISP_IMPLEMENTATION
1286 #define XFLOAT_DATA(f) (XFLOAT (f)->data_) 1300 #define XFLOAT_DATA(f) (XFLOAT (f)->u.data_)
1287 #else 1301 #else
1288 #define XFLOAT_DATA(f) (XFLOAT (f)->data) 1302 #define XFLOAT_DATA(f) (XFLOAT (f)->u.data)
1289 #endif 1303 #endif
1290 1304
1291 /* A character, declared with the following typedef, is a member 1305 /* A character, declared with the following typedef, is a member
1292 of some character set associated with the current buffer. */ 1306 of some character set associated with the current buffer. */
1293 #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ 1307 #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */