diff options
Diffstat (limited to 'byte.c')
-rw-r--r-- | byte.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -149,8 +149,8 @@ SCM scm_read_byte(port) return MAKINUM(c); } -static char s_sub_rd[] = "substring-read!"; -SCM scm_substring_read(sstr, start, args) +static char s_sub_rd[] = "subbytes-read!"; +SCM scm_subbytes_read(sstr, start, args) SCM sstr, start, args; { SCM end, port; @@ -196,8 +196,8 @@ SCM scm_substring_read(sstr, start, args) } } -static char s_sub_wr[] = "substring-write"; -SCM scm_substring_write(sstr, start, args) +static char s_sub_wr[] = "subbytes-write"; +SCM scm_subbytes_write(sstr, start, args) SCM sstr, start, args; { SCM end, port; @@ -246,8 +246,8 @@ static iproc subr2os[] = { {0, 0}}; static iproc lsubr2s[] = { - {s_sub_rd, scm_substring_read}, - {s_sub_wr, scm_substring_write}, + {s_sub_rd, scm_subbytes_read}, + {s_sub_wr, scm_subbytes_write}, {0, 0}}; @@ -264,14 +264,15 @@ void init_byte() scm_ldstr("\n\ (define bytes-length string-length)\n\ (define bytes-copy string-copy)\n\ +(define subbytes substring)\n\ (define (bytes-reverse bytes)\n\ (bytes-reverse! (bytes-copy bytes)))\n\ (define (read-bytes n . port)\n\ (let* ((len (abs n))\n\ (byts (make-bytes len))\n\ (cnt (if (positive? n)\n\ - (apply substring-read! byts 0 n port)\n\ - (apply substring-read! byts (- n) 0 port))))\n\ + (apply subbytes-read! byts 0 n port)\n\ + (apply subbytes-read! byts (- n) 0 port))))\n\ (if (= cnt len)\n\ byts\n\ (if (positive? n)\n\ @@ -279,7 +280,9 @@ void init_byte() (substring byts (- len cnt) len)))))\n\ (define (write-bytes bytes n . port)\n\ (if (positive? n)\n\ - (apply substring-write bytes 0 n port)\n\ - (apply substring-write bytes (- n) 0 port)))\n\ + (apply subbytes-write bytes 0 n port)\n\ + (apply subbytes-write bytes (- n) 0 port)))\n\ +(define substring-read! subbytes-read!)\n\ +(define substring-write subbytes-write)\n\ "); } |