comparison src/glyphs.c @ 444:576fb035e263 r21-2-37

Import from CVS: tag r21-2-37
author cvs
date Mon, 13 Aug 2007 11:36:19 +0200
parents abe6d1db359e
children 3078fd1074e8
comparison
equal deleted inserted replaced
443:a8296e22da4e 444:576fb035e263
224 } 224 }
225 225
226 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p, 226 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p,
227 1, 2, 0, /* 227 1, 2, 0, /*
228 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid. 228 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid.
229 If LOCALE is non-nil then the format is checked in that domain. 229 If LOCALE is non-nil then the format is checked in that locale.
230 If LOCALE is nil the current console is used. 230 If LOCALE is nil the current console is used.
231 231
232 Valid formats are some subset of 'nothing, 'string, 'formatted-string, 232 Valid formats are some subset of 'nothing, 'string, 'formatted-string,
233 'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font, 233 'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font,
234 'autodetect, 'subwindow, 'inherit, 'mswindows-resource, 'bmp, 234 'autodetect, 'subwindow, 'inherit, 'mswindows-resource, 'bmp,
281 return &decode_console_type (console_type, ERROR_ME)->image_conversion_list; 281 return &decode_console_type (console_type, ERROR_ME)->image_conversion_list;
282 } 282 }
283 283
284 DEFUN ("set-console-type-image-conversion-list", Fset_console_type_image_conversion_list, 284 DEFUN ("set-console-type-image-conversion-list", Fset_console_type_image_conversion_list,
285 2, 2, 0, /* 285 2, 2, 0, /*
286 Set the image-conversion-list for consoles of the given TYPE. 286 Set the image-conversion-list for consoles of the given CONSOLE-TYPE.
287 The image-conversion-list specifies how image instantiators that 287 The image-conversion-list specifies how image instantiators that
288 are strings should be interpreted. Each element of the list should be 288 are strings should be interpreted. Each element of the list should be
289 a list of two elements (a regular expression string and a vector) or 289 a list of two elements (a regular expression string and a vector) or
290 a list of three elements (the preceding two plus an integer index into 290 a list of three elements (the preceding two plus an integer index into
291 the vector). The string is converted to the vector associated with the 291 the vector). The string is converted to the vector associated with the
349 return list; 349 return list;
350 } 350 }
351 351
352 DEFUN ("console-type-image-conversion-list", Fconsole_type_image_conversion_list, 352 DEFUN ("console-type-image-conversion-list", Fconsole_type_image_conversion_list,
353 1, 1, 0, /* 353 1, 1, 0, /*
354 Return the image-conversion-list for devices of the given TYPE. 354 Return the image-conversion-list for devices of the given CONSOLE-TYPE.
355 The image-conversion-list specifies how to interpret image string 355 The image-conversion-list specifies how to interpret image string
356 instantiators for the specified console type. See 356 instantiators for the specified console type. See
357 `set-console-type-image-conversion-list' for a description of its syntax. 357 `set-console-type-image-conversion-list' for a description of its syntax.
358 */ 358 */
359 (console_type)) 359 (console_type))
471 } 471 }
472 } 472 }
473 473
474 DEFUN ("set-instantiator-property", Fset_instantiator_property, 474 DEFUN ("set-instantiator-property", Fset_instantiator_property,
475 3, 3, 0, /* 475 3, 3, 0, /*
476 Destructively set the property KEYWORD of INSTANTIATOR to VAL. 476 Destructively set the property KEYWORD of INSTANTIATOR to VALUE.
477 If the property is not set then it is added to a copy of the 477 If the property is not set then it is added to a copy of the
478 instantiator and the new instantiator returned. 478 instantiator and the new instantiator returned.
479 Use `set-glyph-image' on glyphs to register instantiator changes. */ 479 Use `set-glyph-image' on glyphs to register instantiator changes. */
480 (instantiator, keyword, val)) 480 (instantiator, keyword, value))
481 { 481 {
482 Lisp_Object *elt; 482 Lisp_Object *elt;
483 int len; 483 int len;
484 484
485 CHECK_VECTOR (instantiator); 485 CHECK_VECTOR (instantiator);
491 491
492 for (len -= 2; len >= 1; len -= 2) 492 for (len -= 2; len >= 1; len -= 2)
493 { 493 {
494 if (EQ (elt[len], keyword)) 494 if (EQ (elt[len], keyword))
495 { 495 {
496 elt[len+1] = val; 496 elt[len+1] = value;
497 break; 497 break;
498 } 498 }
499 } 499 }
500 500
501 /* Didn't find it so add it. */ 501 /* Didn't find it so add it. */
504 Lisp_Object alist = Qnil, result; 504 Lisp_Object alist = Qnil, result;
505 struct gcpro gcpro1; 505 struct gcpro gcpro1;
506 506
507 GCPRO1 (alist); 507 GCPRO1 (alist);
508 alist = tagged_vector_to_alist (instantiator); 508 alist = tagged_vector_to_alist (instantiator);
509 alist = Fcons (Fcons (keyword, val), alist); 509 alist = Fcons (Fcons (keyword, value), alist);
510 result = alist_to_tagged_vector (elt[0], alist); 510 result = alist_to_tagged_vector (elt[0], alist);
511 free_alist (alist); 511 free_alist (alist);
512 RETURN_UNGCPRO (result); 512 RETURN_UNGCPRO (result);
513 } 513 }
514 514
1411 { 1411 {
1412 return Fcopy_sequence (Vimage_instance_type_list); 1412 return Fcopy_sequence (Vimage_instance_type_list);
1413 } 1413 }
1414 1414
1415 Error_behavior 1415 Error_behavior
1416 decode_error_behavior_flag (Lisp_Object no_error) 1416 decode_error_behavior_flag (Lisp_Object noerror)
1417 { 1417 {
1418 if (NILP (no_error)) return ERROR_ME; 1418 if (NILP (noerror)) return ERROR_ME;
1419 else if (EQ (no_error, Qt)) return ERROR_ME_NOT; 1419 else if (EQ (noerror, Qt)) return ERROR_ME_NOT;
1420 else return ERROR_ME_WARN; 1420 else return ERROR_ME_WARN;
1421 } 1421 }
1422 1422
1423 Lisp_Object 1423 Lisp_Object
1424 encode_error_behavior_flag (Error_behavior errb) 1424 encode_error_behavior_flag (Error_behavior errb)
1425 { 1425 {
1565 when creating an image instance with an instantiator format of `inherit', 1565 when creating an image instance with an instantiator format of `inherit',
1566 but we currently disallow this. #### We should fix this.) 1566 but we currently disallow this. #### We should fix this.)
1567 1567
1568 If omitted, DOMAIN defaults to the selected window. 1568 If omitted, DOMAIN defaults to the selected window.
1569 1569
1570 NO-ERROR controls what happens when the image cannot be generated. 1570 NOERROR controls what happens when the image cannot be generated.
1571 If nil, an error message is generated. If t, no messages are 1571 If nil, an error message is generated. If t, no messages are
1572 generated and this function returns nil. If anything else, a warning 1572 generated and this function returns nil. If anything else, a warning
1573 message is generated and this function returns nil. 1573 message is generated and this function returns nil.
1574 */ 1574 */
1575 (data, domain, dest_types, no_error)) 1575 (data, domain, dest_types, noerror))
1576 { 1576 {
1577 Error_behavior errb = decode_error_behavior_flag (no_error); 1577 Error_behavior errb = decode_error_behavior_flag (noerror);
1578 1578
1579 return call_with_suspended_errors ((lisp_fn_t) make_image_instance_1, 1579 return call_with_suspended_errors ((lisp_fn_t) make_image_instance_1,
1580 Qnil, Qimage, errb, 1580 Qnil, Qimage, errb,
1581 3, data, domain, dest_types); 1581 3, data, domain, dest_types);
1582 } 1582 }
2581 int result; 2581 int result;
2582 const char *filename_ext; 2582 const char *filename_ext;
2583 2583
2584 LISP_STRING_TO_EXTERNAL (name, filename_ext, Qfile_name); 2584 LISP_STRING_TO_EXTERNAL (name, filename_ext, Qfile_name);
2585 result = read_bitmap_data_from_file (filename_ext, &w, &h, 2585 result = read_bitmap_data_from_file (filename_ext, &w, &h,
2586 &data, xhot, yhot); 2586 (unsigned char **) &data, xhot, yhot);
2587 2587
2588 if (result == BitmapSuccess) 2588 if (result == BitmapSuccess)
2589 { 2589 {
2590 Lisp_Object retval; 2590 Lisp_Object retval;
2591 int len = (w + 7) / 8 * h; 2591 int len = (w + 7) / 8 * h;
2592 2592
2593 retval = list3 (make_int (w), make_int (h), 2593 retval = list3 (make_int (w), make_int (h),
2594 make_ext_string (data, len, Qbinary)); 2594 make_ext_string (data, len, Qbinary));
2595 XFree ((char *) data); 2595 XFree (data);
2596 return retval; 2596 return retval;
2597 } 2597 }
2598 2598
2599 switch (result) 2599 switch (result)
2600 { 2600 {
5381 set_specifier_fallback (Vcurrent_display_table, 5381 set_specifier_fallback (Vcurrent_display_table,
5382 list1 (Fcons (Qnil, Qnil))); 5382 list1 (Fcons (Qnil, Qnil)));
5383 set_specifier_caching (Vcurrent_display_table, 5383 set_specifier_caching (Vcurrent_display_table,
5384 offsetof (struct window, display_table), 5384 offsetof (struct window, display_table),
5385 some_window_value_changed, 5385 some_window_value_changed,
5386 0, 0); 5386 0, 0, 0);
5387 } 5387 }
5388 5388
5389 void 5389 void
5390 complex_vars_of_glyphs (void) 5390 complex_vars_of_glyphs (void)
5391 { 5391 {