aboutsummaryrefslogtreecommitdiffstats
path: root/rope.c
diff options
context:
space:
mode:
Diffstat (limited to 'rope.c')
-rwxr-xr-x[-rw-r--r--]rope.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/rope.c b/rope.c
index 4c482a4..d31b0cb 100644..100755
--- a/rope.c
+++ b/rope.c
@@ -163,13 +163,13 @@ double num2dbl(num, pos, s_caller)
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 int2dbl(num);
#endif
errout: wta(num, pos, s_caller);
}
#endif
- /* Convert (arrays of) strings to SCM */
+ /* Convert string to SCM */
SCM makfromstr(src, len)
const char *src;
sizet len;
@@ -181,6 +181,7 @@ SCM makfromstr(src, len)
while (len--) *dst++ = *src++;
return s;
}
+ /* Convert null-terminated string to SCM */
SCM makfrom0str(src)
const char *src;
{
@@ -269,12 +270,12 @@ int scm_ldprog(path)
/* Get byte address of SCM array */
#ifdef ARRAYS
long aind P((SCM ra, SCM args, const char *what));
-unsigned long scm_addr(args, s_name)
+void* scm_addr(args, s_name)
SCM args;
const char *s_name;
{
long pos;
- unsigned long ptr = 0; /* gratuitous assignment squelches cc warn. */
+ void* ptr = 0; /* gratuitous assignment squelches cc warn. */
SCM v;
ASRTGO(NIMP(args), wna);
v = CAR(args);
@@ -299,29 +300,29 @@ unsigned long scm_addr(args, s_name)
}
switch TYP7(v) {
case tc7_string:
- ptr = (unsigned long)&(CHARS(v)[pos]);
+ ptr = (void*)&(CHARS(v)[pos]);
break;
# ifdef FLOATS
# ifdef SINGLES
case tc7_VfloC32: pos = 2 * pos;
- case tc7_VfloR32: ptr = (unsigned long)&(((float *)CDR(v))[pos]);
+ case tc7_VfloR32: ptr = (void*)&(((float *)CDR(v))[pos]);
break;
# endif
case tc7_VfloC64: pos = 2 * pos;
- case tc7_VfloR64: ptr = (unsigned long)&(((double *)CDR(v))[pos]);
+ case tc7_VfloR64: ptr = (void*)&(((double *)CDR(v))[pos]);
break;
# endif
case tc7_Vbool: ASRTGO(0==(pos%LONG_BIT), outrng);
pos = pos/LONG_BIT;
case tc7_VfixN32:
case tc7_VfixZ32:
- case tc7_vector: ptr = (unsigned long)&(VELTS(v)[pos]);
+ case tc7_vector: ptr = (void*)&(VELTS(v)[pos]);
break;
case tc7_VfixN16:
- case tc7_VfixZ16: ptr = (unsigned long)&(((short *)CDR(v))[pos]);
+ case tc7_VfixZ16: ptr = (void*)&(((short *)CDR(v))[pos]);
break;
case tc7_VfixN8:
- case tc7_VfixZ8: ptr = (unsigned long)&(((char *)CDR(v))[pos]);
+ case tc7_VfixZ8: ptr = (void*)&(((char *)CDR(v))[pos]);
break;
outrng: wta(MAKINUM(pos), (char *)OUTOFRANGE, s_name);
default:
@@ -330,12 +331,12 @@ unsigned long scm_addr(args, s_name)
}
return ptr;
}
-unsigned long scm_base_addr(v, s_name)
+void* scm_base_addr(v, s_name)
SCM v;
const char *s_name;
{
long pos = 0;
- unsigned long ptr = 0; /* gratuitous assignment squelches cc warn. */
+ void* ptr = 0; /* gratuitous assignment squelches cc warn. */
if (IMP(v)) {goto badarg;}
else if (ARRAYP(v)) {
pos = ARRAY_BASE(v);
@@ -343,30 +344,30 @@ unsigned long scm_base_addr(v, s_name)
}
switch TYP7(v) {
case tc7_string:
- ptr = (unsigned long)&(CHARS(v)[pos]);
+ ptr = (void*)&(CHARS(v)[pos]);
break;
# ifdef FLOATS
# ifdef SINGLES
case tc7_VfloC32: pos = 2 * pos;
case tc7_VfloR32:
- ptr = (unsigned long)&(((float *)CDR(v))[pos]);
+ ptr = (void*)&(((float *)CDR(v))[pos]);
break;
# endif
case tc7_VfloC64: pos = 2 * pos;
- case tc7_VfloR64: ptr = (unsigned long)&(((double *)CDR(v))[pos]);
+ case tc7_VfloR64: ptr = (void*)&(((double *)CDR(v))[pos]);
break;
# endif
case tc7_Vbool: ASRTGO(0==(pos%LONG_BIT), outrng);
pos = pos/LONG_BIT;
case tc7_VfixN32:
case tc7_VfixZ32:
- case tc7_vector: ptr = (unsigned long)&(VELTS(v)[pos]);
+ case tc7_vector: ptr = (void*)&(VELTS(v)[pos]);
break;
case tc7_VfixN16:
- case tc7_VfixZ16: ptr = (unsigned long)&(((short *)CDR(v))[pos]);
+ case tc7_VfixZ16: ptr = (void*)&(((short *)CDR(v))[pos]);
break;
case tc7_VfixN8:
- case tc7_VfixZ8: ptr = (unsigned long)&(((char *)CDR(v))[pos]);
+ case tc7_VfixZ8: ptr = (void*)&(((char *)CDR(v))[pos]);
break;
outrng: wta(MAKINUM(pos), (char *)OUTOFRANGE, s_name);
default:
@@ -415,9 +416,6 @@ SCM scm_gc_protect(obj)
long len;
ASRTER(NIMP(scm_uprotects), MAKINUM(20), NALLOC, "protects");
if (IMP(obj)) return obj;
- for (len = LENGTH(scm_uprotects);len--;) {
- if (obj==VELTS(scm_uprotects)[len]) return obj;
- }
len = LENGTH(scm_uprotects);
if (scm_protidx >= len) resizuve(scm_uprotects, MAKINUM(len + (len>>2)));
VELTS(scm_uprotects)[scm_protidx++] = obj;