Commit 8f34f70a authored by Ken Raeburn's avatar Ken Raeburn
Browse files

(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.
parent 5e8b779f
...@@ -525,12 +525,23 @@ typedef struct interval *INTERVAL; ...@@ -525,12 +525,23 @@ typedef struct interval *INTERVAL;
struct Lisp_Cons struct Lisp_Cons
{ {
/* Please do not use the names of these elements in code other
than the core lisp implementation. Use XCAR and XCDR below. */
#ifdef HIDE_LISP_IMPLEMENTATION
Lisp_Object car_, cdr_;
#else
Lisp_Object car, cdr; Lisp_Object car, cdr;
#endif
}; };
/* Take the car or cdr of something known to be a cons cell. */ /* Take the car or cdr of something known to be a cons cell. */
#ifdef HIDE_LISP_IMPLEMENTATION
#define XCAR(c) (XCONS ((c))->car_)
#define XCDR(c) (XCONS ((c))->cdr_)
#else
#define XCAR(c) (XCONS ((c))->car) #define XCAR(c) (XCONS ((c))->car)
#define XCDR(c) (XCONS ((c))->cdr) #define XCDR(c) (XCONS ((c))->cdr)
#endif
/* Take the car or cdr of something whose type is not known. */ /* Take the car or cdr of something whose type is not known. */
#define CAR(c) \ #define CAR(c) \
...@@ -1012,8 +1023,18 @@ struct Lisp_Float ...@@ -1012,8 +1023,18 @@ struct Lisp_Float
{ {
Lisp_Object type; /* essentially used for mark-bit Lisp_Object type; /* essentially used for mark-bit
and chaining when on free-list */ and chaining when on free-list */
#ifdef HIDE_LISP_IMPLEMENTATION
double data_;
#else
double data; double data;
#endif
}; };
#ifdef HIDE_LISP_IMPLEMENTATION
#define XFLOAT_DATA(f) (XFLOAT (f)->data_)
#else
#define XFLOAT_DATA(f) (XFLOAT (f)->data)
#endif
#endif /* LISP_FLOAT_TYPE */ #endif /* LISP_FLOAT_TYPE */
/* A character, declared with the following typedef, is a member /* A character, declared with the following typedef, is a member
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment