]> code.delx.au - gnu-emacs/blobdiff - src/data.c
(Fbyte_code): Harmonize arguments with documentation.
[gnu-emacs] / src / data.c
index 826fec57a87c4de3da0f75184167b5e2cb14f17c..b02294301411fb91872622115d69ef32905df00a 100644 (file)
@@ -31,13 +31,6 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include "syssignal.h"
 
-#ifdef MSDOS
-/* These are redefined (correctly, but differently) in values.h.  */
-#undef INTBITS
-#undef LONGBITS
-#undef SHORTBITS
-#endif
-
 #ifdef LISP_FLOAT_TYPE
 
 #ifdef STDC_HEADERS
@@ -90,6 +83,7 @@ Lisp_Object Qnumberp, Qnumber_or_marker_p;
 static Lisp_Object Qinteger, Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
 static Lisp_Object Qfloat, Qwindow_configuration, Qprocess, Qwindow;
 static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
+static Lisp_Object Qchar_table, Qbool_vector;
 
 static Lisp_Object swap_in_symval_forwarding ();
 
@@ -235,6 +229,10 @@ for example, (type-of 1) returns `integer'.")
        return Qcompiled_function;
       if (GC_BUFFERP (object))
        return Qbuffer;
+      if (GC_CHAR_TABLE_P (object))
+       return Qchar_table;
+      if (GC_BOOL_VECTOR_P (object))
+       return Qbool_vector;
 
 #ifdef MULTI_FRAME
       if (GC_FRAMEP (object))
@@ -864,7 +862,7 @@ swap_in_symval_forwarding (sym, valcontents)
 \f
 /* Find the value of a symbol, returning Qunbound if it's not bound.
    This is helpful for code which just wants to get a variable's value
-   if it has one, without signalling an error.
+   if it has one, without signaling an error.
    Note that it must not be possible to quit
    within this function.  Great care is required for this.  */
 
@@ -1291,6 +1289,11 @@ Use `make-local-hook' instead.")
   tem = Fassq (sym, current_buffer->local_var_alist);
   if (NILP (tem))
     {
+      /* Swap out any local binding for some other buffer, and make
+        sure the current value is permanently recorded, if it's the
+        default value.  */
+      find_symbol_value (sym);
+
       current_buffer->local_var_alist
         = Fcons (Fcons (sym, XCONS (XCONS (XBUFFER_LOCAL_VALUE (XSYMBOL (sym)->value)->cdr)->cdr)->cdr),
                 current_buffer->local_var_alist);
@@ -1299,7 +1302,9 @@ Use `make-local-hook' instead.")
         force it to look once again for this buffer's value */
       {
        Lisp_Object *pvalbuf;
+
        valcontents = XSYMBOL (sym)->value;
+
        pvalbuf = &XCONS (XBUFFER_LOCAL_VALUE (valcontents)->cdr)->car;
        if (current_buffer == XBUFFER (*pvalbuf))
          *pvalbuf = Qnil;
@@ -1532,13 +1537,12 @@ or a byte-code object.  INDEX starts at 0.")
   else if (BOOL_VECTOR_P (array))
     {
       int val;
-      int bits_per_char = INTBITS / sizeof (int);
 
       if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size)
        args_out_of_range (array, idx);
 
-      val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / bits_per_char];
-      return (val & (1 << (idxval % bits_per_char)) ? Qt : Qnil);
+      val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR];
+      return (val & (1 << (idxval % BITS_PER_CHAR)) ? Qt : Qnil);
     }
   else if (CHAR_TABLE_P (array))
     {
@@ -1639,18 +1643,17 @@ ARRAY may be a vector or a string.  IDX starts at 0.")
   else if (BOOL_VECTOR_P (array))
     {
       int val;
-      int bits_per_char = INTBITS / sizeof (int);
 
       if (idxval < 0 || idxval >= XBOOL_VECTOR (array)->size)
        args_out_of_range (array, idx);
 
-      val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / bits_per_char];
+      val = (unsigned char) XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR];
 
       if (! NILP (newelt))
-       val |= 1 << (idxval % bits_per_char);
+       val |= 1 << (idxval % BITS_PER_CHAR);
       else
-       val &= ~(1 << (idxval % bits_per_char));
-      XBOOL_VECTOR (array)->data[idxval / bits_per_char] = val;
+       val &= ~(1 << (idxval % BITS_PER_CHAR));
+      XBOOL_VECTOR (array)->data[idxval / BITS_PER_CHAR] = val;
     }
   else if (CHAR_TABLE_P (array))
     {
@@ -2142,11 +2145,9 @@ double
 fmod (f1, f2)
      double f1, f2;
 {
-#ifdef HAVE_DREM  /* Some systems use this non-standard name.  */
-  return (drem (f1, f2));
-#else  /* Other systems don't seem to have it at all.  */
+  if (f2 < 0.0)
+    f2 = -f2;
   return (f1 - f2 * floor (f1/f2));
-#endif
 }
 #endif /* ! HAVE_FMOD */
 
@@ -2604,6 +2605,8 @@ syms_of_data ()
   Qbuffer = intern ("buffer");
   Qframe = intern ("frame");
   Qvector = intern ("vector");
+  Qchar_table = intern ("char-table");
+  Qbool_vector = intern ("bool-vector");
 
   staticpro (&Qinteger);
   staticpro (&Qsymbol);
@@ -2620,6 +2623,8 @@ syms_of_data ()
   staticpro (&Qbuffer);
   staticpro (&Qframe);
   staticpro (&Qvector);
+  staticpro (&Qchar_table);
+  staticpro (&Qbool_vector);
 
   defsubr (&Seq);
   defsubr (&Snull);