else if (CHAR_TABLE_P (sequence))
XSETFASTINT (val, MAX_CHAR);
else if (BOOL_VECTOR_P (sequence))
- XSETFASTINT (val, XBOOL_VECTOR (sequence)->size);
+ XSETFASTINT (val, bool_vector_size (sequence));
else if (COMPILEDP (sequence))
XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
else if (CONSP (sequence))
{
Lisp_Object val;
ptrdiff_t size_in_chars
- = ((XBOOL_VECTOR (arg)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ = ((bool_vector_size (arg) + BOOL_VECTOR_BITS_PER_CHAR - 1)
/ BOOL_VECTOR_BITS_PER_CHAR);
val = Fmake_bool_vector (Flength (arg), Qnil);
if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c))
some_multibyte = 1;
}
- else if (BOOL_VECTOR_P (this) && XBOOL_VECTOR (this)->size > 0)
+ else if (BOOL_VECTOR_P (this) && bool_vector_size (this) > 0)
wrong_type_argument (Qintegerp, Faref (this, make_number (0)));
else if (CONSP (this))
for (; CONSP (this); this = XCDR (this))
for (i = n = 0; i < ASIZE (seq); ++i)
if (NILP (Fequal (AREF (seq, i), elt)))
- p->contents[n++] = AREF (seq, i);
+ p->u.contents[n++] = AREF (seq, i);
XSETVECTOR (seq, p);
}
/* Boolvectors are compared much like strings. */
if (BOOL_VECTOR_P (o1))
{
- if (XBOOL_VECTOR (o1)->size != XBOOL_VECTOR (o2)->size)
+ EMACS_INT size = bool_vector_size (o1);
+ if (size != bool_vector_size (o2))
return 0;
if (memcmp (XBOOL_VECTOR (o1)->data, XBOOL_VECTOR (o2)->data,
- ((XBOOL_VECTOR (o1)->size
- + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
/ BOOL_VECTOR_BITS_PER_CHAR)))
return 0;
return 1;
}
else if (BOOL_VECTOR_P (array))
{
- register unsigned char *p = XBOOL_VECTOR (array)->data;
- size =
- ((XBOOL_VECTOR (array)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
- / BOOL_VECTOR_BITS_PER_CHAR);
+ unsigned char *p = XBOOL_VECTOR (array)->data;
+ size = ((bool_vector_size (array) + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR);
if (size)
{
The user must confirm the answer with RET, and can edit it until it
has been confirmed.
-Under a windowing system a dialog box will be used if `last-nonmenu-event'
-is nil, and `use-dialog-box' is non-nil. */)
+If dialog boxes are supported, a dialog box will be used
+if `last-nonmenu-event' is nil, and `use-dialog-box' is non-nil. */)
(Lisp_Object prompt)
{
register Lisp_Object ans;
#ifdef HAVE_MENUS
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
- && use_dialog_box
- && window_system_available (SELECTED_FRAME ()))
+ && use_dialog_box)
{
Lisp_Object pane, menu, obj;
redisplay_preserve_echo_area (4);
{
struct Lisp_Vector *v;
ptrdiff_t i, incr, incr_max, old_size, new_size;
- ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents;
+ ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->u.contents;
ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max
? nitems_max : C_language_max);
eassert (VECTORP (vec));
memory_full (SIZE_MAX);
new_size = old_size + incr;
v = allocate_vector (new_size);
- memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
+ memcpy (v->u.contents, XVECTOR (vec)->u.contents, old_size * sizeof *v->u.contents);
for (i = old_size; i < new_size; ++i)
- v->contents[i] = Qnil;
+ v->u.contents[i] = Qnil;
XSETVECTOR (vec, v);
return vec;
}
args[0] = ht->user_hash_function;
args[1] = key;
hash = Ffuncall (2, args);
- if (!INTEGERP (hash))
- signal_error ("Invalid hash code returned from user-supplied hash function", hash);
- return XUINT (hash);
+ return hashfn_eq (ht, hash);
}
/* An upper bound on the size of a hash table index. It must fit in
static EMACS_UINT
sxhash_bool_vector (Lisp_Object vec)
{
- EMACS_UINT hash = XBOOL_VECTOR (vec)->size;
+ EMACS_INT size = bool_vector_size (vec);
+ EMACS_UINT hash = size;
int i, n;
- n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size);
+ n = min (SXHASH_MAX_LEN,
+ ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+ / BOOL_VECTOR_BITS_PER_CHAR));
for (i = 0; i < n; ++i)
hash = sxhash_combine (hash, XBOOL_VECTOR (vec)->data[i]);
TEST must be a function taking two arguments and returning non-nil if
both arguments are the same. HASH must be a function taking one
-argument and return an integer that is the hash code of the argument.
-Hash code computation should use the whole value range of integers,
-including negative integers. */)
+argument and returning an object that is the hash code of the argument.
+It should be the case that if (eq (funcall HASH x1) (funcall HASH x2))
+returns nil, then (funcall TEST x1 x2) also returns nil. */)
(Lisp_Object name, Lisp_Object test, Lisp_Object hash)
{
return Fput (name, Qhash_table_test, list2 (test, hash));