From fddeee8bb826d2f16ddf2d57312bad467b75a4b3 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Sat, 12 Jan 2013 22:47:41 +0100 Subject: [PATCH] ECL now recognizes all ASCII control-character abbreviations --- src/c/iso_latin_names.h | 25 +++++++++++++++++++++++++ src/c/main.d | 17 +++++------------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/c/iso_latin_names.h b/src/c/iso_latin_names.h index 6fa51869f..8136578b0 100644 --- a/src/c/iso_latin_names.h +++ b/src/c/iso_latin_names.h @@ -144,3 +144,28 @@ ecl_def_string_array(char_names,static,const) = { ecl_def_string_array_elt("Rubout"), ecl_def_string_array_elt(0) }; + +/* Linefeed is redundant with one of the names given in + * iso_latin_names.h, but it can not be associated to the code + * 10, because the default name must be Newline. Similar to + * the other codes. */ +ecl_def_string_array(extra_char_names,static,const) = { + ecl_def_string_array_elt("Null"), /* 0 */ + ecl_def_string_array_elt("Bell"), /* 7 */ + ecl_def_string_array_elt("Bs"), /* 8 */ + ecl_def_string_array_elt("Ht"), /* 9 */ + ecl_def_string_array_elt("Linefeed"), /* 10 */ + ecl_def_string_array_elt("Lf"), /* 10 */ + ecl_def_string_array_elt("Escape"), /* 27 */ + ecl_def_string_array_elt("Ff"), /* 12 */ + ecl_def_string_array_elt("Cr"), /* 13 */ + ecl_def_string_array_elt("Sp"), /* 32 */ + ecl_def_string_array_elt("Del") /* 127 */ +}; + +static const unsigned char extra_char_codes[] = { + 0, 7, 8, 9, 10, 10, 27, 12, 13, 32, 127 +}; + +#define extra_char_names_size 11 + diff --git a/src/c/main.d b/src/c/main.d index 98d439958..f0f6544bf 100755 --- a/src/c/main.d +++ b/src/c/main.d @@ -310,10 +310,6 @@ ecl_def_ct_base_string(str_multiprocessing,"MULTIPROCESSING",15,static,const); #ifdef ECL_CLOS_STREAMS ecl_def_ct_base_string(str_gray,"GRAY",4,static,const); #endif -ecl_def_ct_base_string(str_null,"Null",4,static,const); -ecl_def_ct_base_string(str_linefeed,"Linefeed",8,static,const); -ecl_def_ct_base_string(str_bell,"Bell",4,static,const); -ecl_def_ct_base_string(str_escape,"Escape",6,static,const); ecl_def_ct_base_string(str_star_dot_star,"*.*",3,static,const); ecl_def_ct_base_string(str_rel_star_dot_star,"./*.*",5,static,const); ecl_def_ct_base_string(str_empty,"",0,static,const); @@ -667,14 +663,11 @@ cl_boot(int argc, char **argv) ecl_sethash(name, aux, code); ecl_sethash(code, aux, name); } - /* Linefeed is redundant with one of the names given in - * iso_latin_names.h, but it can not be associated to the code - * 10, because the default name must be Newline. Similar to - * the other codes. */ - ecl_sethash(str_null, aux, ecl_make_fixnum(0)); - ecl_sethash(str_linefeed, aux, ecl_make_fixnum(10)); - ecl_sethash(str_bell, aux, ecl_make_fixnum(7)); - ecl_sethash(str_escape, aux, ecl_make_fixnum(27)); + for (i = 0; i < extra_char_names_size; i++) { + cl_object name = (cl_object)(extra_char_names + i); + cl_object code = ecl_make_fixnum(extra_char_codes[i]); + ecl_sethash(name, aux, code); + } /* * Initialize logical pathname translations. This must come after