summaryrefslogtreecommitdiffstats
path: root/byte.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:34 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:34 -0800
commit50eb784bfcf15ee3c6b0b53d747db92673395040 (patch)
tree60f039bb5aa27bc58d92ab0c7bab0d82dbfe7686 /byte.c
parentae2b295c7deaf2d7c18ad1ed9b6050970e56bae7 (diff)
downloadscm-50eb784bfcf15ee3c6b0b53d747db92673395040.tar.gz
scm-50eb784bfcf15ee3c6b0b53d747db92673395040.zip
Import Upstream version 5e3upstream/5e3
Diffstat (limited to 'byte.c')
-rw-r--r--byte.c23
1 files changed, 13 insertions, 10 deletions
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\
");
}