/[emacs]/emacs/src/lread.c
ViewVC logotype

Diff of /emacs/src/lread.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.304 by rms, Sat Dec 21 18:06:27 2002 UTC revision 1.305 by lektu, Tue Feb 4 14:03:12 2003 UTC
# Line 215  static Lisp_Object load_descriptor_unwin Line 215  static Lisp_Object load_descriptor_unwin
215     The READCHAR and UNREAD macros are meant for reading/unreading a     The READCHAR and UNREAD macros are meant for reading/unreading a
216     byte code; they do not handle multibyte characters.  The caller     byte code; they do not handle multibyte characters.  The caller
217     should manage them if necessary.     should manage them if necessary.
218      
219     [ Actually that seems to be a lie; READCHAR will definitely read     [ Actually that seems to be a lie; READCHAR will definitely read
220       multibyte characters from buffer sources, at least.  Is the       multibyte characters from buffer sources, at least.  Is the
221       comment just out of date?       comment just out of date?
# Line 233  readchar (readcharfun) Line 233  readchar (readcharfun)
233    register int c;    register int c;
234    
235    readchar_count++;    readchar_count++;
236      
237    if (BUFFERP (readcharfun))    if (BUFFERP (readcharfun))
238      {      {
239        register struct buffer *inbuffer = XBUFFER (readcharfun);        register struct buffer *inbuffer = XBUFFER (readcharfun);
# Line 411  unreadchar (readcharfun, c) Line 411  unreadchar (readcharfun, c)
411  static Lisp_Object read_internal_start P_ ((Lisp_Object, Lisp_Object,  static Lisp_Object read_internal_start P_ ((Lisp_Object, Lisp_Object,
412                                              Lisp_Object));                                              Lisp_Object));
413  static Lisp_Object read0 P_ ((Lisp_Object));  static Lisp_Object read0 P_ ((Lisp_Object));
414  static Lisp_Object read1 P_ ((Lisp_Object, int *, int));  static Lisp_Object read1 P_ ((Lisp_Object, int *, int));
415    
416  static Lisp_Object read_list P_ ((int, Lisp_Object));  static Lisp_Object read_list P_ ((int, Lisp_Object));
417  static Lisp_Object read_vector P_ ((Lisp_Object, int));  static Lisp_Object read_vector P_ ((Lisp_Object, int));
# Line 457  read_filtered_event (no_switch_frame, as Line 457  read_filtered_event (no_switch_frame, as
457    if (display_hourglass_p)    if (display_hourglass_p)
458      cancel_hourglass ();      cancel_hourglass ();
459  #endif  #endif
460      
461    delayed_switch_frame = Qnil;    delayed_switch_frame = Qnil;
462    
463    /* Read until we get an acceptable event.  */    /* Read until we get an acceptable event.  */
# Line 498  read_filtered_event (no_switch_frame, as Line 498  read_filtered_event (no_switch_frame, as
498                  XSETFASTINT (val, XINT (tem1) | XINT (Fcar (Fcdr (tem))));                  XSETFASTINT (val, XINT (tem1) | XINT (Fcar (Fcdr (tem))));
499              }              }
500          }          }
501              
502        /* If we don't have a character now, deal with it appropriately.  */        /* If we don't have a character now, deal with it appropriately.  */
503        if (!INTEGERP (val))        if (!INTEGERP (val))
504          {          {
# Line 709  Return t if file exists.  */) Line 709  Return t if file exists.  */)
709      }      }
710    else    else
711      file = Fsubstitute_in_file_name (file);      file = Fsubstitute_in_file_name (file);
712        
713    
714    /* Avoid weird lossage with null string as arg,    /* Avoid weird lossage with null string as arg,
715       since it would try to load a directory as a Lisp file */       since it would try to load a directory as a Lisp file */
# Line 1550  read_internal_start (stream, start, end) Line 1550  read_internal_start (stream, start, end)
1550        read_from_string_index_byte = string_char_to_byte (stream, startval);        read_from_string_index_byte = string_char_to_byte (stream, startval);
1551        read_from_string_limit = endval;        read_from_string_limit = endval;
1552      }      }
1553          
1554    retval = read0 (stream);    retval = read0 (stream);
1555    if (EQ (Vread_with_symbol_positions, Qt)    if (EQ (Vread_with_symbol_positions, Qt)
1556        || EQ (Vread_with_symbol_positions, stream))        || EQ (Vread_with_symbol_positions, stream))
# Line 1751  read_escape (readcharfun, stringp, byter Line 1751  read_escape (readcharfun, stringp, byter
1751                  break;                  break;
1752                }                }
1753            }            }
1754            
1755          *byterep = 1;          *byterep = 1;
1756          return i;          return i;
1757        }        }
# Line 1825  read_integer (readcharfun, radix) Line 1825  read_integer (readcharfun, radix)
1825          }          }
1826        else if (c == '+')        else if (c == '+')
1827          c = READCHAR;          c = READCHAR;
1828      
1829        while (c >= 0)        while (c >= 0)
1830          {          {
1831            int digit;            int digit;
1832          
1833            if (c >= '0' && c <= '9')            if (c >= '0' && c <= '9')
1834              digit = c - '0';              digit = c - '0';
1835            else if (c >= 'a' && c <= 'z')            else if (c >= 'a' && c <= 'z')
# Line 1894  to_multibyte (p, end, nchars) Line 1894  to_multibyte (p, end, nchars)
1894    if (nbytes != *nchars)    if (nbytes != *nchars)
1895      nbytes = str_as_multibyte (read_buffer, read_buffer_size,      nbytes = str_as_multibyte (read_buffer, read_buffer_size,
1896                                 *p - read_buffer, nchars);                                 *p - read_buffer, nchars);
1897      
1898    *p = read_buffer + nbytes;    *p = read_buffer + nbytes;
1899  }  }
1900    
# Line 1992  read1 (readcharfun, pch, first_in_list) Line 1992  read1 (readcharfun, pch, first_in_list)
1992                          == (SCHARS (tmp) - 1) * BITS_PER_CHAR))                          == (SCHARS (tmp) - 1) * BITS_PER_CHAR))
1993                  Fsignal (Qinvalid_read_syntax,                  Fsignal (Qinvalid_read_syntax,
1994                           Fcons (make_string ("#&...", 5), Qnil));                           Fcons (make_string ("#&...", 5), Qnil));
1995                    
1996                val = Fmake_bool_vector (length, Qnil);                val = Fmake_bool_vector (length, Qnil);
1997                bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,                bcopy (SDATA (tmp), XBOOL_VECTOR (val)->data,
1998                       size_in_chars);                       size_in_chars);
# Line 2047  read1 (readcharfun, pch, first_in_list) Line 2047  read1 (readcharfun, pch, first_in_list)
2047            UNGCPRO;            UNGCPRO;
2048            return tmp;            return tmp;
2049          }          }
2050          
2051        /* #@NUMBER is used to skip NUMBER following characters.        /* #@NUMBER is used to skip NUMBER following characters.
2052           That's used in .elc files to skip over doc strings           That's used in .elc files to skip over doc strings
2053           and function definitions.  */           and function definitions.  */
# Line 2064  read1 (readcharfun, pch, first_in_list) Line 2064  read1 (readcharfun, pch, first_in_list)
2064              }              }
2065            if (c >= 0)            if (c >= 0)
2066              UNREAD (c);              UNREAD (c);
2067              
2068            if (load_force_doc_strings && EQ (readcharfun, Qget_file_char))            if (load_force_doc_strings && EQ (readcharfun, Qget_file_char))
2069              {              {
2070                /* If we are supposed to force doc strings into core right now,                /* If we are supposed to force doc strings into core right now,
# Line 2170  read1 (readcharfun, pch, first_in_list) Line 2170  read1 (readcharfun, pch, first_in_list)
2170    
2171                /* ...and #n# will use the real value from now on.  */                /* ...and #n# will use the real value from now on.  */
2172                Fsetcdr (cell, tem);                Fsetcdr (cell, tem);
2173                  
2174                return tem;                return tem;
2175              }              }
2176            /* #n# returns a previously read object.  */            /* #n# returns a previously read object.  */
# Line 2183  read1 (readcharfun, pch, first_in_list) Line 2183  read1 (readcharfun, pch, first_in_list)
2183              }              }
2184            else if (c == 'r' ||  c == 'R')            else if (c == 'r' ||  c == 'R')
2185              return read_integer (readcharfun, n);              return read_integer (readcharfun, n);
2186              
2187            /* Fall through to error message.  */            /* Fall through to error message.  */
2188          }          }
2189        else if (c == 'x' || c == 'X')        else if (c == 'x' || c == 'X')
# Line 2442  read1 (readcharfun, pch, first_in_list) Line 2442  read1 (readcharfun, pch, first_in_list)
2442                    p = read_buffer + offset;                    p = read_buffer + offset;
2443                    end = read_buffer + read_buffer_size;                    end = read_buffer + read_buffer_size;
2444                  }                  }
2445                  
2446                if (c == '\\')                if (c == '\\')
2447                  {                  {
2448                    c = READCHAR;                    c = READCHAR;
# Line 2536  read1 (readcharfun, pch, first_in_list) Line 2536  read1 (readcharfun, pch, first_in_list)
2536              : intern (read_buffer);              : intern (read_buffer);
2537            if (EQ (Vread_with_symbol_positions, Qt)            if (EQ (Vread_with_symbol_positions, Qt)
2538                || EQ (Vread_with_symbol_positions, readcharfun))                || EQ (Vread_with_symbol_positions, readcharfun))
2539              Vread_symbol_positions_list =              Vread_symbol_positions_list =
2540                /* Kind of a hack; this will probably fail if characters                /* Kind of a hack; this will probably fail if characters
2541                   in the symbol name were escaped.  Not really a big                   in the symbol name were escaped.  Not really a big
2542                   deal, though.  */                   deal, though.  */
# Line 2567  substitute_object_in_subtree (object, pl Line 2567  substitute_object_in_subtree (object, pl
2567    /* Make all the substitutions. */    /* Make all the substitutions. */
2568    check_object    check_object
2569      = substitute_object_recurse (object, placeholder, object);      = substitute_object_recurse (object, placeholder, object);
2570      
2571    /* Clear seen_list because we're done with it. */    /* Clear seen_list because we're done with it. */
2572    seen_list = Qnil;    seen_list = Qnil;
2573    
# Line 2611  substitute_object_recurse (object, place Line 2611  substitute_object_recurse (object, place
2611       read_objects.  */       read_objects.  */
2612    if (!EQ (Qnil, Frassq (subtree, read_objects)))    if (!EQ (Qnil, Frassq (subtree, read_objects)))
2613      seen_list = Fcons (subtree, seen_list);      seen_list = Fcons (subtree, seen_list);
2614          
2615    /* Recurse according to subtree's type.    /* Recurse according to subtree's type.
2616       Every branch must return a Lisp_Object.  */       Every branch must return a Lisp_Object.  */
2617    switch (XTYPE (subtree))    switch (XTYPE (subtree))
# Line 2624  substitute_object_recurse (object, place Line 2624  substitute_object_recurse (object, place
2624            {            {
2625              Lisp_Object idx = make_number (i);              Lisp_Object idx = make_number (i);
2626              SUBSTITUTE (Faref (subtree, idx),              SUBSTITUTE (Faref (subtree, idx),
2627                          Faset (subtree, idx, true_value));                          Faset (subtree, idx, true_value));
2628            }            }
2629          return subtree;          return subtree;
2630        }        }
# Line 2645  substitute_object_recurse (object, place Line 2645  substitute_object_recurse (object, place
2645    
2646          INTERVAL    root_interval = STRING_INTERVALS (subtree);          INTERVAL    root_interval = STRING_INTERVALS (subtree);
2647          Lisp_Object arg           = Fcons (object, placeholder);          Lisp_Object arg           = Fcons (object, placeholder);
2648              
2649          traverse_intervals_noorder (root_interval,          traverse_intervals_noorder (root_interval,
2650                                      &substitute_in_interval, arg);                                      &substitute_in_interval, arg);
2651    
# Line 2682  isfloat_string (cp) Line 2682  isfloat_string (cp)
2682       register char *cp;       register char *cp;
2683  {  {
2684    register int state;    register int state;
2685      
2686    char *start = cp;    char *start = cp;
2687    
2688    state = 0;    state = 0;
# Line 2813  read_vector (readcharfun, bytecodeflag) Line 2813  read_vector (readcharfun, bytecodeflag)
2813      }      }
2814    return vector;    return vector;
2815  }  }
2816      
2817  /* FLAG = 1 means check for ] to terminate rather than ) and .  /* FLAG = 1 means check for ] to terminate rather than ) and .
2818     FLAG = -1 means check for starting with defun     FLAG = -1 means check for starting with defun
2819      and make structure pure.  */      and make structure pure.  */
# Line 2832  read_list (flag, readcharfun) Line 2832  read_list (flag, readcharfun)
2832    struct gcpro gcpro1, gcpro2;    struct gcpro gcpro1, gcpro2;
2833    /* 0 is the normal case.    /* 0 is the normal case.
2834       1 means this list is a doc reference; replace it with the number 0.       1 means this list is a doc reference; replace it with the number 0.
2835       2 means this list is a doc reference; replace it with the doc string.  */       2 means this list is a doc reference; replace it with the doc string.  */
2836    int doc_reference = 0;    int doc_reference = 0;
2837    
2838    /* Initialize this to 1 if we are reading a list.  */    /* Initialize this to 1 if we are reading a list.  */
# Line 3321  init_obarray () Line 3321  init_obarray ()
3321    /* Intern nil in the obarray */    /* Intern nil in the obarray */
3322    XSYMBOL (Qnil)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY;    XSYMBOL (Qnil)->interned = SYMBOL_INTERNED_IN_INITIAL_OBARRAY;
3323    XSYMBOL (Qnil)->constant = 1;    XSYMBOL (Qnil)->constant = 1;
3324      
3325    /* These locals are to kludge around a pyramid compiler bug. */    /* These locals are to kludge around a pyramid compiler bug. */
3326    hash = hash_string ("nil", 3);    hash = hash_string ("nil", 3);
3327    /* Separate statement here to avoid VAXC bug. */    /* Separate statement here to avoid VAXC bug. */
# Line 3454  defvar_per_buffer (namestring, address, Line 3454  defvar_per_buffer (namestring, address,
3454    SET_SYMBOL_VALUE (sym, val);    SET_SYMBOL_VALUE (sym, val);
3455    PER_BUFFER_SYMBOL (offset) = sym;    PER_BUFFER_SYMBOL (offset) = sym;
3456    PER_BUFFER_TYPE (offset) = type;    PER_BUFFER_TYPE (offset) = type;
3457      
3458    if (PER_BUFFER_IDX (offset) == 0)    if (PER_BUFFER_IDX (offset) == 0)
3459      /* Did a DEFVAR_PER_BUFFER without initializing the corresponding      /* Did a DEFVAR_PER_BUFFER without initializing the corresponding
3460         slot of buffer_local_flags */         slot of buffer_local_flags */
# Line 3626  init_lread () Line 3626  init_lread ()
3626  #endif  #endif
3627    
3628  #ifndef WINDOWSNT  #ifndef WINDOWSNT
3629    /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is    /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
3630       almost never correct, thereby causing a warning to be printed out that       almost never correct, thereby causing a warning to be printed out that
3631       confuses users.  Since PATH_LOADSEARCH is always overridden by the       confuses users.  Since PATH_LOADSEARCH is always overridden by the
3632       EMACSLOADPATH environment variable below, disable the warning on NT.  */       EMACSLOADPATH environment variable below, disable the warning on NT.  */
3633    
# Line 3750  symbol from the position where `read' or Line 3750  symbol from the position where `read' or
3750  Note that a symbol will appear multiple times in this list, if it was  Note that a symbol will appear multiple times in this list, if it was
3751  read multiple times.  The list is in the same order as the symbols  read multiple times.  The list is in the same order as the symbols
3752  were read in. */);  were read in. */);
3753    Vread_symbol_positions_list = Qnil;      Vread_symbol_positions_list = Qnil;
3754    
3755    DEFVAR_LISP ("load-path", &Vload_path,    DEFVAR_LISP ("load-path", &Vload_path,
3756                 doc: /* *List of directories to search for files to load.                 doc: /* *List of directories to search for files to load.
# Line 3914  to load.  See also `load-dangerous-libra Line 3914  to load.  See also `load-dangerous-libra
3914    staticpro (&read_objects);    staticpro (&read_objects);
3915    read_objects = Qnil;    read_objects = Qnil;
3916    staticpro (&seen_list);    staticpro (&seen_list);
3917      
3918    Vloads_in_progress = Qnil;    Vloads_in_progress = Qnil;
3919    staticpro (&Vloads_in_progress);    staticpro (&Vloads_in_progress);
3920  }  }

Legend:
Removed from v.1.304  
changed lines
  Added in v.1.305

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26