diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:31 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:31 -0800 |
commit | ae2b295c7deaf2d7c18ad1ed9b6050970e56bae7 (patch) | |
tree | eee15e02ae016333546d3841712be591b2bcb06f /rope.c | |
parent | 302e3218b7d487539ec305bf23881a6ee7d5be99 (diff) | |
download | scm-6376a6227f70e3a9cba3498b249604187e1e5546.tar.gz scm-6376a6227f70e3a9cba3498b249604187e1e5546.zip |
Import Upstream version 5e2upstream/5e2
Diffstat (limited to 'rope.c')
-rw-r--r-- | rope.c | 51 |
1 files changed, 26 insertions, 25 deletions
@@ -101,14 +101,14 @@ unsigned long num2ulong(num, pos, s_caller) char *pos, *s_caller; { unsigned long res; - if INUMP(num) { + if (INUMP(num)) { ASRTGO(0 < num, errout); res = INUM((unsigned long)num); return res; } ASRTGO(NIMP(num), errout); #ifdef FLOATS - if REALP(num) { + if (REALP(num)) { double u = REALPART(num); if ((0 <= u) && (u <= (unsigned long)~0L)) { res = u; @@ -132,13 +132,13 @@ long num2long(num, pos, s_caller) char *pos, *s_caller; { long res; - if INUMP(num) { + if (INUMP(num)) { res = INUM((long)num); return res; } ASRTGO(NIMP(num), errout); # ifdef FLOATS - if REALP(num) { + if (REALP(num)) { double u = REALPART(num); if (((MOST_NEGATIVE_FIXNUM * 4) <= u) && (u <= (MOST_POSITIVE_FIXNUM * 4 + 3))) { @@ -148,7 +148,7 @@ long num2long(num, pos, s_caller) } # endif # ifdef BIGDIG - if BIGP(num) { + if (BIGP(num)) { sizet l = NUMDIGS(num); ASRTGO(DIGSPERLONG >= l, errout); res = 0; @@ -173,11 +173,12 @@ double num2dbl(num, pos, s_caller) SCM num; char *pos, *s_caller; { - if INUMP(num) return (double)INUM(num); + if (INUMP(num)) return (double)INUM(num); ASRTGO(NIMP(num), errout); - if REALP(num) return REALPART(num); + if (REALP(num)) return REALPART(num); + if (scm_narn==num) return REALPART(num); #ifdef BIGDIG - if BIGP(num) return big2dbl(num); + if (BIGP(num)) return big2dbl(num); #endif errout: wta(num, pos, s_caller); } @@ -185,7 +186,7 @@ double num2dbl(num, pos, s_caller) /* Convert (arrays of) strings to SCM */ SCM makfromstr(src, len) - char *src; + const char *src; sizet len; { SCM s; @@ -196,7 +197,7 @@ SCM makfromstr(src, len) return s; } SCM makfrom0str(src) - char *src; + const char *src; { if (!src) return BOOL_F; return makfromstr(src, (sizet) strlen(src)); @@ -205,7 +206,7 @@ SCM makfrom0str(src) /* If argc < 0, a null terminated array is assumed. */ SCM makfromstrs(argc, argv) int argc; - char **argv; + const char * const *argv; { int i = argc; SCM lst = EOL; @@ -217,9 +218,9 @@ SCM makfromstrs(argc, argv) /* INTS must be DEFERed around this call and the use of the returned array. */ char **makargvfrmstrs(args, s_name) SCM args; - char *s_name; + const char *s_name; { - char **argv; + char ** argv; int argc = ilength(args); argv = (char **)must_malloc((1L+argc)*sizeof(char *), s_vector); for(argc = 0; NNULLP(args); args=CDR(args), ++argc) { @@ -236,7 +237,7 @@ char **makargvfrmstrs(args, s_name) return argv; } void must_free_argv(argv) - char **argv; + const char * const *argv; { sizet i; for(i = 0; argv[i]; i++) { @@ -282,7 +283,7 @@ int scm_ldprog(path) /* Get byte address of SCM array */ #ifdef ARRAYS -long aind P((SCM ra, SCM args, char *what)); +long aind P((SCM ra, SCM args, const char *what)); unsigned long scm_addr(args, s_name) SCM args; char *s_name; @@ -293,18 +294,18 @@ unsigned long scm_addr(args, s_name) ASRTGO(NIMP(args), wna); v = CAR(args); args = CDR(args); - if IMP(v) {goto badarg;} - else if ARRAYP(v) { + if (IMP(v)) {goto badarg;} + else if (ARRAYP(v)) { pos = aind(v, args, s_name); v = ARRAY_V(v); } else { - if NIMP(args) { + if (NIMP(args)) { ASRTER(CONSP(args) && INUMP(CAR(args)), args, ARG2, s_name); pos = INUM(CAR(args)); ASRTGO(NULLP(CDR(args)), wna); } - else if NULLP(args) pos = 0; + else if (NULLP(args)) pos = 0; else { ASRTER(INUMP(args), args, ARG2, s_name); pos = INUM(args); @@ -346,8 +347,8 @@ unsigned long scm_base_addr(v, s_name) { long pos = 0; unsigned long ptr = 0; /* gratuitous assignment squelches cc warn. */ - if IMP(v) {goto badarg;} - else if ARRAYP(v) { + if (IMP(v)) {goto badarg;} + else if (ARRAYP(v)) { pos = ARRAY_BASE(v); v = ARRAY_V(v); } @@ -394,13 +395,13 @@ int scm_cell_p(x) { register int i, j; register CELLPTR ptr; - if NCELLP(x) return 0; + if (NCELLP(x)) return 0; ptr = (CELLPTR)SCM2PTR(x); i = 0; j = hplim_ind; do { - if PTR_GT(hplims[i++], ptr) break; - if PTR_LE(hplims[--j], ptr) break; + if (PTR_GT(hplims[i++], ptr)) break; + if (PTR_LE(hplims[--j], ptr)) break; if ((i != j) && PTR_LE(hplims[i++], ptr) && PTR_GT(hplims[--j], ptr)) continue; @@ -419,7 +420,7 @@ SCM scm_gc_protect(obj) { long len; ASRTER(NIMP(scm_uprotects), MAKINUM(20), NALLOC, "protects"); - if IMP(obj) return obj; + if (IMP(obj)) return obj; for (len = LENGTH(scm_uprotects);len--;) { if (obj==VELTS(scm_uprotects)[len]) return obj; } |