Mercurial > hg > xemacs-beta
comparison src/rangetab.c @ 5222:18c0b5909d16
Use keywords in structure syntax; new #define, NEED_TO_HANDLE_21_4_CODE 1
src/ChangeLog addition:
2010-05-31 Aidan Kehoe <kehoea@parhasard.net>
* rangetab.c (print_range_table, rangetab_instantiate)
(structure_type_create_rangetab):
* chartab.c (print_char_table, chartab_instantiate)
(structure_type_create_chartab):
* faces.c (syms_of_faces, print_face, face_validate):
Move structure syntax in these files to using keywords by default,
as is done in Common Lisp and GNU Emacs, accepting for the moment
the older non-keywords syntax too.
* glyphs.h: No need to have Q_data here.
* general-slots.h: Add Q_data, Q_type here.
* config.h.in (NEED_TO_HANDLE_21_4_CODE):
New #define, always 1 for the moment, replacing the previous
never-really-used NO_NEED_TO_HANDLE_21_4_CODE, and avoiding
confusing syntax.
* eval.c (Ffuncall): Wrap the hack that allows #'throw to be
funcalled in #ifdef NEED_TO_HANDLE_21_4_CODE.
* elhash.c (syms_of_elhash): Move Q_type, Q_data to
general-slots.h. Change to NEED_TO_HANDLE_21_4_CODE throughout
this file.
lisp/ChangeLog addition:
2010-05-31 Aidan Kehoe <kehoea@parhasard.net>
* specifier.el (current-display-table):
Use keywords in the structure syntax here, now we've moved to that
by default in C.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Mon, 31 May 2010 16:47:44 +0100 |
parents | 71ee43b8a74d |
children | 308d34e9f07d |
comparison
equal
deleted
inserted
replaced
5221:ac6846067766 | 5222:18c0b5909d16 |
---|---|
102 { | 102 { |
103 Lisp_Range_Table *rt = XRANGE_TABLE (obj); | 103 Lisp_Range_Table *rt = XRANGE_TABLE (obj); |
104 int i; | 104 int i; |
105 | 105 |
106 if (print_readably) | 106 if (print_readably) |
107 write_fmt_string_lisp (printcharfun, "#s(range-table type %s data (", | 107 write_fmt_string_lisp (printcharfun, "#s(range-table :type %s :data (", |
108 1, range_table_type_to_symbol (rt->type)); | 108 1, range_table_type_to_symbol (rt->type)); |
109 else | 109 else |
110 write_ascstring (printcharfun, "#<range-table "); | 110 write_ascstring (printcharfun, "#<range-table "); |
111 for (i = 0; i < gap_array_length (rt->entries); i++) | 111 for (i = 0; i < gap_array_length (rt->entries); i++) |
112 { | 112 { |
788 static Lisp_Object | 788 static Lisp_Object |
789 rangetab_instantiate (Lisp_Object plist) | 789 rangetab_instantiate (Lisp_Object plist) |
790 { | 790 { |
791 Lisp_Object data = Qnil, type = Qnil, rangetab; | 791 Lisp_Object data = Qnil, type = Qnil, rangetab; |
792 | 792 |
793 PROPERTY_LIST_LOOP_3 (key, value, plist) | 793 if (KEYWORDP (Fcar (plist))) |
794 { | 794 { |
795 if (EQ (key, Qtype)) type = value; | 795 PROPERTY_LIST_LOOP_3 (key, value, plist) |
796 else if (EQ (key, Qdata)) data = value; | 796 { |
797 else | 797 if (EQ (key, Q_type)) type = value; |
798 ABORT (); | 798 else if (EQ (key, Q_data)) data = value; |
799 } | 799 else if (!KEYWORDP (key)) |
800 signal_error | |
801 (Qinvalid_read_syntax, | |
802 "can't mix keyword and non-keyword structure syntax", | |
803 key); | |
804 else | |
805 ABORT (); | |
806 } | |
807 } | |
808 #ifdef NEED_TO_HANDLE_21_4_CODE | |
809 else | |
810 { | |
811 PROPERTY_LIST_LOOP_3 (key, value, plist) | |
812 { | |
813 if (EQ (key, Qtype)) type = value; | |
814 else if (EQ (key, Qdata)) data = value; | |
815 else if (KEYWORDP (key)) | |
816 signal_error | |
817 (Qinvalid_read_syntax, | |
818 "can't mix keyword and non-keyword structure syntax", | |
819 key); | |
820 else | |
821 ABORT (); | |
822 } | |
823 } | |
824 #endif /* NEED_TO_HANDLE_21_4_CODE */ | |
800 | 825 |
801 rangetab = Fmake_range_table (type); | 826 rangetab = Fmake_range_table (type); |
802 | 827 |
803 { | 828 { |
804 PROPERTY_LIST_LOOP_3 (range, val, data) | 829 PROPERTY_LIST_LOOP_3 (range, val, data) |
1040 { | 1065 { |
1041 struct structure_type *st; | 1066 struct structure_type *st; |
1042 | 1067 |
1043 st = define_structure_type (Qrange_table, 0, rangetab_instantiate); | 1068 st = define_structure_type (Qrange_table, 0, rangetab_instantiate); |
1044 | 1069 |
1070 define_structure_type_keyword (st, Q_data, rangetab_data_validate); | |
1071 define_structure_type_keyword (st, Q_type, rangetab_type_validate); | |
1072 #ifdef NEED_TO_HANDLE_21_4_CODE | |
1045 define_structure_type_keyword (st, Qdata, rangetab_data_validate); | 1073 define_structure_type_keyword (st, Qdata, rangetab_data_validate); |
1046 define_structure_type_keyword (st, Qtype, rangetab_type_validate); | 1074 define_structure_type_keyword (st, Qtype, rangetab_type_validate); |
1047 } | 1075 #endif /* NEED_TO_HANDLE_21_4_CODE */ |
1076 } |