/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
- Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2011
Free Software Foundation, Inc.
This file is part of GNU Emacs.
Lisp_Object Qinteger;
static Lisp_Object Qsymbol, Qstring, Qcons, Qmarker, Qoverlay;
-static Lisp_Object Qfloat, Qwindow_configuration, Qwindow;
+Lisp_Object Qwindow;
+static Lisp_Object Qfloat, Qwindow_configuration;
Lisp_Object Qprocess;
static Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
static void swap_in_symval_forwarding (struct Lisp_Symbol *, struct Lisp_Buffer_Local_Value *);
-Lisp_Object Vmost_positive_fixnum, Vmost_negative_fixnum;
-
void
circular_list_error (Lisp_Object list)
xsignal3 (Qargs_out_of_range, a1, a2, a3);
}
-/* On some machines, XINT needs a temporary location.
- Here it is, in case it is needed. */
-
-int sign_extend_temp;
-
-/* On a few machines, XINT can only be done by calling this. */
-
-int
-sign_extend_lisp_int (EMACS_INT num)
-{
- if (num & (((EMACS_INT) 1) << (VALBITS - 1)))
- return num | (((EMACS_INT) (-1)) << VALBITS);
- else
- return num & ((((EMACS_INT) 1) << VALBITS) - 1);
-}
\f
/* Data type predicates */
DEFUN ("eq", Feq, Seq, 2, 2, 0,
doc: /* Return t if the two args are the same Lisp object. */)
- (obj1, obj2)
- Lisp_Object obj1, obj2;
+ (Lisp_Object obj1, Lisp_Object obj2)
{
if (EQ (obj1, obj2))
return Qt;
DEFUN ("null", Fnull, Snull, 1, 1, 0,
doc: /* Return t if OBJECT is nil. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (NILP (object))
return Qt;
doc: /* Return a symbol representing the type of OBJECT.
The symbol returned names the object's basic type;
for example, (type-of 1) returns `integer'. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
switch (XTYPE (object))
{
DEFUN ("consp", Fconsp, Sconsp, 1, 1, 0,
doc: /* Return t if OBJECT is a cons cell. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (CONSP (object))
return Qt;
DEFUN ("atom", Fatom, Satom, 1, 1, 0,
doc: /* Return t if OBJECT is not a cons cell. This includes nil. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (CONSP (object))
return Qnil;
DEFUN ("listp", Flistp, Slistp, 1, 1, 0,
doc: /* Return t if OBJECT is a list, that is, a cons cell or nil.
Otherwise, return nil. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (CONSP (object) || NILP (object))
return Qt;
DEFUN ("nlistp", Fnlistp, Snlistp, 1, 1, 0,
doc: /* Return t if OBJECT is not a list. Lists include nil. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (CONSP (object) || NILP (object))
return Qnil;
\f
DEFUN ("symbolp", Fsymbolp, Ssymbolp, 1, 1, 0,
doc: /* Return t if OBJECT is a symbol. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (SYMBOLP (object))
return Qt;
doc: /* Return t if OBJECT is a keyword.
This means that it is a symbol with a print name beginning with `:'
interned in the initial obarray. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (SYMBOLP (object)
&& SREF (SYMBOL_NAME (object), 0) == ':'
DEFUN ("vectorp", Fvectorp, Svectorp, 1, 1, 0,
doc: /* Return t if OBJECT is a vector. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (VECTORP (object))
return Qt;
DEFUN ("stringp", Fstringp, Sstringp, 1, 1, 0,
doc: /* Return t if OBJECT is a string. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (STRINGP (object))
return Qt;
DEFUN ("multibyte-string-p", Fmultibyte_string_p, Smultibyte_string_p,
1, 1, 0,
doc: /* Return t if OBJECT is a multibyte string. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (STRINGP (object) && STRING_MULTIBYTE (object))
return Qt;
DEFUN ("char-table-p", Fchar_table_p, Schar_table_p, 1, 1, 0,
doc: /* Return t if OBJECT is a char-table. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (CHAR_TABLE_P (object))
return Qt;
DEFUN ("vector-or-char-table-p", Fvector_or_char_table_p,
Svector_or_char_table_p, 1, 1, 0,
doc: /* Return t if OBJECT is a char-table or vector. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (VECTORP (object) || CHAR_TABLE_P (object))
return Qt;
DEFUN ("bool-vector-p", Fbool_vector_p, Sbool_vector_p, 1, 1, 0,
doc: /* Return t if OBJECT is a bool-vector. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (BOOL_VECTOR_P (object))
return Qt;
DEFUN ("arrayp", Farrayp, Sarrayp, 1, 1, 0,
doc: /* Return t if OBJECT is an array (string or vector). */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (ARRAYP (object))
return Qt;
DEFUN ("sequencep", Fsequencep, Ssequencep, 1, 1, 0,
doc: /* Return t if OBJECT is a sequence (list or array). */)
- (object)
- register Lisp_Object object;
+ (register Lisp_Object object)
{
if (CONSP (object) || NILP (object) || ARRAYP (object))
return Qt;
DEFUN ("bufferp", Fbufferp, Sbufferp, 1, 1, 0,
doc: /* Return t if OBJECT is an editor buffer. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (BUFFERP (object))
return Qt;
DEFUN ("markerp", Fmarkerp, Smarkerp, 1, 1, 0,
doc: /* Return t if OBJECT is a marker (editor pointer). */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (MARKERP (object))
return Qt;
DEFUN ("subrp", Fsubrp, Ssubrp, 1, 1, 0,
doc: /* Return t if OBJECT is a built-in function. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (SUBRP (object))
return Qt;
DEFUN ("byte-code-function-p", Fbyte_code_function_p, Sbyte_code_function_p,
1, 1, 0,
doc: /* Return t if OBJECT is a byte-compiled function object. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (COMPILEDP (object))
return Qt;
DEFUN ("char-or-string-p", Fchar_or_string_p, Schar_or_string_p, 1, 1, 0,
doc: /* Return t if OBJECT is a character or a string. */)
- (object)
- register Lisp_Object object;
+ (register Lisp_Object object)
{
if (CHARACTERP (object) || STRINGP (object))
return Qt;
\f
DEFUN ("integerp", Fintegerp, Sintegerp, 1, 1, 0,
doc: /* Return t if OBJECT is an integer. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (INTEGERP (object))
return Qt;
DEFUN ("integer-or-marker-p", Finteger_or_marker_p, Sinteger_or_marker_p, 1, 1, 0,
doc: /* Return t if OBJECT is an integer or a marker (editor pointer). */)
- (object)
- register Lisp_Object object;
+ (register Lisp_Object object)
{
if (MARKERP (object) || INTEGERP (object))
return Qt;
DEFUN ("natnump", Fnatnump, Snatnump, 1, 1, 0,
doc: /* Return t if OBJECT is a nonnegative integer. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (NATNUMP (object))
return Qt;
DEFUN ("numberp", Fnumberp, Snumberp, 1, 1, 0,
doc: /* Return t if OBJECT is a number (floating point or integer). */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (NUMBERP (object))
return Qt;
DEFUN ("number-or-marker-p", Fnumber_or_marker_p,
Snumber_or_marker_p, 1, 1, 0,
doc: /* Return t if OBJECT is a number or a marker. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (NUMBERP (object) || MARKERP (object))
return Qt;
DEFUN ("floatp", Ffloatp, Sfloatp, 1, 1, 0,
doc: /* Return t if OBJECT is a floating point number. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (FLOATP (object))
return Qt;
See Info node `(elisp)Cons Cells' for a discussion of related basic
Lisp concepts such as car, cdr, cons cell and list. */)
- (list)
- register Lisp_Object list;
+ (register Lisp_Object list)
{
return CAR (list);
}
DEFUN ("car-safe", Fcar_safe, Scar_safe, 1, 1, 0,
doc: /* Return the car of OBJECT if it is a cons cell, or else nil. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
return CAR_SAFE (object);
}
See Info node `(elisp)Cons Cells' for a discussion of related basic
Lisp concepts such as cdr, car, cons cell and list. */)
- (list)
- register Lisp_Object list;
+ (register Lisp_Object list)
{
return CDR (list);
}
DEFUN ("cdr-safe", Fcdr_safe, Scdr_safe, 1, 1, 0,
doc: /* Return the cdr of OBJECT if it is a cons cell, or else nil. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
return CDR_SAFE (object);
}
DEFUN ("setcar", Fsetcar, Ssetcar, 2, 2, 0,
doc: /* Set the car of CELL to be NEWCAR. Returns NEWCAR. */)
- (cell, newcar)
- register Lisp_Object cell, newcar;
+ (register Lisp_Object cell, Lisp_Object newcar)
{
CHECK_CONS (cell);
CHECK_IMPURE (cell);
DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
doc: /* Set the cdr of CELL to be NEWCDR. Returns NEWCDR. */)
- (cell, newcdr)
- register Lisp_Object cell, newcdr;
+ (register Lisp_Object cell, Lisp_Object newcdr)
{
CHECK_CONS (cell);
CHECK_IMPURE (cell);
DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
doc: /* Return t if SYMBOL's value is not void. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
Lisp_Object valcontents;
struct Lisp_Symbol *sym;
DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
doc: /* Return t if SYMBOL's function definition is not void. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
return (EQ (XSYMBOL (symbol)->function, Qunbound) ? Qnil : Qt);
DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
doc: /* Make SYMBOL's value be void.
Return SYMBOL. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
if (SYMBOL_CONSTANT_P (symbol))
DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0,
doc: /* Make SYMBOL's function definition be void.
Return SYMBOL. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
if (NILP (symbol) || EQ (symbol, Qt))
DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
doc: /* Return SYMBOL's function definition. Error if that is void. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
if (!EQ (XSYMBOL (symbol)->function, Qunbound))
DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
doc: /* Return SYMBOL's property list. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
return XSYMBOL (symbol)->plist;
DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
doc: /* Return SYMBOL's name, a string. */)
- (symbol)
- register Lisp_Object symbol;
+ (register Lisp_Object symbol)
{
register Lisp_Object name;
DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION. */)
- (symbol, definition)
- register Lisp_Object symbol, definition;
+ (register Lisp_Object symbol, Lisp_Object definition)
{
register Lisp_Object function;
return definition;
}
-extern Lisp_Object Qfunction_documentation;
-
DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION.
Associates the function with the current load file, if any.
The optional third argument DOCSTRING specifies the documentation string
for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string
determined by DEFINITION. */)
- (symbol, definition, docstring)
- register Lisp_Object symbol, definition, docstring;
+ (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
{
CHECK_SYMBOL (symbol);
if (CONSP (XSYMBOL (symbol)->function)
DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
doc: /* Set SYMBOL's property list to NEWPLIST, and return NEWPLIST. */)
- (symbol, newplist)
- register Lisp_Object symbol, newplist;
+ (register Lisp_Object symbol, Lisp_Object newplist)
{
CHECK_SYMBOL (symbol);
XSYMBOL (symbol)->plist = newplist;
The returned value is a pair (MIN . MAX). MIN is the minimum number
of args. MAX is the maximum number or the symbol `many', for a
function with `&rest' args, or `unevalled' for a special form. */)
- (subr)
- Lisp_Object subr;
+ (Lisp_Object subr)
{
short minargs, maxargs;
CHECK_SUBR (subr);
DEFUN ("subr-name", Fsubr_name, Ssubr_name, 1, 1, 0,
doc: /* Return name of subroutine SUBR.
SUBR must be a built-in function. */)
- (subr)
- Lisp_Object subr;
+ (Lisp_Object subr)
{
const char *name;
CHECK_SUBR (subr);
doc: /* Return the interactive form of CMD or nil if none.
If CMD is not a command, the return value is nil.
Value, if non-nil, is a list \(interactive SPEC). */)
- (cmd)
- Lisp_Object cmd;
+ (Lisp_Object cmd)
{
Lisp_Object fun = indirect_function (cmd); /* Check cycles. */
if (SUBRP (fun))
{
- char *spec = XSUBR (fun)->intspec;
+ const char *spec = XSUBR (fun)->intspec;
if (spec)
return list2 (Qinteractive,
(*spec != '(') ? build_string (spec) :
variable. If OBJECT is not a symbol, just return it.
Signal a cyclic-variable-indirection error if there is a loop in the
variable chain of symbols. */)
- (object)
- Lisp_Object object;
+ (Lisp_Object object)
{
if (SYMBOLP (object))
- XSETSYMBOL (object, indirect_variable (XSYMBOL (object)));
+ {
+ struct Lisp_Symbol *sym = indirect_variable (XSYMBOL (object));
+ XSETSYMBOL (object, sym);
+ }
return object;
}
This does not handle buffer-local variables; use
swap_in_symval_forwarding for that. */
-#define do_blv_forwarding(blv) \
- ((blv)->forwarded ? do_symval_forwarding (BLV_FWD (blv)) : BLV_VALUE (blv))
-
Lisp_Object
do_symval_forwarding (register union Lisp_Fwd *valcontents)
{
BUF non-zero means set the value in buffer BUF instead of the
current buffer. This only plays a role for per-buffer variables. */
-#define store_blv_forwarding(blv, newval, buf) \
- do { \
- if ((blv)->forwarded) \
- store_symval_forwarding (BLV_FWD (blv), (newval), (buf)); \
- else \
- SET_BLV_VALUE (blv, newval); \
- } while (0)
-
static void
store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newval, struct buffer *buf)
{
for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
{
- Lisp_Object buf;
+ Lisp_Object lbuf;
struct buffer *b;
- buf = Fcdr (XCAR (tail));
- if (!BUFFERP (buf)) continue;
- b = XBUFFER (buf);
+ lbuf = Fcdr (XCAR (tail));
+ if (!BUFFERP (lbuf)) continue;
+ b = XBUFFER (lbuf);
if (! PER_BUFFER_VALUE_P (b, idx))
PER_BUFFER_VALUE (b, offset) = newval;
}
else
{
- tem1 = assq_no_quit (var, current_buffer->local_var_alist);
+ tem1 = assq_no_quit (var, BVAR (current_buffer, local_var_alist));
XSETBUFFER (blv->where, current_buffer);
}
}
DEFUN ("symbol-value", Fsymbol_value, Ssymbol_value, 1, 1, 0,
doc: /* Return SYMBOL's value. Error if that is void. */)
- (symbol)
- Lisp_Object symbol;
+ (Lisp_Object symbol)
{
Lisp_Object val;
DEFUN ("set", Fset, Sset, 2, 2, 0,
doc: /* Set SYMBOL's value to NEWVAL, and return NEWVAL. */)
- (symbol, newval)
- register Lisp_Object symbol, newval;
+ (register Lisp_Object symbol, Lisp_Object newval)
{
set_internal (symbol, newval, Qnil, 0);
return newval;
tem1 = Fassq (symbol,
(blv->frame_local
? XFRAME (where)->param_alist
- : XBUFFER (where)->local_var_alist));
+ : BVAR (XBUFFER (where), local_var_alist)));
blv->where = where;
blv->found = 1;
bindings, not for frame-local bindings. */
eassert (!blv->frame_local);
tem1 = Fcons (symbol, XCDR (blv->defcell));
- XBUFFER (where)->local_var_alist
- = Fcons (tem1, XBUFFER (where)->local_var_alist);
+ BVAR (XBUFFER (where), local_var_alist)
+ = Fcons (tem1, BVAR (XBUFFER (where), local_var_alist));
}
}
/* Return the default value of SYMBOL, but don't check for voidness.
Return Qunbound if it is void. */
-Lisp_Object
+static Lisp_Object
default_value (Lisp_Object symbol)
{
struct Lisp_Symbol *sym;
doc: /* Return t if SYMBOL has a non-void default value.
This is the value that is seen in buffers that do not have their own values
for this variable. */)
- (symbol)
- Lisp_Object symbol;
+ (Lisp_Object symbol)
{
register Lisp_Object value;
This is the value that is seen in buffers that do not have their own values
for this variable. The default value is meaningful for variables with
local bindings in certain buffers. */)
- (symbol)
- Lisp_Object symbol;
+ (Lisp_Object symbol)
{
register Lisp_Object value;
doc: /* Set SYMBOL's default value to VALUE. SYMBOL and VALUE are evaluated.
The default value is seen in buffers that do not have their own values
for this variable. */)
- (symbol, value)
- Lisp_Object symbol, value;
+ (Lisp_Object symbol, Lisp_Object value)
{
struct Lisp_Symbol *sym;
The VALUE for the Nth VAR can refer to the new default values
of previous VARs.
usage: (setq-default [VAR VALUE]...) */)
- (args)
- Lisp_Object args;
+ (Lisp_Object args)
{
register Lisp_Object args_left;
register Lisp_Object val, symbol;
which makes a variable local in just one buffer.
The function `default-value' gets the default value and `set-default' sets it. */)
- (variable)
- register Lisp_Object variable;
+ (register Lisp_Object variable)
{
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
- union Lisp_Val_Fwd valcontents;
- int forwarded;
+ union Lisp_Val_Fwd valcontents IF_LINT (= {0});
+ int forwarded IF_LINT (= 0);
CHECK_SYMBOL (variable);
sym = XSYMBOL (variable);
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument. */)
- (variable)
- register Lisp_Object variable;
+ (register Lisp_Object variable)
{
register Lisp_Object tem;
- int forwarded;
- union Lisp_Val_Fwd valcontents;
+ int forwarded IF_LINT (= 0);
+ union Lisp_Val_Fwd valcontents IF_LINT (= {0});
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
if (let_shadows_global_binding_p (symbol))
message ("Making %s local to %s while let-bound!",
SDATA (SYMBOL_NAME (variable)),
- SDATA (current_buffer->name));
+ SDATA (BVAR (current_buffer, name)));
}
}
/* Make sure this buffer has its own value of symbol. */
XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
- tem = Fassq (variable, current_buffer->local_var_alist);
+ tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
if (NILP (tem))
{
if (let_shadows_buffer_binding_p (sym))
default value. */
find_symbol_value (variable);
- current_buffer->local_var_alist
+ BVAR (current_buffer, local_var_alist)
= Fcons (Fcons (variable, XCDR (blv->defcell)),
- current_buffer->local_var_alist);
+ BVAR (current_buffer, local_var_alist));
/* Make sure symbol does not think it is set up for this buffer;
force it to look once again for this buffer's value. */
1, 1, "vKill Local Variable: ",
doc: /* Make VARIABLE no longer have a separate value in the current buffer.
From now on the default value will apply in this buffer. Return VARIABLE. */)
- (variable)
- register Lisp_Object variable;
+ (register Lisp_Object variable)
{
register Lisp_Object tem;
struct Lisp_Buffer_Local_Value *blv;
/* Get rid of this buffer's alist element, if any. */
XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
- tem = Fassq (variable, current_buffer->local_var_alist);
+ tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
if (!NILP (tem))
- current_buffer->local_var_alist
- = Fdelq (tem, current_buffer->local_var_alist);
+ BVAR (current_buffer, local_var_alist)
+ = Fdelq (tem, BVAR (current_buffer, local_var_alist));
/* If the symbol is set up with the current buffer's binding
loaded, recompute its value. We have to do it now, or else
Note that since Emacs 23.1, variables cannot be both buffer-local and
frame-local any more (buffer-local bindings used to take precedence over
frame-local bindings). */)
- (variable)
- register Lisp_Object variable;
+ (register Lisp_Object variable)
{
int forwarded;
union Lisp_Val_Fwd valcontents;
1, 2, 0,
doc: /* Non-nil if VARIABLE has a local binding in buffer BUFFER.
BUFFER defaults to the current buffer. */)
- (variable, buffer)
- register Lisp_Object variable, buffer;
+ (register Lisp_Object variable, Lisp_Object buffer)
{
register struct buffer *buf;
struct Lisp_Symbol *sym;
Lisp_Object tail, elt, tmp;
struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
XSETBUFFER (tmp, buf);
+ XSETSYMBOL (variable, sym); /* Update in case of aliasing. */
- for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
+ for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
{
elt = XCAR (tail);
if (EQ (variable, XCAR (elt)))
will produce a buffer local binding. See Info node
`(elisp)Creating Buffer-Local'.
BUFFER defaults to the current buffer. */)
- (variable, buffer)
- register Lisp_Object variable, buffer;
+ (register Lisp_Object variable, Lisp_Object buffer)
{
struct Lisp_Symbol *sym;
If the current binding is buffer-local, the value is the current buffer.
If the current binding is frame-local, the value is the selected frame.
If the current binding is global (the default), the value is nil. */)
- (variable)
- register Lisp_Object variable;
+ (register Lisp_Object variable)
{
struct Lisp_Symbol *sym;
TERMINAL may be a terminal object, a frame, or nil (meaning the
selected frame's terminal device). */)
- (symbol, terminal)
- Lisp_Object symbol;
- Lisp_Object terminal;
+ (Lisp_Object symbol, Lisp_Object terminal)
{
Lisp_Object result;
struct terminal *t = get_terminal (terminal, 1);
TERMINAL may be a terminal object, a frame, or nil (meaning the
selected frame's terminal device). */)
- (symbol, terminal, value)
- Lisp_Object symbol;
- Lisp_Object terminal;
- Lisp_Object value;
+ (Lisp_Object symbol, Lisp_Object terminal, Lisp_Object value)
{
Lisp_Object result;
struct terminal *t = get_terminal (terminal, 1);
Optional arg NOERROR non-nil means to return nil instead of signalling.
Signal a cyclic-function-indirection error if there is a loop in the
function chain of symbols. */)
- (object, noerror)
- register Lisp_Object object;
- Lisp_Object noerror;
+ (register Lisp_Object object, Lisp_Object noerror)
{
Lisp_Object result;
doc: /* Return the element of ARRAY at index IDX.
ARRAY may be a vector, a string, a char-table, a bool-vector,
or a byte-code object. IDX starts at 0. */)
- (array, idx)
- register Lisp_Object array;
- Lisp_Object idx;
+ (register Lisp_Object array, Lisp_Object idx)
{
- register int idxval;
+ register EMACS_INT idxval;
CHECK_NUMBER (idx);
idxval = XINT (idx);
if (STRINGP (array))
{
- int c, idxval_byte;
+ int c;
+ EMACS_INT idxval_byte;
if (idxval < 0 || idxval >= SCHARS (array))
args_out_of_range (array, idx);
doc: /* Store into the element of ARRAY at index IDX the value NEWELT.
Return NEWELT. ARRAY may be a vector, a string, a char-table or a
bool-vector. IDX starts at 0. */)
- (array, idx, newelt)
- register Lisp_Object array;
- Lisp_Object idx, newelt;
+ (register Lisp_Object array, Lisp_Object idx, Lisp_Object newelt)
{
- register int idxval;
+ register EMACS_INT idxval;
CHECK_NUMBER (idx);
idxval = XINT (idx);
}
else if (STRING_MULTIBYTE (array))
{
- int idxval_byte, prev_bytes, new_bytes, nbytes;
+ EMACS_INT idxval_byte, prev_bytes, new_bytes, nbytes;
unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
if (idxval < 0 || idxval >= SCHARS (array))
if (prev_bytes != new_bytes)
{
/* We must relocate the string data. */
- int nchars = SCHARS (array);
+ EMACS_INT nchars = SCHARS (array);
unsigned char *str;
USE_SAFE_ALLOCA;
enum comparison { equal, notequal, less, grtr, less_or_equal, grtr_or_equal };
-Lisp_Object
+static Lisp_Object
arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
{
double f1 = 0, f2 = 0;
DEFUN ("=", Feqlsign, Seqlsign, 2, 2, 0,
doc: /* Return t if two args, both numbers or markers, are equal. */)
- (num1, num2)
- register Lisp_Object num1, num2;
+ (register Lisp_Object num1, Lisp_Object num2)
{
return arithcompare (num1, num2, equal);
}
DEFUN ("<", Flss, Slss, 2, 2, 0,
doc: /* Return t if first arg is less than second arg. Both must be numbers or markers. */)
- (num1, num2)
- register Lisp_Object num1, num2;
+ (register Lisp_Object num1, Lisp_Object num2)
{
return arithcompare (num1, num2, less);
}
DEFUN (">", Fgtr, Sgtr, 2, 2, 0,
doc: /* Return t if first arg is greater than second arg. Both must be numbers or markers. */)
- (num1, num2)
- register Lisp_Object num1, num2;
+ (register Lisp_Object num1, Lisp_Object num2)
{
return arithcompare (num1, num2, grtr);
}
DEFUN ("<=", Fleq, Sleq, 2, 2, 0,
doc: /* Return t if first arg is less than or equal to second arg.
Both must be numbers or markers. */)
- (num1, num2)
- register Lisp_Object num1, num2;
+ (register Lisp_Object num1, Lisp_Object num2)
{
return arithcompare (num1, num2, less_or_equal);
}
DEFUN (">=", Fgeq, Sgeq, 2, 2, 0,
doc: /* Return t if first arg is greater than or equal to second arg.
Both must be numbers or markers. */)
- (num1, num2)
- register Lisp_Object num1, num2;
+ (register Lisp_Object num1, Lisp_Object num2)
{
return arithcompare (num1, num2, grtr_or_equal);
}
DEFUN ("/=", Fneq, Sneq, 2, 2, 0,
doc: /* Return t if first arg is not equal to second arg. Both must be numbers or markers. */)
- (num1, num2)
- register Lisp_Object num1, num2;
+ (register Lisp_Object num1, Lisp_Object num2)
{
return arithcompare (num1, num2, notequal);
}
DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
doc: /* Return t if NUMBER is zero. */)
- (number)
- register Lisp_Object number;
+ (register Lisp_Object number)
{
CHECK_NUMBER_OR_FLOAT (number);
doc: /* Return the decimal representation of NUMBER as a string.
Uses a minus sign if negative.
NUMBER may be an integer or a floating point number. */)
- (number)
- Lisp_Object number;
+ (Lisp_Object number)
{
char buffer[VALBITS];
if (FLOATP (number))
{
- char pigbuf[350]; /* see comments in float_to_string */
+ char pigbuf[FLOAT_TO_STRING_BUFSIZE];
float_to_string (pigbuf, XFLOAT_DATA (number));
return build_string (pigbuf);
If BASE, interpret STRING as a number in that base. If BASE isn't
present, base 10 is used. BASE must be between 2 and 16 (inclusive).
If the base used is not 10, STRING is always parsed as integer. */)
- (string, base)
- register Lisp_Object string, base;
+ (register Lisp_Object string, Lisp_Object base)
{
- register unsigned char *p;
+ register char *p;
register int b;
int sign = 1;
Lisp_Object val;
/* Skip any whitespace at the front of the number. Some versions of
atoi do this anyway, so we might as well make Emacs lisp consistent. */
- p = SDATA (string);
+ p = SSDATA (string);
while (*p == ' ' || *p == '\t')
p++;
Amin
};
-static Lisp_Object float_arith_driver (double, int, enum arithop,
- int, Lisp_Object *);
-extern Lisp_Object fmod_float (Lisp_Object, Lisp_Object);
-
-Lisp_Object
-arith_driver (enum arithop code, int nargs, register Lisp_Object *args)
+static Lisp_Object float_arith_driver (double, size_t, enum arithop,
+ size_t, Lisp_Object *);
+static Lisp_Object
+arith_driver (enum arithop code, size_t nargs, register Lisp_Object *args)
{
register Lisp_Object val;
- register int argnum;
+ register size_t argnum;
register EMACS_INT accum = 0;
register EMACS_INT next;
#define isnan(x) ((x) != (x))
static Lisp_Object
-float_arith_driver (double accum, register int argnum, enum arithop code, int nargs, register Lisp_Object *args)
+float_arith_driver (double accum, register size_t argnum, enum arithop code,
+ size_t nargs, register Lisp_Object *args)
{
register Lisp_Object val;
double next;
DEFUN ("+", Fplus, Splus, 0, MANY, 0,
doc: /* Return sum of any number of arguments, which are numbers or markers.
usage: (+ &rest NUMBERS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Aadd, nargs, args);
}
With one arg, negates it. With more than one arg,
subtracts all but the first from the first.
usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Asub, nargs, args);
}
DEFUN ("*", Ftimes, Stimes, 0, MANY, 0,
doc: /* Return product of any number of arguments, which are numbers or markers.
usage: (* &rest NUMBERS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Amult, nargs, args);
}
doc: /* Return first argument divided by all the remaining arguments.
The arguments must be numbers or markers.
usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
- int argnum;
+ size_t argnum;
for (argnum = 2; argnum < nargs; argnum++)
if (FLOATP (args[argnum]))
return float_arith_driver (0, 0, Adiv, nargs, args);
DEFUN ("%", Frem, Srem, 2, 2, 0,
doc: /* Return remainder of X divided by Y.
Both must be integers or markers. */)
- (x, y)
- register Lisp_Object x, y;
+ (register Lisp_Object x, Lisp_Object y)
{
Lisp_Object val;
doc: /* Return X modulo Y.
The result falls between zero (inclusive) and Y (exclusive).
Both X and Y must be numbers or markers. */)
- (x, y)
- register Lisp_Object x, y;
+ (register Lisp_Object x, Lisp_Object y)
{
Lisp_Object val;
EMACS_INT i1, i2;
doc: /* Return largest of all the arguments (which must be numbers or markers).
The value is always a number; markers are converted to numbers.
usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Amax, nargs, args);
}
doc: /* Return smallest of all the arguments (which must be numbers or markers).
The value is always a number; markers are converted to numbers.
usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Amin, nargs, args);
}
doc: /* Return bitwise-and of all the arguments.
Arguments may be integers, or markers converted to integers.
usage: (logand &rest INTS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Alogand, nargs, args);
}
doc: /* Return bitwise-or of all the arguments.
Arguments may be integers, or markers converted to integers.
usage: (logior &rest INTS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Alogior, nargs, args);
}
doc: /* Return bitwise-exclusive-or of all the arguments.
Arguments may be integers, or markers converted to integers.
usage: (logxor &rest INTS-OR-MARKERS) */)
- (nargs, args)
- int nargs;
- Lisp_Object *args;
+ (size_t nargs, Lisp_Object *args)
{
return arith_driver (Alogxor, nargs, args);
}
doc: /* Return VALUE with its bits shifted left by COUNT.
If COUNT is negative, shifting is actually to the right.
In this case, the sign bit is duplicated. */)
- (value, count)
- register Lisp_Object value, count;
+ (register Lisp_Object value, Lisp_Object count)
{
register Lisp_Object val;
doc: /* Return VALUE with its bits shifted left by COUNT.
If COUNT is negative, shifting is actually to the right.
In this case, zeros are shifted in on the left. */)
- (value, count)
- register Lisp_Object value, count;
+ (register Lisp_Object value, Lisp_Object count)
{
register Lisp_Object val;
DEFUN ("1+", Fadd1, Sadd1, 1, 1, 0,
doc: /* Return NUMBER plus one. NUMBER may be a number or a marker.
Markers are converted to integers. */)
- (number)
- register Lisp_Object number;
+ (register Lisp_Object number)
{
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
DEFUN ("1-", Fsub1, Ssub1, 1, 1, 0,
doc: /* Return NUMBER minus one. NUMBER may be a number or a marker.
Markers are converted to integers. */)
- (number)
- register Lisp_Object number;
+ (register Lisp_Object number)
{
CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (number);
DEFUN ("lognot", Flognot, Slognot, 1, 1, 0,
doc: /* Return the bitwise complement of NUMBER. NUMBER must be an integer. */)
- (number)
- register Lisp_Object number;
+ (register Lisp_Object number)
{
CHECK_NUMBER (number);
XSETINT (number, ~XINT (number));
doc: /* Return the byteorder for the machine.
Returns 66 (ASCII uppercase B) for big endian machines or 108 (ASCII
lowercase l) for small endian machines. */)
- ()
+ (void)
{
unsigned i = 0x04030201;
int order = *(char *)&i == 1 ? 108 : 66;
XSYMBOL (Qwholenump)->function = XSYMBOL (Qnatnump)->function;
- DEFVAR_LISP ("most-positive-fixnum", &Vmost_positive_fixnum,
+ DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
doc: /* The largest value that is representable in a Lisp integer. */);
Vmost_positive_fixnum = make_number (MOST_POSITIVE_FIXNUM);
XSYMBOL (intern_c_string ("most-positive-fixnum"))->constant = 1;
- DEFVAR_LISP ("most-negative-fixnum", &Vmost_negative_fixnum,
+ DEFVAR_LISP ("most-negative-fixnum", Vmost_negative_fixnum,
doc: /* The smallest value that is representable in a Lisp integer. */);
Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM);
XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
}
-SIGTYPE
+static SIGTYPE
arith_error (int signo)
{
sigsetmask (SIGEMPTYMASK);
signal (SIGEMT, arith_error);
#endif /* uts */
}
-
-/* arch-tag: 25879798-b84d-479a-9c89-7d148e2109f7
- (do not change this comment) */