emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/lread.c [lexbind]


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/src/lread.c [lexbind]
Date: Sat, 04 Sep 2004 05:44:02 -0400

Index: emacs/src/lread.c
diff -c emacs/src/lread.c:1.288.2.5 emacs/src/lread.c:1.288.2.6
*** emacs/src/lread.c:1.288.2.5 Tue Apr 27 14:11:02 2004
--- emacs/src/lread.c   Sat Sep  4 09:20:10 2004
***************
*** 2163,2176 ****
                                                Qnil));
        }
        if (c == '[')
!       {
!         /* Accept compiled functions at read-time so that we don't have to
!            build them using function calls.  */
!         Lisp_Object tmp;
!         tmp = read_vector (readcharfun, 1);
!         return Fmake_byte_code (XVECTOR (tmp)->size,
!                                 XVECTOR (tmp)->contents);
!       }
        if (c == '(')
        {
          Lisp_Object tmp;
--- 2163,2170 ----
                                                Qnil));
        }
        if (c == '[')
!       /* `function vector' objects, including byte-compiled functions.  */
!       return read_vector (readcharfun, 1);
        if (c == '(')
        {
          Lisp_Object tmp;
***************
*** 2938,2946 ****
  
  
  static Lisp_Object
! read_vector (readcharfun, bytecodeflag)
       Lisp_Object readcharfun;
!      int bytecodeflag;
  {
    register int i;
    register int size;
--- 2932,2940 ----
  
  
  static Lisp_Object
! read_vector (readcharfun, read_funvec)
       Lisp_Object readcharfun;
!      int read_funvec;
  {
    register int i;
    register int size;
***************
*** 2948,2953 ****
--- 2942,2952 ----
    register Lisp_Object tem, item, vector;
    register struct Lisp_Cons *otem;
    Lisp_Object len;
+   /* If we're reading a funvec object we start out assuming it's also a
+      byte-code object (a subset of funvecs), so we can do any special
+      processing needed.  If it's just an ordinary funvec object, we'll
+      realize that as soon as we've read the first element.  */
+   int read_bytecode = read_funvec;
  
    tem = read_list (1, readcharfun);
    len = Flength (tem);
***************
*** 2958,2968 ****
    for (i = 0; i < size; i++)
      {
        item = Fcar (tem);
        /* If `load-force-doc-strings' is t when reading a lazily-loaded
         bytecode object, the docstring containing the bytecode and
         constants values must be treated as unibyte and passed to
         Fread, to get the actual bytecode string and constants vector.  */
!       if (bytecodeflag && load_force_doc_strings)
        {
          if (i == COMPILED_BYTECODE)
            {
--- 2957,2975 ----
    for (i = 0; i < size; i++)
      {
        item = Fcar (tem);
+ 
+       /* If READ_BYTECODE is set, check whether this is really a byte-code
+        object, or just an ordinary `funvec' object -- non-byte-code
+        funvec objects use the same reader syntax.  We can tell from the
+        first element which one it is.  */
+       if (read_bytecode && i == 0 && ! FUNVEC_COMPILED_TAG_P (item))
+       read_bytecode = 0;      /* Nope. */
+ 
        /* If `load-force-doc-strings' is t when reading a lazily-loaded
         bytecode object, the docstring containing the bytecode and
         constants values must be treated as unibyte and passed to
         Fread, to get the actual bytecode string and constants vector.  */
!       if (read_bytecode && load_force_doc_strings)
        {
          if (i == COMPILED_BYTECODE)
            {
***************
*** 3006,3011 ****
--- 3013,3026 ----
        tem = Fcdr (tem);
        free_cons (otem);
      }
+ 
+   if (read_bytecode && size >= 4)
+     /* Convert this vector to a bytecode object.  */
+     vector = Fmake_byte_code (size, XVECTOR (vector)->contents);
+   else if (read_funvec && size >= 1)
+     /* Convert this vector to an ordinary funvec object.  */
+     XSETFUNVEC (vector, XVECTOR (vector));
+ 
    return vector;
  }
  




reply via email to

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