summaryrefslogtreecommitdiffstats
path: root/sc2.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:27 -0800
commitc7d035ae1a729232579a0fe41ed5affa131d3623 (patch)
treefb387f7c2a8e01cf603d4c75fbbaa68f711df986 /sc2.c
parentdeda2c0fd8689349fea2a900199a76ff7ecb319e (diff)
downloadscm-c7d035ae1a729232579a0fe41ed5affa131d3623.tar.gz
scm-c7d035ae1a729232579a0fe41ed5affa131d3623.zip
Import Upstream version 5d9upstream/5d9
Diffstat (limited to 'sc2.c')
-rw-r--r--sc2.c64
1 files changed, 33 insertions, 31 deletions
diff --git a/sc2.c b/sc2.c
index 3df2f1a..5749b63 100644
--- a/sc2.c
+++ b/sc2.c
@@ -50,7 +50,7 @@ SCM last_pair(sx)
{
register SCM res = sx;
register SCM x;
- ASSERT(NIMP(res) && CONSP(res), res, ARG1, s_last_pair);
+ ASRTER(NIMP(res) && CONSP(res), res, ARG1, s_last_pair);
while (!0) {
x = CDR(res);
if (IMP(x) || NCONSP(x)) return res;
@@ -59,7 +59,7 @@ SCM last_pair(sx)
if (IMP(x) || NCONSP(x)) return res;
res = x;
sx = CDR(sx);
- ASSERT(x != sx, sx, ARG1, s_last_pair);
+ ASRTER(x != sx, sx, ARG1, s_last_pair);
}
}
@@ -69,20 +69,20 @@ SCM subml(str1, start1, args)
{
SCM end1, str2, start2;
long i, j, e;
- ASSERT(3==ilength(args), args, WNA, s_subml);
+ ASRTER(3==ilength(args), args, WNA, s_subml);
end1 = CAR(args); args = CDR(args);
str2 = CAR(args); args = CDR(args);
start2 = CAR(args);
- ASSERT(NIMP(str1) && STRINGP(str1), str1, ARG1, s_subml);
- ASSERT(INUMP(start1), start1, ARG2, s_subml);
- ASSERT(INUMP(end1), end1, ARG3, s_subml);
- ASSERT(NIMP(str2) && STRINGP(str2), str2, ARG4, s_subml);
- ASSERT(INUMP(start2), start2, ARG5, s_subml);
+ ASRTER(NIMP(str1) && STRINGP(str1), str1, ARG1, s_subml);
+ ASRTER(INUMP(start1), start1, ARG2, s_subml);
+ ASRTER(INUMP(end1), end1, ARG3, s_subml);
+ ASRTER(NIMP(str2) && STRINGP(str2), str2, ARG4, s_subml);
+ ASRTER(INUMP(start2), start2, ARG5, s_subml);
i = INUM(start1), j = INUM(start2), e = INUM(end1);
- ASSERT(i <= LENGTH(str1) && i >= 0, start1, OUTOFRANGE, s_subml);
- ASSERT(j <= LENGTH(str2) && j >= 0, start2, OUTOFRANGE, s_subml);
- ASSERT(e <= LENGTH(str1) && e >= 0, end1, OUTOFRANGE, s_subml);
- ASSERT(e-i+j <= LENGTH(str2), start2, OUTOFRANGE, s_subml);
+ ASRTER(i <= LENGTH(str1) && i >= 0, start1, OUTOFRANGE, s_subml);
+ ASRTER(j <= LENGTH(str2) && j >= 0, start2, OUTOFRANGE, s_subml);
+ ASRTER(e <= LENGTH(str1) && e >= 0, end1, OUTOFRANGE, s_subml);
+ ASRTER(e-i+j <= LENGTH(str2), start2, OUTOFRANGE, s_subml);
while(i<e) CHARS(str2)[j++] = CHARS(str1)[i++];
return UNSPECIFIED;
}
@@ -92,20 +92,20 @@ SCM submr(str1, start1, args)
{
SCM end1, str2, start2;
long i, j, e;
- ASSERT(3==ilength(args), args, WNA, s_submr);
+ ASRTER(3==ilength(args), args, WNA, s_submr);
end1 = CAR(args); args = CDR(args);
str2 = CAR(args); args = CDR(args);
start2 = CAR(args);
- ASSERT(NIMP(str1) && STRINGP(str1), str1, ARG1, s_submr);
- ASSERT(INUMP(start1), start1, ARG2, s_submr);
- ASSERT(INUMP(end1), end1, ARG3, s_submr);
- ASSERT(NIMP(str2) && STRINGP(str2), str2, ARG4, s_submr);
- ASSERT(INUMP(start2), start2, ARG5, s_submr);
+ ASRTER(NIMP(str1) && STRINGP(str1), str1, ARG1, s_submr);
+ ASRTER(INUMP(start1), start1, ARG2, s_submr);
+ ASRTER(INUMP(end1), end1, ARG3, s_submr);
+ ASRTER(NIMP(str2) && STRINGP(str2), str2, ARG4, s_submr);
+ ASRTER(INUMP(start2), start2, ARG5, s_submr);
i = INUM(start1), j = INUM(start2), e = INUM(end1);
- ASSERT(i <= LENGTH(str1) && i >= 0, start1, OUTOFRANGE, s_submr);
- ASSERT(j <= LENGTH(str2) && j >= 0, start2, OUTOFRANGE, s_submr);
- ASSERT(e <= LENGTH(str1) && e >= 0, end1, OUTOFRANGE, s_submr);
- ASSERT((j = e-i+j) <= LENGTH(str2), start2, OUTOFRANGE, s_submr);
+ ASRTER(i <= LENGTH(str1) && i >= 0, start1, OUTOFRANGE, s_submr);
+ ASRTER(j <= LENGTH(str2) && j >= 0, start2, OUTOFRANGE, s_submr);
+ ASRTER(e <= LENGTH(str1) && e >= 0, end1, OUTOFRANGE, s_submr);
+ ASRTER((j = e-i+j) <= LENGTH(str2), start2, OUTOFRANGE, s_submr);
while(i<e) CHARS(str2)[--j] = CHARS(str1)[--e];
return UNSPECIFIED;
}
@@ -116,16 +116,16 @@ SCM subfl(str, start, args)
SCM end, fill;
long i, e;
char c;
- ASSERT(2==ilength(args), args, WNA, s_subfl);
+ ASRTER(2==ilength(args), args, WNA, s_subfl);
end = CAR(args); args = CDR(args);
fill = CAR(args);
- ASSERT(NIMP(str) && STRINGP(str), str, ARG1, s_subfl);
- ASSERT(INUMP(start), start, ARG2, s_subfl);
- ASSERT(INUMP(end), end, ARG3, s_subfl);
- ASSERT(ICHRP(fill), fill, ARG4, s_subfl);
+ ASRTER(NIMP(str) && STRINGP(str), str, ARG1, s_subfl);
+ ASRTER(INUMP(start), start, ARG2, s_subfl);
+ ASRTER(INUMP(end), end, ARG3, s_subfl);
+ ASRTER(ICHRP(fill), fill, ARG4, s_subfl);
i = INUM(start), e = INUM(end);c = ICHR(fill);
- ASSERT(i <= LENGTH(str) && i >= 0, start, OUTOFRANGE, s_subfl);
- ASSERT(e <= LENGTH(str) && e >= 0, end, OUTOFRANGE, s_subfl);
+ ASRTER(i <= LENGTH(str) && i >= 0, start, OUTOFRANGE, s_subfl);
+ ASRTER(e <= LENGTH(str) && e >= 0, end, OUTOFRANGE, s_subfl);
while(i<e) CHARS(str)[i++] = c;
return UNSPECIFIED;
}
@@ -134,7 +134,7 @@ static char s_strnullp[] = "string-null?";
SCM strnullp(str)
SCM str;
{
- ASSERT(NIMP(str) && STRINGP(str), str, ARG1, s_strnullp);
+ ASRTER(NIMP(str) && STRINGP(str), str, ARG1, s_strnullp);
if LENGTH(str) return BOOL_F;
else return BOOL_T;
}
@@ -150,7 +150,7 @@ SCM appendb(args)
args = CDR(args);
if NULLP(args) return arg;
if NULLP(arg) goto tail;
- ASSERT(NIMP(arg) && CONSP(arg), arg, ARG1, s_appendb);
+ ASRTER(NIMP(arg) && CONSP(arg), arg, ARG1, s_appendb);
CDR(last_pair(arg)) = appendb(args);
return arg;
}
@@ -161,6 +161,8 @@ static iproc lsubr2s[] = {
{s_subfl, subfl},
{0, 0}};
+SCM_DLL_EXPORT void init_sc2 P((void));
+
void init_sc2()
{
make_subr(s_last_pair, tc7_subr_1, last_pair);