]> code.delx.au - gnu-emacs/blobdiff - src/bytecode.c
(set_properties, add_properties, remove_properties):
[gnu-emacs] / src / bytecode.c
index 9a5d231dd61fda494634799c15aa3f2998f1da34..ae290c273526953e395b9f11f6f82b22d66029c5 100644 (file)
@@ -15,7 +15,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
 
 hacked on by jwz@lucid.com 17-jun-91
   o  added a compile-time switch to turn on simple sanity checking;
@@ -129,7 +130,8 @@ Lisp_Object Qbytecode;
 #define Bmult 0137
 
 #define Bpoint 0140
-#define Bmark 0141 /* no longer generated as of v18 */
+/* Was Bmark in v17.  */
+#define Bsave_current_buffer 0141
 #define Bgoto_char 0142
 #define Binsert 0143
 #define Bpoint_max 0144
@@ -251,8 +253,9 @@ Lisp_Object Qbytecode;
 
 DEFUN ("byte-code", Fbyte_code, Sbyte_code, 3, 3, 0,
   "Function used internally in byte-compiled code.\n\
-The first argument is a string of byte code; the second, a vector of constants;\n\
-the third, the maximum stack depth used in this function.\n\
+The first argument, BYTESTR, is a string of byte code;\n\
+the second, VECTOR, a vector of constants;\n\
+the third, MAXDEPTH, the maximum stack depth used in this function.\n\
 If the third argument is incorrect, Emacs may crash.")
   (bytestr, vector, maxdepth)
      Lisp_Object bytestr, vector, maxdepth;
@@ -341,23 +344,8 @@ If the third argument is incorrect, Emacs may crash.")
          else
            {
              v2 = XSYMBOL (v1)->value;
-#ifdef SWITCH_ENUM_BUG
-             switch ((int) XTYPE (v2))
-#else
-             switch (XTYPE (v2))
-#endif
-               {
-               case Lisp_Symbol:
-                 if (!EQ (v2, Qunbound))
-                   break;
-               case Lisp_Intfwd:
-               case Lisp_Boolfwd:
-               case Lisp_Objfwd:
-               case Lisp_Buffer_Local_Value:
-               case Lisp_Some_Buffer_Local_Value:
-               case Lisp_Buffer_Objfwd:
-                 v2 = Fsymbol_value (v1);
-               }
+             if (MISCP (v2) || EQ (v2, Qunbound))
+               v2 = Fsymbol_value (v1);
            }
          PUSH (v2);
          break;
@@ -488,14 +476,14 @@ If the third argument is incorrect, Emacs may crash.")
 
        case BRgoto:
          QUIT;
-         pc += *pc - 127;
+         pc += (int) *pc - 127;
          break;
 
        case BRgotoifnil:
          if (NILP (POP))
            {
              QUIT;
-             pc += *pc - 128;
+             pc += (int) *pc - 128;
            }
          pc++;
          break;
@@ -504,7 +492,7 @@ If the third argument is incorrect, Emacs may crash.")
          if (!NILP (POP))
            {
              QUIT;
-             pc += *pc - 128;
+             pc += (int) *pc - 128;
            }
          pc++;
          break;
@@ -550,6 +538,10 @@ If the third argument is incorrect, Emacs may crash.")
          record_unwind_protect (save_excursion_restore, save_excursion_save ());
          break;
 
+       case Bsave_current_buffer:
+         record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+         break;
+
        case Bsave_window_excursion:
          TOP = Fsave_window_excursion (TOP);
          break;
@@ -773,7 +765,18 @@ If the third argument is incorrect, Emacs may crash.")
          v2 = POP; v1 = TOP;
          CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v1, 0);
          CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (v2, 0);
-         TOP = (XFLOATINT (v1) == XFLOATINT (v2)) ? Qt : Qnil;
+#ifdef LISP_FLOAT_TYPE
+         if (FLOATP (v1) || FLOATP (v2))
+           {
+             double f1, f2;
+
+             f1 = (FLOATP (v1) ? XFLOAT (v1)->data : XINT (v1));
+             f2 = (FLOATP (v2) ? XFLOAT (v2)->data : XINT (v2));
+             TOP = (f1 == f2 ? Qt : Qnil);
+           }
+         else
+#endif
+           TOP = (XINT (v1) == XINT (v2) ? Qt : Qnil);
          break;
 
        case Bgtr:
@@ -843,7 +846,7 @@ If the third argument is incorrect, Emacs may crash.")
          break;
 
        case Bpoint:
-         XSETFASTINT (v1, point);
+         XSETFASTINT (v1, PT);
          PUSH (v1);
          break;
 
@@ -876,12 +879,12 @@ If the third argument is incorrect, Emacs may crash.")
          break;
 
        case Bfollowing_char:
-         XSETFASTINT (v1, PT == ZV ? 0 : FETCH_CHAR (point));
+         v1 = Ffollowing_char ();
          PUSH (v1);
          break;
 
        case Bpreceding_char:
-         XSETFASTINT (v1, point <= BEGV ? 0 : FETCH_CHAR (point - 1));
+         v1 = Fprevious_char ();
          PUSH (v1);
          break;
 
@@ -952,7 +955,7 @@ If the third argument is incorrect, Emacs may crash.")
        case Bchar_syntax:
          CHECK_NUMBER (TOP, 0);
          XSETFASTINT (TOP,
-                      syntax_code_spec[(int) SYNTAX (0xFF & XINT (TOP))]);
+                      syntax_code_spec[(int) SYNTAX (XINT (TOP))]);
          break;
 
        case Bbuffer_substring: