Mercurial > hg > xemacs-beta
comparison src/chartab.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 | 02c282ae97cb |
comparison
equal
deleted
inserted
replaced
5221:ac6846067766 | 5222:18c0b5909d16 |
---|---|
334 | 334 |
335 range.type = CHARTAB_RANGE_ALL; | 335 range.type = CHARTAB_RANGE_ALL; |
336 arg.printcharfun = printcharfun; | 336 arg.printcharfun = printcharfun; |
337 arg.first = 1; | 337 arg.first = 1; |
338 | 338 |
339 write_fmt_string_lisp (printcharfun, "#s(char-table type %s data (", | 339 write_fmt_string_lisp (printcharfun, "#s(char-table :type %s :data (", |
340 1, char_table_type_to_symbol (ct->type)); | 340 1, char_table_type_to_symbol (ct->type)); |
341 map_char_table (obj, &range, print_table_entry, &arg); | 341 map_char_table (obj, &range, print_table_entry, &arg); |
342 write_ascstring (printcharfun, "))"); | 342 write_ascstring (printcharfun, "))"); |
343 | 343 |
344 /* #### need to print and read the default; but that will allow the | 344 /* #### need to print and read the default; but that will allow the |
1542 | 1542 |
1543 return 1; | 1543 return 1; |
1544 } | 1544 } |
1545 | 1545 |
1546 static Lisp_Object | 1546 static Lisp_Object |
1547 chartab_instantiate (Lisp_Object data) | 1547 chartab_instantiate (Lisp_Object plist) |
1548 { | 1548 { |
1549 Lisp_Object chartab; | 1549 Lisp_Object chartab; |
1550 Lisp_Object type = Qgeneric; | 1550 Lisp_Object type = Qgeneric; |
1551 Lisp_Object dataval = Qnil; | 1551 Lisp_Object dataval = Qnil; |
1552 | 1552 |
1553 while (!NILP (data)) | 1553 if (KEYWORDP (Fcar (plist))) |
1554 { | 1554 { |
1555 Lisp_Object keyw = Fcar (data); | 1555 PROPERTY_LIST_LOOP_3 (key, value, plist) |
1556 Lisp_Object valw; | 1556 { |
1557 | 1557 if (EQ (key, Q_data)) |
1558 data = Fcdr (data); | 1558 { |
1559 valw = Fcar (data); | 1559 dataval = value; |
1560 data = Fcdr (data); | 1560 } |
1561 if (EQ (keyw, Qtype)) | 1561 else if (EQ (key, Q_type)) |
1562 type = valw; | 1562 { |
1563 else if (EQ (keyw, Qdata)) | 1563 type = value; |
1564 dataval = valw; | 1564 } |
1565 } | 1565 else if (!KEYWORDP (key)) |
1566 { | |
1567 signal_error | |
1568 (Qinvalid_read_syntax, | |
1569 "can't mix keyword and non-keyword structure syntax", | |
1570 key); | |
1571 } | |
1572 else | |
1573 ABORT (); | |
1574 } | |
1575 } | |
1576 #ifdef NEED_TO_HANDLE_21_4_CODE | |
1577 else | |
1578 { | |
1579 PROPERTY_LIST_LOOP_3 (key, value, plist) | |
1580 { | |
1581 if (EQ (key, Qdata)) | |
1582 { | |
1583 dataval = value; | |
1584 } | |
1585 else if (EQ (key, Qtype)) | |
1586 { | |
1587 type = value; | |
1588 } | |
1589 else if (KEYWORDP (key)) | |
1590 signal_error | |
1591 (Qinvalid_read_syntax, | |
1592 "can't mix keyword and non-keyword structure syntax", | |
1593 key); | |
1594 else | |
1595 ABORT (); | |
1596 } | |
1597 } | |
1598 #endif /* NEED_TO_HANDLE_21_4_CODE */ | |
1566 | 1599 |
1567 chartab = Fmake_char_table (type); | 1600 chartab = Fmake_char_table (type); |
1568 | 1601 |
1569 data = dataval; | 1602 while (!NILP (dataval)) |
1570 while (!NILP (data)) | 1603 { |
1571 { | 1604 Lisp_Object range = Fcar (dataval); |
1572 Lisp_Object range = Fcar (data); | 1605 Lisp_Object val = Fcar (Fcdr (dataval)); |
1573 Lisp_Object val = Fcar (Fcdr (data)); | 1606 |
1574 | 1607 dataval = Fcdr (Fcdr (dataval)); |
1575 data = Fcdr (Fcdr (data)); | |
1576 if (CONSP (range)) | 1608 if (CONSP (range)) |
1577 { | 1609 { |
1578 if (CHAR_OR_CHAR_INTP (XCAR (range))) | 1610 if (CHAR_OR_CHAR_INTP (XCAR (range))) |
1579 { | 1611 { |
1580 Ichar first = XCHAR_OR_CHAR_INT (Fcar (range)); | 1612 Ichar first = XCHAR_OR_CHAR_INT (Fcar (range)); |
1885 { | 1917 { |
1886 struct structure_type *st; | 1918 struct structure_type *st; |
1887 | 1919 |
1888 st = define_structure_type (Qchar_table, 0, chartab_instantiate); | 1920 st = define_structure_type (Qchar_table, 0, chartab_instantiate); |
1889 | 1921 |
1922 #ifdef NEED_TO_HANDLE_21_4_CODE | |
1890 define_structure_type_keyword (st, Qtype, chartab_type_validate); | 1923 define_structure_type_keyword (st, Qtype, chartab_type_validate); |
1891 define_structure_type_keyword (st, Qdata, chartab_data_validate); | 1924 define_structure_type_keyword (st, Qdata, chartab_data_validate); |
1925 #endif /* NEED_TO_HANDLE_21_4_CODE */ | |
1926 | |
1927 define_structure_type_keyword (st, Q_type, chartab_type_validate); | |
1928 define_structure_type_keyword (st, Q_data, chartab_data_validate); | |
1892 } | 1929 } |
1893 | 1930 |
1894 void | 1931 void |
1895 complex_vars_of_chartab (void) | 1932 complex_vars_of_chartab (void) |
1896 { | 1933 { |