From f8ba2bb9117d75c93503fe3dde9054f5ff92c51c Mon Sep 17 00:00:00 2001 From: Michael Gran Date: Wed, 19 Aug 2009 21:24:23 -0700 Subject: [PATCH] Rename string-width to string-bytes-per-char * libguile/strings.h: rename scm_string_width to scm_string_bytes_per_char * libguile/strings.c (scm_string_width): renamed to scm_string_bytes_per_char (scm_string_bytes_per_char): renamed from scm_string_width * module/language/assembly/compile-bytecode.scm (write-bytecode): string-width -> string-bytes-per-char * module/language/glil/compile-assembly.scm (dump-object): string-width -> string-bytes-per-char --- libguile/strings.c | 4 ++-- libguile/strings.h | 2 +- module/language/assembly/compile-bytecode.scm | 2 +- module/language/glil/compile-assembly.scm | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libguile/strings.c b/libguile/strings.c index 50adee817..7ae100d8c 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -1098,11 +1098,11 @@ SCM_DEFINE (scm_string_length, "string-length", 1, 0, 0, } #undef FUNC_NAME -SCM_DEFINE (scm_string_width, "string-width", 1, 0, 0, +SCM_DEFINE (scm_string_bytes_per_char, "string-bytes-per-char", 1, 0, 0, (SCM string), "Return the bytes used to represent a character in @var{string}." "This will return 1 or 4.") -#define FUNC_NAME s_scm_string_width +#define FUNC_NAME s_scm_string_bytes_per_char { SCM_VALIDATE_STRING (1, string); if (!scm_i_is_narrow_string (string)) diff --git a/libguile/strings.h b/libguile/strings.h index fe9162d25..390b4f6a8 100644 --- a/libguile/strings.h +++ b/libguile/strings.h @@ -102,7 +102,7 @@ SCM_API SCM scm_string_p (SCM x); SCM_API SCM scm_string (SCM chrs); SCM_API SCM scm_make_string (SCM k, SCM chr); SCM_API SCM scm_string_length (SCM str); -SCM_API SCM scm_string_width (SCM str); +SCM_API SCM scm_string_bytes_per_char (SCM str); SCM_API SCM scm_string_ref (SCM str, SCM k); SCM_API SCM scm_string_set_x (SCM str, SCM k, SCM chr); SCM_API SCM scm_substring (SCM str, SCM start, SCM end); diff --git a/module/language/assembly/compile-bytecode.scm b/module/language/assembly/compile-bytecode.scm index 4706cce64..688cb6b31 100644 --- a/module/language/assembly/compile-bytecode.scm +++ b/module/language/assembly/compile-bytecode.scm @@ -82,7 +82,7 @@ (write-string str)) (define (write-sized-loader str) (let ((len (string-length str)) - (wid (string-width str))) + (wid (string-bytes-per-char str))) (write-loader-len len) (write-byte wid) (if (= wid 4) diff --git a/module/language/glil/compile-assembly.scm b/module/language/glil/compile-assembly.scm index c67ef694b..121d9db9f 100644 --- a/module/language/glil/compile-assembly.scm +++ b/module/language/glil/compile-assembly.scm @@ -391,17 +391,17 @@ ((number? x) `((load-number ,(number->string x)))) ((string? x) - (case (string-width x) + (case (string-bytes-per-char x) ((1) `((load-string ,x))) ((4) (align-code `(load-wide-string ,x) addr 4 4)) - (else (error "bad string width" x)))) + (else (error "bad string bytes per char" x)))) ((symbol? x) (let ((str (symbol->string x))) - (case (string-width str) + (case (string-bytes-per-char str) ((1) `((load-symbol ,str))) ((4) `(,@(dump-object str addr) (make-symbol))) - (else (error "bad string width" str))))) + (else (error "bad string bytes per char" str))))) ((keyword? x) `(,@(dump-object (keyword->symbol x) addr) (make-keyword))) -- 2.20.1