}
static int
-valid_image_instantiator_format_p (Lisp_Object format)
+valid_image_instantiator_format_p (Lisp_Object format, Lisp_Object locale)
{
- return (decode_image_instantiator_format (format, ERROR_ME_NOT) != 0);
+ int i;
+ struct image_instantiator_methods* meths =
+ decode_image_instantiator_format (format, ERROR_ME_NOT);
+ struct console* console = decode_console (locale);
+ Lisp_Object contype = console ? CONSOLE_TYPE (console) : locale;
+ /* nothing is valid in all locales */
+ if (EQ (format, Qnothing))
+ return 1;
+ /* reject unknown formats */
+ else if (!console || !meths)
+ return 0;
+
+ for (i = 0; i < Dynarr_length (meths->consoles); i++)
+ if (EQ (contype, Dynarr_at (meths->consoles, i).symbol))
+ return 1;
+ return 0;
}
DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p,
- 1, 1, 0, /*
+ 1, 2, 0, /*
Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid.
+If LOCALE is non-nil then the format is checked in that domain.
+If LOCALE is nil the current console is used.
Valid formats are some subset of 'nothing, 'string, 'formatted-string,
'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font,
'autodetect, 'widget and 'subwindow, depending on how XEmacs was compiled.
*/
- (image_instantiator_format))
+ (image_instantiator_format, locale))
{
- return valid_image_instantiator_format_p (image_instantiator_format) ?
+ return valid_image_instantiator_format_p (image_instantiator_format, locale) ?
Qt : Qnil;
}
int methp = 0;
GCPRO1 (ii);
+ if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0], device))
+ signal_simple_error
+ ("Image instantiator format is invalid in this locale.",
+ instantiator);
+
meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
ERROR_ME);
methp = (int)HAS_IIFORMAT_METH_P (meths, instantiate);
DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance,
mark_image_instance, print_image_instance,
finalize_image_instance, image_instance_equal,
- image_instance_hash,
+ image_instance_hash, 0,
struct Lisp_Image_Instance);
static Lisp_Object
return result;
}
+static const struct lrecord_description glyph_description[] = {
+ { XD_LISP_OBJECT, offsetof(struct Lisp_Glyph, image), 5 },
+ { XD_END }
+};
+
DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("glyph", glyph,
mark_glyph, print_glyph, 0,
- glyph_equal, glyph_hash,
+ glyph_equal, glyph_hash, glyph_description,
glyph_getprop, glyph_putprop,
glyph_remprop, glyph_plist,
struct Lisp_Glyph);
{
struct font_metric_info fm;
Lisp_Object string = XIMAGE_INSTANCE_TEXT_STRING (instance);
- unsigned char charsets[NUM_LEADING_BYTES];
+ Charset_ID charsets[NUM_LEADING_BYTES];
struct face_cachel frame_cachel;
struct face_cachel *cachel;
IIFORMAT_HAS_METHOD (formatted_string, validate);
IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types);
IIFORMAT_HAS_METHOD (formatted_string, instantiate);
-
IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string);
/* subwindows */