/* Lisp parsing and input streams.
Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995,
1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
/* Fetch the character code from the buffer. */
unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, pt_byte);
BUF_INC_POS (inbuffer, pt_byte);
- c = STRING_CHAR (p, pt_byte - orig_pt_byte);
+ c = STRING_CHAR (p);
if (multibyte)
*multibyte = 1;
}
/* Fetch the character code from the buffer. */
unsigned char *p = BUF_BYTE_ADDRESS (inbuffer, bytepos);
BUF_INC_POS (inbuffer, bytepos);
- c = STRING_CHAR (p, bytepos - orig_bytepos);
+ c = STRING_CHAR (p);
if (multibyte)
*multibyte = 1;
}
}
buf[i++] = c;
}
- return STRING_CHAR (buf, i);
+ return STRING_CHAR (buf);
}
/* Unread the character C in the way appropriate for the stream READCHARFUN.
if (len == 2)
{
- charset = emacs_mule_charset[buf[0]];
+ charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]);
code = buf[1] & 0x7F;
}
else if (len == 3)
if (buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_11
|| buf[0] == EMACS_MULE_LEADING_CODE_PRIVATE_12)
{
- charset = emacs_mule_charset[buf[1]];
+ charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]);
code = buf[2] & 0x7F;
}
else
{
- charset = emacs_mule_charset[buf[0]];
+ charset = CHARSET_FROM_ID (emacs_mule_charset[buf[0]]);
code = ((buf[1] << 8) | buf[2]) & 0x7F7F;
}
}
else
{
- charset = emacs_mule_charset[buf[1]];
+ charset = CHARSET_FROM_ID (emacs_mule_charset[buf[1]]);
code = ((buf[2] << 8) | buf[3]) & 0x7F7F;
}
c = DECODE_CHAR (charset, code);
`require' calls, in an element of `load-history' whose
car is the file name loaded. See `load-history'.
+While the file is in the process of being loaded, the variable
+`load-in-progress' is non-nil and the variable `load-file-name'
+is bound to the file's name.
+
Return t if the file exists and loads successfully. */)
(file, noerror, nomessage, nosuffix, must_suffix)
Lisp_Object file, noerror, nomessage, nosuffix, must_suffix;
if (!bcmp (SDATA (found) + SBYTES (found) - 4,
".elc", 4)
- || (version = safe_to_load_p (fd)) > 0)
+ || (fd >= 0 && (version = safe_to_load_p (fd)) > 0))
/* Load .elc files directly, but not when they are
remote and have no handler! */
{
/* This is repetitive but fast and simple. */
params[param_count] = QCsize;
params[param_count+1] = Fplist_get (tmp, Qsize);
- if (!NILP (params[param_count+1]))
- param_count+=2;
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
params[param_count] = QCtest;
params[param_count+1] = Fplist_get (tmp, Qtest);
- if (!NILP (params[param_count+1]))
- param_count+=2;
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
params[param_count] = QCweakness;
params[param_count+1] = Fplist_get (tmp, Qweakness);
- if (!NILP (params[param_count+1]))
- param_count+=2;
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
params[param_count] = QCrehash_size;
params[param_count+1] = Fplist_get (tmp, Qrehash_size);
- if (!NILP (params[param_count+1]))
- param_count+=2;
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
params[param_count] = QCrehash_threshold;
params[param_count+1] = Fplist_get (tmp, Qrehash_threshold);
- if (!NILP (params[param_count+1]))
- param_count+=2;
+ if (!NILP (params[param_count + 1]))
+ param_count += 2;
/* This is the hashtable data. */
data = Fplist_get (tmp, Qdata);
return ht;
}
+ UNREAD (c);
+ invalid_syntax ("#", 1);
}
if (c == '^')
{
}
}
}
- if (isfloat_string (read_buffer))
+ if (isfloat_string (read_buffer, 0))
{
/* Compute NaN and infinities using 0.0 in a variable,
to cope with compilers that think they are smarter
#define EXP_INT 16
int
-isfloat_string (cp)
+isfloat_string (cp, ignore_trailing)
register char *cp;
+ int ignore_trailing;
{
register int state;
cp += 3;
}
- return (((*cp == 0) || (*cp == ' ') || (*cp == '\t') || (*cp == '\n') || (*cp == '\r') || (*cp == '\f'))
+ return ((ignore_trailing
+ || (*cp == 0) || (*cp == ' ') || (*cp == '\t') || (*cp == '\n') || (*cp == '\r') || (*cp == '\f'))
&& (state == (LEAD_INT|DOT_CHAR|TRAIL_INT)
|| state == (DOT_CHAR|TRAIL_INT)
|| state == (LEAD_INT|E_CHAR|EXP_INT)
if (SYMBOLP (name) && !EQ (name, tem))
return Qnil;
+ /* There are plenty of other symbols which will screw up the Emacs
+ session if we unintern them, as well as even more ways to use
+ `setq' or `fset' or whatnot to make the Emacs session
+ unusable. Let's not go down this silly road. --Stef */
+ /* if (EQ (tem, Qnil) || EQ (tem, Qt))
+ error ("Attempt to unintern t or nil"); */
+
XSYMBOL (tem)->interned = SYMBOL_UNINTERNED;
XSYMBOL (tem)->constant = 0;
XSYMBOL (tem)->indirect_variable = 0;
Vafter_load_alist = Qnil;
DEFVAR_LISP ("load-history", &Vload_history,
- doc: /* Alist mapping file names to symbols and features.
-Each alist element is a list that starts with a file name,
-except for one element (optional) that starts with nil and describes
-definitions evaluated from buffers not visiting files.
-
-The file name is absolute and is the true file name (i.e. it doesn't
-contain symbolic links) of the loaded file.
-
-The remaining elements of each list are symbols defined as variables
-and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)',
-`(defun . FUNCTION)', `(autoload . SYMBOL)', `(defface . SYMBOL)'
-and `(t . SYMBOL)'. An element `(t . SYMBOL)' precedes an entry
-`(defun . FUNCTION)', and means that SYMBOL was an autoload before
-this file redefined it as a function.
+ doc: /* Alist mapping loaded file names to symbols and features.
+Each alist element should be a list (FILE-NAME ENTRIES...), where
+FILE-NAME is the name of a file that has been loaded into Emacs.
+The file name is absolute and true (i.e. it doesn't contain symlinks).
+As an exception, one of the alist elements may have FILE-NAME nil,
+for symbols and features not associated with any file.
+
+The remaining ENTRIES in the alist element describe the functions and
+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.
During preloading, the file name recorded is relative to the main Lisp
directory. These file names are converted to absolute at startup. */);