/* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
- Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2011
+ Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2012
Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "termhooks.h" /* For FRAME_KBOARD reference in y-or-n-p. */
#include "font.h"
-#ifdef STDC_HEADERS
#include <float.h>
-#endif
-
/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */
#ifndef IEEE_FLOATING_POINT
#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
case Lisp_Fwd_Kboard_Obj:
/* We used to simply use current_kboard here, but from Lisp
- code, it's value is often unexpected. It seems nicer to
+ code, its value is often unexpected. It seems nicer to
allow constructions like this to work as intuitively expected:
(with-selected-frame frame
{
struct specbinding *p;
- for (p = specpdl_ptr - 1; p >= specpdl; p--)
- if (p->func == NULL
+ for (p = specpdl_ptr; p > specpdl; )
+ if ((--p)->func == NULL
&& CONSP (p->symbol))
{
struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol));
eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS);
if (symbol == let_bound_symbol
&& XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer)
- break;
+ return 1;
}
- return p >= specpdl;
+ return 0;
}
static int
{
struct specbinding *p;
- for (p = specpdl_ptr - 1; p >= specpdl; p--)
- if (p->func == NULL && EQ (p->symbol, symbol))
- break;
+ for (p = specpdl_ptr; p > specpdl; )
+ if ((--p)->func == NULL && EQ (p->symbol, symbol))
+ return 1;
- return p >= specpdl;
+ return 0;
}
/* Store the value NEWVAL into SYMBOL.
If OBJECT is not a symbol, just return it. Otherwise, follow all
function indirections to find the final function binding and return it.
If the final symbol in the chain is unbound, signal a void-function error.
-Optional arg NOERROR non-nil means to return nil instead of signalling.
+Optional arg NOERROR non-nil means to return nil instead of signaling.
Signal a cyclic-function-indirection error if there is a loop in the
function chain of symbols. */)
(register Lisp_Object object, Lisp_Object noerror)
if (STRINGP (array))
{
int c;
- EMACS_INT idxval_byte;
+ ptrdiff_t idxval_byte;
if (idxval < 0 || idxval >= SCHARS (array))
args_out_of_range (array, idx);
}
else
{
- int size = 0;
+ ptrdiff_t size = 0;
if (VECTORP (array))
size = ASIZE (array);
else if (COMPILEDP (array))
if (STRING_MULTIBYTE (array))
{
- EMACS_INT idxval_byte, prev_bytes, new_bytes, nbytes;
+ ptrdiff_t idxval_byte, nbytes;
+ int prev_bytes, new_bytes;
unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
nbytes = SBYTES (array);
if (prev_bytes != new_bytes)
{
/* We must relocate the string data. */
- EMACS_INT nchars = SCHARS (array);
+ ptrdiff_t nchars = SCHARS (array);
unsigned char *str;
USE_SAFE_ALLOCA;
else
{
CHECK_NUMBER (base);
- b = XINT (base);
- if (b < 2 || b > 16)
+ if (! (2 <= XINT (base) && XINT (base) <= 16))
xsignal1 (Qargs_out_of_range, base);
+ b = XINT (base);
}
p = SSDATA (string);
CHECK_NUMBER_COERCE_MARKER (x);
CHECK_NUMBER_COERCE_MARKER (y);
- if (XFASTINT (y) == 0)
+ if (XINT (y) == 0)
xsignal0 (Qarith_error);
XSETINT (val, XINT (x) % XINT (y));