Commit 2e34157c authored by Richard M. Stallman's avatar Richard M. Stallman

Fix bugs with inappropriate mixing of Lisp_Object with int.

parent 8c239ac3
......@@ -2789,6 +2789,8 @@ modify_overlay (buf, start, end)
}
Lisp_Object Fdelete_overlay ();
DEFUN ("move-overlay", Fmove_overlay, Smove_overlay, 3, 4, 0,
"Set the endpoints of OVERLAY to BEG and END in BUFFER.\n\
If BUFFER is omitted, leave OVERLAY in the same buffer it inhabits now.\n\
......@@ -2839,13 +2841,13 @@ buffer.")
/* Redisplay where the overlay was. */
if (!NILP (obuffer))
{
Lisp_Object o_beg;
Lisp_Object o_end;
int o_beg;
int o_end;
o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
modify_overlay (ob, XINT (o_beg), XINT (o_end));
modify_overlay (ob, o_beg, o_end);
}
/* Redisplay where the overlay is going to be. */
......@@ -2854,22 +2856,21 @@ buffer.")
else
/* Redisplay the area the overlay has just left, or just enclosed. */
{
Lisp_Object o_beg;
Lisp_Object o_end;
int o_beg, o_end;
int change_beg, change_end;
o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
if (XINT (o_beg) == XINT (beg))
modify_overlay (b, XINT (o_end), XINT (end));
else if (XINT (o_end) == XINT (end))
modify_overlay (b, XINT (o_beg), XINT (beg));
if (o_beg == XINT (beg))
modify_overlay (b, o_end, XINT (end));
else if (o_end == XINT (end))
modify_overlay (b, o_beg, XINT (beg));
else
{
if (XINT (beg) < XINT (o_beg)) o_beg = beg;
if (XINT (end) > XINT (o_end)) o_end = end;
modify_overlay (b, XINT (o_beg), XINT (o_end));
if (XINT (beg) < o_beg) o_beg = XINT (beg);
if (XINT (end) > o_end) o_end = XINT (end);
modify_overlay (b, o_beg, o_end);
}
}
......
......@@ -47,12 +47,12 @@ casify_object (flag, obj)
{
if (INTEGERP (obj))
{
c = DOWNCASE (obj);
c = DOWNCASE (XFASTINT (obj));
if (inword)
XSETFASTINT (obj, c);
else if (c == XFASTINT (obj))
{
c = UPCASE1 (obj);
c = UPCASE1 (XFASTINT (obj));
XSETFASTINT (obj, c);
}
return obj;
......
......@@ -31,7 +31,8 @@ Lisp_Object Vascii_canon_table, Vascii_eqv_table;
/* Used as a temporary in DOWNCASE and other macros in lisp.h. No
need to mark it, since it is used only very temporarily. */
Lisp_Object case_temp1, case_temp2;
int case_temp1;
Lisp_Object case_temp2;
static void set_canon ();
static void set_identity ();
......@@ -207,7 +208,7 @@ static void
shuffle (table, c, elt)
Lisp_Object table, c, elt;
{
if (NATNUMP (elt) && c != elt)
if (NATNUMP (elt) && !EQ (c, elt))
{
Lisp_Object tem = Faref (table, elt);
Faset (table, elt, c);
......
......@@ -574,8 +574,8 @@ word_boundary_p (c1, c2)
if (CONSP (elt)
&& CATEGORYP (XCONS (elt)->car)
&& CATEGORYP (XCONS (elt)->cdr)
&& CATEGORY_MEMBER (XCONS (elt)->car, category_set1)
&& CATEGORY_MEMBER (XCONS (elt)->cdr, category_set2))
&& CATEGORY_MEMBER (XFASTINT (XCONS (elt)->car), category_set1)
&& CATEGORY_MEMBER (XFASTINT (XCONS (elt)->cdr), category_set2))
return !default_result;
}
return default_result;
......
......@@ -79,9 +79,8 @@ Boston, MA 02111-1307, USA. */
/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
The faster version of `!NILP (Faref (category_set, category))'. */
#define CATEGORY_MEMBER(category, category_set) \
(!NILP (category_set) \
&& (XCATEGORY_SET (category_set)->data[XFASTINT (category) / 8] \
& (1 << (XFASTINT (category) % 8))))
(XCATEGORY_SET (category_set)->data[(category) / 8] \
& (1 << ((category) % 8)))
/* Temporary internal variable used in macro CHAR_HAS_CATEGORY. */
extern Lisp_Object _temp_category_set;
......@@ -106,14 +105,16 @@ extern Lisp_Object _temp_category_set;
table = XCHAR_TABLE (table)->parent; \
else \
temp = Faref (table, \
COMPOSITE_CHAR_P (c) ? cmpchar_component (c, 0) : (c)); \
make_number (COMPOSITE_CHAR_P (c) \
? cmpchar_component (c, 0) : (c))); \
temp; })
#else
#define CATEGORY_SET(c) \
((c) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
? Faref (current_buffer->category_table, make_number ((unsigned char) c)) \
: Faref (current_buffer->category_table, \
COMPOSITE_CHAR_P (c) ? cmpchar_component ((c), 0) : (c)))
make_number (COMPOSITE_CHAR_P (c) \
? cmpchar_component ((c), 0) : (c))))
#endif
/* Return the doc string of CATEGORY in category table TABLE. */
......
......@@ -654,7 +654,7 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
i = reg[rrr];
j = ccl_prog[ic];
j = XINT (ccl_prog[ic]);
if ((unsigned int) i < j)
{
i = XINT (ccl_prog[ic + 1 + i]);
......
......@@ -702,7 +702,9 @@ detect_coding_iso2022 (src, src_end)
/* Set designation state into CODING. */
#define DECODE_DESIGNATION(reg, dimension, chars, final_char) \
do { \
int charset = ISO_CHARSET_TABLE (dimension, chars, final_char); \
int charset = ISO_CHARSET_TABLE (make_number (dimension), \
make_number (chars), \
make_number (final_char)); \
if (charset >= 0) \
{ \
if (coding->direction == 1 \
......@@ -3515,9 +3517,10 @@ which is a list of all the arguments given to `find-coding-system'.")
|| (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
error ("Invalid %dth argument", XINT (target_idx) + 1);
chain = (operation == Qinsert_file_contents || operation == Qwrite_region
chain = ((EQ (operation, Qinsert_file_contents)
|| EQ (operation, Qwrite_region))
? Vfile_coding_system_alist
: (operation == Qopen_network_stream
: (EQ (operation, Qopen_network_stream)
? Vnetwork_coding_system_alist
: Vprocess_coding_system_alist));
if (NILP (chain))
......
......@@ -324,6 +324,7 @@ Boston, MA 02111-1307, USA. */
#ifdef emacs /* Don't do this for lib-src. */
/* Tell regex.c to use a type compatible with Emacs. */
#define RE_TRANSLATE_TYPE Lisp_Object *
#define RE_TRANSLATE(TBL, C) XINT ((TBL)[C])
#endif
/* Avoid link-time collision with system mktime if we will use our own. */
......
......@@ -981,7 +981,7 @@ If you want them to stand for years in this century, you must do that yourself."
char *tzstring;
char **oldenv = environ, **newenv;
if (zone == Qt)
if (EQ (zone, Qt))
tzstring = "UTC0";
else if (STRINGP (zone))
tzstring = (char *) XSTRING (zone)->data;
......@@ -1146,7 +1146,7 @@ If TZ is t, use Universal Time.")
if (NILP (tz))
tzstring = 0;
else if (tz == Qt)
else if (EQ (tz, Qt))
tzstring = "UTC0";
else
{
......
......@@ -3726,6 +3726,7 @@ This does code conversion according to the value of\n\
}
static Lisp_Object build_annotations ();
extern Lisp_Object Ffile_locked_p ();
/* If build_annotations switched buffers, switch back to BUF.
Kill the temporary buffer that was selected in the meantime.
......@@ -5065,7 +5066,7 @@ The value should be either ?/ or ?\\ (any other value is treated as ?\\).\n\
This variable affects the built-in functions only on Windows,\n\
on other platforms, it is initialized so that Lisp code can find out\n\
what the normal separator is.");
Vdirectory_sep_char = '/';
XSETFASTINT (Vdirectory_sep_char, '/');
DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist,
"*Alist of elements (REGEXP . HANDLER) for file names handled specially.\n\
......
......@@ -584,7 +584,7 @@ This function allows vectors as well as strings.")
size = XVECTOR (string)->size;
if (NILP (to))
to = size;
XSETINT (to, size);
else
CHECK_NUMBER (to, 2);
......@@ -1185,6 +1185,8 @@ internal_equal (o1, o2, depth)
return 0;
}
extern Lisp_Object Fmake_char_internal ();
DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0,
"Store each element of ARRAY with ITEM.\n\
ARRAY is a vector, string, char-table, or bool-vector.")
......
......@@ -208,8 +208,9 @@ skip_invisible (pos, next_boundary_p, to, window)
int to;
Lisp_Object window;
{
Lisp_Object prop, position, end, overlay_limit, proplimit;
Lisp_Object prop, position, overlay_limit, proplimit;
Lisp_Object buffer;
int end;
XSETFASTINT (position, pos);
XSETBUFFER (buffer, current_buffer);
......@@ -239,8 +240,8 @@ skip_invisible (pos, next_boundary_p, to, window)
/* No matter what. don't go past next overlay change. */
if (XFASTINT (overlay_limit) < XFASTINT (proplimit))
proplimit = overlay_limit;
end = Fnext_single_property_change (position, Qinvisible,
buffer, proplimit);
end = XFASTINT (Fnext_single_property_change (position, Qinvisible,
buffer, proplimit));
/* Don't put the boundary in the middle of multibyte form if
there is no actual property change. */
if (end == pos + 100
......@@ -248,7 +249,7 @@ skip_invisible (pos, next_boundary_p, to, window)
&& end < ZV)
while (pos < end && !CHAR_HEAD_P (POS_ADDR (end)))
end--;
*next_boundary_p = XFASTINT (end);
*next_boundary_p = end;
}
/* if the `invisible' property is set, we can skip to
the next property change */
......
......@@ -85,7 +85,7 @@ create_root_interval (parent)
XSTRING (parent)->intervals = new;
}
new->parent = (INTERVAL) parent;
new->parent = (INTERVAL) XFASTINT (parent);
new->position = 1;
return new;
......@@ -411,7 +411,7 @@ balance_possible_root_interval (interval)
if (interval->parent == NULL_INTERVAL)
return interval;
parent = (Lisp_Object) (interval->parent);
XSETFASTINT (parent, (EMACS_INT) interval->parent);
interval = balance_an_interval (interval);
if (BUFFERP (parent))
......@@ -1130,10 +1130,10 @@ delete_interval (i)
if (ROOT_INTERVAL_P (i))
{
Lisp_Object owner;
owner = (Lisp_Object) i->parent;
XSETFASTINT (owner, (EMACS_INT) i->parent);
parent = delete_node (i);
if (! NULL_INTERVAL_P (parent))
parent->parent = (INTERVAL) owner;
parent->parent = (INTERVAL) XFASTINT (owner);
if (BUFFERP (owner))
BUF_INTERVALS (XBUFFER (owner)) = parent;
......@@ -1868,7 +1868,7 @@ move_if_not_intangible (position)
if (! NILP (Vinhibit_point_motion_hooks))
/* If intangible is inhibited, always move point to POSITION. */
;
else if (PT < position && pos < ZV)
else if (PT < position && XINT (pos) < ZV)
{
/* We want to move forward, so check the text before POSITION. */
......@@ -1884,7 +1884,7 @@ move_if_not_intangible (position)
intangible_propval))
pos = Fprevious_char_property_change (pos, Qnil);
}
else if (pos > BEGV)
else if (XINT (pos) > BEGV)
{
/* We want to move backward, so check the text after POSITION. */
......@@ -2010,7 +2010,7 @@ copy_intervals_to_string (string, buffer, position, length)
if (NULL_INTERVAL_P (interval_copy))
return;
interval_copy->parent = (INTERVAL) string;
interval_copy->parent = (INTERVAL) XFASTINT (string);
XSTRING (string)->intervals = interval_copy;
}
......
......@@ -37,9 +37,15 @@ Boston, MA 02111-1307, USA. */
/* True if an interval pointer is null, or is a Lisp_Buffer or
Lisp_String pointer (meaning it points to the owner of this
interval tree). */
#ifdef NO_UNION_TYPE
#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL \
|| BUFFERP ((Lisp_Object)(i)) \
|| STRINGP ((Lisp_Object)(i)))
#else
#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL \
|| BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \
|| STRINGP ((Lisp_Object){(EMACS_INT)(i)}))
#endif
/* True if this interval has no right child. */
#define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL)
......
......@@ -538,8 +538,7 @@ get_keyelt (object, autoload)
key = Fcdr (object);
if (INTEGERP (key) && (XINT (key) & meta_modifier))
{
object = access_keymap (map, make_number (meta_prefix_char),
0, 0);
object = access_keymap (map, meta_prefix_char, 0, 0);
map = get_keymap_1 (object, 0, autoload);
object = access_keymap (map,
make_number (XINT (key) & ~meta_modifier),
......@@ -1515,8 +1514,8 @@ then the value includes only maps for prefixes that start with PREFIX.")
element = thisseq;
tem = Fvconcat (1, &element);
XVECTOR (tem)->contents[XINT (last)]
= XINT (elt) | meta_modifier;
XSETFASTINT (XVECTOR (tem)->contents[XINT (last)],
XINT (elt) | meta_modifier);
/* This new sequence is the same length as
thisseq, so stick it in the list right
......@@ -2746,7 +2745,7 @@ describe_vector (vector, elt_prefix, elt_describer,
int starting_i;
if (indices == 0)
indices = (Lisp_Object *) alloca (3 * sizeof (Lisp_Object));
indices = (int *) alloca (3 * sizeof (int));
definition = Qnil;
......
......@@ -608,11 +608,11 @@ struct Lisp_Vector
and 8-bit Europeans characters. For these characters, do not check
validity of CT. Do not follow parent. */
#define CHAR_TABLE_REF(CT, IDX) \
(XFASTINT (IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
? (!NILP (XCHAR_TABLE (CT)->contents[XFASTINT (IDX)])\
? XCHAR_TABLE (CT)->contents[XFASTINT (IDX)] \
((IDX) < CHAR_TABLE_SINGLE_BYTE_SLOTS \
? (!NILP (XCHAR_TABLE (CT)->contents[IDX]) \
? XCHAR_TABLE (CT)->contents[IDX] \
: XCHAR_TABLE (CT)->defalt) \
: Faref (CT, IDX))
: Faref (CT, make_number (IDX)))
/* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and
8-bit Europeans characters. Do not check validity of CT. */
......@@ -1314,7 +1314,8 @@ extern char *stack_bottom;
#define QUITP (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
/* Variables used locally in the following case handling macros. */
extern Lisp_Object case_temp1, case_temp2;
extern int case_temp1;
extern Lisp_Object case_temp2;
/* Current buffer's map from characters to lower-case characters. */
......@@ -1484,6 +1485,7 @@ extern Lisp_Object Ffset (), Fsetplist ();
extern Lisp_Object Fsymbol_value (), find_symbol_value (), Fset ();
extern Lisp_Object Fdefault_value (), Fset_default (), Fdefault_boundp ();
extern Lisp_Object Fmake_local_variable ();
extern Lisp_Object Flocal_variable_if_set_p ();
extern Lisp_Object Faref (), Faset ();
......@@ -1517,6 +1519,7 @@ extern Lisp_Object Fend_of_line (), Fforward_char (), Fforward_line ();
/* Defined in coding.c */
extern Lisp_Object Fcoding_system_p (), Fcheck_coding_system ();
extern Lisp_Object Fread_coding_system (), Fread_non_nil_coding_system ();
extern Lisp_Object Ffind_coding_system ();
/* Defined in syntax.c */
extern Lisp_Object Fforward_word ();
......@@ -1539,6 +1542,8 @@ extern Lisp_Object assq_no_quit ();
extern Lisp_Object Fcopy_alist ();
extern Lisp_Object Fplist_get ();
extern Lisp_Object Fset_char_table_parent ();
extern Lisp_Object Fchar_table_extra_slot ();
extern Lisp_Object Frassoc ();
/* Defined in insdel.c */
extern void move_gap ();
......@@ -1675,6 +1680,7 @@ extern Lisp_Object save_excursion_save (), save_restriction_save ();
extern Lisp_Object save_excursion_restore (), save_restriction_restore ();
extern Lisp_Object Fchar_to_string ();
extern Lisp_Object Fdelete_region (), Fnarrow_to_region (), Fwiden ();
extern Lisp_Object Fuser_login_name (), Fsystem_name ();
/* defined in buffer.c */
extern Lisp_Object Foverlay_start (), Foverlay_end ();
......@@ -1695,6 +1701,7 @@ extern Lisp_Object Ferase_buffer ();
extern Lisp_Object Qoverlayp;
extern Lisp_Object get_truename_buffer ();
extern struct buffer *all_buffers;
extern Lisp_Object Fprevious_overlay_change ();
/* defined in marker.c */
......@@ -1719,6 +1726,7 @@ extern Lisp_Object Ffile_accessible_directory_p ();
extern Lisp_Object Funhandled_file_name_directory ();
extern Lisp_Object Ffile_directory_p ();
extern Lisp_Object Fwrite_region ();
extern Lisp_Object Ffile_readable_p (), Ffile_executable_p ();
/* Defined in abbrev.c */
......@@ -1788,6 +1796,7 @@ extern void describe_map_tree ();
/* defined in indent.c */
extern Lisp_Object Fvertical_motion (), Findent_to (), Fcurrent_column ();
extern Lisp_Object Fmove_to_column ();
/* defined in window.c */
extern Lisp_Object Qwindowp, Qwindow_live_p;
......@@ -1838,6 +1847,7 @@ extern Lisp_Object Fset_frame_size ();
extern Lisp_Object Fset_frame_position ();
extern Lisp_Object Fraise_frame ();
extern Lisp_Object Fredirect_frame_focus ();
extern Lisp_Object frame_buffer_list ();
/* defined in emacs.c */
extern Lisp_Object decode_env_path ();
......@@ -1891,6 +1901,8 @@ extern Lisp_Object Fprevious_single_property_change ();
extern Lisp_Object Fget_text_property (), Fput_text_property ();
extern Lisp_Object Fset_text_properties ();
extern Lisp_Object Ftext_property_not_all ();
extern Lisp_Object Fprevious_char_property_change ();
extern Lisp_Object Fnext_char_property_change ();
/* defined in intervals.c */
extern Lisp_Object get_local_map ();
......
......@@ -956,7 +956,7 @@ scmp (s1, s2, len)
if (completion_ignore_case)
{
while (l && EQ (DOWNCASE (*s1++), DOWNCASE (*s2++)))
while (l && DOWNCASE (*s1++) == DOWNCASE (*s2++))
l--;
}
else
......
......@@ -1063,7 +1063,7 @@ print (obj, printcharfun, escapeflag)
else
{
if (CONSP (printed_gensyms))
XSETFASTINT (tem, XCDR (XCAR (printed_gensyms)) + 1);
XSETFASTINT (tem, XFASTINT (XCDR (XCAR (printed_gensyms))) + 1);
else
XSETFASTINT (tem, 1);
printed_gensyms = Fcons (Fcons (obj, tem), printed_gensyms);
......
......@@ -190,7 +190,7 @@ update_syntax_table (pos, count, init, object)
gl_state.current_syntax_table = tmp_table;
gl_state.old_prop = tmp_table;
if (Fsyntax_table_p (tmp_table) == Qt)
if (EQ (Fsyntax_table_p (tmp_table), Qt))
{
gl_state.use_global = 0;
}
......@@ -665,7 +665,7 @@ DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
char_int = XINT (character);
code = SYNTAX (char_int);
if (code == Sopen || code == Sclose)
return make_number (SYNTAX_MATCH (char_int));
return SYNTAX_MATCH (char_int);
return Qnil;
}
......@@ -735,7 +735,7 @@ DEFUN ("modify-syntax-entry", Fmodify_syntax_entry, Smodify_syntax_entry, 2, 3,
p = XSTRING (newentry)->data;
code = (enum syntaxcode) syntax_spec_code[*p++];
if (((int) code & 0377) == 0377)
error ("invalid syntax description letter: %c", XINT (c));
error ("invalid syntax description letter: %c", p[-1]);
if (code == Sinherit)
{
......
......@@ -134,7 +134,7 @@ extern Lisp_Object syntax_parent_lookup ();
({ Lisp_Object temp; \
temp = SYNTAX_ENTRY (c); \
(CONSP (temp) \
? XINT (XCONS (temp)->cdr) \
? XCONS (temp)->cdr \
: Qnil); })
#else
#define SYNTAX(c) \
......@@ -152,7 +152,7 @@ extern Lisp_Object syntax_parent_lookup ();
#define SYNTAX_MATCH(c) \
(syntax_temp = SYNTAX_ENTRY ((c)), \
(CONSP (syntax_temp) \
? XINT (XCONS (syntax_temp)->cdr) \
? XCONS (syntax_temp)->cdr \
: Qnil))
#endif
......
......@@ -1283,7 +1283,7 @@ init_sys_modes ()
tty = old_tty;
#if defined (HAVE_TERMIO) || defined (HAVE_TERMIOS)
Vtty_erase_char = old_tty.main.c_cc[VERASE];
XSETINT (Vtty_erase_char, old_tty.main.c_cc[VERASE]);
#ifdef DGUX
/* This allows meta to be sent on 8th bit. */
......
......@@ -1739,13 +1739,11 @@ report_interval_modification (start, end)
Lisp_Object start, end;
{
if (! NILP (interval_insert_behind_hooks))
call_mod_hooks (interval_insert_behind_hooks,
make_number (start), make_number (end));
call_mod_hooks (interval_insert_behind_hooks, start, end);
if (! NILP (interval_insert_in_front_hooks)
&& ! EQ (interval_insert_in_front_hooks,
interval_insert_behind_hooks))
call_mod_hooks (interval_insert_in_front_hooks,
make_number (start), make_number (end));
call_mod_hooks (interval_insert_in_front_hooks, start, end);
}
void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment