1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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
This commit is contained in:
Michael Gran 2009-08-19 21:24:23 -07:00
parent 1c7b216f84
commit f8ba2bb911
4 changed files with 8 additions and 8 deletions

View file

@ -1098,11 +1098,11 @@ SCM_DEFINE (scm_string_length, "string-length", 1, 0, 0,
} }
#undef FUNC_NAME #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), (SCM string),
"Return the bytes used to represent a character in @var{string}." "Return the bytes used to represent a character in @var{string}."
"This will return 1 or 4.") "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); SCM_VALIDATE_STRING (1, string);
if (!scm_i_is_narrow_string (string)) if (!scm_i_is_narrow_string (string))

View file

@ -102,7 +102,7 @@ SCM_API SCM scm_string_p (SCM x);
SCM_API SCM scm_string (SCM chrs); SCM_API SCM scm_string (SCM chrs);
SCM_API SCM scm_make_string (SCM k, SCM chr); SCM_API SCM scm_make_string (SCM k, SCM chr);
SCM_API SCM scm_string_length (SCM str); 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_ref (SCM str, SCM k);
SCM_API SCM scm_string_set_x (SCM str, SCM k, SCM chr); SCM_API SCM scm_string_set_x (SCM str, SCM k, SCM chr);
SCM_API SCM scm_substring (SCM str, SCM start, SCM end); SCM_API SCM scm_substring (SCM str, SCM start, SCM end);

View file

@ -82,7 +82,7 @@
(write-string str)) (write-string str))
(define (write-sized-loader str) (define (write-sized-loader str)
(let ((len (string-length str)) (let ((len (string-length str))
(wid (string-width str))) (wid (string-bytes-per-char str)))
(write-loader-len len) (write-loader-len len)
(write-byte wid) (write-byte wid)
(if (= wid 4) (if (= wid 4)

View file

@ -391,17 +391,17 @@
((number? x) ((number? x)
`((load-number ,(number->string x)))) `((load-number ,(number->string x))))
((string? x) ((string? x)
(case (string-width x) (case (string-bytes-per-char x)
((1) `((load-string ,x))) ((1) `((load-string ,x)))
((4) (align-code `(load-wide-string ,x) addr 4 4)) ((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) ((symbol? x)
(let ((str (symbol->string x))) (let ((str (symbol->string x)))
(case (string-width str) (case (string-bytes-per-char str)
((1) `((load-symbol ,str))) ((1) `((load-symbol ,str)))
((4) `(,@(dump-object str addr) ((4) `(,@(dump-object str addr)
(make-symbol))) (make-symbol)))
(else (error "bad string width" str))))) (else (error "bad string bytes per char" str)))))
((keyword? x) ((keyword? x)
`(,@(dump-object (keyword->symbol x) addr) `(,@(dump-object (keyword->symbol x) addr)
(make-keyword))) (make-keyword)))