c = READCHAR;
}
- if (c >= 0)
- UNREAD (c);
+ UNREAD (c);
*p = '\0';
}
nskip *= 10;
nskip += c - '0';
}
- if (c >= 0)
- UNREAD (c);
+ UNREAD (c);
if (load_force_doc_strings
&& (EQ (readcharfun, Qget_file_char)
if (saved_doc_string_size == 0)
{
+ saved_doc_string = (char *) xmalloc (nskip + extra);
saved_doc_string_size = nskip + extra;
- saved_doc_string = (char *) xmalloc (saved_doc_string_size);
}
if (nskip > saved_doc_string_size)
{
- saved_doc_string_size = nskip + extra;
saved_doc_string = (char *) xrealloc (saved_doc_string,
- saved_doc_string_size);
+ nskip + extra);
+ saved_doc_string_size = nskip + extra;
}
saved_doc_string_position = file_tell (instream);
{
uninterned_symbol = 1;
c = READCHAR;
- goto default_label;
+ if (!(c > 040
+ && c != 0x8a0
+ && (c >= 0200
+ || strchr ("\"';()[]#`,", c) == NULL)))
+ {
+ /* No symbol character follows, this is the empty
+ symbol. */
+ UNREAD (c);
+ return Fmake_symbol (build_string (""));
+ }
+ goto read_symbol;
}
/* Reader forms that can reuse previously read objects. */
if (c >= '0' && c <= '9')
next_char = READCHAR;
ok = (next_char <= 040
|| (next_char < 0200
- && (strchr ("\"';()[]#?`,.", next_char))));
+ && strchr ("\"';()[]#?`,.", next_char) != NULL));
UNREAD (next_char);
if (ok)
return make_number (c);
if (end - p < MAX_MULTIBYTE_LENGTH)
{
ptrdiff_t offset = p - read_buffer;
+ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
+ memory_full (SIZE_MAX);
read_buffer = (char *) xrealloc (read_buffer,
- read_buffer_size *= 2);
+ read_buffer_size * 2);
+ read_buffer_size *= 2;
p = read_buffer + offset;
end = read_buffer + read_buffer_size;
}
/* Otherwise, READ_BUFFER contains only ASCII. */
}
- /* We want readchar_count to be the number of characters, not
- bytes. Hence we adjust for multibyte characters in the
- string. ... But it doesn't seem to be necessary, because
- READCHAR *does* read multibyte characters from buffers. */
- /* readchar_count -= (p - read_buffer) - nchars; */
if (read_pure)
return make_pure_string (read_buffer, nchars, p - read_buffer,
(force_multibyte
if (next_char <= 040
|| (next_char < 0200
- && (strchr ("\"';([#?`,", next_char))))
+ && strchr ("\"';([#?`,", next_char) != NULL))
{
*pch = c;
return Qnil;
if (c <= 040) goto retry;
if (c == 0x8a0) /* NBSP */
goto retry;
+
+ read_symbol:
{
char *p = read_buffer;
int quoted = 0;
+ EMACS_INT start_position = readchar_count - 1;
{
char *end = read_buffer + read_buffer_size;
if (end - p < MAX_MULTIBYTE_LENGTH)
{
ptrdiff_t offset = p - read_buffer;
+ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
+ memory_full (SIZE_MAX);
read_buffer = (char *) xrealloc (read_buffer,
- read_buffer_size *= 2);
+ read_buffer_size * 2);
+ read_buffer_size *= 2;
p = read_buffer + offset;
end = read_buffer + read_buffer_size;
}
else
*p++ = c;
c = READCHAR;
- } while (c > 040
- && c != 0x8a0 /* NBSP */
- && (c >= 0200
- || !(strchr ("\"';()[]#`,", c))));
+ }
+ while (c > 040
+ && c != 0x8a0 /* NBSP */
+ && (c >= 0200
+ || strchr ("\"';()[]#`,", c) == NULL));
if (p == end)
{
ptrdiff_t offset = p - read_buffer;
+ if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
+ memory_full (SIZE_MAX);
read_buffer = (char *) xrealloc (read_buffer,
- read_buffer_size *= 2);
+ read_buffer_size * 2);
+ read_buffer_size *= 2;
p = read_buffer + offset;
end = read_buffer + read_buffer_size;
}
*p = 0;
- if (c >= 0)
- UNREAD (c);
+ UNREAD (c);
}
if (!quoted && !uninterned_symbol)
if (EQ (Vread_with_symbol_positions, Qt)
|| EQ (Vread_with_symbol_positions, readcharfun))
Vread_symbol_positions_list =
- /* Kind of a hack; this will probably fail if characters
- in the symbol name were escaped. Not really a big
- deal, though. */
- Fcons (Fcons (result,
- make_number (readchar_count
- - XFASTINT (Flength (Fsymbol_name (result))))),
+ Fcons (Fcons (result, make_number (start_position)),
Vread_symbol_positions_list);
return result;
}
static size_t oblookup_last_bucket_number;
-static size_t hash_string (const char *ptr, size_t len);
-
/* Get an error if OBARRAY is not an obarray.
If it is one, return it. */
XSETINT (tem, hash);
return tem;
}
-
-static size_t
-hash_string (const char *ptr, size_t len)
-{
- register const char *p = ptr;
- register const char *end = p + len;
- register unsigned char c;
- register size_t hash = 0;
-
- while (p != end)
- {
- c = *p++;
- if (c >= 0140) c -= 40;
- hash = (hash << 3) + (hash >> (CHAR_BIT * sizeof hash - 4)) + c;
- }
- return hash;
-}
\f
void
map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg)
init_obarray (void)
{
Lisp_Object oblength;
+ ptrdiff_t size = 100 + MAX_MULTIBYTE_LENGTH;
XSETFASTINT (oblength, OBARRAY_SIZE);
/* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */
Vpurify_flag = Qt;
- Qvariable_documentation = intern_c_string ("variable-documentation");
- staticpro (&Qvariable_documentation);
+ DEFSYM (Qvariable_documentation, "variable-documentation");
- read_buffer_size = 100 + MAX_MULTIBYTE_LENGTH;
- read_buffer = (char *) xmalloc (read_buffer_size);
+ read_buffer = (char *) xmalloc (size);
+ read_buffer_size = size;
}
\f
void
#ifdef NOTDEF /* use fset in subr.el now */
void
-defalias (sname, string)
- struct Lisp_Subr *sname;
- char *string;
+defalias (struct Lisp_Subr *sname, char *string)
{
Lisp_Object sym;
sym = intern (string);
DEFVAR_BOOL ("load-in-progress", load_in_progress,
doc: /* Non-nil if inside of `load'. */);
- Qload_in_progress = intern_c_string ("load-in-progress");
- staticpro (&Qload_in_progress);
+ DEFSYM (Qload_in_progress, "load-in-progress");
DEFVAR_LISP ("after-load-alist", Vafter_load_alist,
doc: /* An alist of expressions to be evalled when particular files are loaded.
variables defined in that file, the features provided, and the
features required. Each entry has the form `(provide . FEATURE)',
`(require . FEATURE)', `(defun . FUNCTION)', `(autoload . SYMBOL)',
-`(defface . SYMBOL)', or `(t . SYMBOL)'. In addition, an entry `(t
-. SYMBOL)' may precede an entry `(defun . FUNCTION)', and means that
-SYMBOL was an autoload before this file redefined it as a function.
+`(defface . SYMBOL)', or `(t . SYMBOL)'. Entries like `(t . SYMBOL)'
+may precede a `(defun . FUNCTION)' entry, and means that SYMBOL was an
+autoload before this file redefined it as a function. In addition,
+entries may also be single symbols, which means that SYMBOL was
+defined by `defvar' or `defconst'.
During preloading, the file name recorded is relative to the main Lisp
directory. These file names are converted to absolute at startup. */);
Qlexical_binding = intern ("lexical-binding");
staticpro (&Qlexical_binding);
DEFVAR_LISP ("lexical-binding", Vlexical_binding,
- doc: /* If non-nil, use lexical binding when evaluating code.
-This only applies to code evaluated by `eval-buffer' and `eval-region'.
-This variable is automatically set from the file variables of an interpreted
- Lisp file read using `load'. */);
+ doc: /* Whether to use lexical binding when evaluating code.
+Non-nil means that the code in the current buffer should be evaluated
+with lexical binding.
+This variable is automatically set from the file variables of an
+interpreted Lisp file read using `load'. */);
Fmake_variable_buffer_local (Qlexical_binding);
DEFVAR_LISP ("eval-buffer-list", Veval_buffer_list,
DEFVAR_LISP ("old-style-backquotes", Vold_style_backquotes,
doc: /* Set to non-nil when `read' encounters an old-style backquote. */);
Vold_style_backquotes = Qnil;
- Qold_style_backquotes = intern_c_string ("old-style-backquotes");
- staticpro (&Qold_style_backquotes);
+ DEFSYM (Qold_style_backquotes, "old-style-backquotes");
/* Vsource_directory was initialized in init_lread. */
load_descriptor_list = Qnil;
staticpro (&load_descriptor_list);
- Qcurrent_load_list = intern_c_string ("current-load-list");
- staticpro (&Qcurrent_load_list);
-
- Qstandard_input = intern_c_string ("standard-input");
- staticpro (&Qstandard_input);
-
- Qread_char = intern_c_string ("read-char");
- staticpro (&Qread_char);
-
- Qget_file_char = intern_c_string ("get-file-char");
- staticpro (&Qget_file_char);
-
- Qget_emacs_mule_file_char = intern_c_string ("get-emacs-mule-file-char");
- staticpro (&Qget_emacs_mule_file_char);
-
- Qload_force_doc_strings = intern_c_string ("load-force-doc-strings");
- staticpro (&Qload_force_doc_strings);
-
- Qbackquote = intern_c_string ("`");
- staticpro (&Qbackquote);
- Qcomma = intern_c_string (",");
- staticpro (&Qcomma);
- Qcomma_at = intern_c_string (",@");
- staticpro (&Qcomma_at);
- Qcomma_dot = intern_c_string (",.");
- staticpro (&Qcomma_dot);
-
- Qinhibit_file_name_operation = intern_c_string ("inhibit-file-name-operation");
- staticpro (&Qinhibit_file_name_operation);
-
- Qascii_character = intern_c_string ("ascii-character");
- staticpro (&Qascii_character);
-
- Qfunction = intern_c_string ("function");
- staticpro (&Qfunction);
-
- Qload = intern_c_string ("load");
- staticpro (&Qload);
-
- Qload_file_name = intern_c_string ("load-file-name");
- staticpro (&Qload_file_name);
-
- Qeval_buffer_list = intern_c_string ("eval-buffer-list");
- staticpro (&Qeval_buffer_list);
-
- Qfile_truename = intern_c_string ("file-truename");
- staticpro (&Qfile_truename) ;
-
- Qdir_ok = intern_c_string ("dir-ok");
- staticpro (&Qdir_ok);
-
- Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation");
- staticpro (&Qdo_after_load_evaluation) ;
+ DEFSYM (Qcurrent_load_list, "current-load-list");
+ DEFSYM (Qstandard_input, "standard-input");
+ DEFSYM (Qread_char, "read-char");
+ DEFSYM (Qget_file_char, "get-file-char");
+ DEFSYM (Qget_emacs_mule_file_char, "get-emacs-mule-file-char");
+ DEFSYM (Qload_force_doc_strings, "load-force-doc-strings");
+
+ DEFSYM (Qbackquote, "`");
+ DEFSYM (Qcomma, ",");
+ DEFSYM (Qcomma_at, ",@");
+ DEFSYM (Qcomma_dot, ",.");
+
+ DEFSYM (Qinhibit_file_name_operation, "inhibit-file-name-operation");
+ DEFSYM (Qascii_character, "ascii-character");
+ DEFSYM (Qfunction, "function");
+ DEFSYM (Qload, "load");
+ DEFSYM (Qload_file_name, "load-file-name");
+ DEFSYM (Qeval_buffer_list, "eval-buffer-list");
+ DEFSYM (Qfile_truename, "file-truename");
+ DEFSYM (Qdir_ok, "dir-ok");
+ DEFSYM (Qdo_after_load_evaluation, "do-after-load-evaluation");
staticpro (&dump_path);
Vloads_in_progress = Qnil;
staticpro (&Vloads_in_progress);
- Qhash_table = intern_c_string ("hash-table");
- staticpro (&Qhash_table);
- Qdata = intern_c_string ("data");
- staticpro (&Qdata);
- Qtest = intern_c_string ("test");
- staticpro (&Qtest);
- Qsize = intern_c_string ("size");
- staticpro (&Qsize);
- Qweakness = intern_c_string ("weakness");
- staticpro (&Qweakness);
- Qrehash_size = intern_c_string ("rehash-size");
- staticpro (&Qrehash_size);
- Qrehash_threshold = intern_c_string ("rehash-threshold");
- staticpro (&Qrehash_threshold);
+ DEFSYM (Qhash_table, "hash-table");
+ DEFSYM (Qdata, "data");
+ DEFSYM (Qtest, "test");
+ DEFSYM (Qsize, "size");
+ DEFSYM (Qweakness, "weakness");
+ DEFSYM (Qrehash_size, "rehash-size");
+ DEFSYM (Qrehash_threshold, "rehash-threshold");
}