comparison src/elhash.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 41ac827cb71b
children 33899241a6a8
comparison
equal deleted inserted replaced
5221:ac6846067766 5222:18c0b5909d16
97 static Lisp_Object Vhash_table_test_eq, Vhash_table_test_eql; 97 static Lisp_Object Vhash_table_test_eq, Vhash_table_test_eql;
98 static Lisp_Object Vhash_table_test_weak_list; 98 static Lisp_Object Vhash_table_test_weak_list;
99 99
100 /* obsolete as of 19990901 in xemacs-21.2 */ 100 /* obsolete as of 19990901 in xemacs-21.2 */
101 static Lisp_Object Qweak, Qkey_weak, Qvalue_weak, Qkey_or_value_weak; 101 static Lisp_Object Qweak, Qkey_weak, Qvalue_weak, Qkey_or_value_weak;
102 static Lisp_Object Qnon_weak, Q_type, Q_data; 102 static Lisp_Object Qnon_weak;
103 103
104 /* A hash table test, with its associated hash function. equal_function may 104 /* A hash table test, with its associated hash function. equal_function may
105 call lisp_equal_function, and hash_function similarly may call 105 call lisp_equal_function, and hash_function similarly may call
106 lisp_hash_function. */ 106 lisp_hash_function. */
107 struct Hash_Table_Test 107 struct Hash_Table_Test
755 if (EQ (value, Qkey)) return 1; 755 if (EQ (value, Qkey)) return 1;
756 if (EQ (value, Qkey_and_value)) return 1; 756 if (EQ (value, Qkey_and_value)) return 1;
757 if (EQ (value, Qkey_or_value)) return 1; 757 if (EQ (value, Qkey_or_value)) return 1;
758 if (EQ (value, Qvalue)) return 1; 758 if (EQ (value, Qvalue)) return 1;
759 759
760 #ifndef NO_NEED_TO_HANDLE_21_4_CODE 760 #ifdef NEED_TO_HANDLE_21_4_CODE
761 /* Following values are obsolete as of 19990901 in xemacs-21.2 */ 761 /* Following values are obsolete as of 19990901 in xemacs-21.2 */
762 if (EQ (value, Qnon_weak)) return 1; 762 if (EQ (value, Qnon_weak)) return 1;
763 if (EQ (value, Qweak)) return 1; 763 if (EQ (value, Qweak)) return 1;
764 if (EQ (value, Qkey_weak)) return 1; 764 if (EQ (value, Qkey_weak)) return 1;
765 if (EQ (value, Qkey_or_value_weak)) return 1; 765 if (EQ (value, Qkey_or_value_weak)) return 1;
779 if (EQ (obj, Qkey_and_value)) return HASH_TABLE_WEAK; 779 if (EQ (obj, Qkey_and_value)) return HASH_TABLE_WEAK;
780 if (EQ (obj, Qkey)) return HASH_TABLE_KEY_WEAK; 780 if (EQ (obj, Qkey)) return HASH_TABLE_KEY_WEAK;
781 if (EQ (obj, Qkey_or_value)) return HASH_TABLE_KEY_VALUE_WEAK; 781 if (EQ (obj, Qkey_or_value)) return HASH_TABLE_KEY_VALUE_WEAK;
782 if (EQ (obj, Qvalue)) return HASH_TABLE_VALUE_WEAK; 782 if (EQ (obj, Qvalue)) return HASH_TABLE_VALUE_WEAK;
783 783
784 #ifndef NO_NEED_TO_HANDLE_21_4_CODE 784 #ifdef NEED_TO_HANDLE_21_4_CODE
785 /* Following values are obsolete as of 19990901 in xemacs-21.2 */ 785 /* Following values are obsolete as of 19990901 in xemacs-21.2 */
786 if (EQ (obj, Qnon_weak)) return HASH_TABLE_NON_WEAK; 786 if (EQ (obj, Qnon_weak)) return HASH_TABLE_NON_WEAK;
787 if (EQ (obj, Qweak)) return HASH_TABLE_WEAK; 787 if (EQ (obj, Qweak)) return HASH_TABLE_WEAK;
788 if (EQ (obj, Qkey_weak)) return HASH_TABLE_KEY_WEAK; 788 if (EQ (obj, Qkey_weak)) return HASH_TABLE_KEY_WEAK;
789 if (EQ (obj, Qkey_or_value_weak)) return HASH_TABLE_KEY_VALUE_WEAK; 789 if (EQ (obj, Qkey_or_value_weak)) return HASH_TABLE_KEY_VALUE_WEAK;
1013 define_structure_type_keyword (st, Q_rehash_size, hash_table_rehash_size_validate); 1013 define_structure_type_keyword (st, Q_rehash_size, hash_table_rehash_size_validate);
1014 define_structure_type_keyword (st, Q_rehash_threshold, hash_table_rehash_threshold_validate); 1014 define_structure_type_keyword (st, Q_rehash_threshold, hash_table_rehash_threshold_validate);
1015 define_structure_type_keyword (st, Q_weakness, hash_table_weakness_validate); 1015 define_structure_type_keyword (st, Q_weakness, hash_table_weakness_validate);
1016 define_structure_type_keyword (st, Q_data, hash_table_data_validate); 1016 define_structure_type_keyword (st, Q_data, hash_table_data_validate);
1017 1017
1018 #ifdef NEED_TO_HANDLE_21_4_CODE
1018 /* Next the mutually exclusive, older, non-keyword syntax: */ 1019 /* Next the mutually exclusive, older, non-keyword syntax: */
1019 define_structure_type_keyword (st, Qtest, hash_table_test_validate); 1020 define_structure_type_keyword (st, Qtest, hash_table_test_validate);
1020 define_structure_type_keyword (st, Qsize, hash_table_size_validate); 1021 define_structure_type_keyword (st, Qsize, hash_table_size_validate);
1021 define_structure_type_keyword (st, Qrehash_size, hash_table_rehash_size_validate); 1022 define_structure_type_keyword (st, Qrehash_size, hash_table_rehash_size_validate);
1022 define_structure_type_keyword (st, Qrehash_threshold, hash_table_rehash_threshold_validate); 1023 define_structure_type_keyword (st, Qrehash_threshold, hash_table_rehash_threshold_validate);
1023 define_structure_type_keyword (st, Qweakness, hash_table_weakness_validate); 1024 define_structure_type_keyword (st, Qweakness, hash_table_weakness_validate);
1024 define_structure_type_keyword (st, Qdata, hash_table_data_validate); 1025 define_structure_type_keyword (st, Qdata, hash_table_data_validate);
1025 1026
1026 #ifndef NO_NEED_TO_HANDLE_21_4_CODE
1027 /* obsolete as of 19990901 in xemacs-21.2 */ 1027 /* obsolete as of 19990901 in xemacs-21.2 */
1028 define_structure_type_keyword (st, Qtype, hash_table_weakness_validate); 1028 define_structure_type_keyword (st, Qtype, hash_table_weakness_validate);
1029 #endif 1029 #endif
1030 } 1030 }
1031 1031
1035 This is called from emacs.c. */ 1035 This is called from emacs.c. */
1036 void 1036 void
1037 structure_type_create_hash_table (void) 1037 structure_type_create_hash_table (void)
1038 { 1038 {
1039 structure_type_create_hash_table_structure_name (Qhash_table); 1039 structure_type_create_hash_table_structure_name (Qhash_table);
1040 #ifdef NEED_TO_HANDLE_21_4_CODE
1040 structure_type_create_hash_table_structure_name (Qhashtable); /* compat */ 1041 structure_type_create_hash_table_structure_name (Qhashtable); /* compat */
1042 #endif
1041 } 1043 }
1042 1044
1043 1045
1044 /************************************************************************/ 1046 /************************************************************************/
1045 /* Definition of Lisp-visible methods */ 1047 /* Definition of Lisp-visible methods */
2275 DEFKEYWORD (Q_test); 2277 DEFKEYWORD (Q_test);
2276 DEFKEYWORD (Q_size); 2278 DEFKEYWORD (Q_size);
2277 DEFKEYWORD (Q_rehash_size); 2279 DEFKEYWORD (Q_rehash_size);
2278 DEFKEYWORD (Q_rehash_threshold); 2280 DEFKEYWORD (Q_rehash_threshold);
2279 DEFKEYWORD (Q_weakness); 2281 DEFKEYWORD (Q_weakness);
2280 DEFKEYWORD (Q_type); /* obsolete */
2281 } 2282 }
2282 2283
2283 void 2284 void
2284 vars_of_elhash (void) 2285 vars_of_elhash (void)
2285 { 2286 {