From 50eb784bfcf15ee3c6b0b53d747db92673395040 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:34 -0800 Subject: Import Upstream version 5e3 --- byte.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'byte.c') diff --git a/byte.c b/byte.c index 416c78f..644966f 100644 --- a/byte.c +++ b/byte.c @@ -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\ "); } -- cgit v1.2.3