From 1edcb9b62a1a520eddae8403c19d841c9b18737f Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 20 Feb 2017 00:05:24 -0800 Subject: Import Upstream version 5b3 --- rope.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'rope.c') 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