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


From: Kim F . Storm
Subject: [Emacs-diffs] Changes to emacs/src/lread.c
Date: Fri, 08 Apr 2005 19:33:28 -0400

Index: emacs/src/lread.c
diff -c emacs/src/lread.c:1.327 emacs/src/lread.c:1.328
*** emacs/src/lread.c:1.327     Tue Feb 15 06:44:50 2005
--- emacs/src/lread.c   Fri Apr  8 23:33:28 2005
***************
*** 206,211 ****
--- 206,212 ----
  static void to_multibyte P_ ((char **, char **, int *));
  static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object,
                              Lisp_Object (*) (), int,
+                             Lisp_Object, Lisp_Object,
                              Lisp_Object, Lisp_Object));
  static Lisp_Object load_unwind P_ ((Lisp_Object));
  static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object));
***************
*** 912,918 ****
    load_descriptor_list
      = Fcons (make_number (fileno (stream)), load_descriptor_list);
    load_in_progress++;
!   readevalloop (Qget_file_char, stream, file, Feval, 0, Qnil, Qnil);
    unbind_to (count, Qnil);
  
    /* Run any load-hooks for this file.  */
--- 913,920 ----
    load_descriptor_list
      = Fcons (make_number (fileno (stream)), load_descriptor_list);
    load_in_progress++;
!   readevalloop (Qget_file_char, stream, file, Feval,
!               0, Qnil, Qnil, Qnil, Qnil);
    unbind_to (count, Qnil);
  
    /* Run any load-hooks for this file.  */
***************
*** 1290,1305 ****
  
  /* UNIBYTE specifies how to set load_convert_to_unibyte
     for this invocation.
!    READFUN, if non-nil, is used instead of `read'.  */
  
  static void
! readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, 
readfun)
       Lisp_Object readcharfun;
       FILE *stream;
       Lisp_Object sourcename;
       Lisp_Object (*evalfun) ();
       int printflag;
       Lisp_Object unibyte, readfun;
  {
    register int c;
    register Lisp_Object val;
--- 1292,1310 ----
  
  /* UNIBYTE specifies how to set load_convert_to_unibyte
     for this invocation.
!    READFUN, if non-nil, is used instead of `read'.
!    START, END is region in current buffer (from eval-region).  */
  
  static void
! readevalloop (readcharfun, stream, sourcename, evalfun,
!             printflag, unibyte, readfun, start, end)
       Lisp_Object readcharfun;
       FILE *stream;
       Lisp_Object sourcename;
       Lisp_Object (*evalfun) ();
       int printflag;
       Lisp_Object unibyte, readfun;
+      Lisp_Object start, end;
  {
    register int c;
    register Lisp_Object val;
***************
*** 1327,1354 ****
    continue_reading_p = 1;
    while (continue_reading_p)
      {
        if (b != 0 && NILP (b->name))
        error ("Reading from killed buffer");
  
        instream = stream;
        c = READCHAR;
        if (c == ';')
        {
          while ((c = READCHAR) != '\n' && c != -1);
!         continue;
        }
-       if (c < 0) break;
  
        /* Ignore whitespace here, so we can detect eof.  */
        if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r')
!       continue;
  
        if (!NILP (Vpurify_flag) && c == '(')
        {
-         int count1 = SPECPDL_INDEX ();
          record_unwind_protect (unreadpure, Qnil);
          val = read_list (-1, readcharfun);
-         unbind_to (count1, Qnil);
        }
        else
        {
--- 1332,1372 ----
    continue_reading_p = 1;
    while (continue_reading_p)
      {
+       int count1 = SPECPDL_INDEX ();
+ 
        if (b != 0 && NILP (b->name))
        error ("Reading from killed buffer");
  
+       if (!NILP (start))
+       {
+         record_unwind_protect (save_excursion_restore, save_excursion_save 
());
+         record_unwind_protect (save_restriction_restore, 
save_restriction_save ());
+         Fgoto_char (start);
+         Fnarrow_to_region (make_number (BEGV), end);
+       }
+ 
        instream = stream;
+     read_next:
        c = READCHAR;
        if (c == ';')
        {
          while ((c = READCHAR) != '\n' && c != -1);
!         goto read_next;
!       }
!       if (c < 0)
!       {
!         unbind_to (count1, Qnil);
!         break;
        }
  
        /* Ignore whitespace here, so we can detect eof.  */
        if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r')
!       goto read_next;
  
        if (!NILP (Vpurify_flag) && c == '(')
        {
          record_unwind_protect (unreadpure, Qnil);
          val = read_list (-1, readcharfun);
        }
        else
        {
***************
*** 1374,1379 ****
--- 1392,1401 ----
            val = read_internal_start (readcharfun, Qnil, Qnil);
        }
  
+       if (!NILP (start) && continue_reading_p)
+       start = Fpoint_marker ();
+       unbind_to (count1, Qnil);
+ 
        val = (*evalfun) (val);
  
        if (printflag)
***************
*** 1432,1438 ****
    specbind (Qstandard_output, tem);
    record_unwind_protect (save_excursion_restore, save_excursion_save ());
    BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
!   readevalloop (buf, 0, filename, Feval, !NILP (printflag), unibyte, Qnil);
    unbind_to (count, Qnil);
  
    return Qnil;
--- 1454,1461 ----
    specbind (Qstandard_output, tem);
    record_unwind_protect (save_excursion_restore, save_excursion_save ());
    BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf)));
!   readevalloop (buf, 0, filename, Feval,
!               !NILP (printflag), unibyte, Qnil, Qnil, Qnil);
    unbind_to (count, Qnil);
  
    return Qnil;
***************
*** 1464,1478 ****
      tem = printflag;
    specbind (Qstandard_output, tem);
  
!   if (NILP (printflag))
!     record_unwind_protect (save_excursion_restore, save_excursion_save ());
!   record_unwind_protect (save_restriction_restore, save_restriction_save ());
! 
!   /* This both uses start and checks its type.  */
!   Fgoto_char (start);
!   Fnarrow_to_region (make_number (BEGV), end);
    readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval,
!               !NILP (printflag), Qnil, read_function);
  
    return unbind_to (count, Qnil);
  }
--- 1487,1496 ----
      tem = printflag;
    specbind (Qstandard_output, tem);
  
!   /* readevalloop calls functions which check the type of start and end.  */
    readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval,
!               !NILP (printflag), Qnil, read_function,
!               start, end);
  
    return unbind_to (count, Qnil);
  }




reply via email to

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