Mercurial > hg > xemacs-beta
comparison src/lisp-union.h @ 5027:22179cd0fe15
merge
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Wed, 10 Feb 2010 07:25:19 -0600 |
parents | ae48681c47fa |
children | 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
5026:46cf825f6158 | 5027:22179cd0fe15 |
---|---|
1 /* Fundamental definitions for XEmacs Lisp interpreter -- union objects. | 1 /* Fundamental definitions for XEmacs Lisp interpreter -- union objects. |
2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994 | 2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994 |
3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
4 Copyright (C) 2002, 2005 Ben Wing. | 4 Copyright (C) 2002, 2005, 2010 Ben Wing. |
5 | 5 |
6 This file is part of XEmacs. | 6 This file is part of XEmacs. |
7 | 7 |
8 XEmacs is free software; you can redistribute it and/or modify it | 8 XEmacs is free software; you can redistribute it and/or modify it |
9 under the terms of the GNU General Public License as published by the | 9 under the terms of the GNU General Public License as published by the |
140 #define INT_PLUS1(x) make_int (XINT (x) + 1) | 140 #define INT_PLUS1(x) make_int (XINT (x) + 1) |
141 #define INT_MINUS1(x) make_int (XINT (x) - 1) | 141 #define INT_MINUS1(x) make_int (XINT (x) - 1) |
142 | 142 |
143 /* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 143 /* WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
144 | 144 |
145 You can only VOID_TO_LISP something that had previously been | 145 You can only GET_LISP_FROM_VOID something that had previously been |
146 LISP_TO_VOID'd. You cannot go the other way, i.e. create a bogus | 146 STORE_LISP_IN_VOID'd. If you want to go the other way, use |
147 Lisp_Object. If you want to stuff a void * into a Lisp_Object, use | 147 STORE_VOID_IN_LISP and GET_VOID_FROM_LISP, or use make_opaque_ptr(). */ |
148 make_opaque_ptr(). */ | |
149 | 148 |
150 /* Convert between a (void *) and a Lisp_Object, as when the | 149 /* Convert a Lisp object to a void * pointer, as when it needs to be passed |
151 Lisp_Object is passed to a toolkit callback function */ | 150 to a toolkit callback function */ |
151 #define STORE_LISP_IN_VOID(larg) ((void *) ((larg).v)) | |
152 | |
153 /* Convert a void * pointer back into a Lisp object, assuming that the | |
154 pointer was generated by STORE_LISP_IN_VOID. */ | |
152 DECLARE_INLINE_HEADER ( | 155 DECLARE_INLINE_HEADER ( |
153 Lisp_Object | 156 Lisp_Object |
154 VOID_TO_LISP (const void *arg) | 157 GET_LISP_FROM_VOID (const void *arg) |
155 ) | 158 ) |
156 { | 159 { |
157 Lisp_Object larg; | 160 Lisp_Object larg; |
158 larg.v = (struct nosuchstruct *) arg; | 161 larg.v = (struct nosuchstruct *) arg; |
159 return larg; | 162 return larg; |
160 } | 163 } |
161 | |
162 #define LISP_TO_VOID(larg) ((void *) ((larg).v)) | |
163 | 164 |
164 /* Convert a Lisp_Object into something that can't be used as an | 165 /* Convert a Lisp_Object into something that can't be used as an |
165 lvalue. Useful for type-checking. */ | 166 lvalue. Useful for type-checking. */ |
166 #if (__GNUC__ > 1) | 167 #if (__GNUC__ > 1) |
167 #define NON_LVALUE(larg) ({ (larg); }) | 168 #define NON_LVALUE(larg) ({ (larg); }) |