emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109495: Revert and cleanup Lisp_Cons


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109495: Revert and cleanup Lisp_Cons, Lisp_Misc and Lisp_Symbol things.
Date: Tue, 07 Aug 2012 17:37:21 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109495
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-07 17:37:21 +0400
message:
  Revert and cleanup Lisp_Cons, Lisp_Misc and Lisp_Symbol things.
  * src/lisp.h (struct Lisp_Symbol): Change xname to meaningful
  name since all xname users are fixed long time ago.  Do not use
  INTERNAL_FIELD.
  (set_symbol_name, set_symbol_function, set_symbol_plist):
  (set_symbol_next, set_overlay_plist): New function.
  (struct Lisp_Cons): Do not use INTERNAL_FIELD.
  (struct Lisp_Overlay): Likewise.
  (CVAR, MVAR, SVAR): Remove.
  * src/alloc.c, src/buffer.c, src/buffer.h, src/bytecode.c:
  * src/cmds.c, src/data.c, src/doc.c, src/eval.c, src/fns.c:
  * src/keyboard.c, src/lread.c, src/nsselect.m, src/xterm.c:
  Adjust users.
  * src/.gdbinit: Change to use name field of struct Lisp_Symbol
  where appropriate.
  * admin/coccinelle/overlay.cocci, admin/coccinelle/symbol.cocci:
  Remove.
removed:
  admin/coccinelle/overlay.cocci
  admin/coccinelle/symbol.cocci
modified:
  admin/ChangeLog
  src/.gdbinit
  src/ChangeLog
  src/alloc.c
  src/buffer.c
  src/buffer.h
  src/bytecode.c
  src/cmds.c
  src/data.c
  src/doc.c
  src/eval.c
  src/fns.c
  src/keyboard.c
  src/lisp.h
  src/lread.c
  src/nsselect.m
  src/xterm.c
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2012-08-02 04:14:48 +0000
+++ b/admin/ChangeLog   2012-08-07 13:37:21 +0000
@@ -1,3 +1,7 @@
+2012-08-07  Dmitry Antipov  <address@hidden>
+
+       * coccinelle/overlay.cocci, coccinelle/symbol.cocci: Remove.
+
 2012-08-02  Paul Eggert  <address@hidden>
 
        Port to Solaris 8.

=== removed file 'admin/coccinelle/overlay.cocci'
--- a/admin/coccinelle/overlay.cocci    2012-08-01 08:49:28 +0000
+++ b/admin/coccinelle/overlay.cocci    1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-// Change direct access to Lisp_Object fields of struct
-// Lisp_Overlay to MVAR.  Beginning M denotes "misc", and
-// MVAR is likely to be used for other second-class objects.
-@@
-struct Lisp_Overlay *V;
-Lisp_Object O;
-@@
-(
-- V->start
-+ MVAR (V, start)
-|
-- V->end
-+ MVAR (V, end)
-|
-- V->plist
-+ MVAR (V, plist)
-
-|
-
-- XOVERLAY (O)->start
-+ MVAR (XOVERLAY (O), start)
-|
-- XOVERLAY (O)->end
-+ MVAR (XOVERLAY (O), end)
-|
-- XOVERLAY (O)->plist
-+ MVAR (XOVERLAY (O), plist)
-)

=== removed file 'admin/coccinelle/symbol.cocci'
--- a/admin/coccinelle/symbol.cocci     2012-08-01 08:18:22 +0000
+++ b/admin/coccinelle/symbol.cocci     1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-// Change direct access to Lisp_Object fields of struct Lisp_Symbol to SVAR.
-@@
-struct Lisp_Symbol *S;
-Lisp_Object O;
-@@
-(
-- S->xname
-+ SVAR (S, xname)
-|
-- S->val.value
-+ SVAR (S, val.value)
-|
-- S->function
-+ SVAR (S, function)
-|
-- S->plist
-+ SVAR (S, plist)
-
-|
-
-- XSYMBOL (O)->xname
-+ SVAR (XSYMBOL (O), xname)
-|
-- XSYMBOL (O)->val.value
-+ SVAR (XSYMBOL (O), val.value)
-|
-- XSYMBOL (O)->function
-+ SVAR (XSYMBOL (O), function)
-|
-- XSYMBOL (O)->plist
-+ SVAR (XSYMBOL (O), plist)
-)

=== modified file 'src/.gdbinit'
--- a/src/.gdbinit      2012-08-01 16:31:59 +0000
+++ b/src/.gdbinit      2012-08-07 13:37:21 +0000
@@ -1047,7 +1047,7 @@
 define xprintsym
   xgetptr $arg0
   set $sym = (struct Lisp_Symbol *) $ptr
-  xgetptr $sym->xname_
+  xgetptr $sym->name
   set $sym_name = (struct Lisp_String *) $ptr
   xprintstr $sym_name
 end
@@ -1218,7 +1218,7 @@
 # $ptr is NULL in temacs
 if ($ptr != 0)
   set $tem = (struct Lisp_Symbol *) $ptr
-  xgetptr $tem->xname_
+  xgetptr $tem->name
   set $tem = (struct Lisp_String *) $ptr
   set $tem = (char *) $tem->data
 
@@ -1241,7 +1241,7 @@
   silent
   xgetptr globals.f_Vinitial_window_system
   set $tem = (struct Lisp_Symbol *) $ptr
-  xgetptr $tem->xname_
+  xgetptr $tem->name
   set $tem = (struct Lisp_String *) $ptr
   set $tem = (char *) $tem->data
   # If we are running in synchronous mode, we want a chance to look

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-07 11:28:41 +0000
+++ b/src/ChangeLog     2012-08-07 13:37:21 +0000
@@ -1,5 +1,22 @@
 2012-08-07  Dmitry Antipov  <address@hidden>
 
+       Revert and cleanup Lisp_Cons, Lisp_Misc and Lisp_Symbol things.
+       * lisp.h (struct Lisp_Symbol): Change xname to meaningful
+       name since all xname users are fixed long time ago.  Do not
+       use INTERNAL_FIELD.
+       (set_symbol_name, set_symbol_function, set_symbol_plist):
+       (set_symbol_next, set_overlay_plist): New function.
+       (struct Lisp_Cons): Do not use INTERNAL_FIELD.
+       (struct Lisp_Overlay): Likewise.
+       (CVAR, MVAR, SVAR): Remove.
+       * alloc.c, buffer.c, buffer.h, bytecode.c, cmds.c, data.c:
+       * doc.c, eval.c, fns.c, keyboard.c, lread.c, nsselect.m:
+       * xterm.c: Adjust users.
+       * .gdbinit: Change to use name field of struct Lisp_Symbol
+       where appropriate.
+
+2012-08-07  Dmitry Antipov  <address@hidden>
+
        Basic functions to set Lisp_Object and pointer slots of intervals.
        * intervals.h (interval_set_parent, interval_set_object):
        (interval_set_left, interval_set_right, interval_set_plist):

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-08-07 11:28:41 +0000
+++ b/src/alloc.c       2012-08-07 13:37:21 +0000
@@ -2691,7 +2691,7 @@
 {
   ptr->u.chain = cons_free_list;
 #if GC_MARK_STACK
-  CVAR (ptr, car) = Vdead;
+  ptr->car = Vdead;
 #endif
   cons_free_list = ptr;
   consing_since_gc -= sizeof *ptr;
@@ -3522,12 +3522,12 @@
   MALLOC_UNBLOCK_INPUT;
 
   p = XSYMBOL (val);
-  SVAR (p, xname) = name;
-  SVAR (p, plist) = Qnil;
+  set_symbol_name (val, name);
+  set_symbol_plist (val, Qnil);
   p->redirect = SYMBOL_PLAINVAL;
   SET_SYMBOL_VAL (p, Qunbound);
-  SVAR (p, function) = Qunbound;
-  p->next = NULL;
+  set_symbol_function (val, Qunbound);
+  set_symbol_next (val, NULL);
   p->gcmarkbit = 0;
   p->interned = SYMBOL_UNINTERNED;
   p->constant = 0;
@@ -3654,7 +3654,7 @@
   overlay = allocate_misc (Lisp_Misc_Overlay);
   OVERLAY_START (overlay) = start;
   OVERLAY_END (overlay) = end;
-  OVERLAY_PLIST (overlay) = plist;
+  set_overlay_plist (overlay, plist);
   XOVERLAY (overlay)->next = NULL;
   return overlay;
 }
@@ -4299,7 +4299,7 @@
              && offset < (CONS_BLOCK_SIZE * sizeof b->conses[0])
              && (b != cons_block
                  || offset / sizeof b->conses[0] < cons_block_index)
-             && !EQ (CVAR ((struct Lisp_Cons *) p, car), Vdead));
+             && !EQ (((struct Lisp_Cons *) p)->car, Vdead));
     }
   else
     return 0;
@@ -4325,7 +4325,7 @@
              && offset < (SYMBOL_BLOCK_SIZE * sizeof b->symbols[0])
              && (b != symbol_block
                  || offset / sizeof b->symbols[0] < symbol_block_index)
-             && !EQ (SVAR (((struct Lisp_Symbol *)p), function), Vdead));
+             && !EQ (((struct Lisp_Symbol *)p)->function, Vdead));
     }
   else
     return 0;
@@ -5831,9 +5831,9 @@
   for (; ptr && !ptr->gcmarkbit; ptr = ptr->next)
     {
       ptr->gcmarkbit = 1;
-      mark_object (MVAR (ptr, start));
-      mark_object (MVAR (ptr, end));
-      mark_object (MVAR (ptr, plist));
+      mark_object (ptr->start);
+      mark_object (ptr->end);
+      mark_object (ptr->plist);
     }
 }
 
@@ -6067,8 +6067,8 @@
          break;
        CHECK_ALLOCATED_AND_LIVE (live_symbol_p);
        ptr->gcmarkbit = 1;
-       mark_object (SVAR (ptr, function));
-       mark_object (SVAR (ptr, plist));
+       mark_object (ptr->function);
+       mark_object (ptr->plist);
        switch (ptr->redirect)
          {
          case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break;
@@ -6099,9 +6099,9 @@
            break;
          default: abort ();
          }
-       if (!PURE_POINTER_P (XSTRING (SVAR (ptr, xname))))
-         MARK_STRING (XSTRING (SVAR (ptr, xname)));
-       MARK_INTERVAL_TREE (STRING_INTERVALS (SVAR (ptr, xname)));
+       if (!PURE_POINTER_P (XSTRING (ptr->name)))
+         MARK_STRING (XSTRING (ptr->name));
+       MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->name));
 
        ptr = ptr->next;
        if (ptr)
@@ -6163,14 +6163,14 @@
        CHECK_ALLOCATED_AND_LIVE (live_cons_p);
        CONS_MARK (ptr);
        /* If the cdr is nil, avoid recursion for the car.  */
-       if (EQ (CVAR (ptr, u.cdr), Qnil))
+       if (EQ (ptr->u.cdr, Qnil))
          {
-           obj = CVAR (ptr, car);
+           obj = ptr->car;
            cdr_count = 0;
            goto loop;
          }
-       mark_object (CVAR (ptr, car));
-       obj = CVAR (ptr, u.cdr);
+       mark_object (ptr->car);
+       obj = ptr->u.cdr;
        cdr_count++;
        if (cdr_count == mark_object_loop_halt)
          abort ();
@@ -6319,7 +6319,7 @@
                        cblk->conses[pos].u.chain = cons_free_list;
                        cons_free_list = &cblk->conses[pos];
 #if GC_MARK_STACK
-                       CVAR (cons_free_list, car) = Vdead;
+                       cons_free_list->car = Vdead;
 #endif
                      }
                    else
@@ -6467,7 +6467,7 @@
            /* Check if the symbol was created during loadup.  In such a case
               it might be pointed to by pure bytecode which we don't trace,
               so we conservatively assume that it is live.  */
-           int pure_p = PURE_POINTER_P (XSTRING (sym->s.INTERNAL_FIELD 
(xname)));
+           int pure_p = PURE_POINTER_P (XSTRING (sym->s.name));
 
            if (!sym->s.gcmarkbit && !pure_p)
              {
@@ -6476,7 +6476,7 @@
                sym->s.next = symbol_free_list;
                symbol_free_list = &sym->s;
 #if GC_MARK_STACK
-               SVAR (symbol_free_list, function) = Vdead;
+               symbol_free_list->function = Vdead;
 #endif
                ++this_free;
              }
@@ -6484,7 +6484,7 @@
              {
                ++num_used;
                if (!pure_p)
-                 UNMARK_STRING (XSTRING (sym->s.INTERNAL_FIELD (xname)));
+                 UNMARK_STRING (XSTRING (sym->s.name));
                sym->s.gcmarkbit = 0;
              }
          }
@@ -6669,10 +6669,10 @@
               XSETSYMBOL (tem, sym);
               val = find_symbol_value (tem);
               if (EQ (val, obj)
-                  || EQ (SVAR (sym, function), obj)
-                  || (!NILP (SVAR (sym, function))
-                      && COMPILEDP (SVAR (sym, function))
-                      && EQ (AREF (SVAR (sym, function), COMPILED_BYTECODE), 
obj))
+                  || EQ (sym->function, obj)
+                  || (!NILP (sym->function)
+                      && COMPILEDP (sym->function)
+                      && EQ (AREF (sym->function, COMPILED_BYTECODE), obj))
                   || (!NILP (val)
                       && COMPILEDP (val)
                       && EQ (AREF (val, COMPILED_BYTECODE), obj)))

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-08-07 07:33:18 +0000
+++ b/src/buffer.c      2012-08-07 13:37:21 +0000
@@ -419,17 +419,17 @@
       Lisp_Object overlay, start, end;
       struct Lisp_Marker *m;
 
-      eassert (MARKERP (MVAR (list, start)));
-      m = XMARKER (MVAR (list, start));
+      eassert (MARKERP (list->start));
+      m = XMARKER (list->start);
       start = build_marker (b, m->charpos, m->bytepos);
       XMARKER (start)->insertion_type = m->insertion_type;
 
-      eassert (MARKERP (MVAR (list, end)));
-      m = XMARKER (MVAR (list, end));
+      eassert (MARKERP (list->end));
+      m = XMARKER (list->end);
       end = build_marker (b, m->charpos, m->bytepos);
       XMARKER (end)->insertion_type = m->insertion_type;
 
-      overlay = build_overlay (start, end, Fcopy_sequence (MVAR (list, 
plist)));
+      overlay = build_overlay (start, end, Fcopy_sequence (list->plist));
       if (tail)
        tail = tail->next = XOVERLAY (overlay);
       else
@@ -659,11 +659,11 @@
 static void
 drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
 {
-  eassert (b == XBUFFER (Fmarker_buffer (MVAR (ov, start))));
-  modify_overlay (b, marker_position (MVAR (ov, start)),
-                 marker_position (MVAR (ov, end)));
-  Fset_marker (MVAR (ov, start), Qnil, Qnil);
-  Fset_marker (MVAR (ov, end), Qnil, Qnil);
+  eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
+  modify_overlay (b, marker_position (ov->start),
+                 marker_position (ov->end));
+  Fset_marker (ov->start, Qnil, Qnil);
+  Fset_marker (ov->end, Qnil, Qnil);
 
 }
 
@@ -3889,7 +3889,7 @@
 {
   CHECK_OVERLAY (overlay);
 
-  return Fcopy_sequence (MVAR (XOVERLAY (overlay), plist));
+  return Fcopy_sequence (XOVERLAY (overlay)->plist);
 }
 
 
@@ -4065,7 +4065,7 @@
   (Lisp_Object overlay, Lisp_Object prop)
 {
   CHECK_OVERLAY (overlay);
-  return lookup_char_property (MVAR (XOVERLAY (overlay), plist), prop, 0);
+  return lookup_char_property (XOVERLAY (overlay)->plist, prop, 0);
 }
 
 DEFUN ("overlay-put", Foverlay_put, Soverlay_put, 3, 3, 0,
@@ -4080,7 +4080,7 @@
 
   buffer = Fmarker_buffer (OVERLAY_START (overlay));
 
-  for (tail = MVAR (XOVERLAY (overlay), plist);
+  for (tail = XOVERLAY (overlay)->plist;
        CONSP (tail) && CONSP (XCDR (tail));
        tail = XCDR (XCDR (tail)))
     if (EQ (XCAR (tail), prop))
@@ -4091,8 +4091,8 @@
       }
   /* It wasn't in the list, so add it to the front.  */
   changed = !NILP (value);
-  MVAR (XOVERLAY (overlay), plist)
-    = Fcons (prop, Fcons (value, MVAR (XOVERLAY (overlay), plist)));
+  set_overlay_plist
+    (overlay, Fcons (prop, Fcons (value, XOVERLAY (overlay)->plist)));
  found:
   if (! NILP (buffer))
     {

=== modified file 'src/buffer.h'
--- a/src/buffer.h      2012-08-06 16:22:43 +0000
+++ b/src/buffer.h      2012-08-07 13:37:21 +0000
@@ -991,15 +991,15 @@
 
 /* Return the marker that stands for where OV starts in the buffer.  */
 
-#define OVERLAY_START(OV) MVAR (XOVERLAY (OV), start)
+#define OVERLAY_START(OV) XOVERLAY (OV)->start
 
 /* Return the marker that stands for where OV ends in the buffer.  */
 
-#define OVERLAY_END(OV) MVAR (XOVERLAY (OV), end)
+#define OVERLAY_END(OV) XOVERLAY (OV)->end
 
 /* Return the plist of overlay OV.  */
 
-#define OVERLAY_PLIST(OV) MVAR (XOVERLAY (OV), plist)
+#define OVERLAY_PLIST(OV) XOVERLAY (OV)->plist
 
 /* Return the actual buffer position for the marker P.
    We assume you know which buffer it's pointing into.  */

=== modified file 'src/bytecode.c'
--- a/src/bytecode.c    2012-08-05 15:47:28 +0000
+++ b/src/bytecode.c    2012-08-07 13:37:21 +0000
@@ -818,7 +818,7 @@
                && !EQ (val, Qunbound)
                && !XSYMBOL (sym)->redirect
                && !SYMBOL_CONSTANT_P (sym))
-             SVAR (XSYMBOL (sym), val.value) = val;
+             SET_SYMBOL_VAL (XSYMBOL (sym), val);
            else
              {
                BEFORE_POTENTIAL_GC ();

=== modified file 'src/cmds.c'
--- a/src/cmds.c        2012-08-01 07:57:09 +0000
+++ b/src/cmds.c        2012-08-07 13:37:21 +0000
@@ -447,12 +447,11 @@
         and the hook has a non-nil `no-self-insert' property,
         return right away--don't really self-insert.  */
       if (SYMBOLP (sym) && ! NILP (sym)
-         && ! NILP (SVAR (XSYMBOL (sym), function))
-         && SYMBOLP (SVAR (XSYMBOL (sym), function)))
+         && ! NILP (XSYMBOL (sym)->function)
+         && SYMBOLP (XSYMBOL (sym)->function))
        {
          Lisp_Object prop;
-         prop = Fget (SVAR (XSYMBOL (sym), function),
-                      intern ("no-self-insert"));
+         prop = Fget (XSYMBOL (sym)->function, intern ("no-self-insert"));
          if (! NILP (prop))
            return 1;
        }

=== modified file 'src/data.c'
--- a/src/data.c        2012-08-07 05:29:25 +0000
+++ b/src/data.c        2012-08-07 13:37:21 +0000
@@ -562,7 +562,7 @@
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return (EQ (SVAR (XSYMBOL (symbol), function), Qunbound) ? Qnil : Qt);
+  return EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt;
 }
 
 DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -585,7 +585,7 @@
   CHECK_SYMBOL (symbol);
   if (NILP (symbol) || EQ (symbol, Qt))
     xsignal1 (Qsetting_constant, symbol);
-  SVAR (XSYMBOL (symbol), function) = Qunbound;
+  set_symbol_function (symbol, Qunbound);
   return symbol;
 }
 
@@ -594,8 +594,8 @@
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  if (!EQ (SVAR (XSYMBOL (symbol), function), Qunbound))
-    return SVAR (XSYMBOL (symbol), function);
+  if (!EQ (XSYMBOL (symbol)->function, Qunbound))
+    return XSYMBOL (symbol)->function;
   xsignal1 (Qvoid_function, symbol);
 }
 
@@ -604,7 +604,7 @@
   (register Lisp_Object symbol)
 {
   CHECK_SYMBOL (symbol);
-  return SVAR (XSYMBOL (symbol), plist);
+  return XSYMBOL (symbol)->plist;
 }
 
 DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
@@ -628,7 +628,7 @@
   if (NILP (symbol) || EQ (symbol, Qt))
     xsignal1 (Qsetting_constant, symbol);
 
-  function = SVAR (XSYMBOL (symbol), function);
+  function = XSYMBOL (symbol)->function;
 
   if (!NILP (Vautoload_queue) && !EQ (function, Qunbound))
     Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
@@ -636,13 +636,13 @@
   if (CONSP (function) && EQ (XCAR (function), Qautoload))
     Fput (symbol, Qautoload, XCDR (function));
 
-  SVAR (XSYMBOL (symbol), function) = definition;
+  set_symbol_function (symbol, definition);
   /* Handle automatic advice activation.  */
-  if (CONSP (SVAR (XSYMBOL (symbol), plist))
+  if (CONSP (XSYMBOL (symbol)->plist)
       && !NILP (Fget (symbol, Qad_advice_info)))
     {
       call2 (Qad_activate_internal, symbol, Qnil);
-      definition = SVAR (XSYMBOL (symbol), function);
+      definition = XSYMBOL (symbol)->function;
     }
   return definition;
 }
@@ -657,8 +657,8 @@
   (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
-  if (CONSP (SVAR (XSYMBOL (symbol), function))
-      && EQ (XCAR (SVAR (XSYMBOL (symbol), function)), Qautoload))
+  if (CONSP (XSYMBOL (symbol)->function)
+      && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
     LOADHIST_ATTACH (Fcons (Qt, symbol));
   if (!NILP (Vpurify_flag)
       /* If `definition' is a keymap, immutable (and copying) is wrong.  */
@@ -679,7 +679,7 @@
   (register Lisp_Object symbol, Lisp_Object newplist)
 {
   CHECK_SYMBOL (symbol);
-  SVAR (XSYMBOL (symbol), plist) = newplist;
+  set_symbol_plist (symbol, newplist);
   return newplist;
 }
 
@@ -2019,12 +2019,12 @@
     {
       if (!SYMBOLP (hare) || EQ (hare, Qunbound))
        break;
-      hare = SVAR (XSYMBOL (hare), function);
+      hare = XSYMBOL (hare)->function;
       if (!SYMBOLP (hare) || EQ (hare, Qunbound))
        break;
-      hare = SVAR (XSYMBOL (hare), function);
+      hare = XSYMBOL (hare)->function;
 
-      tortoise = SVAR (XSYMBOL (tortoise), function);
+      tortoise = XSYMBOL (tortoise)->function;
 
       if (EQ (hare, tortoise))
        xsignal1 (Qcyclic_function_indirection, object);
@@ -2048,7 +2048,7 @@
   /* Optimize for no indirection.  */
   result = object;
   if (SYMBOLP (result) && !EQ (result, Qunbound)
-      && (result = SVAR (XSYMBOL (result), function), SYMBOLP (result)))
+      && (result = XSYMBOL (result)->function, SYMBOLP (result)))
     result = indirect_function (result);
   if (!EQ (result, Qunbound))
     return result;
@@ -3196,7 +3196,7 @@
   defsubr (&Ssubr_arity);
   defsubr (&Ssubr_name);
 
-  SVAR (XSYMBOL (Qwholenump), function) = SVAR (XSYMBOL (Qnatnump), function);
+  set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
 
   DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
               doc: /* The largest value that is representable in a Lisp 
integer.  */);

=== modified file 'src/doc.c'
--- a/src/doc.c 2012-08-03 23:36:11 +0000
+++ b/src/doc.c 2012-08-07 13:37:21 +0000
@@ -508,7 +508,7 @@
 {
   /* Don't use indirect_function here, or defaliases will apply their
      docstrings to the base functions (Bug#2603).  */
-  Lisp_Object fun = SYMBOLP (obj) ? SVAR (XSYMBOL (obj), function) : obj;
+  Lisp_Object fun = SYMBOLP (obj) ? XSYMBOL (obj)->function : obj;
 
   /* The type determines where the docstring is stored.  */
 

=== modified file 'src/eval.c'
--- a/src/eval.c        2012-08-07 05:29:25 +0000
+++ b/src/eval.c        2012-08-07 13:37:21 +0000
@@ -976,7 +976,7 @@
          tem = Fassq (sym, environment);
          if (NILP (tem))
            {
-             def = SVAR (XSYMBOL (sym), function);
+             def = XSYMBOL (sym)->function;
              if (!EQ (def, Qunbound))
                continue;
            }
@@ -1893,9 +1893,9 @@
   CHECK_STRING (file);
 
   /* If function is defined and not as an autoload, don't override.  */
-  if (!EQ (SVAR (XSYMBOL (function), function), Qunbound)
-      && !(CONSP (SVAR (XSYMBOL (function), function))
-          && EQ (XCAR (SVAR (XSYMBOL (function), function)), Qautoload)))
+  if (!EQ (XSYMBOL (function)->function, Qunbound)
+      && !(CONSP (XSYMBOL (function)->function)
+          && EQ (XCAR (XSYMBOL (function)->function), Qautoload)))
     return Qnil;
 
   if (NILP (Vpurify_flag))
@@ -2081,7 +2081,7 @@
   /* Optimize for no indirection.  */
   fun = original_fun;
   if (SYMBOLP (fun) && !EQ (fun, Qunbound)
-      && (fun = SVAR (XSYMBOL (fun), function), SYMBOLP (fun)))
+      && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
     fun = indirect_function (fun);
 
   if (SUBRP (fun))
@@ -2266,7 +2266,7 @@
 
   /* Optimize for no indirection.  */
   if (SYMBOLP (fun) && !EQ (fun, Qunbound)
-      && (fun = SVAR (XSYMBOL (fun), function), SYMBOLP (fun)))
+      && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
     fun = indirect_function (fun);
   if (EQ (fun, Qunbound))
     {
@@ -2771,7 +2771,7 @@
   /* Optimize for no indirection.  */
   fun = original_fun;
   if (SYMBOLP (fun) && !EQ (fun, Qunbound)
-      && (fun = SVAR (XSYMBOL (fun), function), SYMBOLP (fun)))
+      && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
     fun = indirect_function (fun);
 
   if (SUBRP (fun))

=== modified file 'src/fns.c'
--- a/src/fns.c 2012-08-05 15:47:28 +0000
+++ b/src/fns.c 2012-08-07 13:37:21 +0000
@@ -1868,7 +1868,7 @@
   (Lisp_Object symbol, Lisp_Object propname)
 {
   CHECK_SYMBOL (symbol);
-  return Fplist_get (SVAR (XSYMBOL (symbol), plist), propname);
+  return Fplist_get (XSYMBOL (symbol)->plist, propname);
 }
 
 DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0,
@@ -1910,8 +1910,8 @@
   (Lisp_Object symbol, Lisp_Object propname, Lisp_Object value)
 {
   CHECK_SYMBOL (symbol);
-  SVAR (XSYMBOL (symbol), plist)
-    = Fplist_put (SVAR (XSYMBOL (symbol), plist), propname, value);
+  set_symbol_plist
+    (symbol, Fplist_put (XSYMBOL (symbol)->plist, propname, value));
   return value;
 }
 
@@ -2053,8 +2053,8 @@
              || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
                                  depth + 1, props))
            return 0;
-         o1 = MVAR (XOVERLAY (o1), plist);
-         o2 = MVAR (XOVERLAY (o2), plist);
+         o1 = XOVERLAY (o1)->plist;
+         o2 = XOVERLAY (o2)->plist;
          goto tail_recurse;
        }
       if (MARKERP (o1))

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2012-08-07 07:33:18 +0000
+++ b/src/keyboard.c    2012-08-07 13:37:21 +0000
@@ -7896,7 +7896,7 @@
                       (such as lmenu.el set it up), check if the
                       original command matches the cached command.  */
                    && !(SYMBOLP (def)
-                        && EQ (tem, SVAR (XSYMBOL (def), function)))))
+                        && EQ (tem, XSYMBOL (def)->function))))
              keys = Qnil;
          }
 
@@ -8830,9 +8830,9 @@
   /* Handle a symbol whose function definition is a keymap
      or an array.  */
   if (SYMBOLP (next) && !NILP (Ffboundp (next))
-      && (ARRAYP (SVAR (XSYMBOL (next), function))
-         || KEYMAPP (SVAR (XSYMBOL (next), function))))
-    next = Fautoload_do_load (SVAR (XSYMBOL (next), function), next, Qnil);
+      && (ARRAYP (XSYMBOL (next)->function)
+         || KEYMAPP (XSYMBOL (next)->function)))
+    next = Fautoload_do_load (XSYMBOL (next)->function, next, Qnil);
 
   /* If the keymap gives a function, not an
      array, then call the function with one arg and use

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-08-07 07:33:18 +0000
+++ b/src/lisp.h        2012-08-07 13:37:21 +0000
@@ -633,10 +633,7 @@
 #define CHECK_TYPE(ok, Qxxxp, x) \
   do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0)
 
-/* Lisp fields are usually hidden from most code and accessed
-   via special macros.  Only select pieces of code, like the GC,
-   are allowed to use INTERNAL_FIELD directly.  Objects which
-   aren't using this convention should be fixed.  */
+/* Deprecated and will be removed soon.  */
 
 #define INTERNAL_FIELD(field) field ## _
 
@@ -648,20 +645,15 @@
 #define CHECK_STRING_OR_BUFFER(x) \
   CHECK_TYPE (STRINGP (x) || BUFFERP (x), Qbuffer_or_string_p, x)
 
-/* Most code should use this macro to
-   access Lisp fields in struct Lisp_Cons.  */
-
-#define CVAR(cons, field) ((cons)->INTERNAL_FIELD (field))
-
 struct Lisp_Cons
   {
     /* Car of this cons cell.  */
-    Lisp_Object INTERNAL_FIELD (car);
+    Lisp_Object car;
 
     union
     {
       /* Cdr of this cons cell.  */
-      Lisp_Object INTERNAL_FIELD (cdr);
+      Lisp_Object cdr;
 
       /* Used to chain conses on a free list.  */
       struct Lisp_Cons *chain;
@@ -675,8 +667,8 @@
    fields are not accessible as lvalues.  (What if we want to switch to
    a copying collector someday?  Cached cons cell field addresses may be
    invalidated at arbitrary points.)  */
-#define XCAR_AS_LVALUE(c) (CVAR (XCONS (c), car))
-#define XCDR_AS_LVALUE(c) (CVAR (XCONS (c), u.cdr))
+#define XCAR_AS_LVALUE(c) (XCONS (c)->car)
+#define XCDR_AS_LVALUE(c) (XCONS (c)->u.cdr)
 
 /* Use these from normal code.  */
 #define XCAR(c)        LISP_MAKE_RVALUE (XCAR_AS_LVALUE (c))
@@ -1067,11 +1059,6 @@
   SYMBOL_FORWARDED = 3
 };
 
-/* Most code should use this macro to access
-   Lisp fields in struct Lisp_Symbol.  */
-
-#define SVAR(sym, field) ((sym)->INTERNAL_FIELD (field))
-
 struct Lisp_Symbol
 {
   unsigned gcmarkbit : 1;
@@ -1096,25 +1083,23 @@
      special (with `defvar' etc), and shouldn't be lexically bound.  */
   unsigned declared_special : 1;
 
-  /* The symbol's name, as a Lisp string.
-     The name "xname" is used to intentionally break code referring to
-     the old field "name" of type pointer to struct Lisp_String.  */
-  Lisp_Object INTERNAL_FIELD (xname);
+  /* The symbol's name, as a Lisp string.  */
+  Lisp_Object name;
 
   /* Value of the symbol or Qunbound if unbound.  Which alternative of the
      union is used depends on the `redirect' field above.  */
   union {
-    Lisp_Object INTERNAL_FIELD (value);
+    Lisp_Object value;
     struct Lisp_Symbol *alias;
     struct Lisp_Buffer_Local_Value *blv;
     union Lisp_Fwd *fwd;
   } val;
 
   /* Function value of the symbol or Qunbound if not fboundp.  */
-  Lisp_Object INTERNAL_FIELD (function);
+  Lisp_Object function;
 
   /* The symbol's property list.  */
-  Lisp_Object INTERNAL_FIELD (plist);
+  Lisp_Object plist;
 
   /* Next symbol in obarray bucket, if the symbol is interned.  */
   struct Lisp_Symbol *next;
@@ -1122,43 +1107,42 @@
 
 /* Value is name of symbol.  */
 
-#define SYMBOL_VAL(sym)   \
-  (eassert ((sym)->redirect == SYMBOL_PLAINVAL),  SVAR (sym, val.value))
-#define SYMBOL_ALIAS(sym) \
+#define SYMBOL_VAL(sym)                                                        
\
+  (eassert ((sym)->redirect == SYMBOL_PLAINVAL),  sym->val.value)
+#define SYMBOL_ALIAS(sym)                                              \
   (eassert ((sym)->redirect == SYMBOL_VARALIAS),  (sym)->val.alias)
-#define SYMBOL_BLV(sym)   \
+#define SYMBOL_BLV(sym)                                                        
\
   (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv)
-#define SYMBOL_FWD(sym)   \
+#define SYMBOL_FWD(sym)                                                        
\
   (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd)
-#define SET_SYMBOL_VAL(sym, v)     \
-  (eassert ((sym)->redirect == SYMBOL_PLAINVAL),  SVAR (sym, val.value) = (v))
-#define SET_SYMBOL_ALIAS(sym, v)   \
+#define SET_SYMBOL_VAL(sym, v)                                         \
+  (eassert ((sym)->redirect == SYMBOL_PLAINVAL),  (sym)->val.value = (v))
+#define SET_SYMBOL_ALIAS(sym, v)                                       \
   (eassert ((sym)->redirect == SYMBOL_VARALIAS),  (sym)->val.alias = (v))
-#define SET_SYMBOL_BLV(sym, v)     \
+#define SET_SYMBOL_BLV(sym, v)                                         \
   (eassert ((sym)->redirect == SYMBOL_LOCALIZED), (sym)->val.blv = (v))
-#define SET_SYMBOL_FWD(sym, v) \
+#define SET_SYMBOL_FWD(sym, v)                                         \
   (eassert ((sym)->redirect == SYMBOL_FORWARDED), (sym)->val.fwd = (v))
 
-#define SYMBOL_NAME(sym)  \
-     LISP_MAKE_RVALUE (SVAR (XSYMBOL (sym), xname))
+#define SYMBOL_NAME(sym) XSYMBOL (sym)->name
 
 /* Value is non-zero if SYM is an interned symbol.  */
 
-#define SYMBOL_INTERNED_P(sym)  \
-     (XSYMBOL (sym)->interned != SYMBOL_UNINTERNED)
+#define SYMBOL_INTERNED_P(sym)                         \
+  (XSYMBOL (sym)->interned != SYMBOL_UNINTERNED)
 
 /* Value is non-zero if SYM is interned in initial_obarray.  */
 
-#define SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P(sym) \
-     (XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY)
+#define SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P(sym)                      \
+  (XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY)
 
 /* Value is non-zero if symbol is considered a constant, i.e. its
    value cannot be changed (there is an exception for keyword symbols,
    whose value can be set to the keyword symbol itself).  */
 
-#define SYMBOL_CONSTANT_P(sym)   XSYMBOL (sym)->constant
+#define SYMBOL_CONSTANT_P(sym) XSYMBOL (sym)->constant
 
-#define DEFSYM(sym, name)      \
+#define DEFSYM(sym, name)                                              \
   do { (sym) = intern_c_string ((name)); staticpro (&(sym)); } while (0)
 
 
@@ -1289,11 +1273,6 @@
 
 static double const DEFAULT_REHASH_SIZE = 1.5;
 
-/* Most code should use this macro to access
-   Lisp fields in a different misc objects.  */
-
-#define MVAR(misc, field) ((misc)->INTERNAL_FIELD (field))
-
 /* These structures are used for various misc types.  */
 
 struct Lisp_Misc_Any           /* Supertype of all Misc types.  */
@@ -1363,9 +1342,9 @@
     unsigned gcmarkbit : 1;
     int spacer : 15;
     struct Lisp_Overlay *next;
-    Lisp_Object INTERNAL_FIELD (start);
-    Lisp_Object INTERNAL_FIELD (end);
-    Lisp_Object INTERNAL_FIELD (plist);
+    Lisp_Object start;
+    Lisp_Object end;
+    Lisp_Object plist;
   };
 
 /* Hold a C pointer for later use.
@@ -2406,6 +2385,41 @@
   gc_aset (h->index, idx, val);
 }
 
+/* Use these functions to set Lisp_Object
+   or pointer slots of struct Lisp_Symbol.  */
+
+LISP_INLINE void
+set_symbol_name (Lisp_Object sym, Lisp_Object name)
+{
+  XSYMBOL (sym)->name = name;
+}
+
+LISP_INLINE void
+set_symbol_function (Lisp_Object sym, Lisp_Object function)
+{
+  XSYMBOL (sym)->function = function;
+}
+
+LISP_INLINE void
+set_symbol_plist (Lisp_Object sym, Lisp_Object plist)
+{
+  XSYMBOL (sym)->plist = plist;
+}
+
+LISP_INLINE void
+set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next)
+{
+  XSYMBOL (sym)->next = next;
+}
+
+/* Set overlay's property list.  */
+
+LISP_INLINE void
+set_overlay_plist (Lisp_Object overlay, Lisp_Object plist)
+{
+  XOVERLAY (overlay)->plist = plist;
+}
+
 /* Defined in data.c.  */
 extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
 extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;

=== modified file 'src/lread.c'
--- a/src/lread.c       2012-08-07 11:28:41 +0000
+++ b/src/lread.c       2012-08-07 13:37:21 +0000
@@ -3717,9 +3717,9 @@
 
   ptr = aref_addr (obarray, XINT(tem));
   if (SYMBOLP (*ptr))
-    XSYMBOL (sym)->next = XSYMBOL (*ptr);
+    set_symbol_next (sym, XSYMBOL (*ptr));
   else
-    XSYMBOL (sym)->next = 0;
+    set_symbol_next (sym, NULL);
   *ptr = sym;
   return sym;
 }
@@ -3816,7 +3816,7 @@
          XSETSYMBOL (following, XSYMBOL (tail)->next);
          if (EQ (following, tem))
            {
-             XSYMBOL (tail)->next = XSYMBOL (following)->next;
+             set_symbol_next (tail, XSYMBOL (following)->next);
              break;
            }
        }
@@ -3926,13 +3926,12 @@
   /* Fmake_symbol inits fields of new symbols with Qunbound and Qnil,
      so those two need to be fixed manually.  */
   SET_SYMBOL_VAL (XSYMBOL (Qunbound), Qunbound);
-  SVAR (XSYMBOL (Qunbound), function) = Qunbound;
-  SVAR (XSYMBOL (Qunbound), plist) = Qnil;
-  /* XSYMBOL (Qnil)->function = Qunbound; */
+  set_symbol_function (Qunbound, Qunbound);
+  set_symbol_plist (Qunbound, Qnil);
   SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
   XSYMBOL (Qnil)->constant = 1;
   XSYMBOL (Qnil)->declared_special = 1;
-  SVAR (XSYMBOL (Qnil), plist) = Qnil;
+  set_symbol_plist (Qnil, Qnil);
 
   Qt = intern_c_string ("t");
   SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
@@ -3951,10 +3950,11 @@
 void
 defsubr (struct Lisp_Subr *sname)
 {
-  Lisp_Object sym;
+  Lisp_Object sym, tem;
   sym = intern_c_string (sname->symbol_name);
   XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR);
-  XSETSUBR (SVAR (XSYMBOL (sym), function), sname);
+  XSETSUBR (tem, sname);
+  set_symbol_function (sym, tem);
 }
 
 #ifdef NOTDEF /* Use fset in subr.el now!  */

=== modified file 'src/nsselect.m'
--- a/src/nsselect.m    2012-08-01 20:15:30 +0000
+++ b/src/nsselect.m    2012-08-07 13:37:21 +0000
@@ -62,7 +62,7 @@
   if (EQ (sym, QPRIMARY))     return NXPrimaryPboard;
   if (EQ (sym, QSECONDARY))   return NXSecondaryPboard;
   if (EQ (sym, QTEXT))        return NSStringPboardType;
-  return [NSString stringWithUTF8String: SSDATA (SVAR (XSYMBOL (sym), xname))];
+  return [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (sym))];
 }
 
 static NSPasteboard *

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2012-08-07 07:33:18 +0000
+++ b/src/xterm.c       2012-08-07 13:37:21 +0000
@@ -10123,7 +10123,7 @@
        terminal->kboard->next_kboard = all_kboards;
        all_kboards = terminal->kboard;
 
-       if (!EQ (SVAR (XSYMBOL (Qvendor_specific_keysyms), function), Qunbound))
+       if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
          {
            char *vendor = ServerVendor (dpy);
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]