mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-01 01:41:01 -08:00
Use "ASET (a, i, v)" rather than "AREF (a, i) = v".
This how ASET and AREF are supposed to work, and makes it easier to think about future improvements. See <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00026.html>. * charset.h (set_charset_attr): New function. All lvalue-style uses of CHARSET_DECODER etc. changed to use it. * lisp.h (ASET): Rewrite so as not to use AREF in an lvalue style. (aref_addr): New function. All uses of &AREF(...) changed. (set_hash_key, set_hash_value, set_hash_next, set_hash_hash) (set_hash_index): New functions. All lvalue-style uses of HASH_KEY etc. changed. * keyboard.c (set_prop): New function. All lvalue-style uses of PROP changed.
This commit is contained in:
parent
947b2afddc
commit
4939150cb4
17 changed files with 266 additions and 189 deletions
|
|
@ -1,3 +1,19 @@
|
|||
2012-08-01 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Use "ASET (a, i, v)" rather than "AREF (a, i) = v".
|
||||
This how ASET and AREF are supposed to work, and makes
|
||||
it easier to think about future improvements. See
|
||||
<http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00026.html>.
|
||||
* charset.h (set_charset_attr): New function.
|
||||
All lvalue-style uses of CHARSET_DECODER etc. changed to use it.
|
||||
* lisp.h (ASET): Rewrite so as not to use AREF in an lvalue style.
|
||||
(aref_addr): New function. All uses of &AREF(...) changed.
|
||||
(set_hash_key, set_hash_value, set_hash_next, set_hash_hash)
|
||||
(set_hash_index): New functions. All lvalue-style uses of
|
||||
HASH_KEY etc. changed.
|
||||
* keyboard.c (set_prop): New function. All lvalue-style uses
|
||||
of PROP changed.
|
||||
|
||||
2012-08-01 Alp Aker <alp.tekin.aker@gmail.com>
|
||||
|
||||
* nsterm.m (ns_set_vertical_scroll_bar, ns_redeem_scroll_bar)
|
||||
|
|
|
|||
|
|
@ -272,8 +272,8 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
|
|||
{
|
||||
int n = CODE_POINT_TO_INDEX (charset, max_code) + 1;
|
||||
|
||||
vec = CHARSET_DECODER (charset)
|
||||
= Fmake_vector (make_number (n), make_number (-1));
|
||||
vec = Fmake_vector (make_number (n), make_number (-1));
|
||||
set_charset_attr (charset, charset_decoder, vec);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -285,10 +285,10 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
|
|||
else
|
||||
{
|
||||
table = Fmake_char_table (Qnil, Qnil);
|
||||
if (charset->method == CHARSET_METHOD_MAP)
|
||||
CHARSET_ENCODER (charset) = table;
|
||||
else
|
||||
CHARSET_DEUNIFIER (charset) = table;
|
||||
set_charset_attr (charset,
|
||||
(charset->method == CHARSET_METHOD_MAP
|
||||
? charset_encoder : charset_deunifier),
|
||||
table);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1133,7 +1133,7 @@ usage: (define-charset-internal ...) */)
|
|||
{
|
||||
new_definition_p = 0;
|
||||
id = XFASTINT (CHARSET_SYMBOL_ID (args[charset_arg_name]));
|
||||
HASH_VALUE (hash_table, charset.hash_index) = attrs;
|
||||
set_hash_value (hash_table, charset.hash_index, attrs);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1336,7 +1336,7 @@ DEFUN ("set-charset-plist", Fset_charset_plist, Sset_charset_plist, 2, 2, 0,
|
|||
Lisp_Object attrs;
|
||||
|
||||
CHECK_CHARSET_GET_ATTR (charset, attrs);
|
||||
CHARSET_ATTR_PLIST (attrs) = plist;
|
||||
ASET (attrs, charset_plist, plist);
|
||||
return plist;
|
||||
}
|
||||
|
||||
|
|
@ -1375,7 +1375,7 @@ Optional third argument DEUNIFY, if non-nil, means to de-unify CHARSET. */)
|
|||
{
|
||||
if (! STRINGP (unify_map) && ! VECTORP (unify_map))
|
||||
signal_error ("Bad unify-map", unify_map);
|
||||
CHARSET_UNIFY_MAP (cs) = unify_map;
|
||||
set_charset_attr (cs, charset_unify_map, unify_map);
|
||||
}
|
||||
if (NILP (Vchar_unify_table))
|
||||
Vchar_unify_table = Fmake_char_table (Qnil, Qnil);
|
||||
|
|
|
|||
|
|
@ -325,6 +325,13 @@ extern int emacs_mule_charset[256];
|
|||
#define CHARSET_DEUNIFIER(charset) \
|
||||
(CHARSET_ATTR_DEUNIFIER (CHARSET_ATTRIBUTES (charset)))
|
||||
|
||||
static inline void
|
||||
set_charset_attr (struct charset *charset, enum charset_attr_index idx,
|
||||
Lisp_Object val)
|
||||
{
|
||||
ASET (CHARSET_ATTRIBUTES (charset), idx, val);
|
||||
}
|
||||
|
||||
|
||||
/* Nonzero if OBJ is a valid charset symbol. */
|
||||
#define CHARSETP(obj) (CHARSET_SYMBOL_HASH_INDEX (obj) >= 0)
|
||||
|
|
|
|||
87
src/coding.c
87
src/coding.c
|
|
@ -2674,8 +2674,8 @@ encode_coding_emacs_mule (struct coding_system *coding)
|
|||
CODING_GET_INFO (coding, attrs, charset_list);
|
||||
if (! EQ (charset_list, Vemacs_mule_charset_list))
|
||||
{
|
||||
CODING_ATTR_CHARSET_LIST (attrs)
|
||||
= charset_list = Vemacs_mule_charset_list;
|
||||
charset_list = Vemacs_mule_charset_list;
|
||||
ASET (attrs, coding_attr_charset_list, charset_list);
|
||||
}
|
||||
|
||||
while (charbuf < charbuf_end)
|
||||
|
|
@ -2967,8 +2967,8 @@ setup_iso_safe_charsets (Lisp_Object attrs)
|
|||
if ((flags & CODING_ISO_FLAG_FULL_SUPPORT)
|
||||
&& ! EQ (charset_list, Viso_2022_charset_list))
|
||||
{
|
||||
CODING_ATTR_CHARSET_LIST (attrs)
|
||||
= charset_list = Viso_2022_charset_list;
|
||||
charset_list = Viso_2022_charset_list;
|
||||
ASET (attrs, coding_attr_charset_list, charset_list);
|
||||
ASET (attrs, coding_attr_safe_charsets, Qnil);
|
||||
}
|
||||
|
||||
|
|
@ -9603,16 +9603,16 @@ usage: (define-coding-system-internal ...) */)
|
|||
|
||||
name = args[coding_arg_name];
|
||||
CHECK_SYMBOL (name);
|
||||
CODING_ATTR_BASE_NAME (attrs) = name;
|
||||
ASET (attrs, coding_attr_base_name, name);
|
||||
|
||||
val = args[coding_arg_mnemonic];
|
||||
if (! STRINGP (val))
|
||||
CHECK_CHARACTER (val);
|
||||
CODING_ATTR_MNEMONIC (attrs) = val;
|
||||
ASET (attrs, coding_attr_mnemonic, val);
|
||||
|
||||
coding_type = args[coding_arg_coding_type];
|
||||
CHECK_SYMBOL (coding_type);
|
||||
CODING_ATTR_TYPE (attrs) = coding_type;
|
||||
ASET (attrs, coding_attr_type, coding_type);
|
||||
|
||||
charset_list = args[coding_arg_charset_list];
|
||||
if (SYMBOLP (charset_list))
|
||||
|
|
@ -9659,49 +9659,49 @@ usage: (define-coding-system-internal ...) */)
|
|||
max_charset_id = charset->id;
|
||||
}
|
||||
}
|
||||
CODING_ATTR_CHARSET_LIST (attrs) = charset_list;
|
||||
ASET (attrs, coding_attr_charset_list, charset_list);
|
||||
|
||||
safe_charsets = make_uninit_string (max_charset_id + 1);
|
||||
memset (SDATA (safe_charsets), 255, max_charset_id + 1);
|
||||
for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
|
||||
SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
|
||||
CODING_ATTR_SAFE_CHARSETS (attrs) = safe_charsets;
|
||||
ASET (attrs, coding_attr_safe_charsets, safe_charsets);
|
||||
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = args[coding_arg_ascii_compatible_p];
|
||||
ASET (attrs, coding_attr_ascii_compat, args[coding_arg_ascii_compatible_p]);
|
||||
|
||||
val = args[coding_arg_decode_translation_table];
|
||||
if (! CHAR_TABLE_P (val) && ! CONSP (val))
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_DECODE_TBL (attrs) = val;
|
||||
ASET (attrs, coding_attr_decode_tbl, val);
|
||||
|
||||
val = args[coding_arg_encode_translation_table];
|
||||
if (! CHAR_TABLE_P (val) && ! CONSP (val))
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_ENCODE_TBL (attrs) = val;
|
||||
ASET (attrs, coding_attr_encode_tbl, val);
|
||||
|
||||
val = args[coding_arg_post_read_conversion];
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_POST_READ (attrs) = val;
|
||||
ASET (attrs, coding_attr_post_read, val);
|
||||
|
||||
val = args[coding_arg_pre_write_conversion];
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_PRE_WRITE (attrs) = val;
|
||||
ASET (attrs, coding_attr_pre_write, val);
|
||||
|
||||
val = args[coding_arg_default_char];
|
||||
if (NILP (val))
|
||||
CODING_ATTR_DEFAULT_CHAR (attrs) = make_number (' ');
|
||||
ASET (attrs, coding_attr_default_char, make_number (' '));
|
||||
else
|
||||
{
|
||||
CHECK_CHARACTER (val);
|
||||
CODING_ATTR_DEFAULT_CHAR (attrs) = val;
|
||||
ASET (attrs, coding_attr_default_char, val);
|
||||
}
|
||||
|
||||
val = args[coding_arg_for_unibyte];
|
||||
CODING_ATTR_FOR_UNIBYTE (attrs) = NILP (val) ? Qnil : Qt;
|
||||
ASET (attrs, coding_attr_for_unibyte, NILP (val) ? Qnil : Qt);
|
||||
|
||||
val = args[coding_arg_plist];
|
||||
CHECK_LIST (val);
|
||||
CODING_ATTR_PLIST (attrs) = val;
|
||||
ASET (attrs, coding_attr_plist, val);
|
||||
|
||||
if (EQ (coding_type, Qcharset))
|
||||
{
|
||||
|
|
@ -9726,7 +9726,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
int idx = (dim - 1) * 4;
|
||||
|
||||
if (CHARSET_ASCII_COMPATIBLE_P (charset))
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
|
||||
for (i = charset->code_space[idx];
|
||||
i <= charset->code_space[idx + 1]; i++)
|
||||
|
|
@ -9824,7 +9824,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
{
|
||||
Lisp_Object bom, endian;
|
||||
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qnil;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qnil);
|
||||
|
||||
if (nargs < coding_arg_utf16_max)
|
||||
goto short_args;
|
||||
|
|
@ -9877,7 +9877,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
CHECK_CHARSET_GET_CHARSET (val, charset);
|
||||
ASET (initial, i, make_number (CHARSET_ID (charset)));
|
||||
if (i == 0 && CHARSET_ASCII_COMPATIBLE_P (charset))
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
}
|
||||
else
|
||||
ASET (initial, i, make_number (-1));
|
||||
|
|
@ -9938,13 +9938,13 @@ usage: (define-coding-system-internal ...) */)
|
|||
}
|
||||
if (category != coding_category_iso_8_1
|
||||
&& category != coding_category_iso_8_2)
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qnil;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qnil);
|
||||
}
|
||||
else if (EQ (coding_type, Qemacs_mule))
|
||||
{
|
||||
if (EQ (args[coding_arg_charset_list], Qemacs_mule))
|
||||
ASET (attrs, coding_attr_emacs_mule_full, Qt);
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
category = coding_category_emacs_mule;
|
||||
}
|
||||
else if (EQ (coding_type, Qshift_jis))
|
||||
|
|
@ -9961,7 +9961,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
error ("Dimension of charset %s is not one",
|
||||
SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
|
||||
if (CHARSET_ASCII_COMPATIBLE_P (charset))
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
|
||||
charset_list = XCDR (charset_list);
|
||||
charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
|
||||
|
|
@ -9999,7 +9999,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
error ("Dimension of charset %s is not one",
|
||||
SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
|
||||
if (CHARSET_ASCII_COMPATIBLE_P (charset))
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
|
||||
charset_list = XCDR (charset_list);
|
||||
charset = CHARSET_FROM_ID (XINT (XCAR (charset_list)));
|
||||
|
|
@ -10013,7 +10013,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
else if (EQ (coding_type, Qraw_text))
|
||||
{
|
||||
category = coding_category_raw_text;
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
}
|
||||
else if (EQ (coding_type, Qutf_8))
|
||||
{
|
||||
|
|
@ -10033,7 +10033,7 @@ usage: (define-coding-system-internal ...) */)
|
|||
}
|
||||
ASET (attrs, coding_attr_utf_bom, bom);
|
||||
if (NILP (bom))
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = Qt;
|
||||
ASET (attrs, coding_attr_ascii_compat, Qt);
|
||||
|
||||
category = (CONSP (bom) ? coding_category_utf_8_auto
|
||||
: NILP (bom) ? coding_category_utf_8_nosig
|
||||
|
|
@ -10045,14 +10045,15 @@ usage: (define-coding-system-internal ...) */)
|
|||
error ("Invalid coding system type: %s",
|
||||
SDATA (SYMBOL_NAME (coding_type)));
|
||||
|
||||
CODING_ATTR_CATEGORY (attrs) = make_number (category);
|
||||
CODING_ATTR_PLIST (attrs)
|
||||
= Fcons (QCcategory, Fcons (AREF (Vcoding_category_table, category),
|
||||
CODING_ATTR_PLIST (attrs)));
|
||||
CODING_ATTR_PLIST (attrs)
|
||||
= Fcons (QCascii_compatible_p,
|
||||
ASET (attrs, coding_attr_category, make_number (category));
|
||||
ASET (attrs, coding_attr_plist,
|
||||
Fcons (QCcategory,
|
||||
Fcons (AREF (Vcoding_category_table, category),
|
||||
CODING_ATTR_PLIST (attrs))));
|
||||
ASET (attrs, coding_attr_plist,
|
||||
Fcons (QCascii_compatible_p,
|
||||
Fcons (CODING_ATTR_ASCII_COMPAT (attrs),
|
||||
CODING_ATTR_PLIST (attrs)));
|
||||
CODING_ATTR_PLIST (attrs))));
|
||||
|
||||
eol_type = args[coding_arg_eol_type];
|
||||
if (! NILP (eol_type)
|
||||
|
|
@ -10126,7 +10127,7 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
|
|||
{
|
||||
if (! STRINGP (val))
|
||||
CHECK_CHARACTER (val);
|
||||
CODING_ATTR_MNEMONIC (attrs) = val;
|
||||
ASET (attrs, coding_attr_mnemonic, val);
|
||||
}
|
||||
else if (EQ (prop, QCdefault_char))
|
||||
{
|
||||
|
|
@ -10134,37 +10135,37 @@ DEFUN ("coding-system-put", Fcoding_system_put, Scoding_system_put,
|
|||
val = make_number (' ');
|
||||
else
|
||||
CHECK_CHARACTER (val);
|
||||
CODING_ATTR_DEFAULT_CHAR (attrs) = val;
|
||||
ASET (attrs, coding_attr_default_char, val);
|
||||
}
|
||||
else if (EQ (prop, QCdecode_translation_table))
|
||||
{
|
||||
if (! CHAR_TABLE_P (val) && ! CONSP (val))
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_DECODE_TBL (attrs) = val;
|
||||
ASET (attrs, coding_attr_decode_tbl, val);
|
||||
}
|
||||
else if (EQ (prop, QCencode_translation_table))
|
||||
{
|
||||
if (! CHAR_TABLE_P (val) && ! CONSP (val))
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_ENCODE_TBL (attrs) = val;
|
||||
ASET (attrs, coding_attr_encode_tbl, val);
|
||||
}
|
||||
else if (EQ (prop, QCpost_read_conversion))
|
||||
{
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_POST_READ (attrs) = val;
|
||||
ASET (attrs, coding_attr_post_read, val);
|
||||
}
|
||||
else if (EQ (prop, QCpre_write_conversion))
|
||||
{
|
||||
CHECK_SYMBOL (val);
|
||||
CODING_ATTR_PRE_WRITE (attrs) = val;
|
||||
ASET (attrs, coding_attr_pre_write, val);
|
||||
}
|
||||
else if (EQ (prop, QCascii_compatible_p))
|
||||
{
|
||||
CODING_ATTR_ASCII_COMPAT (attrs) = val;
|
||||
ASET (attrs, coding_attr_ascii_compat, val);
|
||||
}
|
||||
|
||||
CODING_ATTR_PLIST (attrs)
|
||||
= Fplist_put (CODING_ATTR_PLIST (attrs), prop, val);
|
||||
ASET (attrs, coding_attr_plist,
|
||||
Fplist_put (CODING_ATTR_PLIST (attrs), prop, val));
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -762,7 +762,7 @@ composition_gstring_width (Lisp_Object gstring, ptrdiff_t from, ptrdiff_t to,
|
|||
}
|
||||
metrics->width = metrics->lbearing = metrics->rbearing = 0;
|
||||
}
|
||||
for (glyph = &LGSTRING_GLYPH (gstring, from); from < to; from++, glyph++)
|
||||
for (glyph = lgstring_glyph_addr (gstring, from); from < to; from++, glyph++)
|
||||
{
|
||||
int x;
|
||||
|
||||
|
|
|
|||
|
|
@ -247,6 +247,11 @@ extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object,
|
|||
#define LGSTRING_GLYPH_LEN(lgs) (ASIZE ((lgs)) - 2)
|
||||
#define LGSTRING_GLYPH(lgs, idx) AREF ((lgs), (idx) + 2)
|
||||
#define LGSTRING_SET_GLYPH(lgs, idx, val) ASET ((lgs), (idx) + 2, (val))
|
||||
static inline Lisp_Object *
|
||||
lgstring_glyph_addr (Lisp_Object lgs, ptrdiff_t idx)
|
||||
{
|
||||
return aref_addr (lgs, idx + 2);
|
||||
}
|
||||
|
||||
/* Vector size of Lispy glyph. */
|
||||
enum lglyph_indices
|
||||
|
|
|
|||
55
src/fns.c
55
src/fns.c
|
|
@ -1192,7 +1192,7 @@ value is a new vector that contains the elements between index FROM
|
|||
string, make_number (0), res, Qnil);
|
||||
}
|
||||
else
|
||||
res = Fvector (to_char - from_char, &AREF (string, from_char));
|
||||
res = Fvector (to_char - from_char, aref_addr (string, from_char));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -1274,7 +1274,7 @@ substring_both (Lisp_Object string, ptrdiff_t from, ptrdiff_t from_byte,
|
|||
string, make_number (0), res, Qnil);
|
||||
}
|
||||
else
|
||||
res = Fvector (to - from, &AREF (string, from));
|
||||
res = Fvector (to - from, aref_addr (string, from));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -3663,7 +3663,7 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
|
|||
|
||||
/* Set up the free list. */
|
||||
for (i = 0; i < sz - 1; ++i)
|
||||
HASH_NEXT (h, i) = make_number (i + 1);
|
||||
set_hash_next (h, i, make_number (i + 1));
|
||||
h->next_free = make_number (0);
|
||||
|
||||
XSET_HASH_TABLE (table, h);
|
||||
|
|
@ -3770,7 +3770,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
|
|||
the end of the free list. This makes some operations like
|
||||
maphash faster. */
|
||||
for (i = old_size; i < new_size - 1; ++i)
|
||||
HASH_NEXT (h, i) = make_number (i + 1);
|
||||
set_hash_next (h, i, make_number (i + 1));
|
||||
|
||||
if (!NILP (h->next_free))
|
||||
{
|
||||
|
|
@ -3781,7 +3781,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
|
|||
!NILP (next))
|
||||
last = next;
|
||||
|
||||
HASH_NEXT (h, XFASTINT (last)) = make_number (old_size);
|
||||
set_hash_next (h, XFASTINT (last), make_number (old_size));
|
||||
}
|
||||
else
|
||||
XSETFASTINT (h->next_free, old_size);
|
||||
|
|
@ -3792,8 +3792,8 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
|
|||
{
|
||||
EMACS_UINT hash_code = XUINT (HASH_HASH (h, i));
|
||||
ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
|
||||
HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
|
||||
HASH_INDEX (h, start_of_bucket) = make_number (i);
|
||||
set_hash_next (h, i, HASH_INDEX (h, start_of_bucket));
|
||||
set_hash_index (h, start_of_bucket, make_number (i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3852,16 +3852,16 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value,
|
|||
/* Store key/value in the key_and_value vector. */
|
||||
i = XFASTINT (h->next_free);
|
||||
h->next_free = HASH_NEXT (h, i);
|
||||
HASH_KEY (h, i) = key;
|
||||
HASH_VALUE (h, i) = value;
|
||||
set_hash_key (h, i, key);
|
||||
set_hash_value (h, i, value);
|
||||
|
||||
/* Remember its hash code. */
|
||||
HASH_HASH (h, i) = make_number (hash);
|
||||
set_hash_hash (h, i, make_number (hash));
|
||||
|
||||
/* Add new entry to its collision chain. */
|
||||
start_of_bucket = hash % ASIZE (h->index);
|
||||
HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
|
||||
HASH_INDEX (h, start_of_bucket) = make_number (i);
|
||||
set_hash_next (h, i, HASH_INDEX (h, start_of_bucket));
|
||||
set_hash_index (h, start_of_bucket, make_number (i));
|
||||
return i;
|
||||
}
|
||||
|
||||
|
|
@ -3892,14 +3892,16 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
|
|||
{
|
||||
/* Take entry out of collision chain. */
|
||||
if (NILP (prev))
|
||||
HASH_INDEX (h, start_of_bucket) = HASH_NEXT (h, i);
|
||||
set_hash_index (h, start_of_bucket, HASH_NEXT (h, i));
|
||||
else
|
||||
HASH_NEXT (h, XFASTINT (prev)) = HASH_NEXT (h, i);
|
||||
set_hash_next (h, XFASTINT (prev), HASH_NEXT (h, i));
|
||||
|
||||
/* Clear slots in key_and_value and add the slots to
|
||||
the free list. */
|
||||
HASH_KEY (h, i) = HASH_VALUE (h, i) = HASH_HASH (h, i) = Qnil;
|
||||
HASH_NEXT (h, i) = h->next_free;
|
||||
set_hash_key (h, i, Qnil);
|
||||
set_hash_value (h, i, Qnil);
|
||||
set_hash_hash (h, i, Qnil);
|
||||
set_hash_next (h, i, h->next_free);
|
||||
h->next_free = make_number (i);
|
||||
h->count--;
|
||||
eassert (h->count >= 0);
|
||||
|
|
@ -3925,10 +3927,10 @@ hash_clear (struct Lisp_Hash_Table *h)
|
|||
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
HASH_NEXT (h, i) = i < size - 1 ? make_number (i + 1) : Qnil;
|
||||
HASH_KEY (h, i) = Qnil;
|
||||
HASH_VALUE (h, i) = Qnil;
|
||||
HASH_HASH (h, i) = Qnil;
|
||||
set_hash_next (h, i, i < size - 1 ? make_number (i + 1) : Qnil);
|
||||
set_hash_key (h, i, Qnil);
|
||||
set_hash_value (h, i, Qnil);
|
||||
set_hash_hash (h, i, Qnil);
|
||||
}
|
||||
|
||||
for (i = 0; i < ASIZE (h->index); ++i)
|
||||
|
|
@ -3992,17 +3994,18 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
|
|||
{
|
||||
/* Take out of collision chain. */
|
||||
if (NILP (prev))
|
||||
HASH_INDEX (h, bucket) = next;
|
||||
set_hash_index (h, bucket, next);
|
||||
else
|
||||
HASH_NEXT (h, XFASTINT (prev)) = next;
|
||||
set_hash_next (h, XFASTINT (prev), next);
|
||||
|
||||
/* Add to free list. */
|
||||
HASH_NEXT (h, i) = h->next_free;
|
||||
set_hash_next (h, i, h->next_free);
|
||||
h->next_free = idx;
|
||||
|
||||
/* Clear key, value, and hash. */
|
||||
HASH_KEY (h, i) = HASH_VALUE (h, i) = Qnil;
|
||||
HASH_HASH (h, i) = Qnil;
|
||||
set_hash_key (h, i, Qnil);
|
||||
set_hash_value (h, i, Qnil);
|
||||
set_hash_hash (h, i, Qnil);
|
||||
|
||||
h->count--;
|
||||
}
|
||||
|
|
@ -4509,7 +4512,7 @@ VALUE. In any case, return VALUE. */)
|
|||
|
||||
i = hash_lookup (h, key, &hash);
|
||||
if (i >= 0)
|
||||
HASH_VALUE (h, i) = value;
|
||||
set_hash_value (h, i, value);
|
||||
else
|
||||
hash_put (h, key, value, hash);
|
||||
|
||||
|
|
|
|||
|
|
@ -4722,7 +4722,7 @@ the corresponding element is nil. */)
|
|||
Lisp_Object elt = AREF (object, XFASTINT (from) + i);
|
||||
CHECK_CHARACTER (elt);
|
||||
}
|
||||
chars = &(AREF (object, XFASTINT (from)));
|
||||
chars = aref_addr (object, XFASTINT (from));
|
||||
}
|
||||
|
||||
vec = Fmake_vector (make_number (len), Qnil);
|
||||
|
|
|
|||
|
|
@ -5551,7 +5551,7 @@ make_lispy_event (struct input_event *event)
|
|||
mouse_syms = larger_vector (mouse_syms, incr, -1);
|
||||
}
|
||||
|
||||
start_pos_ptr = &AREF (button_down_location, button);
|
||||
start_pos_ptr = aref_addr (button_down_location, button);
|
||||
start_pos = *start_pos_ptr;
|
||||
*start_pos_ptr = Qnil;
|
||||
|
||||
|
|
@ -5959,7 +5959,7 @@ make_lispy_event (struct input_event *event)
|
|||
mouse_syms = larger_vector (mouse_syms, incr, -1);
|
||||
}
|
||||
|
||||
start_pos_ptr = &AREF (button_down_location, button);
|
||||
start_pos_ptr = aref_addr (button_down_location, button);
|
||||
start_pos = *start_pos_ptr;
|
||||
|
||||
position = make_lispy_position (f, event->x, event->y,
|
||||
|
|
@ -7525,8 +7525,8 @@ menu_bar_items (Lisp_Object old)
|
|||
tem2 = AREF (menu_bar_items_vector, i + 2);
|
||||
tem3 = AREF (menu_bar_items_vector, i + 3);
|
||||
if (end > i + 4)
|
||||
memmove (&AREF (menu_bar_items_vector, i),
|
||||
&AREF (menu_bar_items_vector, i + 4),
|
||||
memmove (aref_addr (menu_bar_items_vector, i),
|
||||
aref_addr (menu_bar_items_vector, i + 4),
|
||||
(end - i - 4) * sizeof (Lisp_Object));
|
||||
ASET (menu_bar_items_vector, end - 4, tem0);
|
||||
ASET (menu_bar_items_vector, end - 3, tem1);
|
||||
|
|
@ -7575,8 +7575,8 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
|
|||
if (EQ (key, AREF (menu_bar_items_vector, i)))
|
||||
{
|
||||
if (menu_bar_items_index > i + 4)
|
||||
memmove (&AREF (menu_bar_items_vector, i),
|
||||
&AREF (menu_bar_items_vector, i + 4),
|
||||
memmove (aref_addr (menu_bar_items_vector, i),
|
||||
aref_addr (menu_bar_items_vector, i + 4),
|
||||
(menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
|
||||
menu_bar_items_index -= 4;
|
||||
}
|
||||
|
|
@ -8096,6 +8096,14 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
|
|||
UNGCPRO;
|
||||
}
|
||||
|
||||
/* Access slot with index IDX of vector tool_bar_item_properties. */
|
||||
#define PROP(IDX) AREF (tool_bar_item_properties, (IDX))
|
||||
static inline void
|
||||
set_prop (ptrdiff_t idx, Lisp_Object val)
|
||||
{
|
||||
ASET (tool_bar_item_properties, idx, val);
|
||||
}
|
||||
|
||||
|
||||
/* Parse a tool bar item specification ITEM for key KEY and return the
|
||||
result in tool_bar_item_properties. Value is zero if ITEM is
|
||||
|
|
@ -8146,9 +8154,6 @@ process_tool_bar_item (Lisp_Object key, Lisp_Object def, Lisp_Object data, void
|
|||
static int
|
||||
parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
||||
{
|
||||
/* Access slot with index IDX of vector tool_bar_item_properties. */
|
||||
#define PROP(IDX) AREF (tool_bar_item_properties, (IDX))
|
||||
|
||||
Lisp_Object filter = Qnil;
|
||||
Lisp_Object caption;
|
||||
int i, have_label = 0;
|
||||
|
|
@ -8172,15 +8177,15 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
if (VECTORP (tool_bar_item_properties))
|
||||
{
|
||||
for (i = 0; i < TOOL_BAR_ITEM_NSLOTS; ++i)
|
||||
PROP (i) = Qnil;
|
||||
set_prop (i, Qnil);
|
||||
}
|
||||
else
|
||||
tool_bar_item_properties
|
||||
= Fmake_vector (make_number (TOOL_BAR_ITEM_NSLOTS), Qnil);
|
||||
|
||||
/* Set defaults. */
|
||||
PROP (TOOL_BAR_ITEM_KEY) = key;
|
||||
PROP (TOOL_BAR_ITEM_ENABLED_P) = Qt;
|
||||
set_prop (TOOL_BAR_ITEM_KEY, key);
|
||||
set_prop (TOOL_BAR_ITEM_ENABLED_P, Qt);
|
||||
|
||||
/* Get the caption of the item. If the caption is not a string,
|
||||
evaluate it to get a string. If we don't get a string, skip this
|
||||
|
|
@ -8192,7 +8197,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
if (!STRINGP (caption))
|
||||
return 0;
|
||||
}
|
||||
PROP (TOOL_BAR_ITEM_CAPTION) = caption;
|
||||
set_prop (TOOL_BAR_ITEM_CAPTION, caption);
|
||||
|
||||
/* If the rest following the caption is not a list, the menu item is
|
||||
either a separator, or invalid. */
|
||||
|
|
@ -8201,7 +8206,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
{
|
||||
if (menu_separator_name_p (SSDATA (caption)))
|
||||
{
|
||||
PROP (TOOL_BAR_ITEM_TYPE) = Qt;
|
||||
set_prop (TOOL_BAR_ITEM_TYPE, Qt);
|
||||
#if !defined (USE_GTK) && !defined (HAVE_NS)
|
||||
/* If we use build_desired_tool_bar_string to render the
|
||||
tool bar, the separator is rendered as an image. */
|
||||
|
|
@ -8217,7 +8222,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
}
|
||||
|
||||
/* Store the binding. */
|
||||
PROP (TOOL_BAR_ITEM_BINDING) = XCAR (item);
|
||||
set_prop (TOOL_BAR_ITEM_BINDING, XCAR (item));
|
||||
item = XCDR (item);
|
||||
|
||||
/* Ignore cached key binding, if any. */
|
||||
|
|
@ -8236,9 +8241,9 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
{
|
||||
/* `:enable FORM'. */
|
||||
if (!NILP (Venable_disabled_menus_and_buttons))
|
||||
PROP (TOOL_BAR_ITEM_ENABLED_P) = Qt;
|
||||
set_prop (TOOL_BAR_ITEM_ENABLED_P, Qt);
|
||||
else
|
||||
PROP (TOOL_BAR_ITEM_ENABLED_P) = value;
|
||||
set_prop (TOOL_BAR_ITEM_ENABLED_P, value);
|
||||
}
|
||||
else if (EQ (ikey, QCvisible))
|
||||
{
|
||||
|
|
@ -8249,17 +8254,16 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
}
|
||||
else if (EQ (ikey, QChelp))
|
||||
/* `:help HELP-STRING'. */
|
||||
PROP (TOOL_BAR_ITEM_HELP) = value;
|
||||
set_prop (TOOL_BAR_ITEM_HELP, value);
|
||||
else if (EQ (ikey, QCvert_only))
|
||||
/* `:vert-only t/nil'. */
|
||||
PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
|
||||
set_prop (TOOL_BAR_ITEM_VERT_ONLY, value);
|
||||
else if (EQ (ikey, QClabel))
|
||||
{
|
||||
const char *bad_label = "!!?GARBLED ITEM?!!";
|
||||
/* `:label LABEL-STRING'. */
|
||||
PROP (TOOL_BAR_ITEM_LABEL) = STRINGP (value)
|
||||
? value
|
||||
: build_string (bad_label);
|
||||
set_prop (TOOL_BAR_ITEM_LABEL,
|
||||
STRINGP (value) ? value : build_string (bad_label));
|
||||
have_label = 1;
|
||||
}
|
||||
else if (EQ (ikey, QCfilter))
|
||||
|
|
@ -8274,8 +8278,8 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
selected = XCDR (value);
|
||||
if (EQ (type, QCtoggle) || EQ (type, QCradio))
|
||||
{
|
||||
PROP (TOOL_BAR_ITEM_SELECTED_P) = selected;
|
||||
PROP (TOOL_BAR_ITEM_TYPE) = type;
|
||||
set_prop (TOOL_BAR_ITEM_SELECTED_P, selected);
|
||||
set_prop (TOOL_BAR_ITEM_TYPE, type);
|
||||
}
|
||||
}
|
||||
else if (EQ (ikey, QCimage)
|
||||
|
|
@ -8283,10 +8287,10 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
|| (VECTORP (value) && ASIZE (value) == 4)))
|
||||
/* Value is either a single image specification or a vector
|
||||
of 4 such specifications for the different button states. */
|
||||
PROP (TOOL_BAR_ITEM_IMAGES) = value;
|
||||
set_prop (TOOL_BAR_ITEM_IMAGES, value);
|
||||
else if (EQ (ikey, QCrtl))
|
||||
/* ':rtl STRING' */
|
||||
PROP (TOOL_BAR_ITEM_RTL_IMAGE) = value;
|
||||
set_prop (TOOL_BAR_ITEM_RTL_IMAGE, value);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -8328,18 +8332,19 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
|
||||
new_lbl = Fupcase_initials (build_string (label));
|
||||
if (SCHARS (new_lbl) <= tool_bar_max_label_size)
|
||||
PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;
|
||||
set_prop (TOOL_BAR_ITEM_LABEL, new_lbl);
|
||||
else
|
||||
PROP (TOOL_BAR_ITEM_LABEL) = empty_unibyte_string;
|
||||
set_prop (TOOL_BAR_ITEM_LABEL, empty_unibyte_string);
|
||||
xfree (buf);
|
||||
}
|
||||
|
||||
/* If got a filter apply it on binding. */
|
||||
if (!NILP (filter))
|
||||
PROP (TOOL_BAR_ITEM_BINDING)
|
||||
= menu_item_eval_property (list2 (filter,
|
||||
set_prop (TOOL_BAR_ITEM_BINDING,
|
||||
(menu_item_eval_property
|
||||
(list2 (filter,
|
||||
list2 (Qquote,
|
||||
PROP (TOOL_BAR_ITEM_BINDING))));
|
||||
PROP (TOOL_BAR_ITEM_BINDING))))));
|
||||
|
||||
/* See if the binding is a keymap. Give up if it is. */
|
||||
if (CONSP (get_keymap (PROP (TOOL_BAR_ITEM_BINDING), 0, 1)))
|
||||
|
|
@ -8347,13 +8352,13 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
|
||||
/* Enable or disable selection of item. */
|
||||
if (!EQ (PROP (TOOL_BAR_ITEM_ENABLED_P), Qt))
|
||||
PROP (TOOL_BAR_ITEM_ENABLED_P)
|
||||
= menu_item_eval_property (PROP (TOOL_BAR_ITEM_ENABLED_P));
|
||||
set_prop (TOOL_BAR_ITEM_ENABLED_P,
|
||||
menu_item_eval_property (PROP (TOOL_BAR_ITEM_ENABLED_P)));
|
||||
|
||||
/* Handle radio buttons or toggle boxes. */
|
||||
if (!NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)))
|
||||
PROP (TOOL_BAR_ITEM_SELECTED_P)
|
||||
= menu_item_eval_property (PROP (TOOL_BAR_ITEM_SELECTED_P));
|
||||
set_prop (TOOL_BAR_ITEM_SELECTED_P,
|
||||
menu_item_eval_property (PROP (TOOL_BAR_ITEM_SELECTED_P)));
|
||||
|
||||
return 1;
|
||||
|
||||
|
|
|
|||
40
src/lisp.h
40
src/lisp.h
|
|
@ -598,7 +598,7 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
|
|||
#define ASET(ARRAY, IDX, VAL) \
|
||||
(eassert ((IDX) == (IDX)), \
|
||||
eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)), \
|
||||
AREF ((ARRAY), (IDX)) = (VAL))
|
||||
XVECTOR (ARRAY)->contents[IDX] = (VAL))
|
||||
|
||||
/* Convenience macros for dealing with Lisp strings. */
|
||||
|
||||
|
|
@ -2336,6 +2336,44 @@ void staticpro (Lisp_Object *);
|
|||
struct window;
|
||||
struct frame;
|
||||
|
||||
/* Simple access functions. */
|
||||
|
||||
static inline Lisp_Object *
|
||||
aref_addr (Lisp_Object array, ptrdiff_t idx)
|
||||
{
|
||||
return & XVECTOR (array)->contents[idx];
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_hash_key (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
|
||||
{
|
||||
ASET (h->key_and_value, 2 * idx, val);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_hash_value (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
|
||||
{
|
||||
ASET (h->key_and_value, 2 * idx + 1, val);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_hash_next (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
|
||||
{
|
||||
ASET (h->next, idx, val);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_hash_hash (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
|
||||
{
|
||||
ASET (h->hash, idx, val);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_hash_index (struct Lisp_Hash_Table *h, ptrdiff_t idx, Lisp_Object val)
|
||||
{
|
||||
ASET (h->index, idx, val);
|
||||
}
|
||||
|
||||
/* Defined in data.c. */
|
||||
extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
|
||||
extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
|
||||
|
|
|
|||
10
src/lread.c
10
src/lread.c
|
|
@ -3715,7 +3715,7 @@ it defaults to the value of `obarray'. */)
|
|||
SET_SYMBOL_VAL (XSYMBOL (sym), sym);
|
||||
}
|
||||
|
||||
ptr = &AREF (obarray, XINT(tem));
|
||||
ptr = aref_addr (obarray, XINT(tem));
|
||||
if (SYMBOLP (*ptr))
|
||||
XSYMBOL (sym)->next = XSYMBOL (*ptr);
|
||||
else
|
||||
|
|
@ -3797,9 +3797,13 @@ OBARRAY defaults to the value of the variable `obarray'. */)
|
|||
if (EQ (AREF (obarray, hash), tem))
|
||||
{
|
||||
if (XSYMBOL (tem)->next)
|
||||
XSETSYMBOL (AREF (obarray, hash), XSYMBOL (tem)->next);
|
||||
{
|
||||
Lisp_Object sym;
|
||||
XSETSYMBOL (sym, XSYMBOL (tem)->next);
|
||||
ASET (obarray, hash, sym);
|
||||
}
|
||||
else
|
||||
XSETINT (AREF (obarray, hash), 0);
|
||||
ASET (obarray, hash, make_number (0));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1006,7 +1006,7 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data)
|
|||
{
|
||||
entry
|
||||
= AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
|
||||
if (&AREF (menu_items, i) == client_data)
|
||||
if (aref_addr (menu_items, i) == client_data)
|
||||
{
|
||||
if (keymaps != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -222,7 +222,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
|
|||
|
||||
/* Save the frame's previous menu bar contents data */
|
||||
if (previous_menu_items_used)
|
||||
memcpy (previous_items, &AREF (FVAR (f, menu_bar_vector), 0),
|
||||
memcpy (previous_items, aref_addr (FVAR (f, menu_bar_vector), 0),
|
||||
previous_menu_items_used * sizeof (Lisp_Object));
|
||||
|
||||
/* parse stage 1: extract from lisp */
|
||||
|
|
@ -939,8 +939,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
|
|||
/* If this item has a null value,
|
||||
make the call_data null so that it won't display a box
|
||||
when the mouse is on it. */
|
||||
wv->call_data
|
||||
= !NILP (def) ? (void *) &AREF (menu_items, i) : 0;
|
||||
wv->call_data = !NILP (def) ? aref_addr (menu_items, i) : 0;
|
||||
wv->enabled = !NILP (enable);
|
||||
|
||||
if (NILP (type))
|
||||
|
|
|
|||
|
|
@ -1062,7 +1062,7 @@ w32_dialog_show (FRAME_PTR f, int keymaps,
|
|||
if (!NILP (descrip))
|
||||
wv->key = SSDATA (descrip);
|
||||
wv->value = SSDATA (item_name);
|
||||
wv->call_data = (void *) &AREF (menu_items, i);
|
||||
wv->call_data = aref_addr (menu_items, i);
|
||||
wv->enabled = !NILP (enable);
|
||||
wv->help = Qnil;
|
||||
prev_wv = wv;
|
||||
|
|
|
|||
110
src/xfaces.c
110
src/xfaces.c
|
|
@ -2182,14 +2182,14 @@ set_lface_from_font (struct frame *f, Lisp_Object lface,
|
|||
{
|
||||
Lisp_Object family = AREF (font_object, FONT_FAMILY_INDEX);
|
||||
|
||||
LFACE_FAMILY (lface) = SYMBOL_NAME (family);
|
||||
ASET (lface, LFACE_FAMILY_INDEX, SYMBOL_NAME (family));
|
||||
}
|
||||
|
||||
if (force_p || UNSPECIFIEDP (LFACE_FOUNDRY (lface)))
|
||||
{
|
||||
Lisp_Object foundry = AREF (font_object, FONT_FOUNDRY_INDEX);
|
||||
|
||||
LFACE_FOUNDRY (lface) = SYMBOL_NAME (foundry);
|
||||
ASET (lface, LFACE_FOUNDRY_INDEX, SYMBOL_NAME (foundry));
|
||||
}
|
||||
|
||||
if (force_p || UNSPECIFIEDP (LFACE_HEIGHT (lface)))
|
||||
|
|
@ -2197,26 +2197,26 @@ set_lface_from_font (struct frame *f, Lisp_Object lface,
|
|||
int pt = PIXEL_TO_POINT (font->pixel_size * 10, f->resy);
|
||||
|
||||
eassert (pt > 0);
|
||||
LFACE_HEIGHT (lface) = make_number (pt);
|
||||
ASET (lface, LFACE_HEIGHT_INDEX, make_number (pt));
|
||||
}
|
||||
|
||||
if (force_p || UNSPECIFIEDP (LFACE_WEIGHT (lface)))
|
||||
{
|
||||
val = FONT_WEIGHT_FOR_FACE (font_object);
|
||||
LFACE_WEIGHT (lface) = ! NILP (val) ? val :Qnormal;
|
||||
ASET (lface, LFACE_WEIGHT_INDEX, ! NILP (val) ? val :Qnormal);
|
||||
}
|
||||
if (force_p || UNSPECIFIEDP (LFACE_SLANT (lface)))
|
||||
{
|
||||
val = FONT_SLANT_FOR_FACE (font_object);
|
||||
LFACE_SLANT (lface) = ! NILP (val) ? val : Qnormal;
|
||||
ASET (lface, LFACE_SLANT_INDEX, ! NILP (val) ? val : Qnormal);
|
||||
}
|
||||
if (force_p || UNSPECIFIEDP (LFACE_SWIDTH (lface)))
|
||||
{
|
||||
val = FONT_WIDTH_FOR_FACE (font_object);
|
||||
LFACE_SWIDTH (lface) = ! NILP (val) ? val : Qnormal;
|
||||
ASET (lface, LFACE_SWIDTH_INDEX, ! NILP (val) ? val : Qnormal);
|
||||
}
|
||||
|
||||
LFACE_FONT (lface) = font_object;
|
||||
ASET (lface, LFACE_FONT_INDEX, font_object);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -2851,7 +2851,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face family", value);
|
||||
}
|
||||
old_value = LFACE_FAMILY (lface);
|
||||
LFACE_FAMILY (lface) = value;
|
||||
ASET (lface, LFACE_FAMILY_INDEX, value);
|
||||
prop_index = FONT_FAMILY_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCfoundry))
|
||||
|
|
@ -2863,7 +2863,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face foundry", value);
|
||||
}
|
||||
old_value = LFACE_FOUNDRY (lface);
|
||||
LFACE_FOUNDRY (lface) = value;
|
||||
ASET (lface, LFACE_FOUNDRY_INDEX, value);
|
||||
prop_index = FONT_FOUNDRY_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCheight))
|
||||
|
|
@ -2891,7 +2891,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
}
|
||||
|
||||
old_value = LFACE_HEIGHT (lface);
|
||||
LFACE_HEIGHT (lface) = value;
|
||||
ASET (lface, LFACE_HEIGHT_INDEX, value);
|
||||
prop_index = FONT_SIZE_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCweight))
|
||||
|
|
@ -2903,7 +2903,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face weight", value);
|
||||
}
|
||||
old_value = LFACE_WEIGHT (lface);
|
||||
LFACE_WEIGHT (lface) = value;
|
||||
ASET (lface, LFACE_WEIGHT_INDEX, value);
|
||||
prop_index = FONT_WEIGHT_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCslant))
|
||||
|
|
@ -2915,7 +2915,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face slant", value);
|
||||
}
|
||||
old_value = LFACE_SLANT (lface);
|
||||
LFACE_SLANT (lface) = value;
|
||||
ASET (lface, LFACE_SLANT_INDEX, value);
|
||||
prop_index = FONT_SLANT_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCunderline))
|
||||
|
|
@ -2969,7 +2969,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face underline", value);
|
||||
|
||||
old_value = LFACE_UNDERLINE (lface);
|
||||
LFACE_UNDERLINE (lface) = value;
|
||||
ASET (lface, LFACE_UNDERLINE_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCoverline))
|
||||
{
|
||||
|
|
@ -2983,7 +2983,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face overline", value);
|
||||
|
||||
old_value = LFACE_OVERLINE (lface);
|
||||
LFACE_OVERLINE (lface) = value;
|
||||
ASET (lface, LFACE_OVERLINE_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCstrike_through))
|
||||
{
|
||||
|
|
@ -2997,7 +2997,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face strike-through", value);
|
||||
|
||||
old_value = LFACE_STRIKE_THROUGH (lface);
|
||||
LFACE_STRIKE_THROUGH (lface) = value;
|
||||
ASET (lface, LFACE_STRIKE_THROUGH_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCbox))
|
||||
{
|
||||
|
|
@ -3060,7 +3060,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face box", value);
|
||||
|
||||
old_value = LFACE_BOX (lface);
|
||||
LFACE_BOX (lface) = value;
|
||||
ASET (lface, LFACE_BOX_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCinverse_video)
|
||||
|| EQ (attr, QCreverse_video))
|
||||
|
|
@ -3072,7 +3072,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid inverse-video face attribute value", value);
|
||||
}
|
||||
old_value = LFACE_INVERSE (lface);
|
||||
LFACE_INVERSE (lface) = value;
|
||||
ASET (lface, LFACE_INVERSE_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCforeground))
|
||||
{
|
||||
|
|
@ -3089,7 +3089,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Empty foreground color value", value);
|
||||
}
|
||||
old_value = LFACE_FOREGROUND (lface);
|
||||
LFACE_FOREGROUND (lface) = value;
|
||||
ASET (lface, LFACE_FOREGROUND_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCbackground))
|
||||
{
|
||||
|
|
@ -3106,7 +3106,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Empty background color value", value);
|
||||
}
|
||||
old_value = LFACE_BACKGROUND (lface);
|
||||
LFACE_BACKGROUND (lface) = value;
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX, value);
|
||||
}
|
||||
else if (EQ (attr, QCstipple))
|
||||
{
|
||||
|
|
@ -3116,7 +3116,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
&& NILP (Fbitmap_spec_p (value)))
|
||||
signal_error ("Invalid stipple attribute", value);
|
||||
old_value = LFACE_STIPPLE (lface);
|
||||
LFACE_STIPPLE (lface) = value;
|
||||
ASET (lface, LFACE_STIPPLE_INDEX, value);
|
||||
#endif /* HAVE_X_WINDOWS || HAVE_NS */
|
||||
}
|
||||
else if (EQ (attr, QCwidth))
|
||||
|
|
@ -3128,7 +3128,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
signal_error ("Invalid face width", value);
|
||||
}
|
||||
old_value = LFACE_SWIDTH (lface);
|
||||
LFACE_SWIDTH (lface) = value;
|
||||
ASET (lface, LFACE_SWIDTH_INDEX, value);
|
||||
prop_index = FONT_WIDTH_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCfont))
|
||||
|
|
@ -3174,7 +3174,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
set_lface_from_font (f, lface, value, 1);
|
||||
}
|
||||
else
|
||||
LFACE_FONT (lface) = value;
|
||||
ASET (lface, LFACE_FONT_INDEX, value);
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
}
|
||||
|
|
@ -3189,7 +3189,7 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
tmp = Fquery_fontset (value, Qnil);
|
||||
if (NILP (tmp))
|
||||
signal_error ("Invalid fontset name", value);
|
||||
LFACE_FONTSET (lface) = value = tmp;
|
||||
ASET (lface, LFACE_FONTSET_INDEX, value = tmp);
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
}
|
||||
|
|
@ -3203,21 +3203,21 @@ FRAME 0 means change the face on all frames, and change the default
|
|||
if (!SYMBOLP (XCAR (tail)))
|
||||
break;
|
||||
if (NILP (tail))
|
||||
LFACE_INHERIT (lface) = value;
|
||||
ASET (lface, LFACE_INHERIT_INDEX, value);
|
||||
else
|
||||
signal_error ("Invalid face inheritance", value);
|
||||
}
|
||||
else if (EQ (attr, QCbold))
|
||||
{
|
||||
old_value = LFACE_WEIGHT (lface);
|
||||
LFACE_WEIGHT (lface) = NILP (value) ? Qnormal : Qbold;
|
||||
ASET (lface, LFACE_WEIGHT_INDEX, NILP (value) ? Qnormal : Qbold);
|
||||
prop_index = FONT_WEIGHT_INDEX;
|
||||
}
|
||||
else if (EQ (attr, QCitalic))
|
||||
{
|
||||
attr = QCslant;
|
||||
old_value = LFACE_SLANT (lface);
|
||||
LFACE_SLANT (lface) = NILP (value) ? Qnormal : Qitalic;
|
||||
ASET (lface, LFACE_SLANT_INDEX, NILP (value) ? Qnormal : Qitalic);
|
||||
prop_index = FONT_SLANT_INDEX;
|
||||
}
|
||||
else
|
||||
|
|
@ -3365,8 +3365,8 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
|
|||
{
|
||||
face = Qdefault;
|
||||
lface = lface_from_face_name (f, face, 1);
|
||||
LFACE_FOREGROUND (lface) = (STRINGP (new_value)
|
||||
? new_value : Qunspecified);
|
||||
ASET (lface, LFACE_FOREGROUND_INDEX,
|
||||
(STRINGP (new_value) ? new_value : Qunspecified));
|
||||
realize_basic_faces (f);
|
||||
}
|
||||
else if (EQ (param, Qbackground_color))
|
||||
|
|
@ -3381,8 +3381,8 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
|
|||
|
||||
face = Qdefault;
|
||||
lface = lface_from_face_name (f, face, 1);
|
||||
LFACE_BACKGROUND (lface) = (STRINGP (new_value)
|
||||
? new_value : Qunspecified);
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX,
|
||||
(STRINGP (new_value) ? new_value : Qunspecified));
|
||||
realize_basic_faces (f);
|
||||
}
|
||||
#ifdef HAVE_WINDOW_SYSTEM
|
||||
|
|
@ -3390,22 +3390,22 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
|
|||
{
|
||||
face = Qborder;
|
||||
lface = lface_from_face_name (f, face, 1);
|
||||
LFACE_BACKGROUND (lface) = (STRINGP (new_value)
|
||||
? new_value : Qunspecified);
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX,
|
||||
(STRINGP (new_value) ? new_value : Qunspecified));
|
||||
}
|
||||
else if (EQ (param, Qcursor_color))
|
||||
{
|
||||
face = Qcursor;
|
||||
lface = lface_from_face_name (f, face, 1);
|
||||
LFACE_BACKGROUND (lface) = (STRINGP (new_value)
|
||||
? new_value : Qunspecified);
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX,
|
||||
(STRINGP (new_value) ? new_value : Qunspecified));
|
||||
}
|
||||
else if (EQ (param, Qmouse_color))
|
||||
{
|
||||
face = Qmouse;
|
||||
lface = lface_from_face_name (f, face, 1);
|
||||
LFACE_BACKGROUND (lface) = (STRINGP (new_value)
|
||||
? new_value : Qunspecified);
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX,
|
||||
(STRINGP (new_value) ? new_value : Qunspecified));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -3445,7 +3445,7 @@ set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
|
|||
font = font_load_for_lface (f, XVECTOR (lface)->contents, font);
|
||||
if (NILP (font))
|
||||
return;
|
||||
LFACE_FONT (lface) = font;
|
||||
ASET (lface, LFACE_FONT_INDEX, font);
|
||||
}
|
||||
f->default_face_done_p = 0;
|
||||
Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, font), Qnil));
|
||||
|
|
@ -5366,39 +5366,39 @@ realize_default_face (struct frame *f)
|
|||
|
||||
XSETFONT (font_object, FRAME_FONT (f));
|
||||
set_lface_from_font (f, lface, font_object, f->default_face_done_p);
|
||||
LFACE_FONTSET (lface) = fontset_name (FRAME_FONTSET (f));
|
||||
ASET (lface, LFACE_FONTSET_INDEX, fontset_name (FRAME_FONTSET (f)));
|
||||
f->default_face_done_p = 1;
|
||||
}
|
||||
#endif /* HAVE_WINDOW_SYSTEM */
|
||||
|
||||
if (!FRAME_WINDOW_P (f))
|
||||
{
|
||||
LFACE_FAMILY (lface) = build_string ("default");
|
||||
LFACE_FOUNDRY (lface) = LFACE_FAMILY (lface);
|
||||
LFACE_SWIDTH (lface) = Qnormal;
|
||||
LFACE_HEIGHT (lface) = make_number (1);
|
||||
ASET (lface, LFACE_FAMILY_INDEX, build_string ("default"));
|
||||
ASET (lface, LFACE_FOUNDRY_INDEX, LFACE_FAMILY (lface));
|
||||
ASET (lface, LFACE_SWIDTH_INDEX, Qnormal);
|
||||
ASET (lface, LFACE_HEIGHT_INDEX, make_number (1));
|
||||
if (UNSPECIFIEDP (LFACE_WEIGHT (lface)))
|
||||
LFACE_WEIGHT (lface) = Qnormal;
|
||||
ASET (lface, LFACE_WEIGHT_INDEX, Qnormal);
|
||||
if (UNSPECIFIEDP (LFACE_SLANT (lface)))
|
||||
LFACE_SLANT (lface) = Qnormal;
|
||||
ASET (lface, LFACE_SLANT_INDEX, Qnormal);
|
||||
if (UNSPECIFIEDP (LFACE_FONTSET (lface)))
|
||||
LFACE_FONTSET (lface) = Qnil;
|
||||
ASET (lface, LFACE_FONTSET_INDEX, Qnil);
|
||||
}
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_UNDERLINE (lface)))
|
||||
LFACE_UNDERLINE (lface) = Qnil;
|
||||
ASET (lface, LFACE_UNDERLINE_INDEX, Qnil);
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_OVERLINE (lface)))
|
||||
LFACE_OVERLINE (lface) = Qnil;
|
||||
ASET (lface, LFACE_OVERLINE_INDEX, Qnil);
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_STRIKE_THROUGH (lface)))
|
||||
LFACE_STRIKE_THROUGH (lface) = Qnil;
|
||||
ASET (lface, LFACE_STRIKE_THROUGH_INDEX, Qnil);
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_BOX (lface)))
|
||||
LFACE_BOX (lface) = Qnil;
|
||||
ASET (lface, LFACE_BOX_INDEX, Qnil);
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_INVERSE (lface)))
|
||||
LFACE_INVERSE (lface) = Qnil;
|
||||
ASET (lface, LFACE_INVERSE_INDEX, Qnil);
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_FOREGROUND (lface)))
|
||||
{
|
||||
|
|
@ -5407,11 +5407,11 @@ realize_default_face (struct frame *f)
|
|||
Lisp_Object color = Fassq (Qforeground_color, FVAR (f, param_alist));
|
||||
|
||||
if (CONSP (color) && STRINGP (XCDR (color)))
|
||||
LFACE_FOREGROUND (lface) = XCDR (color);
|
||||
ASET (lface, LFACE_FOREGROUND_INDEX, XCDR (color));
|
||||
else if (FRAME_WINDOW_P (f))
|
||||
return 0;
|
||||
else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
|
||||
LFACE_FOREGROUND (lface) = build_string (unspecified_fg);
|
||||
ASET (lface, LFACE_FOREGROUND_INDEX, build_string (unspecified_fg));
|
||||
else
|
||||
abort ();
|
||||
}
|
||||
|
|
@ -5422,17 +5422,17 @@ realize_default_face (struct frame *f)
|
|||
set in the frame parameter list. */
|
||||
Lisp_Object color = Fassq (Qbackground_color, FVAR (f, param_alist));
|
||||
if (CONSP (color) && STRINGP (XCDR (color)))
|
||||
LFACE_BACKGROUND (lface) = XCDR (color);
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX, XCDR (color));
|
||||
else if (FRAME_WINDOW_P (f))
|
||||
return 0;
|
||||
else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
|
||||
LFACE_BACKGROUND (lface) = build_string (unspecified_bg);
|
||||
ASET (lface, LFACE_BACKGROUND_INDEX, build_string (unspecified_bg));
|
||||
else
|
||||
abort ();
|
||||
}
|
||||
|
||||
if (UNSPECIFIEDP (LFACE_STIPPLE (lface)))
|
||||
LFACE_STIPPLE (lface) = Qnil;
|
||||
ASET (lface, LFACE_STIPPLE_INDEX, Qnil);
|
||||
|
||||
/* Realize the face; it must be fully-specified now. */
|
||||
eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
|
||||
|
|
|
|||
|
|
@ -463,11 +463,11 @@ xfont_list_pattern (Display *display, const char *pattern,
|
|||
list = Fcons (entity, list);
|
||||
continue;
|
||||
}
|
||||
if (memcmp (props, &(AREF (entity, FONT_FOUNDRY_INDEX)),
|
||||
if (memcmp (props, aref_addr (entity, FONT_FOUNDRY_INDEX),
|
||||
sizeof (Lisp_Object) * 7)
|
||||
|| ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7]))
|
||||
{
|
||||
memcpy (props, &(AREF (entity, FONT_FOUNDRY_INDEX)),
|
||||
memcpy (props, aref_addr (entity, FONT_FOUNDRY_INDEX),
|
||||
sizeof (Lisp_Object) * 7);
|
||||
props[7] = AREF (entity, FONT_SPACING_INDEX);
|
||||
scripts = xfont_supported_scripts (display, indices[i],
|
||||
|
|
|
|||
|
|
@ -1782,8 +1782,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
|
|||
/* If this item has a null value,
|
||||
make the call_data null so that it won't display a box
|
||||
when the mouse is on it. */
|
||||
wv->call_data
|
||||
= (!NILP (def) ? (void *) &AREF (menu_items, i) : 0);
|
||||
wv->call_data = !NILP (def) ? aref_addr (menu_items, i) : 0;
|
||||
wv->enabled = !NILP (enable);
|
||||
|
||||
if (NILP (type))
|
||||
|
|
@ -1884,7 +1883,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
|
|||
{
|
||||
entry
|
||||
= AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
|
||||
if (menu_item_selection == &AREF (menu_items, i))
|
||||
if (menu_item_selection == aref_addr (menu_items, i))
|
||||
{
|
||||
if (keymaps != 0)
|
||||
{
|
||||
|
|
@ -2104,7 +2103,7 @@ xdialog_show (FRAME_PTR f,
|
|||
if (!NILP (descrip))
|
||||
wv->key = SSDATA (descrip);
|
||||
wv->value = SSDATA (item_name);
|
||||
wv->call_data = (void *) &AREF (menu_items, i);
|
||||
wv->call_data = aref_addr (menu_items, i);
|
||||
wv->enabled = !NILP (enable);
|
||||
wv->help = Qnil;
|
||||
prev_wv = wv;
|
||||
|
|
@ -2187,7 +2186,7 @@ xdialog_show (FRAME_PTR f,
|
|||
{
|
||||
entry
|
||||
= AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
|
||||
if (menu_item_selection == &AREF (menu_items, i))
|
||||
if (menu_item_selection == aref_addr (menu_items, i))
|
||||
{
|
||||
if (keymaps != 0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue