Mercurial > hg > xemacs-beta
annotate src/lisp-disunion.h @ 5925:08cfc8f77fb6 cygwin
make space for long ptr, and store as such, for frame in WINDOW data,
add a bit more debugging to debug-mswindow,
Vin Shelton patch to fix M-x shell
| author | Henry Thompson <ht@markup.co.uk> |
|---|---|
| date | Fri, 27 Feb 2015 17:41:20 +0000 |
| parents | 0d05accafc63 |
| children | f5dfcf2323bc |
| rev | line source |
|---|---|
| 428 | 1 /* Fundamental definitions for XEmacs Lisp interpreter -- non-union objects. |
| 2 Copyright (C) 1985, 1986, 1987, 1992, 1993 Free Software Foundation, Inc. | |
| 826 | 3 Copyright (C) 2001, 2002 Ben Wing. |
| 428 | 4 |
| 5 This file is part of XEmacs. | |
| 6 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5013
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
| 428 | 8 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5013
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5013
diff
changeset
|
10 option) any later version. |
| 428 | 11 |
| 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 15 for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5013
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 19 |
| 20 /* Synched up with: FSF 19.30. Split out from lisp.h. */ | |
| 21 /* This file has diverged greatly from FSF Emacs. Syncing is no | |
| 22 longer desirable or possible */ | |
| 23 | |
| 24 /* | |
| 25 Format of a non-union-type Lisp Object | |
| 26 | |
| 27 3 2 1 0 | |
| 28 bit 10987654321098765432109876543210 | |
| 29 -------------------------------- | |
| 30 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTT | |
| 31 | |
| 32 Integers are treated specially, and look like this: | |
| 33 | |
| 34 3 2 1 0 | |
| 35 bit 10987654321098765432109876543210 | |
| 36 -------------------------------- | |
| 37 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVT | |
| 38 | |
| 39 For integral Lisp types, i.e. integers and characters, the value | |
| 458 | 40 bits are the Lisp object. Some people call such Lisp_Objects "immediate". |
| 428 | 41 |
| 458 | 42 The object is obtained by masking off the type bits. |
| 462 | 43 Bit 1 is used as a value bit by splitting the Lisp integer type |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
44 into two subtypes, Lisp_Type_Fixnum_Even and Lisp_Type_Fixnum_Odd. |
| 458 | 45 By this trickery we get 31 bits for integers instead of 30. |
| 428 | 46 |
| 47 For non-integral types, the value bits of a Lisp_Object contain | |
| 48 a pointer to a structure containing the object. The pointer is | |
| 49 obtained by masking off the type and mark bits. | |
| 50 | |
| 462 | 51 All pointer-based types are coalesced under a single type called |
| 458 | 52 Lisp_Type_Record. The type bits for this type are required by the |
| 53 implementation to be 00, just like the least significant bits of | |
| 54 word-aligned struct pointers on 32-bit hardware. This requires that | |
| 55 all structs implementing Lisp_Objects have an alignment of at least 4 | |
| 56 bytes. Because of this, Lisp_Object pointers don't have to be masked | |
| 57 and are full-sized. | |
| 428 | 58 |
| 458 | 59 There are no mark bits in the Lisp_Object itself (there used to be). |
| 60 | |
| 61 Integers and characters don't need to be marked. All other types are | |
| 62 lrecord-based, which means they get marked by setting the mark bit in | |
| 63 the struct lrecord_header. | |
| 428 | 64 |
| 65 Here is a brief description of the following macros: | |
| 66 | |
| 67 XTYPE The type bits of a Lisp_Object | |
| 68 XPNTRVAL The value bits of a Lisp_Object storing a pointer | |
| 867 | 69 XCHARVAL The value bits of a Lisp_Object storing a Ichar |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
70 XREALFIXNUM The value bits of a Lisp_Object storing an integer, signed |
| 428 | 71 XUINT The value bits of a Lisp_Object storing an integer, unsigned |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
72 FIXNUMP Non-zero if this Lisp_Object is an integer |
| 428 | 73 Qzero Lisp Integer 0 |
| 458 | 74 EQ Non-zero if two Lisp_Objects are identical, not merely equal. */ |
| 428 | 75 |
| 76 | |
| 77 typedef EMACS_INT Lisp_Object; | |
| 78 | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
79 #define Lisp_Type_Fixnum_Bit (Lisp_Type_Fixnum_Even & Lisp_Type_Fixnum_Odd) |
| 428 | 80 #define VALMASK (((1UL << VALBITS) - 1UL) << GCTYPEBITS) |
| 81 #define XTYPE(x) ((enum Lisp_Type) (((EMACS_UINT)(x)) & ~VALMASK)) | |
| 82 #define XPNTRVAL(x) (x) /* This depends on Lisp_Type_Record == 0 */ | |
| 83 #define XCHARVAL(x) ((x) >> GCBITS) | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
84 #define XREALFIXNUM(x) ((x) >> FIXNUM_GCBITS) |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
85 #define XUINT(x) ((EMACS_UINT)(x) >> FIXNUM_GCBITS) |
| 826 | 86 |
| 87 #define wrap_pointer_1(ptr) ((Lisp_Object) (ptr)) | |
| 88 | |
| 89 DECLARE_INLINE_HEADER ( | |
| 90 Lisp_Object | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
91 make_fixnum_verify (EMACS_INT val) |
| 826 | 92 ) |
| 93 { | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
94 Lisp_Object obj = (Lisp_Object) ((val << FIXNUM_GCBITS) | Lisp_Type_Fixnum_Bit); |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
95 type_checking_assert (XREALFIXNUM (obj) == val); |
| 826 | 96 return obj; |
| 97 } | |
| 98 | |
|
5629
0d05accafc63
Don't lose bits in make_fixnum / make_char_1.
Jerry James <james@xemacs.org>
parents:
5581
diff
changeset
|
99 #define make_fixnum(x) ((Lisp_Object) ((((EMACS_INT)(x)) << FIXNUM_GCBITS) | Lisp_Type_Fixnum_Bit)) |
| 826 | 100 |
|
5629
0d05accafc63
Don't lose bits in make_fixnum / make_char_1.
Jerry James <james@xemacs.org>
parents:
5581
diff
changeset
|
101 #define make_char_1(x) ((Lisp_Object) ((((EMACS_UINT)(x)) << GCBITS) | Lisp_Type_Char)) |
| 826 | 102 |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
103 #define FIXNUMP(x) ((EMACS_UINT)(x) & Lisp_Type_Fixnum_Bit) |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
104 #define FIXNUM_PLUS(x,y) ((x)+(y)-Lisp_Type_Fixnum_Bit) |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
105 #define FIXNUM_MINUS(x,y) ((x)-(y)+Lisp_Type_Fixnum_Bit) |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
106 #define FIXNUM_PLUS1(x) FIXNUM_PLUS (x, make_fixnum (1)) |
|
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
107 #define FIXNUM_MINUS1(x) FIXNUM_MINUS (x, make_fixnum (1)) |
| 428 | 108 |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
109 #define Qzero make_fixnum (0) |
| 428 | 110 #define Qnull_pointer ((Lisp_Object) 0) |
| 111 #define EQ(x,y) ((x) == (y)) | |
| 112 | |
| 853 | 113 /* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 114 | |
| 5013 | 115 You can only GET_LISP_FROM_VOID something that had previously been |
| 116 STORE_LISP_IN_VOID'd. If you want to go the other way, use | |
| 117 STORE_VOID_IN_LISP and GET_VOID_FROM_LISP, or use make_opaque_ptr(). */ | |
| 853 | 118 |
| 5013 | 119 /* Convert a Lisp object to a void * pointer, as when it needs to be passed |
| 120 to a toolkit callback function */ | |
| 121 #define STORE_LISP_IN_VOID(larg) ((void *) (larg)) | |
| 122 | |
| 123 /* Convert a void * pointer back into a Lisp object, assuming that the | |
| 124 pointer was generated by STORE_LISP_IN_VOID. */ | |
| 125 #define GET_LISP_FROM_VOID(varg) ((Lisp_Object) (varg)) | |
| 428 | 126 |
| 127 /* Convert a Lisp_Object into something that can't be used as an | |
| 128 lvalue. Useful for type-checking. */ | |
| 129 #define NON_LVALUE(larg) ((larg) + 0) |
