diff options
author | Michael Gran <spk121@yahoo.com> | 2009-09-04 07:34:35 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-09-04 07:34:35 -0700 |
commit | 18d8fcd43c8ea6b0122453b2d9f7ac10c1f36d6c (patch) | |
tree | 243aa57d2867b6cac7af37c8bb1581ceda386af6 | |
parent | 25ebc0340d30d1ceb786dbc8c3fe80c6e9ae0e87 (diff) |
Remove locale u8vector functions
Locale u8vector functions deemed harmful.
* libguile/strports.c (scm_strport_to_locale_u8vector)
(scm_call_with_output_locale_u8vector, scm_open_input_locale_u8vector)
(scm_get_output_locale_u8vector): removed
* libguile/strports.h: removed declarations for
scm_strport_to_locale_u8vector,
scm_call_with_output_u8vector,
scm_input_locale_u8vector,
scm_get_output_locale_u8vector
* test-suite/tests/encoding-iso88591.test: display tests removed
* test-suite/tests/encoding-iso88597.test: display tests removed
-rw-r--r-- | libguile/strports.c | 71 | ||||
-rw-r--r-- | libguile/strports.h | 4 | ||||
-rw-r--r-- | test-suite/tests/encoding-iso88591.test | 21 | ||||
-rw-r--r-- | test-suite/tests/encoding-iso88597.test | 21 |
4 files changed, 0 insertions, 117 deletions
diff --git a/libguile/strports.c b/libguile/strports.c index 8541bd7cd..82895ac62 100644 --- a/libguile/strports.c +++ b/libguile/strports.c @@ -386,24 +386,6 @@ SCM scm_strport_to_string (SCM port) return str; } -/* Create a vector containing the locale representation of the string in the - port's buffer. */ -SCM scm_strport_to_locale_u8vector (SCM port) -{ - scm_t_port *pt = SCM_PTAB_ENTRY (port); - SCM vec; - char *buf; - - if (pt->rw_active == SCM_PORT_WRITE) - st_flush (port); - - buf = scm_malloc (pt->read_buf_size); - memcpy (buf, pt->read_buf, pt->read_buf_size); - vec = scm_take_u8vector ((unsigned char *) buf, pt->read_buf_size); - scm_remember_upto_here_1 (port); - return vec; -} - SCM_DEFINE (scm_object_to_string, "object->string", 1, 1, 0, (SCM obj, SCM printer), "Return a Scheme string obtained by printing @var{obj}.\n" @@ -428,25 +410,6 @@ SCM_DEFINE (scm_object_to_string, "object->string", 1, 1, 0, } #undef FUNC_NAME -SCM_DEFINE (scm_call_with_output_locale_u8vector, "call-with-output-locale-u8vector", 1, 0, 0, - (SCM proc), - "Calls the one-argument procedure @var{proc} with a newly created output\n" - "port. When the function returns, a vector containing the bytes of a\n" - "locale representation of the characters written into the port is returned\n") -#define FUNC_NAME s_scm_call_with_output_locale_u8vector -{ - SCM p; - - p = scm_mkstrport (SCM_INUM0, - scm_make_string (SCM_INUM0, SCM_UNDEFINED), - SCM_OPN | SCM_WRTNG, - FUNC_NAME); - scm_call_1 (proc, p); - - return scm_get_output_locale_u8vector (p); -} -#undef FUNC_NAME - SCM_DEFINE (scm_call_with_output_string, "call-with-output-string", 1, 0, 0, (SCM proc), "Calls the one-argument procedure @var{proc} with a newly created output\n" @@ -491,27 +454,6 @@ SCM_DEFINE (scm_open_input_string, "open-input-string", 1, 0, 0, } #undef FUNC_NAME -SCM_DEFINE (scm_open_input_locale_u8vector, "open-input-locale-u8vector", 1, 0, 0, - (SCM vec), - "Take a u8vector containing the bytes of a string encoded in the\n" - "current locale and return an input port that delivers characters\n" - "from the string. The port can be closed by\n" - "@code{close-input-port}, though its storage will be reclaimed\n" - "by the garbage collector if it becomes inaccessible.") -#define FUNC_NAME s_scm_open_input_locale_u8vector -{ - scm_t_array_handle hnd; - ssize_t inc; - size_t len; - const scm_t_uint8 *buf; - - buf = scm_u8vector_elements (vec, &hnd, &len, &inc); - SCM p = scm_i_mkstrport(SCM_INUM0, (const char *) buf, len, SCM_OPN | SCM_RDNG, FUNC_NAME); - scm_array_handle_release (&hnd); - return p; -} -#undef FUNC_NAME - SCM_DEFINE (scm_open_output_string, "open-output-string", 0, 0, 0, (void), "Return an output port that will accumulate characters for\n" @@ -544,19 +486,6 @@ SCM_DEFINE (scm_get_output_string, "get-output-string", 1, 0, 0, #undef FUNC_NAME -SCM_DEFINE (scm_get_output_locale_u8vector, "get-output-locale-u8vector", 1, 0, 0, - (SCM port), - "Given an output port created by @code{open-output-string},\n" - "return a u8 vector containing the characters of the string\n" - "encoded in the current locale.") -#define FUNC_NAME s_scm_get_output_locale_u8vector -{ - SCM_VALIDATE_OPOUTSTRPORT (1, port); - return scm_strport_to_locale_u8vector (port); -} -#undef FUNC_NAME - - /* Given a null-terminated string EXPR containing a Scheme expression read it, and return it as an SCM value. */ SCM diff --git a/libguile/strports.h b/libguile/strports.h index b2ded01f1..d93266a12 100644 --- a/libguile/strports.h +++ b/libguile/strports.h @@ -47,16 +47,12 @@ SCM_API SCM scm_mkstrport (SCM pos, SCM str, long modes, const char * caller); SCM_INTERNAL SCM scm_i_mkstrport (SCM pos, const char *locale_str, size_t str_len, long modes, const char *caller); SCM_API SCM scm_strport_to_string (SCM port); -SCM_API SCM scm_strport_to_locale_u8vector (SCM port); SCM_API SCM scm_object_to_string (SCM obj, SCM printer); SCM_API SCM scm_call_with_output_string (SCM proc); -SCM_API SCM scm_call_with_output_locale_u8vector (SCM proc); SCM_API SCM scm_call_with_input_string (SCM str, SCM proc); SCM_API SCM scm_open_input_string (SCM str); -SCM_API SCM scm_open_input_locale_u8vector (SCM str); SCM_API SCM scm_open_output_string (void); SCM_API SCM scm_get_output_string (SCM port); -SCM_API SCM scm_get_output_locale_u8vector (SCM port); SCM_API SCM scm_c_read_string (const char *expr); SCM_API SCM scm_c_eval_string (const char *expr); SCM_API SCM scm_c_eval_string_in_module (const char *expr, SCM module); diff --git a/test-suite/tests/encoding-iso88591.test b/test-suite/tests/encoding-iso88591.test index 8e85436f9..b4d48a6f3 100644 --- a/test-suite/tests/encoding-iso88591.test +++ b/test-suite/tests/encoding-iso88591.test @@ -145,27 +145,6 @@ (list= eqv? (string->list s4) (list #\¿ #\C #\ó #\m #\o #\?)))) -;; Check that the output is in ISO-8859-1 encoding -(with-test-prefix "display" - - (pass-if "s1" - (let ((pt (open-output-string))) - (set-port-encoding! pt "ISO-8859-1") - (display s1 pt) - (list= eqv? - (list #xfa #x6c #x74 #x69 #x6d #x61) - (u8vector->list - (get-output-locale-u8vector pt))))) - - (pass-if "s2" - (let ((pt (open-output-string))) - (set-port-encoding! pt "ISO-8859-1") - (display s2 pt) - (list= eqv? - (list #x63 #xe9 #x64 #x75 #x6c #x61) - (u8vector->list - (get-output-locale-u8vector pt)))))) - (with-test-prefix "symbols == strings" (pass-if "última" diff --git a/test-suite/tests/encoding-iso88597.test b/test-suite/tests/encoding-iso88597.test index 9f278f11c..8c155d265 100644 --- a/test-suite/tests/encoding-iso88597.test +++ b/test-suite/tests/encoding-iso88597.test @@ -142,27 +142,6 @@ (list= eqv? (string->list s4) (list #\ê #\á #\é)))) -;; Testing that the display of the string is output in the ISO-8859-7 -;; encoding -(with-test-prefix "display" - - (pass-if "s1" - (let ((pt (open-output-string))) - (set-port-encoding! pt "ISO-8859-7") - (display s1 pt) - (list= eqv? - (list #xd0 #xe5 #xf1 #xdf) - (u8vector->list - (get-output-locale-u8vector pt))))) - (pass-if "s2" - (let ((pt (open-output-string))) - (set-port-encoding! pt "ISO-8859-7") - (display s2 pt) - (list= eqv? - (list #xf4 #xe7 #xf2) - (u8vector->list - (get-output-locale-u8vector pt)))))) - (with-test-prefix "symbols == strings" (pass-if "Ðåñß" |