comparison src/specifier.c @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 0293115a14e9
children 56c54cf7c5b6
comparison
equal deleted inserted replaced
19:ac1f612d5250 20:859a2309aef8
362 if (decode_specifier_type (type, ERROR_ME_NOT)) 362 if (decode_specifier_type (type, ERROR_ME_NOT))
363 return 1; 363 return 1;
364 return 0; 364 return 0;
365 } 365 }
366 366
367 DEFUN ("valid-specifier-type-p", Fvalid_specifier_type_p, 367 DEFUN ("valid-specifier-type-p", Fvalid_specifier_type_p, 1, 1, 0, /*
368 Svalid_specifier_type_p, 1, 1, 0 /*
369 Given a SPECIFIER-TYPE, return non-nil if it is valid. 368 Given a SPECIFIER-TYPE, return non-nil if it is valid.
370 Valid types are 'generic, 'integer, boolean, 'color, 'font, 'image, 369 Valid types are 'generic, 'integer, boolean, 'color, 'font, 'image,
371 'face-boolean, and 'toolbar. 370 'face-boolean, and 'toolbar.
372 */ ) 371 */
373 (specifier_type) 372 (specifier_type))
374 Lisp_Object specifier_type;
375 { 373 {
376 if (valid_specifier_type_p (specifier_type)) 374 if (valid_specifier_type_p (specifier_type))
377 return Qt; 375 return Qt;
378 else 376 else
379 return Qnil; 377 return Qnil;
380 } 378 }
381 379
382 DEFUN ("specifier-type-list", Fspecifier_type_list, Sspecifier_type_list, 380 DEFUN ("specifier-type-list", Fspecifier_type_list, 0, 0, 0, /*
383 0, 0, 0 /*
384 Return a list of valid specifier types. 381 Return a list of valid specifier types.
385 */ ) 382 */
386 () 383 ())
387 { 384 {
388 return Fcopy_sequence (Vspecifier_type_list); 385 return Fcopy_sequence (Vspecifier_type_list);
389 } 386 }
390 387
391 void 388 void
427 MAYBE_SPECMETH (XSPECIFIER (specifier), create, (specifier)); 424 MAYBE_SPECMETH (XSPECIFIER (specifier), create, (specifier));
428 UNGCPRO; 425 UNGCPRO;
429 return specifier; 426 return specifier;
430 } 427 }
431 428
432 DEFUN ("make-specifier", Fmake_specifier, Smake_specifier, 1, 1, 0 /* 429 DEFUN ("make-specifier", Fmake_specifier, 1, 1, 0, /*
433 Create a new specifier. 430 Create a new specifier.
434 431
435 A specifier is an object that can be used to keep track of a property 432 A specifier is an object that can be used to keep track of a property
436 whose value can be per-buffer, per-window, per-frame, or per-device, 433 whose value can be per-buffer, per-window, per-frame, or per-device,
437 and can further be restricted to a particular console-type or device-class. 434 and can further be restricted to a particular console-type or device-class.
449 446
450 For more information on particular types of specifiers, see the functions 447 For more information on particular types of specifiers, see the functions
451 `generic-specifier-p', `integer-specifier-p', `boolean-specifier-p', 448 `generic-specifier-p', `integer-specifier-p', `boolean-specifier-p',
452 `color-specifier-p', `font-specifier-p', `image-specifier-p', 449 `color-specifier-p', `font-specifier-p', `image-specifier-p',
453 `face-boolean-specifier-p', and `toolbar-specifier-p'. 450 `face-boolean-specifier-p', and `toolbar-specifier-p'.
454 */ ) 451 */
455 (type) 452 (type))
456 Lisp_Object type;
457 { 453 {
458 /* This function can GC */ 454 /* This function can GC */
459 struct specifier_methods *meths = decode_specifier_type (type, 455 struct specifier_methods *meths = decode_specifier_type (type,
460 ERROR_ME); 456 ERROR_ME);
461 457
462 return make_specifier (meths); 458 return make_specifier (meths);
463 } 459 }
464 460
465 DEFUN ("specifierp", Fspecifierp, Sspecifierp, 1, 1, 0 /* 461 DEFUN ("specifierp", Fspecifierp, 1, 1, 0, /*
466 Return non-nil if OBJECT is a specifier. 462 Return non-nil if OBJECT is a specifier.
467 463
468 A specifier is an object that can be used to keep track of a property 464 A specifier is an object that can be used to keep track of a property
469 whose value can be per-buffer, per-window, per-frame, or per-device, 465 whose value can be per-buffer, per-window, per-frame, or per-device,
470 and can further be restricted to a particular console-type or device-class. 466 and can further be restricted to a particular console-type or device-class.
471 See `make-specifier'. 467 See `make-specifier'.
472 */ ) 468 */
473 (object) 469 (object))
474 Lisp_Object object;
475 { 470 {
476 if (!SPECIFIERP (object)) 471 if (!SPECIFIERP (object))
477 return Qnil; 472 return Qnil;
478 return Qt; 473 return Qt;
479 } 474 }
480 475
481 DEFUN ("specifier-type", Fspecifier_type, Sspecifier_type, 1, 1, 0 /* 476 DEFUN ("specifier-type", Fspecifier_type, 1, 1, 0, /*
482 Return the type of SPECIFIER. 477 Return the type of SPECIFIER.
483 */ ) 478 */
484 (specifier) 479 (specifier))
485 Lisp_Object specifier;
486 { 480 {
487 CHECK_SPECIFIER (specifier); 481 CHECK_SPECIFIER (specifier);
488 return intern (XSPECIFIER (specifier)->methods->name); 482 return intern (XSPECIFIER (specifier)->methods->name);
489 } 483 }
490 484
491 485
492 /************************************************************************/ 486 /************************************************************************/
493 /* Locales and domains */ 487 /* Locales and domains */
494 /************************************************************************/ 488 /************************************************************************/
495 489
496 DEFUN ("valid-specifier-locale-p", Fvalid_specifier_locale_p, 490 DEFUN ("valid-specifier-locale-p", Fvalid_specifier_locale_p, 1, 1, 0, /*
497 Svalid_specifier_locale_p, 1, 1, 0 /*
498 Return non-nil if LOCALE is a valid specifier locale. 491 Return non-nil if LOCALE is a valid specifier locale.
499 Valid locales are a device, a frame, a window, a buffer, and 'global. 492 Valid locales are a device, a frame, a window, a buffer, and 'global.
500 (nil is not valid.) 493 (nil is not valid.)
501 */ ) 494 */
502 (locale) 495 (locale))
503 Lisp_Object locale;
504 { 496 {
505 /* This cannot GC. */ 497 /* This cannot GC. */
506 if ((DEVICEP (locale) && DEVICE_LIVE_P (XDEVICE (locale))) || 498 if ((DEVICEP (locale) && DEVICE_LIVE_P (XDEVICE (locale))) ||
507 (FRAMEP (locale) && FRAME_LIVE_P (XFRAME (locale))) || 499 (FRAMEP (locale) && FRAME_LIVE_P (XFRAME (locale))) ||
508 (BUFFERP (locale) && BUFFER_LIVE_P (XBUFFER (locale))) || 500 (BUFFERP (locale) && BUFFER_LIVE_P (XBUFFER (locale))) ||
513 return Qt; 505 return Qt;
514 else 506 else
515 return Qnil; 507 return Qnil;
516 } 508 }
517 509
518 DEFUN ("valid-specifier-domain-p", 510 DEFUN ("valid-specifier-domain-p", Fvalid_specifier_domain_p, 1, 1, 0, /*
519 Fvalid_specifier_domain_p,
520 Svalid_specifier_domain_p, 1, 1, 0 /*
521 Return non-nil if DOMAIN is a valid specifier domain. 511 Return non-nil if DOMAIN is a valid specifier domain.
522 A domain is used to instance a specifier (i.e. determine the specifier's 512 A domain is used to instance a specifier (i.e. determine the specifier's
523 value in that domain). Valid domains are a window, frame, or device. 513 value in that domain). Valid domains are a window, frame, or device.
524 (nil is not valid.) 514 (nil is not valid.)
525 */ ) 515 */
526 (domain) 516 (domain))
527 Lisp_Object domain;
528 { 517 {
529 /* This cannot GC. */ 518 /* This cannot GC. */
530 if ((DEVICEP (domain) && DEVICE_LIVE_P (XDEVICE (domain))) || 519 if ((DEVICEP (domain) && DEVICE_LIVE_P (XDEVICE (domain))) ||
531 (FRAMEP (domain) && FRAME_LIVE_P (XFRAME (domain))) || 520 (FRAMEP (domain) && FRAME_LIVE_P (XFRAME (domain))) ||
532 (WINDOWP (domain) && WINDOW_LIVE_P (XWINDOW (domain)))) 521 (WINDOWP (domain) && WINDOW_LIVE_P (XWINDOW (domain))))
533 return Qt; 522 return Qt;
534 else 523 else
535 return Qnil; 524 return Qnil;
536 } 525 }
537 526
538 DEFUN ("valid-specifier-locale-type-p", 527 DEFUN ("valid-specifier-locale-type-p", Fvalid_specifier_locale_type_p, 1, 1, 0, /*
539 Fvalid_specifier_locale_type_p,
540 Svalid_specifier_locale_type_p, 1, 1, 0 /*
541 Given a specifier LOCALE-TYPE, return non-nil if it is valid. 528 Given a specifier LOCALE-TYPE, return non-nil if it is valid.
542 Valid locale types are 'global, 'device, 'frame, 'window, and 'buffer. 529 Valid locale types are 'global, 'device, 'frame, 'window, and 'buffer.
543 (Note, however, that in functions that accept either a locale or a locale 530 (Note, however, that in functions that accept either a locale or a locale
544 type, 'global is considered an individual locale.) 531 type, 'global is considered an individual locale.)
545 */ ) 532 */
546 (locale_type) 533 (locale_type))
547 Lisp_Object locale_type;
548 { 534 {
549 /* This cannot GC. */ 535 /* This cannot GC. */
550 if (EQ (locale_type, Qglobal) || 536 if (EQ (locale_type, Qglobal) ||
551 EQ (locale_type, Qdevice) || 537 EQ (locale_type, Qdevice) ||
552 EQ (locale_type, Qframe) || 538 EQ (locale_type, Qframe) ||
566 !NILP (Fvalid_specifier_locale_type_p (locale))) 552 !NILP (Fvalid_specifier_locale_type_p (locale)))
567 return; 553 return;
568 signal_simple_error ("Invalid specifier locale or locale type", locale); 554 signal_simple_error ("Invalid specifier locale or locale type", locale);
569 } 555 }
570 556
571 DEFUN ("specifier-locale-type-from-locale", 557 DEFUN ("specifier-locale-type-from-locale", Fspecifier_locale_type_from_locale, 1, 1, 0, /*
572 Fspecifier_locale_type_from_locale,
573 Sspecifier_locale_type_from_locale, 1, 1, 0 /*
574 Given a specifier LOCALE, return its type. 558 Given a specifier LOCALE, return its type.
575 */ ) 559 */
576 (locale) 560 (locale))
577 Lisp_Object locale;
578 { 561 {
579 /* This cannot GC. */ 562 /* This cannot GC. */
580 if (NILP (Fvalid_specifier_locale_p (locale))) 563 if (NILP (Fvalid_specifier_locale_p (locale)))
581 signal_simple_error ("Invalid specifier locale", locale); 564 signal_simple_error ("Invalid specifier locale", locale);
582 if (DEVICEP (locale)) 565 if (DEVICEP (locale))
662 645
663 /************************************************************************/ 646 /************************************************************************/
664 /* Tags */ 647 /* Tags */
665 /************************************************************************/ 648 /************************************************************************/
666 649
667 DEFUN ("valid-specifier-tag-p", Fvalid_specifier_tag_p, 650 DEFUN ("valid-specifier-tag-p", Fvalid_specifier_tag_p, 1, 1, 0, /*
668 Svalid_specifier_tag_p,
669 1, 1, 0 /*
670 Return non-nil if TAG is a valid specifier tag. 651 Return non-nil if TAG is a valid specifier tag.
671 See also `valid-specifier-tag-set-p'. 652 See also `valid-specifier-tag-set-p'.
672 */ ) 653 */
673 (tag) 654 (tag))
674 Lisp_Object tag;
675 { 655 {
676 if (valid_console_type_p (tag) || 656 if (valid_console_type_p (tag) ||
677 valid_device_class_p (tag) || 657 valid_device_class_p (tag) ||
678 !NILP (assq_no_quit (tag, Vuser_defined_tags))) 658 !NILP (assq_no_quit (tag, Vuser_defined_tags)))
679 return Qt; 659 return Qt;
680 return Qnil; 660 return Qnil;
681 } 661 }
682 662
683 DEFUN ("valid-specifier-tag-set-p", Fvalid_specifier_tag_set_p, 663 DEFUN ("valid-specifier-tag-set-p", Fvalid_specifier_tag_set_p, 1, 1, 0, /*
684 Svalid_specifier_tag_set_p,
685 1, 1, 0 /*
686 Return non-nil if TAG-SET is a valid specifier tag set. 664 Return non-nil if TAG-SET is a valid specifier tag set.
687 665
688 A specifier tag set is an entity that is attached to an instantiator 666 A specifier tag set is an entity that is attached to an instantiator
689 and can be used to restrict the scope of that instantiator to a 667 and can be used to restrict the scope of that instantiator to a
690 particular device class or device type and/or to mark instantiators 668 particular device class or device type and/or to mark instantiators
705 considered if the device of the domain being instanced over matches 683 considered if the device of the domain being instanced over matches
706 all tags in the tag set attached to that instantiator. 684 all tags in the tag set attached to that instantiator.
707 685
708 Most of the time, a tag set is not specified, and the instantiator 686 Most of the time, a tag set is not specified, and the instantiator
709 gets a null tag set, which matches all devices. 687 gets a null tag set, which matches all devices.
710 */ ) 688 */
711 (tag_set) 689 (tag_set))
712 Lisp_Object tag_set;
713 { 690 {
714 Lisp_Object rest; 691 Lisp_Object rest;
715 692
716 for (rest = tag_set; !NILP (rest); rest = XCDR (rest)) 693 for (rest = tag_set; !NILP (rest); rest = XCDR (rest))
717 { 694 {
783 } 760 }
784 761
785 return Flist (j, tags); 762 return Flist (j, tags);
786 } 763 }
787 764
788 DEFUN ("canonicalize-tag-set", Fcanonicalize_tag_set, 765 DEFUN ("canonicalize-tag-set", Fcanonicalize_tag_set, 1, 1, 0, /*
789 Scanonicalize_tag_set, 1, 1, 0 /*
790 Canonicalize the given tag set. 766 Canonicalize the given tag set.
791 Two canonicalized tag sets can be compared with `equal' to see if they 767 Two canonicalized tag sets can be compared with `equal' to see if they
792 represent the same tag set. (Specifically, canonicalizing involves 768 represent the same tag set. (Specifically, canonicalizing involves
793 sorting by symbol name and removing duplicates.) 769 sorting by symbol name and removing duplicates.)
794 */ ) 770 */
795 (tag_set) 771 (tag_set))
796 Lisp_Object tag_set;
797 { 772 {
798 if (NILP (Fvalid_specifier_tag_set_p (tag_set))) 773 if (NILP (Fvalid_specifier_tag_set_p (tag_set)))
799 signal_simple_error ("Invalid tag set", tag_set); 774 signal_simple_error ("Invalid tag set", tag_set);
800 return canonicalize_tag_set (tag_set); 775 return canonicalize_tag_set (tag_set);
801 } 776 }
824 } 799 }
825 800
826 return 1; 801 return 1;
827 } 802 }
828 803
829 DEFUN ("device-matches-specifier-tag-set-p", 804 DEFUN ("device-matches-specifier-tag-set-p", Fdevice_matches_specifier_tag_set_p, 2, 2, 0, /*
830 Fdevice_matches_specifier_tag_set_p,
831 Sdevice_matches_specifier_tag_set_p,
832 2, 2, 0 /*
833 Return non-nil if DEVICE matches specifier tag set TAG-SET. 805 Return non-nil if DEVICE matches specifier tag set TAG-SET.
834 This means that DEVICE matches each tag in the tag set. (Every 806 This means that DEVICE matches each tag in the tag set. (Every
835 tag recognized by XEmacs has a predicate associated with it that 807 tag recognized by XEmacs has a predicate associated with it that
836 specifies which devices match it.) 808 specifies which devices match it.)
837 */ ) 809 */
838 (device, tag_set) 810 (device, tag_set))
839 Lisp_Object device, tag_set;
840 { 811 {
841 CHECK_LIVE_DEVICE (device); 812 CHECK_LIVE_DEVICE (device);
842 813
843 if (NILP (Fvalid_specifier_tag_set_p (tag_set))) 814 if (NILP (Fvalid_specifier_tag_set_p (tag_set)))
844 signal_simple_error ("Invalid tag set", tag_set); 815 signal_simple_error ("Invalid tag set", tag_set);
845 816
846 return device_matches_specifier_tag_set_p (device, tag_set) ? Qt : Qnil; 817 return device_matches_specifier_tag_set_p (device, tag_set) ? Qt : Qnil;
847 } 818 }
848 819
849 DEFUN ("define-specifier-tag", Fdefine_specifier_tag, Sdefine_specifier_tag, 820 DEFUN ("define-specifier-tag", Fdefine_specifier_tag, 1, 2, 0, /*
850 1, 2, 0 /*
851 Define a new specifier tag. 821 Define a new specifier tag.
852 If PREDICATE is specified, it should be a function of one argument 822 If PREDICATE is specified, it should be a function of one argument
853 (a device) that specifies whether the tag matches that particular 823 (a device) that specifies whether the tag matches that particular
854 device. If PREDICATE is omitted, the tag matches all devices. 824 device. If PREDICATE is omitted, the tag matches all devices.
855 825
856 You can redefine an existing user-defined specifier tag. However, 826 You can redefine an existing user-defined specifier tag. However,
857 you cannot redefine the built-in specifier tags (the device types 827 you cannot redefine the built-in specifier tags (the device types
858 and classes) or the symbols nil, t, 'all, or 'global. 828 and classes) or the symbols nil, t, 'all, or 'global.
859 */ ) 829 */
860 (tag, predicate) 830 (tag, predicate))
861 Lisp_Object tag, predicate;
862 { 831 {
863 Lisp_Object assoc, devcons, concons; 832 Lisp_Object assoc, devcons, concons;
864 int recompute = 0; 833 int recompute = 0;
865 834
866 CHECK_SYMBOL (tag); 835 CHECK_SYMBOL (tag);
942 else 911 else
943 XCDR (XCAR (rest2)) = !NILP (call1 (predicate, device)) ? Qt : Qnil; 912 XCDR (XCAR (rest2)) = !NILP (call1 (predicate, device)) ? Qt : Qnil;
944 } 913 }
945 } 914 }
946 915
947 DEFUN ("device-matching-specifier-tag-list", 916 DEFUN ("device-matching-specifier-tag-list", Fdevice_matching_specifier_tag_list, 0, 1, 0, /*
948 Fdevice_matching_specifier_tag_list,
949 Sdevice_matching_specifier_tag_list,
950 0, 1, 0 /*
951 Return a list of all specifier tags matching DEVICE. 917 Return a list of all specifier tags matching DEVICE.
952 DEVICE defaults to the selected device if omitted. 918 DEVICE defaults to the selected device if omitted.
953 */ ) 919 */
954 (device) 920 (device))
955 Lisp_Object device;
956 { 921 {
957 struct device *d = decode_device (device); 922 struct device *d = decode_device (device);
958 Lisp_Object rest, list = Qnil; 923 Lisp_Object rest, list = Qnil;
959 struct gcpro gcpro1; 924 struct gcpro gcpro1;
960 925
971 list = Fcons (DEVICE_TYPE (d), list); 936 list = Fcons (DEVICE_TYPE (d), list);
972 937
973 RETURN_UNGCPRO (list); 938 RETURN_UNGCPRO (list);
974 } 939 }
975 940
976 DEFUN ("specifier-tag-list", Fspecifier_tag_list, Sspecifier_tag_list, 941 DEFUN ("specifier-tag-list", Fspecifier_tag_list, 0, 0, 0, /*
977 0, 0, 0 /*
978 Return a list of all currently-defined specifier tags. 942 Return a list of all currently-defined specifier tags.
979 This includes the built-in ones (the device types and classes). 943 This includes the built-in ones (the device types and classes).
980 */ ) 944 */
981 () 945 ())
982 { 946 {
983 Lisp_Object list = Qnil, rest; 947 Lisp_Object list = Qnil, rest;
984 struct gcpro gcpro1; 948 struct gcpro gcpro1;
985 949
986 GCPRO1 (list); 950 GCPRO1 (list);
993 list = nconc2 (Fcopy_sequence (Vconsole_type_list), list); 957 list = nconc2 (Fcopy_sequence (Vconsole_type_list), list);
994 958
995 RETURN_UNGCPRO (list); 959 RETURN_UNGCPRO (list);
996 } 960 }
997 961
998 DEFUN ("specifier-tag-predicate", Fspecifier_tag_predicate, 962 DEFUN ("specifier-tag-predicate", Fspecifier_tag_predicate, 1, 1, 0, /*
999 Sspecifier_tag_predicate,
1000 1, 1, 0 /*
1001 Return the predicate for the given specifier tag. 963 Return the predicate for the given specifier tag.
1002 */ ) 964 */
1003 (tag) 965 (tag))
1004 Lisp_Object tag;
1005 { 966 {
1006 /* The return value of this function must be GCPRO'd. */ 967 /* The return value of this function must be GCPRO'd. */
1007 CHECK_SYMBOL (tag); 968 CHECK_SYMBOL (tag);
1008 969
1009 if (NILP (Fvalid_specifier_tag_p (tag))) 970 if (NILP (Fvalid_specifier_tag_p (tag)))
1098 return retval; 1059 return retval;
1099 } 1060 }
1100 return Qt; 1061 return Qt;
1101 } 1062 }
1102 1063
1103 DEFUN ("check-valid-instantiator", Fcheck_valid_instantiator, 1064 DEFUN ("check-valid-instantiator", Fcheck_valid_instantiator, 2, 2, 0, /*
1104 Scheck_valid_instantiator,
1105 2, 2, 0 /*
1106 Signal an error if INSTANTIATOR is invalid for SPECIFIER-TYPE. 1065 Signal an error if INSTANTIATOR is invalid for SPECIFIER-TYPE.
1107 */ ) 1066 */
1108 (instantiator, specifier_type) 1067 (instantiator, specifier_type))
1109 Lisp_Object instantiator, specifier_type;
1110 { 1068 {
1111 struct specifier_methods *meths = decode_specifier_type (specifier_type, 1069 struct specifier_methods *meths = decode_specifier_type (specifier_type,
1112 ERROR_ME); 1070 ERROR_ME);
1113 1071
1114 return check_valid_instantiator (instantiator, meths, ERROR_ME); 1072 return check_valid_instantiator (instantiator, meths, ERROR_ME);
1115 } 1073 }
1116 1074
1117 DEFUN ("valid-instantiator-p", Fvalid_instantiator_p, Svalid_instantiator_p, 1075 DEFUN ("valid-instantiator-p", Fvalid_instantiator_p, 2, 2, 0, /*
1118 2, 2, 0 /*
1119 Return non-nil if INSTANTIATOR is valid for SPECIFIER-TYPE. 1076 Return non-nil if INSTANTIATOR is valid for SPECIFIER-TYPE.
1120 */ ) 1077 */
1121 (instantiator, specifier_type) 1078 (instantiator, specifier_type))
1122 Lisp_Object instantiator, specifier_type;
1123 { 1079 {
1124 struct specifier_methods *meths = decode_specifier_type (specifier_type, 1080 struct specifier_methods *meths = decode_specifier_type (specifier_type,
1125 ERROR_ME); 1081 ERROR_ME);
1126 1082
1127 return check_valid_instantiator (instantiator, meths, ERROR_ME_NOT); 1083 return check_valid_instantiator (instantiator, meths, ERROR_ME_NOT);
1154 } 1110 }
1155 1111
1156 return Qt; 1112 return Qt;
1157 } 1113 }
1158 1114
1159 DEFUN ("check-valid-inst-list", Fcheck_valid_inst_list, Scheck_valid_inst_list, 1115 DEFUN ("check-valid-inst-list", Fcheck_valid_inst_list, 2, 2, 0, /*
1160 2, 2, 0 /*
1161 Signal an error if INST-LIST is invalid for specifier type TYPE. 1116 Signal an error if INST-LIST is invalid for specifier type TYPE.
1162 */ ) 1117 */
1163 (inst_list, type) 1118 (inst_list, type))
1164 Lisp_Object inst_list, type;
1165 { 1119 {
1166 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME); 1120 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME);
1167 1121
1168 return check_valid_inst_list (inst_list, meths, ERROR_ME); 1122 return check_valid_inst_list (inst_list, meths, ERROR_ME);
1169 } 1123 }
1170 1124
1171 DEFUN ("valid-inst-list-p", Fvalid_inst_list_p, Svalid_inst_list_p, 1125 DEFUN ("valid-inst-list-p", Fvalid_inst_list_p, 2, 2, 0, /*
1172 2, 2, 0 /*
1173 Return non-nil if INST-LIST is valid for specifier type TYPE. 1126 Return non-nil if INST-LIST is valid for specifier type TYPE.
1174 */ ) 1127 */
1175 (inst_list, type) 1128 (inst_list, type))
1176 Lisp_Object inst_list, type;
1177 { 1129 {
1178 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME); 1130 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME);
1179 1131
1180 return check_valid_inst_list (inst_list, meths, ERROR_ME_NOT); 1132 return check_valid_inst_list (inst_list, meths, ERROR_ME_NOT);
1181 } 1133 }
1207 } 1159 }
1208 1160
1209 return Qt; 1161 return Qt;
1210 } 1162 }
1211 1163
1212 DEFUN ("check-valid-spec-list", Fcheck_valid_spec_list, Scheck_valid_spec_list, 1164 DEFUN ("check-valid-spec-list", Fcheck_valid_spec_list, 2, 2, 0, /*
1213 2, 2, 0 /*
1214 Signal an error if SPEC-LIST is invalid for specifier type TYPE. 1165 Signal an error if SPEC-LIST is invalid for specifier type TYPE.
1215 */ ) 1166 */
1216 (spec_list, type) 1167 (spec_list, type))
1217 Lisp_Object spec_list, type;
1218 { 1168 {
1219 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME); 1169 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME);
1220 1170
1221 return check_valid_spec_list (spec_list, meths, ERROR_ME); 1171 return check_valid_spec_list (spec_list, meths, ERROR_ME);
1222 } 1172 }
1223 1173
1224 DEFUN ("valid-spec-list-p", Fvalid_spec_list_p, Svalid_spec_list_p, 1174 DEFUN ("valid-spec-list-p", Fvalid_spec_list_p, 2, 2, 0, /*
1225 2, 2, 0 /*
1226 Return non-nil if SPEC-LIST is valid for specifier type TYPE. 1175 Return non-nil if SPEC-LIST is valid for specifier type TYPE.
1227 */ ) 1176 */
1228 (spec_list, type) 1177 (spec_list, type))
1229 Lisp_Object spec_list, type;
1230 { 1178 {
1231 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME); 1179 struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME);
1232 1180
1233 return check_valid_spec_list (spec_list, meths, ERROR_ME_NOT); 1181 return check_valid_spec_list (spec_list, meths, ERROR_ME_NOT);
1234 } 1182 }
1774 1722
1775 UNGCPRO; 1723 UNGCPRO;
1776 return retval; 1724 return retval;
1777 } 1725 }
1778 1726
1779 DEFUN ("add-spec-to-specifier", Fadd_spec_to_specifier, Sadd_spec_to_specifier, 1727 DEFUN ("add-spec-to-specifier", Fadd_spec_to_specifier, 2, 5, 0, /*
1780 2, 5, 0 /*
1781 Add a specification to SPECIFIER. 1728 Add a specification to SPECIFIER.
1782 The specification maps from LOCALE (which should be a buffer, window, 1729 The specification maps from LOCALE (which should be a buffer, window,
1783 frame, device, or 'global, and defaults to 'global) to INSTANTIATOR, 1730 frame, device, or 'global, and defaults to 'global) to INSTANTIATOR,
1784 whose allowed values depend on the type of the specifier. Optional 1731 whose allowed values depend on the type of the specifier. Optional
1785 argument TAG-SET limits the instantiator to apply only to the specified 1732 argument TAG-SET limits the instantiator to apply only to the specified
1813 'remove-all Remove all specifications from the specifier 1760 'remove-all Remove all specifications from the specifier
1814 before adding the new spec. 1761 before adding the new spec.
1815 1762
1816 You can retrieve the specifications for a particular locale or locale type 1763 You can retrieve the specifications for a particular locale or locale type
1817 with the function `specifier-spec-list' or `specifier-specs'. 1764 with the function `specifier-spec-list' or `specifier-specs'.
1818 */ ) 1765 */
1819 (specifier, instantiator, locale, tag_set, how_to_add) 1766 (specifier, instantiator, locale, tag_set, how_to_add))
1820 Lisp_Object specifier, instantiator, locale, tag_set, how_to_add;
1821 { 1767 {
1822 enum spec_add_meth add_meth; 1768 enum spec_add_meth add_meth;
1823 Lisp_Object inst_list; 1769 Lisp_Object inst_list;
1824 struct gcpro gcpro1; 1770 struct gcpro gcpro1;
1825 1771
1839 specifier_add_spec (specifier, locale, inst_list, add_meth); 1785 specifier_add_spec (specifier, locale, inst_list, add_meth);
1840 recompute_cached_specifier_everywhere (specifier); 1786 recompute_cached_specifier_everywhere (specifier);
1841 RETURN_UNGCPRO (Qnil); 1787 RETURN_UNGCPRO (Qnil);
1842 } 1788 }
1843 1789
1844 DEFUN ("add-spec-list-to-specifier", Fadd_spec_list_to_specifier, 1790 DEFUN ("add-spec-list-to-specifier", Fadd_spec_list_to_specifier, 2, 3, 0, /*
1845 Sadd_spec_list_to_specifier, 2, 3, 0 /*
1846 Add a spec-list (a list of specifications) to SPECIFIER. 1791 Add a spec-list (a list of specifications) to SPECIFIER.
1847 The format of a spec-list is 1792 The format of a spec-list is
1848 1793
1849 ((LOCALE (TAG-SET . INSTANTIATOR) ...) ...) 1794 ((LOCALE (TAG-SET . INSTANTIATOR) ...) ...)
1850 1795
1866 the existing ones, and has the same semantics as for 1811 the existing ones, and has the same semantics as for
1867 `add-spec-to-specifier'. 1812 `add-spec-to-specifier'.
1868 1813
1869 In many circumstances, the higher-level function `set-specifier' is 1814 In many circumstances, the higher-level function `set-specifier' is
1870 more convenient and should be used instead. 1815 more convenient and should be used instead.
1871 */ ) 1816 */
1872 (specifier, spec_list, how_to_add) 1817 (specifier, spec_list, how_to_add))
1873 Lisp_Object specifier, spec_list, how_to_add;
1874 { 1818 {
1875 enum spec_add_meth add_meth; 1819 enum spec_add_meth add_meth;
1876 Lisp_Object rest; 1820 Lisp_Object rest;
1877 1821
1878 CHECK_SPECIFIER (specifier); 1822 CHECK_SPECIFIER (specifier);
1947 the actual objects. This may cause a slight loss of potential 1891 the actual objects. This may cause a slight loss of potential
1948 functionality but if we were to allow it then a user could manage to 1892 functionality but if we were to allow it then a user could manage to
1949 violate our assertion that the specs contained in the actual 1893 violate our assertion that the specs contained in the actual
1950 specifier lists are all valid. */ 1894 specifier lists are all valid. */
1951 1895
1952 DEFUN ("specifier-spec-list", Fspecifier_spec_list, Sspecifier_spec_list, 1896 DEFUN ("specifier-spec-list", Fspecifier_spec_list, 1, 4, 0, /*
1953 1, 4, 0 /*
1954 Return the spec-list of specifications for SPECIFIER in LOCALE. 1897 Return the spec-list of specifications for SPECIFIER in LOCALE.
1955 1898
1956 If LOCALE is a particular locale (a buffer, window, frame, device, 1899 If LOCALE is a particular locale (a buffer, window, frame, device,
1957 or 'global), a spec-list consisting of the specification for that 1900 or 'global), a spec-list consisting of the specification for that
1958 locale will be returned. 1901 locale will be returned.
1972 subset of (or possibly equal to) the instantiator's tag set are returned. 1915 subset of (or possibly equal to) the instantiator's tag set are returned.
1973 (The default value of nil is a subset of all tag sets, so in this case 1916 (The default value of nil is a subset of all tag sets, so in this case
1974 no instantiators will be screened out.) If EXACT-P is non-nil, however, 1917 no instantiators will be screened out.) If EXACT-P is non-nil, however,
1975 TAG-SET must be equal to an instantiator's tag set for the instantiator 1918 TAG-SET must be equal to an instantiator's tag set for the instantiator
1976 to be returned. 1919 to be returned.
1977 */ ) 1920 */
1978 (specifier, locale, tag_set, exact_p) 1921 (specifier, locale, tag_set, exact_p))
1979 Lisp_Object specifier, locale, tag_set, exact_p;
1980 { 1922 {
1981 struct specifier_spec_list_closure cl; 1923 struct specifier_spec_list_closure cl;
1982 struct gcpro gcpro1, gcpro2; 1924 struct gcpro gcpro1, gcpro2;
1983 1925
1984 CHECK_SPECIFIER (specifier); 1926 CHECK_SPECIFIER (specifier);
1989 UNGCPRO; 1931 UNGCPRO;
1990 return cl.head; 1932 return cl.head;
1991 } 1933 }
1992 1934
1993 1935
1994 DEFUN ("specifier-specs", Fspecifier_specs, Sspecifier_specs, 1936 DEFUN ("specifier-specs", Fspecifier_specs, 1, 4, 0, /*
1995 1, 4, 0 /*
1996 Return the specification(s) for SPECIFIER in LOCALE. 1937 Return the specification(s) for SPECIFIER in LOCALE.
1997 1938
1998 If LOCALE is a single locale or is a list of one element containing a 1939 If LOCALE is a single locale or is a list of one element containing a
1999 single locale, then a \"short form\" of the instantiators for that locale 1940 single locale, then a \"short form\" of the instantiators for that locale
2000 will be returned. Otherwise, this function is identical to 1941 will be returned. Otherwise, this function is identical to
2011 instead of the inst-pair. 1952 instead of the inst-pair.
2012 3. If there is only one instantiator, its value is nil, and its tag is 1953 3. If there is only one instantiator, its value is nil, and its tag is
2013 'any, a one-element list containing nil will be returned rather 1954 'any, a one-element list containing nil will be returned rather
2014 than just nil, to distinguish this case from there being no 1955 than just nil, to distinguish this case from there being no
2015 instantiators at all. 1956 instantiators at all.
2016 */ ) 1957 */
2017 (specifier, locale, tag_set, exact_p) 1958 (specifier, locale, tag_set, exact_p))
2018 Lisp_Object specifier, locale, tag_set, exact_p;
2019 { 1959 {
2020 if (!NILP (Fvalid_specifier_locale_p (locale)) || 1960 if (!NILP (Fvalid_specifier_locale_p (locale)) ||
2021 (CONSP (locale) && !NILP (Fvalid_specifier_locale_p (XCAR (locale))) && 1961 (CONSP (locale) && !NILP (Fvalid_specifier_locale_p (XCAR (locale))) &&
2022 NILP (XCDR (locale)))) 1962 NILP (XCDR (locale))))
2023 { 1963 {
2052 else 1992 else
2053 specifier_remove_spec (specifier, locale, locale_type, tag_set, exact_p); 1993 specifier_remove_spec (specifier, locale, locale_type, tag_set, exact_p);
2054 return 0; 1994 return 0;
2055 } 1995 }
2056 1996
2057 DEFUN ("remove-specifier", Fremove_specifier, 1997 DEFUN ("remove-specifier", Fremove_specifier, 1, 4, 0, /*
2058 Sremove_specifier, 1, 4, 0 /*
2059 Remove specification(s) for SPECIFIER. 1998 Remove specification(s) for SPECIFIER.
2060 1999
2061 If LOCALE is a particular locale (a buffer, window, frame, device, 2000 If LOCALE is a particular locale (a buffer, window, frame, device,
2062 or 'global), the specification for that locale will be removed. 2001 or 'global), the specification for that locale will be removed.
2063 2002
2075 subset of (or possibly equal to) the instantiator's tag set are removed. 2014 subset of (or possibly equal to) the instantiator's tag set are removed.
2076 The default value of nil is a subset of all tag sets, so in this case 2015 The default value of nil is a subset of all tag sets, so in this case
2077 no instantiators will be screened out. If EXACT-P is non-nil, however, 2016 no instantiators will be screened out. If EXACT-P is non-nil, however,
2078 TAG-SET must be equal to an instantiator's tag set for the instantiator 2017 TAG-SET must be equal to an instantiator's tag set for the instantiator
2079 to be removed. 2018 to be removed.
2080 */ ) 2019 */
2081 (specifier, locale, tag_set, exact_p) 2020 (specifier, locale, tag_set, exact_p))
2082 Lisp_Object specifier, locale, tag_set, exact_p;
2083 { 2021 {
2084 CHECK_SPECIFIER (specifier); 2022 CHECK_SPECIFIER (specifier);
2085 map_specifier (specifier, locale, remove_specifier_mapfun, tag_set, 2023 map_specifier (specifier, locale, remove_specifier_mapfun, tag_set,
2086 exact_p, 0); 2024 exact_p, 0);
2087 recompute_cached_specifier_everywhere (specifier); 2025 recompute_cached_specifier_everywhere (specifier);
2118 cl->add_meth_is_nil ? SPEC_REMOVE_LOCALE : 2056 cl->add_meth_is_nil ? SPEC_REMOVE_LOCALE :
2119 cl->add_meth); 2057 cl->add_meth);
2120 return 0; 2058 return 0;
2121 } 2059 }
2122 2060
2123 DEFUN ("copy-specifier", Fcopy_specifier, Scopy_specifier, 2061 DEFUN ("copy-specifier", Fcopy_specifier, 1, 6, 0, /*
2124 1, 6, 0 /*
2125 Copy SPECIFIER to DEST, or create a new one if DEST is nil. 2062 Copy SPECIFIER to DEST, or create a new one if DEST is nil.
2126 2063
2127 If DEST is nil or omitted, a new specifier will be created and the 2064 If DEST is nil or omitted, a new specifier will be created and the
2128 specifications copied into it. Otherwise, the specifications will be 2065 specifications copied into it. Otherwise, the specifications will be
2129 copied into the existing specifier in DEST. 2066 copied into the existing specifier in DEST.
2145 2082
2146 Optional argument HOW-TO-ADD specifies what to do with existing 2083 Optional argument HOW-TO-ADD specifies what to do with existing
2147 specifications in DEST. If nil, then whichever locales or locale types 2084 specifications in DEST. If nil, then whichever locales or locale types
2148 are copied will first be completely erased in DEST. Otherwise, it is 2085 are copied will first be completely erased in DEST. Otherwise, it is
2149 the same as in `add-spec-to-specifier'. 2086 the same as in `add-spec-to-specifier'.
2150 */ ) 2087 */
2151 (specifier, dest, locale, tag_set, exact_p, how_to_add) 2088 (specifier, dest, locale, tag_set, exact_p, how_to_add))
2152 Lisp_Object specifier, dest, locale, tag_set, exact_p, how_to_add;
2153 { 2089 {
2154 struct gcpro gcpro1; 2090 struct gcpro gcpro1;
2155 struct copy_specifier_closure cl; 2091 struct copy_specifier_closure cl;
2156 2092
2157 CHECK_SPECIFIER (specifier); 2093 CHECK_SPECIFIER (specifier);
2232 intern (meths->name), Qspecifier, errb); 2168 intern (meths->name), Qspecifier, errb);
2233 return Qnil; 2169 return Qnil;
2234 } 2170 }
2235 } 2171 }
2236 2172
2237 DEFUN ("check-valid-specifier-matchspec", Fcheck_valid_specifier_matchspec, 2173 DEFUN ("check-valid-specifier-matchspec", Fcheck_valid_specifier_matchspec, 2, 2, 0, /*
2238 Scheck_valid_specifier_matchspec,
2239 2, 2, 0 /*
2240 Signal an error if MATCHSPEC is invalid for SPECIFIER-TYPE. 2174 Signal an error if MATCHSPEC is invalid for SPECIFIER-TYPE.
2241 See `specifier-matching-instance' for a description of matchspecs. 2175 See `specifier-matching-instance' for a description of matchspecs.
2242 */ ) 2176 */
2243 (matchspec, specifier_type) 2177 (matchspec, specifier_type))
2244 Lisp_Object matchspec, specifier_type;
2245 { 2178 {
2246 struct specifier_methods *meths = decode_specifier_type (specifier_type, 2179 struct specifier_methods *meths = decode_specifier_type (specifier_type,
2247 ERROR_ME); 2180 ERROR_ME);
2248 2181
2249 return check_valid_specifier_matchspec (matchspec, meths, ERROR_ME); 2182 return check_valid_specifier_matchspec (matchspec, meths, ERROR_ME);
2250 } 2183 }
2251 2184
2252 DEFUN ("valid-specifier-matchspec-p", Fvalid_specifier_matchspec_p, 2185 DEFUN ("valid-specifier-matchspec-p", Fvalid_specifier_matchspec_p, 2, 2, 0, /*
2253 Svalid_specifier_matchspec_p,
2254 2, 2, 0 /*
2255 Return non-nil if MATCHSPEC is valid for SPECIFIER-TYPE. 2186 Return non-nil if MATCHSPEC is valid for SPECIFIER-TYPE.
2256 See `specifier-matching-instance' for a description of matchspecs. 2187 See `specifier-matching-instance' for a description of matchspecs.
2257 */ ) 2188 */
2258 (matchspec, specifier_type) 2189 (matchspec, specifier_type))
2259 Lisp_Object matchspec, specifier_type;
2260 { 2190 {
2261 struct specifier_methods *meths = decode_specifier_type (specifier_type, 2191 struct specifier_methods *meths = decode_specifier_type (specifier_type,
2262 ERROR_ME); 2192 ERROR_ME);
2263 2193
2264 return check_valid_specifier_matchspec (matchspec, meths, ERROR_ME_NOT); 2194 return check_valid_specifier_matchspec (matchspec, meths, ERROR_ME_NOT);
2280 /* call the after-change method */ 2210 /* call the after-change method */
2281 MAYBE_SPECMETH (sp, after_change, (specifier, Qfallback)); 2211 MAYBE_SPECMETH (sp, after_change, (specifier, Qfallback));
2282 recompute_cached_specifier_everywhere (specifier); 2212 recompute_cached_specifier_everywhere (specifier);
2283 } 2213 }
2284 2214
2285 DEFUN ("specifier-fallback", Fspecifier_fallback, Sspecifier_fallback, 2215 DEFUN ("specifier-fallback", Fspecifier_fallback, 1, 1, 0, /*
2286 1, 1, 0 /*
2287 Return the fallback value for SPECIFIER. 2216 Return the fallback value for SPECIFIER.
2288 Fallback values are provided by the C code for certain built-in 2217 Fallback values are provided by the C code for certain built-in
2289 specifiers to make sure that instancing won't fail even if all 2218 specifiers to make sure that instancing won't fail even if all
2290 specs are removed from the specifier, or to implement simple 2219 specs are removed from the specifier, or to implement simple
2291 inheritance behavior (e.g. this method is used to ensure that 2220 inheritance behavior (e.g. this method is used to ensure that
2300 \(results in inheritance), or nil for no fallback. 2229 \(results in inheritance), or nil for no fallback.
2301 2230
2302 When you instance a specifier, you can explicitly request that the 2231 When you instance a specifier, you can explicitly request that the
2303 fallback not be consulted. (The C code does this, for example, when 2232 fallback not be consulted. (The C code does this, for example, when
2304 merging faces.) See `specifier-instance'. 2233 merging faces.) See `specifier-instance'.
2305 */ ) 2234 */
2306 (specifier) 2235 (specifier))
2307 Lisp_Object specifier;
2308 { 2236 {
2309 CHECK_SPECIFIER (specifier); 2237 CHECK_SPECIFIER (specifier);
2310 return Fcopy_tree (XSPECIFIER (specifier)->fallback, Qt); 2238 return Fcopy_tree (XSPECIFIER (specifier)->fallback, Qt);
2311 } 2239 }
2312 2240
2493 { 2421 {
2494 return specifier_instance (specifier, matchspec, domain, errb, 2422 return specifier_instance (specifier, matchspec, domain, errb,
2495 1, no_fallback, depth); 2423 1, no_fallback, depth);
2496 } 2424 }
2497 2425
2498 DEFUN ("specifier-instance", Fspecifier_instance, Sspecifier_instance, 2426 DEFUN ("specifier-instance", Fspecifier_instance, 1, 4, 0, /*
2499 1, 4, 0 /*
2500 Instantiate SPECIFIER (return its value) in DOMAIN. 2427 Instantiate SPECIFIER (return its value) in DOMAIN.
2501 If no instance can be generated for this domain, return DEFAULT. 2428 If no instance can be generated for this domain, return DEFAULT.
2502 2429
2503 DOMAIN should be a window, frame, or device. Other values that are legal 2430 DOMAIN should be a window, frame, or device. Other values that are legal
2504 as a locale (e.g. a buffer) are not valid as a domain because they do not 2431 as a locale (e.g. a buffer) are not valid as a domain because they do not
2540 for a font specifier (as returned by the `face-font' function), the returned 2467 for a font specifier (as returned by the `face-font' function), the returned
2541 value will be a font-instance object. For glyphs, the returned value 2468 value will be a font-instance object. For glyphs, the returned value
2542 will be a string, pixmap, or subwindow. 2469 will be a string, pixmap, or subwindow.
2543 2470
2544 See also `specifier-matching-instance'. 2471 See also `specifier-matching-instance'.
2545 */ ) 2472 */
2546 (specifier, domain, defalt, no_fallback) 2473 (specifier, domain, defalt, no_fallback))
2547 Lisp_Object specifier, domain, defalt, no_fallback;
2548 { 2474 {
2549 Lisp_Object instance; 2475 Lisp_Object instance;
2550 2476
2551 CHECK_SPECIFIER (specifier); 2477 CHECK_SPECIFIER (specifier);
2552 domain = decode_domain (domain); 2478 domain = decode_domain (domain);
2556 if (UNBOUNDP (instance)) 2482 if (UNBOUNDP (instance))
2557 return defalt; 2483 return defalt;
2558 return instance; 2484 return instance;
2559 } 2485 }
2560 2486
2561 DEFUN ("specifier-matching-instance", Fspecifier_matching_instance, 2487 DEFUN ("specifier-matching-instance", Fspecifier_matching_instance, 2, 5, 0, /*
2562 Sspecifier_matching_instance, 2, 5, 0 /*
2563 Return an instance for SPECIFIER in DOMAIN that matches MATCHSPEC. 2488 Return an instance for SPECIFIER in DOMAIN that matches MATCHSPEC.
2564 If no instance can be generated for this domain, return DEFAULT. 2489 If no instance can be generated for this domain, return DEFAULT.
2565 2490
2566 This function is identical to `specifier-instance' except that a 2491 This function is identical to `specifier-instance' except that a
2567 specification will only be considered if it matches MATCHSPEC. 2492 specification will only be considered if it matches MATCHSPEC.
2579 -- For font specifiers, MATCHSPEC should be a charset, and the specification 2504 -- For font specifiers, MATCHSPEC should be a charset, and the specification
2580 (a font string) must have a registry that matches the charset's registry. 2505 (a font string) must have a registry that matches the charset's registry.
2581 (This only makes sense with Mule support.) This makes it easy to choose a 2506 (This only makes sense with Mule support.) This makes it easy to choose a
2582 font that can display a particular character. (This is what redisplay 2507 font that can display a particular character. (This is what redisplay
2583 does, in fact.) 2508 does, in fact.)
2584 */ ) 2509 */
2585 (specifier, matchspec, domain, defalt, no_fallback) 2510 (specifier, matchspec, domain, defalt, no_fallback))
2586 Lisp_Object specifier, matchspec, domain, defalt, no_fallback;
2587 { 2511 {
2588 Lisp_Object instance; 2512 Lisp_Object instance;
2589 2513
2590 CHECK_SPECIFIER (specifier); 2514 CHECK_SPECIFIER (specifier);
2591 check_valid_specifier_matchspec (matchspec, XSPECIFIER (specifier)->methods, 2515 check_valid_specifier_matchspec (matchspec, XSPECIFIER (specifier)->methods,
2597 if (UNBOUNDP (instance)) 2521 if (UNBOUNDP (instance))
2598 return defalt; 2522 return defalt;
2599 return instance; 2523 return instance;
2600 } 2524 }
2601 2525
2602 DEFUN ("specifier-instance-from-inst-list", Fspecifier_instance_from_inst_list, 2526 DEFUN ("specifier-instance-from-inst-list",
2603 Sspecifier_instance_from_inst_list, 3, 4, 0 /* 2527 Fspecifier_instance_from_inst_list, 3, 4, 0, /*
2604 Attempt to convert a particular inst-list into an instance. 2528 Attempt to convert a particular inst-list into an instance.
2605 This attempts to instantiate INST-LIST in the given DOMAIN, 2529 This attempts to instantiate INST-LIST in the given DOMAIN,
2606 as if INST-LIST existed in a specification in SPECIFIER. If 2530 as if INST-LIST existed in a specification in SPECIFIER. If
2607 the instantiation fails, DEFAULT is returned. In most circumstances, 2531 the instantiation fails, DEFAULT is returned. In most circumstances,
2608 you should not use this function; use `specifier-instance' instead. 2532 you should not use this function; use `specifier-instance' instead.
2609 */ ) 2533 */
2610 (specifier, domain, inst_list, defalt) 2534 (specifier, domain, inst_list, defalt))
2611 Lisp_Object specifier, domain, inst_list, defalt;
2612 { 2535 {
2613 Lisp_Object val = Qunbound; 2536 Lisp_Object val = Qunbound;
2614 struct Lisp_Specifier *sp = XSPECIFIER (specifier); 2537 struct Lisp_Specifier *sp = XSPECIFIER (specifier);
2615 struct gcpro gcpro1; 2538 struct gcpro gcpro1;
2616 Lisp_Object built_up_list = Qnil; 2539 Lisp_Object built_up_list = Qnil;
2629 return defalt; 2552 return defalt;
2630 return val; 2553 return val;
2631 } 2554 }
2632 2555
2633 DEFUN ("specifier-matching-instance-from-inst-list", 2556 DEFUN ("specifier-matching-instance-from-inst-list",
2634 Fspecifier_matching_instance_from_inst_list, 2557 Fspecifier_matching_instance_from_inst_list, 4, 5, 0, /*
2635 Sspecifier_matching_instance_from_inst_list, 4, 5, 0 /*
2636 Attempt to convert a particular inst-list into an instance. 2558 Attempt to convert a particular inst-list into an instance.
2637 This attempts to instantiate INST-LIST in the given DOMAIN 2559 This attempts to instantiate INST-LIST in the given DOMAIN
2638 (as if INST-LIST existed in a specification in SPECIFIER), 2560 (as if INST-LIST existed in a specification in SPECIFIER),
2639 matching the specifications against MATCHSPEC. 2561 matching the specifications against MATCHSPEC.
2640 2562
2641 This function is analogous to `specifier-instance-from-inst-list' 2563 This function is analogous to `specifier-instance-from-inst-list'
2642 but allows for specification-matching as in `specifier-matching-instance'. 2564 but allows for specification-matching as in `specifier-matching-instance'.
2643 See that function for a description of exactly how the matching process 2565 See that function for a description of exactly how the matching process
2644 works. 2566 works.
2645 */ ) 2567 */
2646 (specifier, matchspec, domain, inst_list, defalt) 2568 (specifier, matchspec, domain, inst_list, defalt))
2647 Lisp_Object specifier, matchspec, domain, inst_list, defalt;
2648 { 2569 {
2649 Lisp_Object val = Qunbound; 2570 Lisp_Object val = Qunbound;
2650 struct Lisp_Specifier *sp = XSPECIFIER (specifier); 2571 struct Lisp_Specifier *sp = XSPECIFIER (specifier);
2651 struct gcpro gcpro1; 2572 struct gcpro gcpro1;
2652 Lisp_Object built_up_list = Qnil; 2573 Lisp_Object built_up_list = Qnil;
2812 recompute_one_cached_specifier_in_frame (specifier, 2733 recompute_one_cached_specifier_in_frame (specifier,
2813 XFRAME (XCAR (frmcons))); 2734 XFRAME (XCAR (frmcons)));
2814 } 2735 }
2815 } 2736 }
2816 2737
2817 DEFUN ("set-specifier-dirty-flag", Fset_specifier_dirty_flag, 2738 DEFUN ("set-specifier-dirty-flag", Fset_specifier_dirty_flag, 1, 1, 0, /*
2818 Sset_specifier_dirty_flag, 1, 1, 0 /*
2819 Force recomputation of any caches associated with SPECIFIER. 2739 Force recomputation of any caches associated with SPECIFIER.
2820 Note that this automatically happens whenever you change a specification 2740 Note that this automatically happens whenever you change a specification
2821 in SPECIFIER; you do not have to call this function then. 2741 in SPECIFIER; you do not have to call this function then.
2822 One example of where this function is useful is when you have a 2742 One example of where this function is useful is when you have a
2823 toolbar button whose `active-p' field is an expression to be 2743 toolbar button whose `active-p' field is an expression to be
2824 evaluated. Calling `set-specifier-dirty-flag' on the 2744 evaluated. Calling `set-specifier-dirty-flag' on the
2825 toolbar specifier will force the `active-p' fields to be 2745 toolbar specifier will force the `active-p' fields to be
2826 recomputed. 2746 recomputed.
2827 */ ) 2747 */
2828 (specifier) 2748 (specifier))
2829 Lisp_Object specifier;
2830 { 2749 {
2831 CHECK_SPECIFIER (specifier); 2750 CHECK_SPECIFIER (specifier);
2832 recompute_cached_specifier_everywhere (specifier); 2751 recompute_cached_specifier_everywhere (specifier);
2833 return Qnil; 2752 return Qnil;
2834 } 2753 }
2883 "instantiator is valid). It can also return nil to indicate an invalid\n" 2802 "instantiator is valid). It can also return nil to indicate an invalid\n"
2884 "instantiator; in this case, a general error will be signalled." 2803 "instantiator; in this case, a general error will be signalled."
2885 2804
2886 #endif /* 0 */ 2805 #endif /* 0 */
2887 2806
2888 DEFUN ("generic-specifier-p", Fgeneric_specifier_p, 2807 DEFUN ("generic-specifier-p", Fgeneric_specifier_p, 1, 1, 0, /*
2889 Sgeneric_specifier_p, 1, 1, 0 /*
2890 Return non-nil if OBJECT is a generic specifier. 2808 Return non-nil if OBJECT is a generic specifier.
2891 2809
2892 A generic specifier allows any kind of Lisp object as an instantiator, 2810 A generic specifier allows any kind of Lisp object as an instantiator,
2893 and returns back the Lisp object unchanged when it is instantiated. 2811 and returns back the Lisp object unchanged when it is instantiated.
2894 */ ) 2812 */
2895 (object) 2813 (object))
2896 Lisp_Object object;
2897 { 2814 {
2898 return (GENERIC_SPECIFIERP (object) ? Qt : Qnil); 2815 return (GENERIC_SPECIFIERP (object) ? Qt : Qnil);
2899 } 2816 }
2900 2817
2901 2818
2909 integer_validate (Lisp_Object instantiator) 2826 integer_validate (Lisp_Object instantiator)
2910 { 2827 {
2911 CHECK_INT (instantiator); 2828 CHECK_INT (instantiator);
2912 } 2829 }
2913 2830
2914 DEFUN ("integer-specifier-p", Finteger_specifier_p, 2831 DEFUN ("integer-specifier-p", Finteger_specifier_p, 1, 1, 0, /*
2915 Sinteger_specifier_p, 1, 1, 0 /*
2916 Return non-nil if OBJECT is an integer specifier. 2832 Return non-nil if OBJECT is an integer specifier.
2917 */ ) 2833 */
2918 (object) 2834 (object))
2919 Lisp_Object object;
2920 { 2835 {
2921 return (INTEGER_SPECIFIERP (object) ? Qt : Qnil); 2836 return (INTEGER_SPECIFIERP (object) ? Qt : Qnil);
2922 } 2837 }
2923 2838
2924 /************************************************************************/ 2839 /************************************************************************/
2931 natnum_validate (Lisp_Object instantiator) 2846 natnum_validate (Lisp_Object instantiator)
2932 { 2847 {
2933 CHECK_NATNUM (instantiator); 2848 CHECK_NATNUM (instantiator);
2934 } 2849 }
2935 2850
2936 DEFUN ("natnum-specifier-p", Fnatnum_specifier_p, 2851 DEFUN ("natnum-specifier-p", Fnatnum_specifier_p, 1, 1, 0, /*
2937 Snatnum_specifier_p, 1, 1, 0 /*
2938 Return non-nil if OBJECT is a natnum (non-negative-integer) specifier. 2852 Return non-nil if OBJECT is a natnum (non-negative-integer) specifier.
2939 */ ) 2853 */
2940 (object) 2854 (object))
2941 Lisp_Object object;
2942 { 2855 {
2943 return (NATNUM_SPECIFIERP (object) ? Qt : Qnil); 2856 return (NATNUM_SPECIFIERP (object) ? Qt : Qnil);
2944 } 2857 }
2945 2858
2946 /************************************************************************/ 2859 /************************************************************************/
2954 { 2867 {
2955 if (!EQ (instantiator, Qt) && !EQ (instantiator, Qnil)) 2868 if (!EQ (instantiator, Qt) && !EQ (instantiator, Qnil))
2956 signal_simple_error ("Must be t or nil", instantiator); 2869 signal_simple_error ("Must be t or nil", instantiator);
2957 } 2870 }
2958 2871
2959 DEFUN ("boolean-specifier-p", Fboolean_specifier_p, 2872 DEFUN ("boolean-specifier-p", Fboolean_specifier_p, 1, 1, 0, /*
2960 Sboolean_specifier_p, 1, 1, 0 /*
2961 Return non-nil if OBJECT is an boolean specifier. 2873 Return non-nil if OBJECT is an boolean specifier.
2962 */ ) 2874 */
2963 (object) 2875 (object))
2964 Lisp_Object object;
2965 { 2876 {
2966 return (BOOLEAN_SPECIFIERP (object) ? Qt : Qnil); 2877 return (BOOLEAN_SPECIFIERP (object) ? Qt : Qnil);
2967 } 2878 }
2968 2879
2969 2880
2980 defsymbol (&Qdevice_class, "device-class"); 2891 defsymbol (&Qdevice_class, "device-class");
2981 2892
2982 /* Qinteger, Qboolean, Qgeneric defined in general.c */ 2893 /* Qinteger, Qboolean, Qgeneric defined in general.c */
2983 defsymbol (&Qnatnum, "natnum"); 2894 defsymbol (&Qnatnum, "natnum");
2984 2895
2985 defsubr (&Svalid_specifier_type_p); 2896 DEFSUBR (Fvalid_specifier_type_p);
2986 defsubr (&Sspecifier_type_list); 2897 DEFSUBR (Fspecifier_type_list);
2987 defsubr (&Smake_specifier); 2898 DEFSUBR (Fmake_specifier);
2988 defsubr (&Sspecifierp); 2899 DEFSUBR (Fspecifierp);
2989 defsubr (&Sspecifier_type); 2900 DEFSUBR (Fspecifier_type);
2990 2901
2991 defsubr (&Svalid_specifier_locale_p); 2902 DEFSUBR (Fvalid_specifier_locale_p);
2992 defsubr (&Svalid_specifier_domain_p); 2903 DEFSUBR (Fvalid_specifier_domain_p);
2993 defsubr (&Svalid_specifier_locale_type_p); 2904 DEFSUBR (Fvalid_specifier_locale_type_p);
2994 defsubr (&Sspecifier_locale_type_from_locale); 2905 DEFSUBR (Fspecifier_locale_type_from_locale);
2995 2906
2996 defsubr (&Svalid_specifier_tag_p); 2907 DEFSUBR (Fvalid_specifier_tag_p);
2997 defsubr (&Svalid_specifier_tag_set_p); 2908 DEFSUBR (Fvalid_specifier_tag_set_p);
2998 defsubr (&Scanonicalize_tag_set); 2909 DEFSUBR (Fcanonicalize_tag_set);
2999 defsubr (&Sdevice_matches_specifier_tag_set_p); 2910 DEFSUBR (Fdevice_matches_specifier_tag_set_p);
3000 defsubr (&Sdefine_specifier_tag); 2911 DEFSUBR (Fdefine_specifier_tag);
3001 defsubr (&Sdevice_matching_specifier_tag_list); 2912 DEFSUBR (Fdevice_matching_specifier_tag_list);
3002 defsubr (&Sspecifier_tag_list); 2913 DEFSUBR (Fspecifier_tag_list);
3003 defsubr (&Sspecifier_tag_predicate); 2914 DEFSUBR (Fspecifier_tag_predicate);
3004 2915
3005 defsubr (&Scheck_valid_instantiator); 2916 DEFSUBR (Fcheck_valid_instantiator);
3006 defsubr (&Svalid_instantiator_p); 2917 DEFSUBR (Fvalid_instantiator_p);
3007 defsubr (&Scheck_valid_inst_list); 2918 DEFSUBR (Fcheck_valid_inst_list);
3008 defsubr (&Svalid_inst_list_p); 2919 DEFSUBR (Fvalid_inst_list_p);
3009 defsubr (&Scheck_valid_spec_list); 2920 DEFSUBR (Fcheck_valid_spec_list);
3010 defsubr (&Svalid_spec_list_p); 2921 DEFSUBR (Fvalid_spec_list_p);
3011 defsubr (&Sadd_spec_to_specifier); 2922 DEFSUBR (Fadd_spec_to_specifier);
3012 defsubr (&Sadd_spec_list_to_specifier); 2923 DEFSUBR (Fadd_spec_list_to_specifier);
3013 defsubr (&Sspecifier_spec_list); 2924 DEFSUBR (Fspecifier_spec_list);
3014 defsubr (&Sspecifier_specs); 2925 DEFSUBR (Fspecifier_specs);
3015 defsubr (&Sremove_specifier); 2926 DEFSUBR (Fremove_specifier);
3016 defsubr (&Scopy_specifier); 2927 DEFSUBR (Fcopy_specifier);
3017 2928
3018 defsubr (&Scheck_valid_specifier_matchspec); 2929 DEFSUBR (Fcheck_valid_specifier_matchspec);
3019 defsubr (&Svalid_specifier_matchspec_p); 2930 DEFSUBR (Fvalid_specifier_matchspec_p);
3020 defsubr (&Sspecifier_fallback); 2931 DEFSUBR (Fspecifier_fallback);
3021 defsubr (&Sspecifier_instance); 2932 DEFSUBR (Fspecifier_instance);
3022 defsubr (&Sspecifier_matching_instance); 2933 DEFSUBR (Fspecifier_matching_instance);
3023 defsubr (&Sspecifier_instance_from_inst_list); 2934 DEFSUBR (Fspecifier_instance_from_inst_list);
3024 defsubr (&Sspecifier_matching_instance_from_inst_list); 2935 DEFSUBR (Fspecifier_matching_instance_from_inst_list);
3025 defsubr (&Sset_specifier_dirty_flag); 2936 DEFSUBR (Fset_specifier_dirty_flag);
3026 2937
3027 defsubr (&Sgeneric_specifier_p); 2938 DEFSUBR (Fgeneric_specifier_p);
3028 defsubr (&Sinteger_specifier_p); 2939 DEFSUBR (Finteger_specifier_p);
3029 defsubr (&Snatnum_specifier_p); 2940 DEFSUBR (Fnatnum_specifier_p);
3030 defsubr (&Sboolean_specifier_p); 2941 DEFSUBR (Fboolean_specifier_p);
3031 2942
3032 /* Symbols pertaining to specifier creation. Specifiers are created 2943 /* Symbols pertaining to specifier creation. Specifiers are created
3033 in the syms_of() functions. */ 2944 in the syms_of() functions. */
3034 2945
3035 /* locales are defined in general.c. */ 2946 /* locales are defined in general.c. */