aboutsummaryrefslogtreecommitdiffstats
path: root/rope.c
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:24 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:24 -0800
commit1edcb9b62a1a520eddae8403c19d841c9b18737f (patch)
treebc0a43d9b3905726a76ed6f0528b54275f23d082 /rope.c
parent5ca6e8e6a4e5c022a6fb5d28f30219c22c99eda8 (diff)
downloadscm-1edcb9b62a1a520eddae8403c19d841c9b18737f.tar.gz
scm-1edcb9b62a1a520eddae8403c19d841c9b18737f.zip
Import Upstream version 5b3upstream/5b3
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()
{
}