static Lisp_Object Qultra_expanded;
static Lisp_Object Qreleased_button, Qpressed_button;
static Lisp_Object QCstyle, QCcolor, QCline_width;
-static Lisp_Object Qunspecified;
+Lisp_Object Qunspecified; /* used in dosfns.c */
static Lisp_Object Qignore_defface;
char unspecified_fg[] = "unspecified-fg", unspecified_bg[] = "unspecified-bg";
/* A vector mapping Lisp face Id's to face names. */
static Lisp_Object *lface_id_to_name;
-static int lface_id_to_name_size;
+static ptrdiff_t lface_id_to_name_size;
/* TTY color-related functions (defined in tty-colors.el). */
static void set_font_frame_param (Lisp_Object, Lisp_Object);
static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *,
int, struct named_merge_point *);
-static int load_pixmap (struct frame *, Lisp_Object, unsigned *, unsigned *);
+static ptrdiff_t load_pixmap (struct frame *, Lisp_Object,
+ unsigned *, unsigned *);
static struct frame *frame_or_selected_frame (Lisp_Object, int);
static void load_face_colors (struct frame *, struct face *, Lisp_Object *);
static void free_face_colors (struct frame *, struct face *);
/* Register color PIXEL as allocated. */
void
-register_color (pixel)
- unsigned long pixel;
+register_color (unsigned long pixel)
{
xassert (pixel < 256);
++color_count[pixel];
/* Register color PIXEL as deallocated. */
void
-unregister_color (pixel)
- unsigned long pixel;
+unregister_color (unsigned long pixel)
{
xassert (pixel < 256);
if (color_count[pixel] > 0)
/* Register N colors from PIXELS as deallocated. */
void
-unregister_colors (pixels, n)
- unsigned long *pixels;
- int n;
+unregister_colors (unsigned long *pixels, int n)
{
int i;
for (i = 0; i < n; ++i)
/* Create and return a GC for use on frame F. GC values and mask
are given by XGCV and MASK. */
-static INLINE GC
+static inline GC
x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
{
GC gc;
/* Free GC which was used on frame F. */
-static INLINE void
+static inline void
x_free_gc (struct frame *f, GC gc)
{
eassert (interrupt_input_blocked);
#ifdef WINDOWSNT
/* W32 emulation of GCs */
-static INLINE GC
+static inline GC
x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
{
GC gc;
/* Free GC which was used on frame F. */
-static INLINE void
+static inline void
x_free_gc (struct frame *f, GC gc)
{
IF_DEBUG (xassert (--ngcs >= 0));
#ifdef HAVE_NS
/* NS emulation of GCs */
-static INLINE GC
+static inline GC
x_create_gc (struct frame *f,
unsigned long mask,
XGCValues *xgcv)
return gc;
}
-static INLINE void
+static inline void
x_free_gc (struct frame *f, GC gc)
{
xfree (gc);
CHECK_LIVE_FRAME. This is here because it's a frequent pattern in
Lisp function definitions. */
-static INLINE struct frame *
+static inline struct frame *
frame_or_selected_frame (Lisp_Object frame, int nparam)
{
if (NILP (frame))
}
}
- if (NATNUMP (width) && NATNUMP (height) && STRINGP (data))
+ if (STRINGP (data)
+ && INTEGERP (width) && 0 < XINT (width)
+ && INTEGERP (height) && 0 < XINT (height))
{
- int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1)
- / BITS_PER_CHAR);
- if (SBYTES (data) >= bytes_per_row * XINT (height))
+ EMACS_INT bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1)
+ / BITS_PER_CHAR);
+ if (XINT (height) <= SBYTES (data) / bytes_per_row)
pixmap_p = 1;
}
}
zero. Store the bitmap width in *W_PTR and its height in *H_PTR,
if these pointers are not null. */
-static int
+static ptrdiff_t
load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, unsigned int *h_ptr)
{
- int bitmap_id;
+ ptrdiff_t bitmap_id;
if (NILP (name))
return 0;
#define LFACEP(LFACE) \
(VECTORP (LFACE) \
- && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE \
+ && ASIZE (LFACE) == LFACE_VECTOR_SIZE \
&& EQ (AREF (LFACE, 0), Qface))
#endif
/* Check consistency of Lisp face attribute vector ATTRS. */
static void
-check_lface_attrs (attrs)
- Lisp_Object *attrs;
+check_lface_attrs (Lisp_Object *attrs)
{
xassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_FAMILY_INDEX])
|| IGNORE_DEFFACE_P (attrs[LFACE_FONT_INDEX])
|| FONTP (attrs[LFACE_FONT_INDEX]));
xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX])
- || STRINGP (attrs[LFACE_FONTSET_INDEX]));
+ || STRINGP (attrs[LFACE_FONTSET_INDEX])
+ || NILP (attrs[LFACE_FONTSET_INDEX]));
#endif
}
/* Check consistency of attributes of Lisp face LFACE (a Lisp vector). */
static void
-check_lface (lface)
- Lisp_Object lface;
+check_lface (Lisp_Object lface)
{
if (!NILP (lface))
{
FACE_NAME and NAMED_MERGE_POINT_KIND, as the head of the linked list
pointed to by NAMED_MERGE_POINTS, and return 1. */
-static INLINE int
+static inline int
push_named_merge_point (struct named_merge_point *new_named_merge_point,
Lisp_Object face_name,
enum named_merge_point_kind named_merge_point_kind,
}
\f
-
-#if 0 /* Seems to be unused. */
-static Lisp_Object
-internal_resolve_face_name (nargs, args)
- int nargs;
- Lisp_Object *args;
-{
- return Fget (args[0], args[1]);
-}
-
-static Lisp_Object
-resolve_face_name_error (ignore)
- Lisp_Object ignore;
-{
- return Qnil;
-}
-#endif
-
/* Resolve face name FACE_NAME. If FACE_NAME is a string, intern it
to make it a symbol. If FACE_NAME is an alias for another face,
return that face's name.
face text properties; Ediff uses that). If SIGNAL_P is non-zero,
signal an error if FACE_NAME is not a valid face name. If SIGNAL_P
is zero, value is nil if FACE_NAME is not a valid face name. */
-static INLINE Lisp_Object
+static inline Lisp_Object
lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, int signal_p)
{
Lisp_Object lface;
non-zero, signal an error if FACE_NAME is not a valid face name.
If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face
name. */
-static INLINE Lisp_Object
+static inline Lisp_Object
lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
{
face_name = resolve_face_name (face_name, signal_p);
is non-zero, signal an error if FACE_NAME does not name a face.
Otherwise, value is zero if FACE_NAME is not a face. */
-static INLINE int
+static inline int
get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p)
{
Lisp_Object lface;
non-zero, signal an error if FACE_NAME does not name a face.
Otherwise, value is zero if FACE_NAME is not a face. */
-static INLINE int
+static inline int
get_lface_attributes (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p, struct named_merge_point *named_merge_points)
{
Lisp_Object face_remapping;
loops in face inheritance/remapping; it should be 0 when called from
other places. */
-static INLINE void
+static inline void
merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct named_merge_point *named_merge_points)
{
int i;
The mapping from Lisp face to Lisp face id is given by the
property `face' of the Lisp face name. */
if (next_lface_id == lface_id_to_name_size)
- {
- int new_size = max (50, 2 * lface_id_to_name_size);
- int sz = new_size * sizeof *lface_id_to_name;
- lface_id_to_name = (Lisp_Object *) xrealloc (lface_id_to_name, sz);
- lface_id_to_name_size = new_size;
- }
+ lface_id_to_name =
+ xpalloc (lface_id_to_name, &lface_id_to_name_size, 1,
+ min (INT_MAX, MOST_POSITIVE_FIXNUM),
+ sizeof *lface_id_to_name);
lface_id_to_name[next_lface_id] = face;
Fput (face, Qface, make_number (next_lface_id));
Fmodify_frame_parameters (frame, Fcons (Fcons (Qfont, name),
Qnil));
}
+
+ if (STRINGP (gvec[LFACE_FOREGROUND_INDEX]))
+ Fmodify_frame_parameters (frame,
+ Fcons (Fcons (Qforeground_color,
+ gvec[LFACE_FOREGROUND_INDEX]),
+ Qnil));
+
+ if (STRINGP (gvec[LFACE_BACKGROUND_INDEX]))
+ Fmodify_frame_parameters (frame,
+ Fcons (Fcons (Qbackground_color,
+ gvec[LFACE_BACKGROUND_INDEX]),
+ Qnil));
}
}
all attributes are `equal'. Tries to be fast because this function
is called quite often. */
-static INLINE int
+static inline int
face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
{
/* Type can differ, e.g. when one attribute is unspecified, i.e. nil,
all attributes are `equal'. Tries to be fast because this function
is called quite often. */
-static INLINE int
+static inline int
lface_equal_p (Lisp_Object *v1, Lisp_Object *v2)
{
int i, equal_p = 1;
/* Return a hash code for Lisp string STRING with case ignored. Used
below in computing a hash value for a Lisp face. */
-static INLINE unsigned
+static inline unsigned
hash_string_case_insensitive (Lisp_Object string)
{
const unsigned char *s;
/* Return a hash code for face attribute vector V. */
-static INLINE unsigned
+static inline unsigned
lface_hash (Lisp_Object *v)
{
return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
family, point size, weight, width, slant, and font. Both
LFACE1 and LFACE2 must be fully-specified. */
-static INLINE int
+static inline int
lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
{
xassert (lface_fully_specified_p (lface1)
break;
face->id = i;
- /* Maybe enlarge C->faces_by_id. */
- if (i == c->used)
- {
- if (c->used == c->size)
- {
- int new_size, sz;
- new_size = min (2 * c->size, MAX_FACE_ID);
- if (new_size == c->size)
- abort (); /* Alternatives? ++kfs */
- sz = new_size * sizeof *c->faces_by_id;
- c->faces_by_id = (struct face **) xrealloc (c->faces_by_id, sz);
- c->size = new_size;
- }
- c->used++;
- }
-
#if GLYPH_DEBUG
/* Check that FACE got a unique id. */
{
int j, n;
- struct face *face;
+ struct face *face1;
for (j = n = 0; j < FACE_CACHE_BUCKETS_SIZE; ++j)
- for (face = c->buckets[j]; face; face = face->next)
- if (face->id == i)
+ for (face1 = c->buckets[j]; face1; face1 = face1->next)
+ if (face1->id == i)
++n;
xassert (n == 1);
}
#endif /* GLYPH_DEBUG */
+ /* Maybe enlarge C->faces_by_id. */
+ if (i == c->used)
+ {
+ if (c->used == c->size)
+ c->faces_by_id = xpalloc (c->faces_by_id, &c->size, 1, MAX_FACE_ID,
+ sizeof *c->faces_by_id);
+ c->used++;
+ }
+
c->faces_by_id[i] = face;
}
Value is the ID of the face found. If no suitable face is found,
realize a new one. */
-static INLINE int
+static inline int
lookup_face (struct frame *f, Lisp_Object *attr)
{
struct face_cache *cache = FRAME_FACE_CACHE (f);
struct frame *f = XFRAME (w->frame);
Lisp_Object attrs[LFACE_VECTOR_SIZE];
Lisp_Object prop, position;
- int i, noverlays;
+ ptrdiff_t i, noverlays;
Lisp_Object *overlay_vec;
Lisp_Object frame;
EMACS_INT endpos;
*/
int
-merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_id)
+merge_faces (struct frame *f, Lisp_Object face_name, EMACS_INT face_id,
+ int base_face_id)
{
Lisp_Object attrs[LFACE_VECTOR_SIZE];
struct face *base_face;
/* Print the contents of the realized face FACE to stderr. */
static void
-dump_realized_face (face)
- struct face *face;
+dump_realized_face (struct face *face)
{
fprintf (stderr, "ID: %d\n", face->id);
#ifdef HAVE_X_WINDOWS
void
syms_of_xfaces (void)
{
- Qface = intern_c_string ("face");
- staticpro (&Qface);
- Qface_no_inherit = intern_c_string ("face-no-inherit");
- staticpro (&Qface_no_inherit);
- Qbitmap_spec_p = intern_c_string ("bitmap-spec-p");
- staticpro (&Qbitmap_spec_p);
- Qframe_set_background_mode = intern_c_string ("frame-set-background-mode");
- staticpro (&Qframe_set_background_mode);
+ DEFSYM (Qface, "face");
+ DEFSYM (Qface_no_inherit, "face-no-inherit");
+ DEFSYM (Qbitmap_spec_p, "bitmap-spec-p");
+ DEFSYM (Qframe_set_background_mode, "frame-set-background-mode");
/* Lisp face attribute keywords. */
- QCfamily = intern_c_string (":family");
- staticpro (&QCfamily);
- QCheight = intern_c_string (":height");
- staticpro (&QCheight);
- QCweight = intern_c_string (":weight");
- staticpro (&QCweight);
- QCslant = intern_c_string (":slant");
- staticpro (&QCslant);
- QCunderline = intern_c_string (":underline");
- staticpro (&QCunderline);
- QCinverse_video = intern_c_string (":inverse-video");
- staticpro (&QCinverse_video);
- QCreverse_video = intern_c_string (":reverse-video");
- staticpro (&QCreverse_video);
- QCforeground = intern_c_string (":foreground");
- staticpro (&QCforeground);
- QCbackground = intern_c_string (":background");
- staticpro (&QCbackground);
- QCstipple = intern_c_string (":stipple");
- staticpro (&QCstipple);
- QCwidth = intern_c_string (":width");
- staticpro (&QCwidth);
- QCfont = intern_c_string (":font");
- staticpro (&QCfont);
- QCfontset = intern_c_string (":fontset");
- staticpro (&QCfontset);
- QCbold = intern_c_string (":bold");
- staticpro (&QCbold);
- QCitalic = intern_c_string (":italic");
- staticpro (&QCitalic);
- QCoverline = intern_c_string (":overline");
- staticpro (&QCoverline);
- QCstrike_through = intern_c_string (":strike-through");
- staticpro (&QCstrike_through);
- QCbox = intern_c_string (":box");
- staticpro (&QCbox);
- QCinherit = intern_c_string (":inherit");
- staticpro (&QCinherit);
+ DEFSYM (QCfamily, ":family");
+ DEFSYM (QCheight, ":height");
+ DEFSYM (QCweight, ":weight");
+ DEFSYM (QCslant, ":slant");
+ DEFSYM (QCunderline, ":underline");
+ DEFSYM (QCinverse_video, ":inverse-video");
+ DEFSYM (QCreverse_video, ":reverse-video");
+ DEFSYM (QCforeground, ":foreground");
+ DEFSYM (QCbackground, ":background");
+ DEFSYM (QCstipple, ":stipple");
+ DEFSYM (QCwidth, ":width");
+ DEFSYM (QCfont, ":font");
+ DEFSYM (QCfontset, ":fontset");
+ DEFSYM (QCbold, ":bold");
+ DEFSYM (QCitalic, ":italic");
+ DEFSYM (QCoverline, ":overline");
+ DEFSYM (QCstrike_through, ":strike-through");
+ DEFSYM (QCbox, ":box");
+ DEFSYM (QCinherit, ":inherit");
/* Symbols used for Lisp face attribute values. */
- QCcolor = intern_c_string (":color");
- staticpro (&QCcolor);
- QCline_width = intern_c_string (":line-width");
- staticpro (&QCline_width);
- QCstyle = intern_c_string (":style");
- staticpro (&QCstyle);
- Qreleased_button = intern_c_string ("released-button");
- staticpro (&Qreleased_button);
- Qpressed_button = intern_c_string ("pressed-button");
- staticpro (&Qpressed_button);
- Qnormal = intern_c_string ("normal");
- staticpro (&Qnormal);
- Qultra_light = intern_c_string ("ultra-light");
- staticpro (&Qultra_light);
- Qextra_light = intern_c_string ("extra-light");
- staticpro (&Qextra_light);
- Qlight = intern_c_string ("light");
- staticpro (&Qlight);
- Qsemi_light = intern_c_string ("semi-light");
- staticpro (&Qsemi_light);
- Qsemi_bold = intern_c_string ("semi-bold");
- staticpro (&Qsemi_bold);
- Qbold = intern_c_string ("bold");
- staticpro (&Qbold);
- Qextra_bold = intern_c_string ("extra-bold");
- staticpro (&Qextra_bold);
- Qultra_bold = intern_c_string ("ultra-bold");
- staticpro (&Qultra_bold);
- Qoblique = intern_c_string ("oblique");
- staticpro (&Qoblique);
- Qitalic = intern_c_string ("italic");
- staticpro (&Qitalic);
- Qreverse_oblique = intern_c_string ("reverse-oblique");
- staticpro (&Qreverse_oblique);
- Qreverse_italic = intern_c_string ("reverse-italic");
- staticpro (&Qreverse_italic);
- Qultra_condensed = intern_c_string ("ultra-condensed");
- staticpro (&Qultra_condensed);
- Qextra_condensed = intern_c_string ("extra-condensed");
- staticpro (&Qextra_condensed);
- Qcondensed = intern_c_string ("condensed");
- staticpro (&Qcondensed);
- Qsemi_condensed = intern_c_string ("semi-condensed");
- staticpro (&Qsemi_condensed);
- Qsemi_expanded = intern_c_string ("semi-expanded");
- staticpro (&Qsemi_expanded);
- Qexpanded = intern_c_string ("expanded");
- staticpro (&Qexpanded);
- Qextra_expanded = intern_c_string ("extra-expanded");
- staticpro (&Qextra_expanded);
- Qultra_expanded = intern_c_string ("ultra-expanded");
- staticpro (&Qultra_expanded);
- Qbackground_color = intern_c_string ("background-color");
- staticpro (&Qbackground_color);
- Qforeground_color = intern_c_string ("foreground-color");
- staticpro (&Qforeground_color);
- Qunspecified = intern_c_string ("unspecified");
- staticpro (&Qunspecified);
- Qignore_defface = intern_c_string (":ignore-defface");
- staticpro (&Qignore_defface);
-
- Qface_alias = intern_c_string ("face-alias");
- staticpro (&Qface_alias);
- Qdefault = intern_c_string ("default");
- staticpro (&Qdefault);
- Qtool_bar = intern_c_string ("tool-bar");
- staticpro (&Qtool_bar);
- Qregion = intern_c_string ("region");
- staticpro (&Qregion);
- Qfringe = intern_c_string ("fringe");
- staticpro (&Qfringe);
- Qheader_line = intern_c_string ("header-line");
- staticpro (&Qheader_line);
- Qscroll_bar = intern_c_string ("scroll-bar");
- staticpro (&Qscroll_bar);
- Qmenu = intern_c_string ("menu");
- staticpro (&Qmenu);
- Qcursor = intern_c_string ("cursor");
- staticpro (&Qcursor);
- Qborder = intern_c_string ("border");
- staticpro (&Qborder);
- Qmouse = intern_c_string ("mouse");
- staticpro (&Qmouse);
- Qmode_line_inactive = intern_c_string ("mode-line-inactive");
- staticpro (&Qmode_line_inactive);
- Qvertical_border = intern_c_string ("vertical-border");
- staticpro (&Qvertical_border);
- Qtty_color_desc = intern_c_string ("tty-color-desc");
- staticpro (&Qtty_color_desc);
- Qtty_color_standard_values = intern_c_string ("tty-color-standard-values");
- staticpro (&Qtty_color_standard_values);
- Qtty_color_by_index = intern_c_string ("tty-color-by-index");
- staticpro (&Qtty_color_by_index);
- Qtty_color_alist = intern_c_string ("tty-color-alist");
- staticpro (&Qtty_color_alist);
- Qscalable_fonts_allowed = intern_c_string ("scalable-fonts-allowed");
- staticpro (&Qscalable_fonts_allowed);
+ DEFSYM (QCcolor, ":color");
+ DEFSYM (QCline_width, ":line-width");
+ DEFSYM (QCstyle, ":style");
+ DEFSYM (Qreleased_button, "released-button");
+ DEFSYM (Qpressed_button, "pressed-button");
+ DEFSYM (Qnormal, "normal");
+ DEFSYM (Qultra_light, "ultra-light");
+ DEFSYM (Qextra_light, "extra-light");
+ DEFSYM (Qlight, "light");
+ DEFSYM (Qsemi_light, "semi-light");
+ DEFSYM (Qsemi_bold, "semi-bold");
+ DEFSYM (Qbold, "bold");
+ DEFSYM (Qextra_bold, "extra-bold");
+ DEFSYM (Qultra_bold, "ultra-bold");
+ DEFSYM (Qoblique, "oblique");
+ DEFSYM (Qitalic, "italic");
+ DEFSYM (Qreverse_oblique, "reverse-oblique");
+ DEFSYM (Qreverse_italic, "reverse-italic");
+ DEFSYM (Qultra_condensed, "ultra-condensed");
+ DEFSYM (Qextra_condensed, "extra-condensed");
+ DEFSYM (Qcondensed, "condensed");
+ DEFSYM (Qsemi_condensed, "semi-condensed");
+ DEFSYM (Qsemi_expanded, "semi-expanded");
+ DEFSYM (Qexpanded, "expanded");
+ DEFSYM (Qextra_expanded, "extra-expanded");
+ DEFSYM (Qultra_expanded, "ultra-expanded");
+ DEFSYM (Qbackground_color, "background-color");
+ DEFSYM (Qforeground_color, "foreground-color");
+ DEFSYM (Qunspecified, "unspecified");
+ DEFSYM (Qignore_defface, ":ignore-defface");
+
+ DEFSYM (Qface_alias, "face-alias");
+ DEFSYM (Qdefault, "default");
+ DEFSYM (Qtool_bar, "tool-bar");
+ DEFSYM (Qregion, "region");
+ DEFSYM (Qfringe, "fringe");
+ DEFSYM (Qheader_line, "header-line");
+ DEFSYM (Qscroll_bar, "scroll-bar");
+ DEFSYM (Qmenu, "menu");
+ DEFSYM (Qcursor, "cursor");
+ DEFSYM (Qborder, "border");
+ DEFSYM (Qmouse, "mouse");
+ DEFSYM (Qmode_line_inactive, "mode-line-inactive");
+ DEFSYM (Qvertical_border, "vertical-border");
+ DEFSYM (Qtty_color_desc, "tty-color-desc");
+ DEFSYM (Qtty_color_standard_values, "tty-color-standard-values");
+ DEFSYM (Qtty_color_by_index, "tty-color-by-index");
+ DEFSYM (Qtty_color_alist, "tty-color-alist");
+ DEFSYM (Qscalable_fonts_allowed, "scalable-fonts-allowed");
Vparam_value_alist = Fcons (Fcons (Qnil, Qnil), Qnil);
staticpro (&Vparam_value_alist);