# HG changeset patch # User Jim Blandy # Date 734429107 0 # Node ID c0cdd6a803916d12074e5bdbb71388db8c3e0ed5 # Parent 6700e25af205567fc53951235ec6a60e660b9ef0 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. diff -r 6700e25af205 -r c0cdd6a80391 src/data.c --- a/src/data.c Sat Apr 10 08:04:27 1993 +0000 +++ b/src/data.c Sat Apr 10 08:05:07 1993 +0000 @@ -1425,6 +1425,35 @@ return Qnil; } +/* Convert between 32-bit values and pairs of lispy 24-bit values. */ + +Lisp_Object +long_to_cons (i) + unsigned long i; +{ + unsigned int top = i >> 16; + unsigned int bot = i & 0xFFFF; + if (top == 0) + return make_number (bot); + if (top == 0xFFFF) + return Fcons (make_number (-1), make_number (bot)); + return Fcons (make_number (top), make_number (bot)); +} + +unsigned long +cons_to_long (c) + Lisp_Object c; +{ + int top, bot; + if (INTEGERP (c)) + return XINT (c); + top = XCONS (c)->car; + bot = XCONS (c)->cdr; + if (CONSP (bot)) + bot = XCONS (bot)->car; + return ((XINT (top) << 16) | XINT (bot)); +} + DEFUN ("number-to-string", Fnumber_to_string, Snumber_to_string, 1, 1, 0, "Convert NUM to a string by printing it in decimal.\n\ Uses a minus sign if negative.\n\ diff -r 6700e25af205 -r c0cdd6a80391 src/lisp.h --- a/src/lisp.h Sat Apr 10 08:04:27 1993 +0000 +++ b/src/lisp.h Sat Apr 10 08:05:07 1993 +0000 @@ -985,6 +985,8 @@ extern Lisp_Object Fadd1 (), Fsub1 (); extern Lisp_Object make_number (); +extern Lisp_Object long_to_cons (); +extern unsigned long cons_to_long (); extern void args_out_of_range (); extern void args_out_of_range_3 (); extern Lisp_Object wrong_type_argument (); diff -r 6700e25af205 -r c0cdd6a80391 src/xselect.c --- a/src/xselect.c Sat Apr 10 08:04:27 1993 +0000 +++ b/src/xselect.c Sat Apr 10 08:05:07 1993 +0000 @@ -234,36 +234,6 @@ return val; } -/* Convert between full word time values (last modification times, etc) - and their Lisp representation as a cons cell (HIGH . LOW). */ - -Lisp_Object -long_to_cons (i) - unsigned long i; -{ - unsigned int top = i >> 16; - unsigned int bot = i & 0xFFFF; - if (top == 0) - return make_number (bot); - if (top == 0xFFFF) - return Fcons (make_number (-1), make_number (bot)); - return Fcons (make_number (top), make_number (bot)); -} - -unsigned long -cons_to_long (c) - Lisp_Object c; -{ - int top, bot; - if (INTEGERP (c)) - return XINT (c); - top = XCONS (c)->car; - bot = XCONS (c)->cdr; - if (CONSP (bot)) - bot = XCONS (bot)->car; - return ((XINT (top) << 16) | XINT (bot)); -} - /* Do protocol to assert ourself as a selection owner. Update the Vselection_alist so that we can reply to later requests for our selection. */