;;; -*-Scheme-*-
;;;
-;;; $Id: regexp.scm,v 1.63 1992/12/01 14:47:07 gjr Exp $
+;;; $Id: regexp.scm,v 1.64 1993/08/13 23:40:21 cph Exp $
;;;
-;;; Copyright (c) 1986, 1989-1992 Massachusetts Institute of Technology
+;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology
;;;
;;; This material was developed by the Scheme project at the
;;; Massachusetts Institute of Technology, Department of
(declare (usual-integrations))
\f
(define registers (make-vector 20))
-(define match-group (object-hash false))
+(define hash-of-false (object-hash false))
+(define match-group hash-of-false)
(define-integrable (re-match-start-index i)
(vector-ref registers i))
unspecific)
thunk
(lambda ()
- (set! match-group (object-hash group))
+ (set! match-group (if group (group-hash-number group) hash-of-false))
(set! registers
(if group
(vector-map marks
(syntax-table-argument syntax-table)
registers
group start end)))
- (set! match-group (object-hash (and index group)))
+ (set! match-group (compute-match-group group index))
index))
(define (re-search-buffer-backward pattern case-fold-search syntax-table
(syntax-table-argument syntax-table)
registers
group start end)))
- (set! match-group (object-hash (and index group)))
+ (set! match-group (compute-match-group group index))
index))
(define (re-match-buffer-forward pattern case-fold-search syntax-table
(syntax-table-argument syntax-table)
registers
group start end)))
- (set! match-group (object-hash (and index group)))
+ (set! match-group (compute-match-group group index))
index))
+(define (compute-match-group group index)
+ (if index
+ (group-hash-number group)
+ hash-of-false))
+
(define (re-match-string-forward pattern case-fold-search syntax-table string)
(re-match-substring-forward pattern case-fold-search syntax-table
string 0 (string-length string)))
(define (re-match-substring-forward pattern case-fold-search syntax-table
string start end)
- (set! match-group (object-hash false))
+ (set! match-group hash-of-false)
((ucode-primitive re-match-substring)
pattern
(re-translation-table case-fold-search)
(define (re-search-substring-forward pattern case-fold-search syntax-table
string start end)
- (set! match-group (object-hash false))
+ (set! match-group hash-of-false)
((ucode-primitive re-search-substring-forward)
pattern
(re-translation-table case-fold-search)
(define (re-search-substring-backward pattern case-fold-search syntax-table
string start end)
- (set! match-group (object-hash false))
+ (set! match-group hash-of-false)
((ucode-primitive re-search-substring-backward)
pattern
(re-translation-table case-fold-search)
;;; -*-Scheme-*-
;;;
-;;; $Id: struct.scm,v 1.87 1993/08/13 23:19:57 cph Exp $
+;;; $Id: struct.scm,v 1.88 1993/08/13 23:40:14 cph Exp $
;;;
;;; Copyright (c) 1985, 1989-93 Massachusetts Institute of Technology
;;;
point
buffer
shrink-length
- text-properties)
+ text-properties
+ %hash-number)
(define-integrable (set-group-marks! group marks)
(vector-set! group group-index:marks marks))
(define-integrable (set-group-text-properties! group properties)
(vector-set! group group-index:text-properties properties))
+
+(define-integrable (set-group-%hash-number! group n)
+ (vector-set! group group-index:%hash-number n))
\f
(define (make-group buffer)
(let ((group (%make-group)))
(vector-set! group group-index:buffer buffer)
(vector-set! group group-index:shrink-length 0)
(vector-set! group group-index:text-properties false)
+ (vector-set! group group-index:%hash-number #f)
group))
(define (group-length group)
(define (group-absolute-end group)
(make-temporary-mark group (group-length group) true))
+
+(define (group-hash-number group)
+ (or (group-%hash-number group)
+ (let ((n (object-hash group)))
+ (set-group-%hash-number! group n)
+ n)))
\f
;;;; Text Clipping