aboutsummaryrefslogtreecommitdiffstats
path: root/rope.c
diff options
context:
space:
mode:
Diffstat (limited to 'rope.c')
-rw-r--r--rope.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/rope.c b/rope.c
index c922046..94b6631 100644
--- a/rope.c
+++ b/rope.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
+/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -330,6 +330,35 @@ unsigned long scm_addr(args, s_name)
}
#endif /* ARRAYS */
+/* scm_cell_p() returns !0 if the SCM argument `x' is cell-aligned and
+ points into a valid heap segment. This code is duplicated from
+ mark_locations() and obunhash() in "sys.c", which means that
+ changes to these routines must be coordinated. */
+
+#include "continue.h"
+extern sizet hplim_ind;
+extern CELLPTR *hplims;
+
+int scm_cell_p(x)
+ SCM x;
+{
+ register int i, j;
+ register CELLPTR ptr;
+ 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 ((i != j)
+ && PTR_LE(hplims[i++], ptr)
+ && PTR_GT(hplims[--j], ptr)) continue;
+ return !0; /* NFREEP(x) */
+ } while(i<j);
+ return 0;
+}
+
void init_rope()
{
}