diff options
author | Daniel Kraft <d@domob.eu> | 2009-08-04 09:37:50 +0200 |
---|---|---|
committer | Daniel Kraft <d@domob.eu> | 2009-08-04 09:37:50 +0200 |
commit | 157ffbd797b466d80c2a1002a1d40d9b6a89d102 (patch) | |
tree | e9575c49ce0bbece1b26bffff183d9b1f9923448 | |
parent | 1b1195f29bd73885bcd9fd77e9b2dae0dfa003c0 (diff) | |
parent | a876e7dcea78e770bedba40017fbb225cf88bff5 (diff) | |
download | guile-157ffbd797b466d80c2a1002a1d40d9b6a89d102.tar.gz |
Merge branch 'master' of git://git.savannah.gnu.org/guile into elisp
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | libguile/chars.c | 90 | ||||
-rw-r--r-- | libguile/chars.h | 19 | ||||
-rw-r--r-- | libguile/numbers.h | 3 | ||||
-rw-r--r-- | libguile/print.c | 20 | ||||
-rw-r--r-- | libguile/vm-i-system.c | 8 |
6 files changed, 78 insertions, 77 deletions
@@ -8,6 +8,21 @@ Please send Guile bug reports to bug-guile@gnu.org. (During the 1.9 series, we will keep an incremental NEWS for the latest prerelease, and a full NEWS corresponding to 1.8 -> 2.0.) +Changes in 1.9.2 (since the 1.9.1 prerelease): + +** Global variables `scm_charnames' and `scm_charnums' are removed. + +These variables contained the names of control characters and were +used when writing characters. While these were global, they were +never intended to be public API. They have been replaced with private +functions. + +** EBCDIC support is removed. + +There was an EBCDIC compile flag that altered some of the character +processing. It appeared that full EBCDIC support was never completed +and was unmaintained. + Changes in 1.9.1 (since the 1.9.0 prerelease): ** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type diff --git a/libguile/chars.c b/libguile/chars.c index 5a53c456a..2103c540c 100644 --- a/libguile/chars.c +++ b/libguile/chars.c @@ -312,51 +312,45 @@ scm_c_downcase (scm_t_wchar c) extensions for control characters, and leftover Guile extensions. They are listed in order of precedence. */ -const char *const scm_r5rs_charnames[] = - { - "space", "newline" - }; +static const char *const scm_r5rs_charnames[] = { + "space", "newline" +}; -const scm_t_uint32 const scm_r5rs_charnums[] = - { - 0x20, 0x0A - }; +static const scm_t_uint32 const scm_r5rs_charnums[] = { + 0x20, 0x0A +}; -const int scm_n_r5rs_charnames = sizeof (scm_r5rs_charnames) / sizeof (char *); +#define SCM_N_R5RS_CHARNAMES (sizeof (scm_r5rs_charnames) / sizeof (char *)) /* The abbreviated names for control characters. */ -const char *const scm_C0_control_charnames[] = - { - /* C0 controls */ - "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", - "bs", "ht", "lf", "vt", "ff", "cr", "so", "si", - "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", - "can", "em", "sub", "esc", "fs", "gs", "rs", "us", - "sp", "del" - }; - -const scm_t_uint32 const scm_C0_control_charnums[] = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x7f - }; - -int scm_n_C0_control_charnames = sizeof (scm_C0_control_charnames) / sizeof (char *); - -const char *const scm_alt_charnames[] = - { - "null", "backspace", "tab", "nl", "newline", "np", "page", "return", - }; - -const scm_t_uint32 const scm_alt_charnums[] = - { - 0x00, 0x08, 0x09, 0x0a, 0x0a, 0x0c, 0x0c, 0x0d - }; - -const int scm_n_alt_charnames = sizeof (scm_alt_charnames) / sizeof (char *); +static const char *const scm_C0_control_charnames[] = { + /* C0 controls */ + "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", + "bs", "ht", "lf", "vt", "ff", "cr", "so", "si", + "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb", + "can", "em", "sub", "esc", "fs", "gs", "rs", "us", + "sp", "del" +}; + +static const scm_t_uint32 const scm_C0_control_charnums[] = { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, + 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, + 0x20, 0x7f +}; + +#define SCM_N_C0_CONTROL_CHARNAMES (sizeof (scm_C0_control_charnames) / sizeof (char *)) + +static const char *const scm_alt_charnames[] = { + "null", "backspace", "tab", "nl", "newline", "np", "page", "return", +}; + +static const scm_t_uint32 const scm_alt_charnums[] = { + 0x00, 0x08, 0x09, 0x0a, 0x0a, 0x0c, 0x0c, 0x0d +}; + +#define SCM_N_ALT_CHARNAMES (sizeof (scm_alt_charnames) / sizeof (char *)) /* Returns the string charname for a character if it exists, or NULL otherwise. */ @@ -366,15 +360,15 @@ scm_i_charname (SCM chr) int c; scm_t_uint32 i = SCM_CHAR (chr); - for (c = 0; c < scm_n_r5rs_charnames; c++) + for (c = 0; c < SCM_N_R5RS_CHARNAMES; c++) if (scm_r5rs_charnums[c] == i) return scm_r5rs_charnames[c]; - for (c = 0; c < scm_n_C0_control_charnames; c++) + for (c = 0; c < SCM_N_C0_CONTROL_CHARNAMES; c++) if (scm_C0_control_charnums[c] == i) return scm_C0_control_charnames[c]; - for (c = 0; c < scm_n_alt_charnames; c++) + for (c = 0; c < SCM_N_ALT_CHARNAMES; c++) if (scm_alt_charnums[c] == i) return scm_alt_charnames[i]; @@ -389,23 +383,23 @@ scm_i_charname_to_char (const char *charname, size_t charname_len) /* The R5RS charnames. These are supposed to be case insensitive. */ - for (c = 0; c < scm_n_r5rs_charnames; c++) + for (c = 0; c < SCM_N_R5RS_CHARNAMES; c++) if ((strlen (scm_r5rs_charnames[c]) == charname_len) && (!strncasecmp (scm_r5rs_charnames[c], charname, charname_len))) return SCM_MAKE_CHAR (scm_r5rs_charnums[c]); /* Then come the controls. These are not case sensitive. */ - for (c = 0; c < scm_n_C0_control_charnames; c++) + for (c = 0; c < SCM_N_C0_CONTROL_CHARNAMES; c++) if ((strlen (scm_C0_control_charnames[c]) == charname_len) && (!strncasecmp (scm_C0_control_charnames[c], charname, charname_len))) return SCM_MAKE_CHAR (scm_C0_control_charnums[c]); /* Lastly are some old names carried over for compatibility. */ - for (c = 0; c < scm_n_alt_charnames; c++) + for (c = 0; c < SCM_N_ALT_CHARNAMES; c++) if ((strlen (scm_alt_charnames[c]) == charname_len) && (!strncasecmp (scm_alt_charnames[c], charname, charname_len))) return SCM_MAKE_CHAR (scm_alt_charnums[c]); - + return SCM_BOOL_F; } diff --git a/libguile/chars.h b/libguile/chars.h index e68f06d21..4d1be1db9 100644 --- a/libguile/chars.h +++ b/libguile/chars.h @@ -24,28 +24,23 @@ #include "libguile/__scm.h" +#include "libguile/numbers.h" /* Immediate Characters */ - -#ifndef SCM_WCHAR_DEFINED -typedef scm_t_int32 scm_t_wchar; -#define SCM_WCHAR_DEFINED -#endif - #define SCM_CHARP(x) (SCM_ITAG8(x) == scm_tc8_char) #define SCM_CHAR(x) ((scm_t_wchar)SCM_ITAG8_DATA(x)) -#define SCM_MAKE_CHAR(x) ({scm_t_int32 _x = (x); \ - _x < 0 \ - ? SCM_MAKE_ITAG8((scm_t_bits)(unsigned char)_x, scm_tc8_char) \ - : SCM_MAKE_ITAG8((scm_t_bits)_x, scm_tc8_char);}) +#define SCM_MAKE_CHAR(x) \ + (x < 0 \ + ? SCM_MAKE_ITAG8 ((scm_t_bits) (unsigned char) x, scm_tc8_char) \ + : SCM_MAKE_ITAG8 ((scm_t_bits) x, scm_tc8_char)) #define SCM_CODEPOINT_MAX (0x10ffff) #define SCM_IS_UNICODE_CHAR(c) \ - ((scm_t_wchar)(c)<=0xd7ff || \ - ((scm_t_wchar)(c)>=0xe000 && (scm_t_wchar)(c)<=SCM_CODEPOINT_MAX)) + ((scm_t_wchar) (c) <= 0xd7ff \ + || ((scm_t_wchar) (c) >= 0xe000 && (scm_t_wchar) (c) <= SCM_CODEPOINT_MAX)) diff --git a/libguile/numbers.h b/libguile/numbers.h index f30f7d061..bb72d7ac8 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -174,10 +174,7 @@ typedef struct scm_t_complex double imag; } scm_t_complex; -#ifndef SCM_WCHAR_DEFINED typedef scm_t_int32 scm_t_wchar; -#define SCM_WCHAR_DEFINED -#endif diff --git a/libguile/print.c b/libguile/print.c index 1a5aebe1b..f43856bbe 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -454,22 +454,16 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate) /* Print the character if is graphic character. */ { if (i<256) - { - /* Character is graphic. Print it. */ - scm_putc (i, port); - } + /* Character is graphic. Print it. */ + scm_putc (i, port); else - { - /* Character is graphic but unrepresentable in - this port's encoding. */ - scm_intprint (i, 8, port); - } + /* Character is graphic but unrepresentable in + this port's encoding. */ + scm_intprint (i, 8, port); } else - { - /* Character is a non-graphical character. */ - scm_intprint (i, 8, port); - } + /* Character is a non-graphical character. */ + scm_intprint (i, 8, port); } else scm_putc (i, port); diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 5a4809db4..ad0ec547e 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -177,7 +177,13 @@ VM_DEFINE_INSTRUCTION (15, make_uint64, "make-uint64", 8, 0, 1) VM_DEFINE_INSTRUCTION (16, make_char8, "make-char8", 1, 0, 1) { - PUSH (SCM_MAKE_CHAR (FETCH ())); + scm_t_uint8 v = 0; + v = FETCH (); + + PUSH (SCM_MAKE_CHAR (v)); + /* Don't simplify this to PUSH (SCM_MAKE_CHAR (FETCH ())). The + contents of SCM_MAKE_CHAR may be evaluated more than once, + resulting in a double fetch. */ NEXT; } |