diff src/data.c @ 5118:e0db3c197671 ben-lisp-object

merge up to latest default branch, doesn't compile yet
author Ben Wing <ben@xemacs.org>
date Sat, 26 Dec 2009 21:18:49 -0600
parents 3742ea8250b5 aa5ed11f473b
children 623d57b7fbe8
line wrap: on
line diff
--- a/src/data.c	Sat Dec 26 00:20:27 2009 -0600
+++ b/src/data.c	Sat Dec 26 21:18:49 2009 -0600
@@ -160,23 +160,6 @@
     args_out_of_range_3 (make_int (val), make_int (min), make_int (max));
 }
 
-/* On some machines, XINT needs a temporary location.
-   Here it is, in case it is needed.  */
-
-EMACS_INT sign_extend_temp;
-
-/* On a few machines, XINT can only be done by calling this.  */
-/* XEmacs:  only used by m/convex.h */
-EMACS_INT sign_extend_lisp_int (EMACS_INT num);
-EMACS_INT
-sign_extend_lisp_int (EMACS_INT num)
-{
-  if (num & (1L << (INT_VALBITS - 1)))
-    return num | ((-1L) << INT_VALBITS);
-  else
-    return num & (EMACS_INT) ((1UL << INT_VALBITS) - 1);
-}
-
 
 /* Data type predicates */
 
@@ -216,6 +199,9 @@
 
 DEFUN ("consp", Fconsp, 1, 1, 0, /*
 Return t if OBJECT is a cons cell.  `nil' is not a cons cell.
+
+See the documentation for `cons' or the Lisp manual for more details on what
+a cons cell is.
 */
        (object))
 {
@@ -224,6 +210,9 @@
 
 DEFUN ("atom", Fatom, 1, 1, 0, /*
 Return t if OBJECT is not a cons cell.  `nil' is not a cons cell.
+
+See the documentation for `cons' or the Lisp manual for more details on what
+a cons cell is.
 */
        (object))
 {
@@ -232,6 +221,10 @@
 
 DEFUN ("listp", Flistp, 1, 1, 0, /*
 Return t if OBJECT is a list.  `nil' is a list.
+
+A list is either the Lisp object nil (a symbol), interpreted as the empty
+list in this context, or a cons cell whose CDR refers to either nil or a
+cons cell.  A "proper list" contains no cycles.
 */
        (object))
 {
@@ -256,6 +249,9 @@
 
 DEFUN ("symbolp", Fsymbolp, 1, 1, 0, /*
 Return t if OBJECT is a symbol.
+
+A symbol is a Lisp object with a name. It can optionally have any and all of
+a value, a property list and an associated function. 
 */
        (object))
 {
@@ -600,19 +596,21 @@
 /* Extract and set components of lists */
 
 DEFUN ("car", Fcar, 1, 1, 0, /*
-Return the car of LIST.  If arg is nil, return nil.
-Error if arg is not nil and not a cons cell.  See also `car-safe'.
+Return the car of CONS.  If CONS is nil, return nil.
+The car of a list or a dotted pair is its first element.
+
+Error if CONS is not nil and not a cons cell.  See also `car-safe'.
 */
-       (list))
+       (cons))
 {
   while (1)
     {
-      if (CONSP (list))
-	return XCAR (list);
-      else if (NILP (list))
+      if (CONSP (cons))
+	return XCAR (cons);
+      else if (NILP (cons))
 	return Qnil;
       else
-	list = wrong_type_argument (Qlistp, list);
+	cons = wrong_type_argument (Qlistp, cons);
     }
 }
 
@@ -625,19 +623,22 @@
 }
 
 DEFUN ("cdr", Fcdr, 1, 1, 0, /*
-Return the cdr of LIST.  If arg is nil, return nil.
+Return the cdr of CONS.  If CONS is nil, return nil.
+The cdr of a list is the list without its first element.  The cdr of a
+dotted pair (A . B) is the second element, B.
+
 Error if arg is not nil and not a cons cell.  See also `cdr-safe'.
 */
-       (list))
+       (cons))
 {
   while (1)
     {
-      if (CONSP (list))
-	return XCDR (list);
-      else if (NILP (list))
+      if (CONSP (cons))
+	return XCDR (cons);
+      else if (NILP (cons))
 	return Qnil;
       else
-	list = wrong_type_argument (Qlistp, list);
+	cons = wrong_type_argument (Qlistp, cons);
     }
 }
 
@@ -651,6 +652,7 @@
 
 DEFUN ("setcar", Fsetcar, 2, 2, 0, /*
 Set the car of CONS-CELL to be NEWCAR.  Return NEWCAR.
+The car of a list or a dotted pair is its first element.
 */
        (cons_cell, newcar))
 {
@@ -663,6 +665,8 @@
 
 DEFUN ("setcdr", Fsetcdr, 2, 2, 0, /*
 Set the cdr of CONS-CELL to be NEWCDR.  Return NEWCDR.
+The cdr of a list is the list without its first element.  The cdr of a
+dotted pair (A . B) is the second element, B.
 */
        (cons_cell, newcdr))
 {
@@ -978,6 +982,8 @@
 DEFUN ("=", Feqlsign, 1, MANY, 0, /*
 Return t if all the arguments are numerically equal.
 The arguments may be numbers, characters or markers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -986,7 +992,14 @@
 
 DEFUN ("<", Flss, 1, MANY, 0, /*
 Return t if the sequence of arguments is monotonically increasing.
-The arguments may be numbers, characters or markers.
+
+(That is, if there is a second argument, it must be numerically greater than
+the first.  If there is a third, it must be numerically greater than the
+second, and so on.)  At least one argument is required.
+
+The arguments may be numbers, characters or markers.  
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -995,7 +1008,14 @@
 
 DEFUN (">", Fgtr, 1, MANY, 0, /*
 Return t if the sequence of arguments is monotonically decreasing.
+
+(That is, if there is a second argument, it must be numerically less than
+the first.  If there is a third, it must be numerically less than the
+second, and so forth.)  At least one argument is required.
+
 The arguments may be numbers, characters or markers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1005,6 +1025,8 @@
 DEFUN ("<=", Fleq, 1, MANY, 0, /*
 Return t if the sequence of arguments is monotonically nondecreasing.
 The arguments may be numbers, characters or markers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1014,6 +1036,8 @@
 DEFUN (">=", Fgeq, 1, MANY, 0, /*
 Return t if the sequence of arguments is monotonically nonincreasing.
 The arguments may be numbers, characters or markers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1029,6 +1053,8 @@
 DEFUN ("/=", Fneq, 1, MANY, 0, /*
 Return t if no two arguments are numerically equal.
 The arguments may be numbers, characters or markers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1409,6 +1435,8 @@
 DEFUN ("+", Fplus, 0, MANY, 0, /*
 Return sum of any number of arguments.
 The arguments should all be numbers, characters or markers.
+
+arguments: (&rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1481,6 +1509,8 @@
 Negate number or subtract numbers, characters or markers.
 With one arg, negates it.  With more than one arg,
 subtracts all but the first from the first.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1603,6 +1633,8 @@
 DEFUN ("*", Ftimes, 0, MANY, 0, /*
 Return product of any number of arguments.
 The arguments should all be numbers, characters or markers.
+
+arguments: (&rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1675,6 +1707,8 @@
 Note that this is a departure from Common Lisp, where / creates ratios when
 dividing integers.  Having a separate function lets us avoid breaking existing
 Emacs Lisp code that expects / to do integer division.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1739,9 +1773,11 @@
 #endif /* HAVE_RATIO */
 
 DEFUN ("/", Fquo, 1, MANY, 0, /*
-Return first argument divided by all the remaining arguments.
+Return FIRST divided by all the remaining arguments.
 The arguments must be numbers, characters or markers.
 With one argument, reciprocates the argument.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1861,6 +1897,8 @@
 All arguments must be real numbers, characters or markers.
 The value is always a number; markers and characters are converted
 to numbers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -1956,6 +1994,8 @@
 All arguments must be numbers, characters or markers.
 The value is always a number; markers and characters are converted
 to numbers.
+
+arguments: (FIRST &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -2049,6 +2089,8 @@
 DEFUN ("logand", Flogand, 0, MANY, 0, /*
 Return bitwise-and of all the arguments.
 Arguments may be integers, or markers or characters converted to integers.
+
+arguments: (&rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -2099,6 +2141,8 @@
 DEFUN ("logior", Flogior, 0, MANY, 0, /*
 Return bitwise-or of all the arguments.
 Arguments may be integers, or markers or characters converted to integers.
+
+arguments: (&rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -2149,6 +2193,8 @@
 DEFUN ("logxor", Flogxor, 0, MANY, 0, /*
 Return bitwise-exclusive-or of all the arguments.
 Arguments may be integers, or markers or characters converted to integers.
+
+arguments: (&rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -2593,11 +2639,11 @@
   { XD_END }
 };
 
-DEFINE_LISP_OBJECT ("weak-list", weak_list,
-			       mark_weak_list, print_weak_list,
-			       0, weak_list_equal, weak_list_hash,
-			       weak_list_description,
-			       struct weak_list);
+DEFINE_DUMPABLE_LISP_OBJECT ("weak-list", weak_list,
+			     mark_weak_list, print_weak_list,
+			     0, weak_list_equal, weak_list_hash,
+			     weak_list_description,
+			     struct weak_list);
 /*
    -- we do not mark the list elements (either the elements themselves
       or the cons cells that hold them) in the normal marking phase.
@@ -3061,7 +3107,7 @@
   { XD_END}
 };
 
-DEFINE_NONDUMPABLE_LISP_OBJECT ("weak-box", weak_box, mark_weak_box,
+DEFINE_NODUMP_LISP_OBJECT ("weak-box", weak_box, mark_weak_box,
 					   print_weak_box, 0, weak_box_equal,
 					   weak_box_hash, weak_box_description,
 					   struct weak_box);
@@ -3299,7 +3345,7 @@
   { XD_END }
 };
 
-DEFINE_NONDUMPABLE_LISP_OBJECT ("ephemeron", ephemeron,
+DEFINE_NODUMP_LISP_OBJECT ("ephemeron", ephemeron,
 					   mark_ephemeron, print_ephemeron,
 					   0, ephemeron_equal, ephemeron_hash,
 					   ephemeron_description,