Mercurial > emacs
comparison src/xselect.c @ 2515:c0cdd6a80391
long_to_cons and cons_to_long are generally useful things; they're
needed whether or not X is defined.
* xselect.c (long_to_cons, cons_to_long): Moved from here...
* data.c (long_to_cons, cons_to_long): ... to here.
* lisp.h (long_to_cons, cons_to_long): Add extern declaration.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Sat, 10 Apr 1993 08:05:07 +0000 |
parents | b6c62e4abf59 |
children | ae18dabac465 |
comparison
equal
deleted
inserted
replaced
2514:6700e25af205 | 2515:c0cdd6a80391 |
---|---|
230 val = intern (str); | 230 val = intern (str); |
231 BLOCK_INPUT; | 231 BLOCK_INPUT; |
232 XFree (str); | 232 XFree (str); |
233 UNBLOCK_INPUT; | 233 UNBLOCK_INPUT; |
234 return val; | 234 return val; |
235 } | |
236 | |
237 /* Convert between full word time values (last modification times, etc) | |
238 and their Lisp representation as a cons cell (HIGH . LOW). */ | |
239 | |
240 Lisp_Object | |
241 long_to_cons (i) | |
242 unsigned long i; | |
243 { | |
244 unsigned int top = i >> 16; | |
245 unsigned int bot = i & 0xFFFF; | |
246 if (top == 0) | |
247 return make_number (bot); | |
248 if (top == 0xFFFF) | |
249 return Fcons (make_number (-1), make_number (bot)); | |
250 return Fcons (make_number (top), make_number (bot)); | |
251 } | |
252 | |
253 unsigned long | |
254 cons_to_long (c) | |
255 Lisp_Object c; | |
256 { | |
257 int top, bot; | |
258 if (INTEGERP (c)) | |
259 return XINT (c); | |
260 top = XCONS (c)->car; | |
261 bot = XCONS (c)->cdr; | |
262 if (CONSP (bot)) | |
263 bot = XCONS (bot)->car; | |
264 return ((XINT (top) << 16) | XINT (bot)); | |
265 } | 235 } |
266 | 236 |
267 /* Do protocol to assert ourself as a selection owner. | 237 /* Do protocol to assert ourself as a selection owner. |
268 Update the Vselection_alist so that we can reply to later requests for | 238 Update the Vselection_alist so that we can reply to later requests for |
269 our selection. */ | 239 our selection. */ |