diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 18 | ||||
| -rw-r--r-- | src/alloc.c | 14 | ||||
| -rw-r--r-- | src/chartab.c | 47 | ||||
| -rw-r--r-- | src/lisp.h | 41 | ||||
| -rw-r--r-- | src/lread.c | 41 | ||||
| -rw-r--r-- | src/print.c | 2 |
6 files changed, 103 insertions, 60 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7eb789ca341..3df37a69527 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,21 @@ | |||
| 1 | 2014-07-02 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Shrink Lisp_Sub_Char_Table by preferring C integers to Lisp_Objects. | ||
| 4 | * lisp.h (struct Lisp_Sub_Char_Table): Use C integers for depth and | ||
| 5 | min_char slots. Adjust comment. | ||
| 6 | (enum char_table_specials): Rename from CHAR_TABLE_STANDARD_SLOTS. | ||
| 7 | Add SUB_CHAR_TABLE_OFFSET member. | ||
| 8 | (make_uninit_sub_char_table): New function. | ||
| 9 | * alloc.c (mark_char_table): Add extra argument to denote char table | ||
| 10 | subtype. Adjust to match new layout of sub char-table. | ||
| 11 | (mark_object): Always mark sub char-tables with mark_char_table. | ||
| 12 | * chartab.c (make_sub_char_table, copy_sub_char_table) | ||
| 13 | (sub_char_table_ref, sub_char_table_ref_and_range, sub_char_table_set) | ||
| 14 | (sub_char_table_set_range, optimize_sub_char_table, map_sub_char_table) | ||
| 15 | (map_sub_char_table_for_charset, uniprop_table_uncompress): | ||
| 16 | All related users changed. | ||
| 17 | * lread.c (read1): Adjust to match new layout of sub char-table. | ||
| 18 | |||
| 1 | 2014-07-02 Stefan Monnier <monnier@iro.umontreal.ca> | 19 | 2014-07-02 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 20 | ||
| 3 | * keymap.c (get_keyelt): Simplify. | 21 | * keymap.c (get_keyelt): Simplify. |
diff --git a/src/alloc.c b/src/alloc.c index e2213db853d..6eb2e756ed1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5958,14 +5958,15 @@ mark_vectorlike (struct Lisp_Vector *ptr) | |||
| 5958 | symbols. */ | 5958 | symbols. */ |
| 5959 | 5959 | ||
| 5960 | static void | 5960 | static void |
| 5961 | mark_char_table (struct Lisp_Vector *ptr) | 5961 | mark_char_table (struct Lisp_Vector *ptr, enum pvec_type pvectype) |
| 5962 | { | 5962 | { |
| 5963 | int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK; | 5963 | int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK; |
| 5964 | int i; | 5964 | /* Consult the Lisp_Sub_Char_Table layout before changing this. */ |
| 5965 | int i, idx = (pvectype == PVEC_SUB_CHAR_TABLE ? SUB_CHAR_TABLE_OFFSET : 0); | ||
| 5965 | 5966 | ||
| 5966 | eassert (!VECTOR_MARKED_P (ptr)); | 5967 | eassert (!VECTOR_MARKED_P (ptr)); |
| 5967 | VECTOR_MARK (ptr); | 5968 | VECTOR_MARK (ptr); |
| 5968 | for (i = 0; i < size; i++) | 5969 | for (i = idx; i < size; i++) |
| 5969 | { | 5970 | { |
| 5970 | Lisp_Object val = ptr->contents[i]; | 5971 | Lisp_Object val = ptr->contents[i]; |
| 5971 | 5972 | ||
| @@ -5974,7 +5975,7 @@ mark_char_table (struct Lisp_Vector *ptr) | |||
| 5974 | if (SUB_CHAR_TABLE_P (val)) | 5975 | if (SUB_CHAR_TABLE_P (val)) |
| 5975 | { | 5976 | { |
| 5976 | if (! VECTOR_MARKED_P (XVECTOR (val))) | 5977 | if (! VECTOR_MARKED_P (XVECTOR (val))) |
| 5977 | mark_char_table (XVECTOR (val)); | 5978 | mark_char_table (XVECTOR (val), PVEC_SUB_CHAR_TABLE); |
| 5978 | } | 5979 | } |
| 5979 | else | 5980 | else |
| 5980 | mark_object (val); | 5981 | mark_object (val); |
| @@ -6320,7 +6321,8 @@ mark_object (Lisp_Object arg) | |||
| 6320 | break; | 6321 | break; |
| 6321 | 6322 | ||
| 6322 | case PVEC_CHAR_TABLE: | 6323 | case PVEC_CHAR_TABLE: |
| 6323 | mark_char_table (ptr); | 6324 | case PVEC_SUB_CHAR_TABLE: |
| 6325 | mark_char_table (ptr, (enum pvec_type) pvectype); | ||
| 6324 | break; | 6326 | break; |
| 6325 | 6327 | ||
| 6326 | case PVEC_BOOL_VECTOR: | 6328 | case PVEC_BOOL_VECTOR: |
| @@ -7218,7 +7220,7 @@ The time is in seconds as a floating point value. */); | |||
| 7218 | union | 7220 | union |
| 7219 | { | 7221 | { |
| 7220 | enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; | 7222 | enum CHARTAB_SIZE_BITS CHARTAB_SIZE_BITS; |
| 7221 | enum CHAR_TABLE_STANDARD_SLOTS CHAR_TABLE_STANDARD_SLOTS; | 7223 | enum char_table_specials char_table_specials; |
| 7222 | enum char_bits char_bits; | 7224 | enum char_bits char_bits; |
| 7223 | enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; | 7225 | enum CHECK_LISP_OBJECT_TYPE CHECK_LISP_OBJECT_TYPE; |
| 7224 | enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; | 7226 | enum DEFAULT_HASH_SIZE DEFAULT_HASH_SIZE; |
diff --git a/src/chartab.c b/src/chartab.c index 4d4e6381b19..3906ad30b37 100644 --- a/src/chartab.c +++ b/src/chartab.c | |||
| @@ -140,15 +140,11 @@ the char-table has no extra slot. */) | |||
| 140 | static Lisp_Object | 140 | static Lisp_Object |
| 141 | make_sub_char_table (int depth, int min_char, Lisp_Object defalt) | 141 | make_sub_char_table (int depth, int min_char, Lisp_Object defalt) |
| 142 | { | 142 | { |
| 143 | Lisp_Object table; | 143 | int i; |
| 144 | int size = (PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) | 144 | Lisp_Object table = make_uninit_sub_char_table (depth, min_char); |
| 145 | + chartab_size[depth]); | ||
| 146 | |||
| 147 | table = Fmake_vector (make_number (size), defalt); | ||
| 148 | XSETPVECTYPE (XVECTOR (table), PVEC_SUB_CHAR_TABLE); | ||
| 149 | XSUB_CHAR_TABLE (table)->depth = make_number (depth); | ||
| 150 | XSUB_CHAR_TABLE (table)->min_char = make_number (min_char); | ||
| 151 | 145 | ||
| 146 | for (i = 0; i < chartab_size[depth]; i++) | ||
| 147 | XSUB_CHAR_TABLE (table)->contents[i] = defalt; | ||
| 152 | return table; | 148 | return table; |
| 153 | } | 149 | } |
| 154 | 150 | ||
| @@ -172,8 +168,8 @@ char_table_ascii (Lisp_Object table) | |||
| 172 | static Lisp_Object | 168 | static Lisp_Object |
| 173 | copy_sub_char_table (Lisp_Object table) | 169 | copy_sub_char_table (Lisp_Object table) |
| 174 | { | 170 | { |
| 175 | int depth = XINT (XSUB_CHAR_TABLE (table)->depth); | 171 | int depth = XSUB_CHAR_TABLE (table)->depth; |
| 176 | int min_char = XINT (XSUB_CHAR_TABLE (table)->min_char); | 172 | int min_char = XSUB_CHAR_TABLE (table)->min_char; |
| 177 | Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil); | 173 | Lisp_Object copy = make_sub_char_table (depth, min_char, Qnil); |
| 178 | int i; | 174 | int i; |
| 179 | 175 | ||
| @@ -220,10 +216,8 @@ static Lisp_Object | |||
| 220 | sub_char_table_ref (Lisp_Object table, int c, bool is_uniprop) | 216 | sub_char_table_ref (Lisp_Object table, int c, bool is_uniprop) |
| 221 | { | 217 | { |
| 222 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 218 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 223 | int depth = XINT (tbl->depth); | ||
| 224 | int min_char = XINT (tbl->min_char); | ||
| 225 | Lisp_Object val; | 219 | Lisp_Object val; |
| 226 | int idx = CHARTAB_IDX (c, depth, min_char); | 220 | int idx = CHARTAB_IDX (c, tbl->depth, tbl->min_char); |
| 227 | 221 | ||
| 228 | val = tbl->contents[idx]; | 222 | val = tbl->contents[idx]; |
| 229 | if (is_uniprop && UNIPROP_COMPRESSED_FORM_P (val)) | 223 | if (is_uniprop && UNIPROP_COMPRESSED_FORM_P (val)) |
| @@ -265,8 +259,7 @@ sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to, | |||
| 265 | Lisp_Object defalt, bool is_uniprop) | 259 | Lisp_Object defalt, bool is_uniprop) |
| 266 | { | 260 | { |
| 267 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 261 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 268 | int depth = XINT (tbl->depth); | 262 | int depth = tbl->depth, min_char = tbl->min_char; |
| 269 | int min_char = XINT (tbl->min_char); | ||
| 270 | int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; | 263 | int chartab_idx = CHARTAB_IDX (c, depth, min_char), idx; |
| 271 | Lisp_Object val; | 264 | Lisp_Object val; |
| 272 | 265 | ||
| @@ -402,8 +395,7 @@ static void | |||
| 402 | sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, bool is_uniprop) | 395 | sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, bool is_uniprop) |
| 403 | { | 396 | { |
| 404 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 397 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 405 | int depth = XINT ((tbl)->depth); | 398 | int depth = tbl->depth, min_char = tbl->min_char; |
| 406 | int min_char = XINT ((tbl)->min_char); | ||
| 407 | int i = CHARTAB_IDX (c, depth, min_char); | 399 | int i = CHARTAB_IDX (c, depth, min_char); |
| 408 | Lisp_Object sub; | 400 | Lisp_Object sub; |
| 409 | 401 | ||
| @@ -458,8 +450,7 @@ sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val, | |||
| 458 | bool is_uniprop) | 450 | bool is_uniprop) |
| 459 | { | 451 | { |
| 460 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 452 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 461 | int depth = XINT ((tbl)->depth); | 453 | int depth = tbl->depth, min_char = tbl->min_char; |
| 462 | int min_char = XINT ((tbl)->min_char); | ||
| 463 | int chars_in_block = chartab_chars[depth]; | 454 | int chars_in_block = chartab_chars[depth]; |
| 464 | int i, c, lim = chartab_size[depth]; | 455 | int i, c, lim = chartab_size[depth]; |
| 465 | 456 | ||
| @@ -689,9 +680,8 @@ static Lisp_Object | |||
| 689 | optimize_sub_char_table (Lisp_Object table, Lisp_Object test) | 680 | optimize_sub_char_table (Lisp_Object table, Lisp_Object test) |
| 690 | { | 681 | { |
| 691 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 682 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 692 | int depth = XINT (tbl->depth); | 683 | int i, depth = tbl->depth; |
| 693 | Lisp_Object elt, this; | 684 | Lisp_Object elt, this; |
| 694 | int i; | ||
| 695 | bool optimizable; | 685 | bool optimizable; |
| 696 | 686 | ||
| 697 | elt = XSUB_CHAR_TABLE (table)->contents[0]; | 687 | elt = XSUB_CHAR_TABLE (table)->contents[0]; |
| @@ -778,8 +768,8 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object), | |||
| 778 | { | 768 | { |
| 779 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 769 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 780 | 770 | ||
| 781 | depth = XINT (tbl->depth); | 771 | depth = tbl->depth; |
| 782 | min_char = XINT (tbl->min_char); | 772 | min_char = tbl->min_char; |
| 783 | max_char = min_char + chartab_chars[depth - 1] - 1; | 773 | max_char = min_char + chartab_chars[depth - 1] - 1; |
| 784 | } | 774 | } |
| 785 | else | 775 | else |
| @@ -973,12 +963,10 @@ map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), | |||
| 973 | unsigned from, unsigned to) | 963 | unsigned from, unsigned to) |
| 974 | { | 964 | { |
| 975 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); | 965 | struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table); |
| 976 | int depth = XINT (tbl->depth); | 966 | int i, c = tbl->min_char, depth = tbl->depth; |
| 977 | int c, i; | ||
| 978 | 967 | ||
| 979 | if (depth < 3) | 968 | if (depth < 3) |
| 980 | for (i = 0, c = XINT (tbl->min_char); i < chartab_size[depth]; | 969 | for (i = 0; i < chartab_size[depth]; i++, c += chartab_chars[depth]) |
| 981 | i++, c += chartab_chars[depth]) | ||
| 982 | { | 970 | { |
| 983 | Lisp_Object this; | 971 | Lisp_Object this; |
| 984 | 972 | ||
| @@ -1000,7 +988,7 @@ map_sub_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Object), | |||
| 1000 | } | 988 | } |
| 1001 | } | 989 | } |
| 1002 | else | 990 | else |
| 1003 | for (i = 0, c = XINT (tbl->min_char); i < chartab_size[depth]; i++, c ++) | 991 | for (i = 0; i < chartab_size[depth]; i++, c++) |
| 1004 | { | 992 | { |
| 1005 | Lisp_Object this; | 993 | Lisp_Object this; |
| 1006 | unsigned code; | 994 | unsigned code; |
| @@ -1147,8 +1135,7 @@ static Lisp_Object | |||
| 1147 | uniprop_table_uncompress (Lisp_Object table, int idx) | 1135 | uniprop_table_uncompress (Lisp_Object table, int idx) |
| 1148 | { | 1136 | { |
| 1149 | Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[idx]; | 1137 | Lisp_Object val = XSUB_CHAR_TABLE (table)->contents[idx]; |
| 1150 | int min_char = (XINT (XSUB_CHAR_TABLE (table)->min_char) | 1138 | int min_char = XSUB_CHAR_TABLE (table)->min_char + chartab_chars[2] * idx; |
| 1151 | + chartab_chars[2] * idx); | ||
| 1152 | Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); | 1139 | Lisp_Object sub = make_sub_char_table (3, min_char, Qnil); |
| 1153 | const unsigned char *p, *pend; | 1140 | const unsigned char *p, *pend; |
| 1154 | 1141 | ||
diff --git a/src/lisp.h b/src/lisp.h index fb832b80940..3c4845ec79b 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1407,10 +1407,11 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) | |||
| 1407 | sense to handle a char-table with type struct Lisp_Vector. An | 1407 | sense to handle a char-table with type struct Lisp_Vector. An |
| 1408 | element of a char table can be any Lisp objects, but if it is a sub | 1408 | element of a char table can be any Lisp objects, but if it is a sub |
| 1409 | char-table, we treat it a table that contains information of a | 1409 | char-table, we treat it a table that contains information of a |
| 1410 | specific range of characters. A sub char-table has the same | 1410 | specific range of characters. A sub char-table is like a vector but |
| 1411 | structure as a vector. A sub char table appears only in an element | 1411 | with two integer fields between the header and Lisp data, which means |
| 1412 | of a char-table, and there's no way to access it directly from | 1412 | that it has to be marked with some precautions (see mark_char_table |
| 1413 | Emacs Lisp program. */ | 1413 | in alloc.c). A sub char-table appears only in an element of a char-table, |
| 1414 | and there's no way to access it directly from Emacs Lisp program. */ | ||
| 1414 | 1415 | ||
| 1415 | enum CHARTAB_SIZE_BITS | 1416 | enum CHARTAB_SIZE_BITS |
| 1416 | { | 1417 | { |
| @@ -1465,10 +1466,10 @@ struct Lisp_Sub_Char_Table | |||
| 1465 | contains 32 elements, and each element covers 128 characters. A | 1466 | contains 32 elements, and each element covers 128 characters. A |
| 1466 | sub char-table of depth 3 contains 128 elements, and each element | 1467 | sub char-table of depth 3 contains 128 elements, and each element |
| 1467 | is for one character. */ | 1468 | is for one character. */ |
| 1468 | Lisp_Object depth; | 1469 | int depth; |
| 1469 | 1470 | ||
| 1470 | /* Minimum character covered by the sub char-table. */ | 1471 | /* Minimum character covered by the sub char-table. */ |
| 1471 | Lisp_Object min_char; | 1472 | int min_char; |
| 1472 | 1473 | ||
| 1473 | /* Use set_sub_char_table_contents to set this. */ | 1474 | /* Use set_sub_char_table_contents to set this. */ |
| 1474 | Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; | 1475 | Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER]; |
| @@ -1539,12 +1540,16 @@ struct Lisp_Subr | |||
| 1539 | const char *doc; | 1540 | const char *doc; |
| 1540 | }; | 1541 | }; |
| 1541 | 1542 | ||
| 1542 | /* This is the number of slots that every char table must have. This | 1543 | enum char_table_specials |
| 1543 | counts the ordinary slots and the top, defalt, parent, and purpose | ||
| 1544 | slots. */ | ||
| 1545 | enum CHAR_TABLE_STANDARD_SLOTS | ||
| 1546 | { | 1544 | { |
| 1547 | CHAR_TABLE_STANDARD_SLOTS = PSEUDOVECSIZE (struct Lisp_Char_Table, extras) | 1545 | /* This is the number of slots that every char table must have. This |
| 1546 | counts the ordinary slots and the top, defalt, parent, and purpose | ||
| 1547 | slots. */ | ||
| 1548 | CHAR_TABLE_STANDARD_SLOTS = PSEUDOVECSIZE (struct Lisp_Char_Table, extras), | ||
| 1549 | |||
| 1550 | /* This is an index of first Lisp_Object field in Lisp_Sub_Char_Table | ||
| 1551 | when the latter is treated as an ordinary Lisp_Vector. */ | ||
| 1552 | SUB_CHAR_TABLE_OFFSET = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) | ||
| 1548 | }; | 1553 | }; |
| 1549 | 1554 | ||
| 1550 | /* Return the number of "extra" slots in the char table CT. */ | 1555 | /* Return the number of "extra" slots in the char table CT. */ |
| @@ -3723,6 +3728,20 @@ make_uninit_vector (ptrdiff_t size) | |||
| 3723 | return v; | 3728 | return v; |
| 3724 | } | 3729 | } |
| 3725 | 3730 | ||
| 3731 | /* Like above, but special for sub char-tables. */ | ||
| 3732 | |||
| 3733 | INLINE Lisp_Object | ||
| 3734 | make_uninit_sub_char_table (int depth, int min_char) | ||
| 3735 | { | ||
| 3736 | int slots = SUB_CHAR_TABLE_OFFSET + chartab_size[depth]; | ||
| 3737 | Lisp_Object v = make_uninit_vector (slots); | ||
| 3738 | |||
| 3739 | XSETPVECTYPE (XVECTOR (v), PVEC_SUB_CHAR_TABLE); | ||
| 3740 | XSUB_CHAR_TABLE (v)->depth = depth; | ||
| 3741 | XSUB_CHAR_TABLE (v)->min_char = min_char; | ||
| 3742 | return v; | ||
| 3743 | } | ||
| 3744 | |||
| 3726 | extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); | 3745 | extern struct Lisp_Vector *allocate_pseudovector (int, int, enum pvec_type); |
| 3727 | #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ | 3746 | #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ |
| 3728 | ((typ*) \ | 3747 | ((typ*) \ |
diff --git a/src/lread.c b/src/lread.c index f252993207d..639d574ac6b 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2619,21 +2619,38 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 2619 | c = READCHAR; | 2619 | c = READCHAR; |
| 2620 | if (c == '[') | 2620 | if (c == '[') |
| 2621 | { | 2621 | { |
| 2622 | Lisp_Object tmp; | 2622 | /* Sub char-table can't be read as a regular |
| 2623 | int depth; | 2623 | vector because of a two C integer fields. */ |
| 2624 | ptrdiff_t size; | 2624 | Lisp_Object tbl, tmp = read_list (1, readcharfun); |
| 2625 | ptrdiff_t size = XINT (Flength (tmp)); | ||
| 2626 | int i, depth, min_char; | ||
| 2627 | struct Lisp_Cons *cell; | ||
| 2625 | 2628 | ||
| 2626 | tmp = read_vector (readcharfun, 0); | ||
| 2627 | size = ASIZE (tmp); | ||
| 2628 | if (size == 0) | 2629 | if (size == 0) |
| 2629 | error ("Invalid size char-table"); | 2630 | error ("Zero-sized sub char-table"); |
| 2630 | if (! RANGED_INTEGERP (1, AREF (tmp, 0), 3)) | 2631 | |
| 2631 | error ("Invalid depth in char-table"); | 2632 | if (! RANGED_INTEGERP (1, XCAR (tmp), 3)) |
| 2632 | depth = XINT (AREF (tmp, 0)); | 2633 | error ("Invalid depth in sub char-table"); |
| 2634 | depth = XINT (XCAR (tmp)); | ||
| 2633 | if (chartab_size[depth] != size - 2) | 2635 | if (chartab_size[depth] != size - 2) |
| 2634 | error ("Invalid size char-table"); | 2636 | error ("Invalid size in sub char-table"); |
| 2635 | XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE); | 2637 | cell = XCONS (tmp), tmp = XCDR (tmp), size--; |
| 2636 | return tmp; | 2638 | free_cons (cell); |
| 2639 | |||
| 2640 | if (! RANGED_INTEGERP (0, XCAR (tmp), MAX_CHAR)) | ||
| 2641 | error ("Invalid minimum character in sub-char-table"); | ||
| 2642 | min_char = XINT (XCAR (tmp)); | ||
| 2643 | cell = XCONS (tmp), tmp = XCDR (tmp), size--; | ||
| 2644 | free_cons (cell); | ||
| 2645 | |||
| 2646 | tbl = make_uninit_sub_char_table (depth, min_char); | ||
| 2647 | for (i = 0; i < size; i++) | ||
| 2648 | { | ||
| 2649 | XSUB_CHAR_TABLE (tbl)->contents[i] = XCAR (tmp); | ||
| 2650 | cell = XCONS (tmp), tmp = XCDR (tmp); | ||
| 2651 | free_cons (cell); | ||
| 2652 | } | ||
| 2653 | return tbl; | ||
| 2637 | } | 2654 | } |
| 2638 | invalid_syntax ("#^^"); | 2655 | invalid_syntax ("#^^"); |
| 2639 | } | 2656 | } |
diff --git a/src/print.c b/src/print.c index 9050a0cb773..9b3620765a8 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -1968,7 +1968,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) | |||
| 1968 | Otherwise we'll make a line extremely long, which | 1968 | Otherwise we'll make a line extremely long, which |
| 1969 | results in slow redisplay. */ | 1969 | results in slow redisplay. */ |
| 1970 | if (SUB_CHAR_TABLE_P (obj) | 1970 | if (SUB_CHAR_TABLE_P (obj) |
| 1971 | && XINT (XSUB_CHAR_TABLE (obj)->depth) == 3) | 1971 | && XSUB_CHAR_TABLE (obj)->depth == 3) |
| 1972 | PRINTCHAR ('\n'); | 1972 | PRINTCHAR ('\n'); |
| 1973 | PRINTCHAR ('#'); | 1973 | PRINTCHAR ('#'); |
| 1974 | PRINTCHAR ('^'); | 1974 | PRINTCHAR ('^'); |