diff options
| author | Jim Blandy | 1993-04-10 08:05:07 +0000 |
|---|---|---|
| committer | Jim Blandy | 1993-04-10 08:05:07 +0000 |
| commit | 51cf3e317c4a5e5664218b6fe7a1c09f1c81631b (patch) | |
| tree | 36b81604db79c05fa628d67aabefa89eaa25f2ae /src | |
| parent | 6904bdcd0874054d3992319455cf049e5f01c69d (diff) | |
| download | emacs-51cf3e317c4a5e5664218b6fe7a1c09f1c81631b.tar.gz emacs-51cf3e317c4a5e5664218b6fe7a1c09f1c81631b.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 29 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/xselect.c | 30 |
3 files changed, 31 insertions, 30 deletions
diff --git a/src/data.c b/src/data.c index 4b2fa3cebbf..66b4e90157b 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1425,6 +1425,35 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0, "T if NUMBER is zero.") | |||
| 1425 | return Qnil; | 1425 | return Qnil; |
| 1426 | } | 1426 | } |
| 1427 | 1427 | ||
| 1428 | /* Convert between 32-bit values and pairs of lispy 24-bit values. */ | ||
| 1429 | |||
| 1430 | Lisp_Object | ||
| 1431 | long_to_cons (i) | ||
| 1432 | unsigned long i; | ||
| 1433 | { | ||
| 1434 | unsigned int top = i >> 16; | ||
| 1435 | unsigned int bot = i & 0xFFFF; | ||
| 1436 | if (top == 0) | ||
| 1437 | return make_number (bot); | ||
| 1438 | if (top == 0xFFFF) | ||
| 1439 | return Fcons (make_number (-1), make_number (bot)); | ||
| 1440 | return Fcons (make_number (top), make_number (bot)); | ||
| 1441 | } | ||
| 1442 | |||
| 1443 | unsigned long | ||
| 1444 | cons_to_long (c) | ||
| 1445 | Lisp_Object c; | ||
| 1446 | { | ||
| 1447 | int top, bot; | ||
| 1448 | if (INTEGERP (c)) | ||
| 1449 | return XINT (c); | ||
| 1450 | top = XCONS (c)->car; | ||
| 1451 | bot = XCONS (c)->cdr; | ||
| 1452 | if (CONSP (bot)) | ||
| 1453 | bot = XCONS (bot)->car; | ||
| 1454 | return ((XINT (top) << 16) | XINT (bot)); | ||
| 1455 | } | ||
| 1456 | |||
| 1428 | DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, | 1457 | DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, |
| 1429 | "Convert NUM to a string by printing it in decimal.\n\ | 1458 | "Convert NUM to a string by printing it in decimal.\n\ |
| 1430 | Uses a minus sign if negative.\n\ | 1459 | Uses a minus sign if negative.\n\ |
diff --git a/src/lisp.h b/src/lisp.h index 4e2b86e57ec..a89c5290a69 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -985,6 +985,8 @@ extern Lisp_Object Flsh (), Fash (); | |||
| 985 | extern Lisp_Object Fadd1 (), Fsub1 (); | 985 | extern Lisp_Object Fadd1 (), Fsub1 (); |
| 986 | 986 | ||
| 987 | extern Lisp_Object make_number (); | 987 | extern Lisp_Object make_number (); |
| 988 | extern Lisp_Object long_to_cons (); | ||
| 989 | extern unsigned long cons_to_long (); | ||
| 988 | extern void args_out_of_range (); | 990 | extern void args_out_of_range (); |
| 989 | extern void args_out_of_range_3 (); | 991 | extern void args_out_of_range_3 (); |
| 990 | extern Lisp_Object wrong_type_argument (); | 992 | extern Lisp_Object wrong_type_argument (); |
diff --git a/src/xselect.c b/src/xselect.c index 51592fe7282..bb052ae1ccf 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -234,36 +234,6 @@ x_atom_to_symbol (display, atom) | |||
| 234 | return val; | 234 | return val; |
| 235 | } | 235 | } |
| 236 | 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 | } | ||
| 266 | |||
| 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. */ |