File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 28
28
(->identifier how str stx->uri-string))
29
29
30
30
(define (stx->uri-string stx)
31
+ (define xref (get-xref))
31
32
(match (and xref (xref-binding->definition-tag xref stx 0 ))
32
33
[(? tag? tag )
33
34
(define-values (path anchor) (xref-tag->path+anchor xref tag ))
Original file line number Diff line number Diff line change 44
44
45
45
(define/contract (binding->path+anchor stx)
46
46
(-> identifier? (or/c #f (cons/c path-string? (or/c #f string?))))
47
- (let* ([tag (xref-binding->definition-tag xref stx 0 )]
47
+ (let* ([xref (get-xref)]
48
+ [tag (xref-binding->definition-tag xref stx 0 )]
48
49
[p+a (and tag (tag->path+anchor xref tag ))])
49
50
p+a))
50
51
72
73
73
74
(define/contract (identifier->bluebox stx)
74
75
(-> identifier? (or/c #f string?))
75
- (match (xref-binding->definition-tag xref stx 0 )
76
+ (match (xref-binding->definition-tag (get- xref) stx 0 )
76
77
[(? tag? tag ) (get-bluebox-string tag )]
77
78
[_ #f ]))
78
79
169
170
(let ([ht (exported-index-desc*-extras desc)])
170
171
(or (hash-ref ht 'hidden? #f )
171
172
(hash-ref ht 'constructor? #f ))))))
172
- (for* ([entry (in-list (xref-index xref))]
173
+ (for* ([entry (in-list (xref-index (get- xref) ))]
173
174
[desc (in-value (entry-desc entry))]
174
175
#:when desc
175
176
#:unless (hide-desc? desc)
181
182
root)
182
183
183
184
(define (doc-trie-value desc term tag )
184
- (define-values (path anchor) (xref-tag->path+anchor xref tag ))
185
+ (define-values (path anchor) (xref-tag->path+anchor (get- xref) tag ))
185
186
(define (method-what)
186
187
(cond
187
188
[(method-tag? tag )
Original file line number Diff line number Diff line change 5
5
6
6
(require setup/xref)
7
7
8
- (provide xref
9
- xref-ready-evt)
8
+ (provide get-xref)
10
9
11
- (define xref-ready-evt never-evt)
12
- (define xref (begin0 (load-collections-xref)
13
- (set! xref-ready-evt always-evt)))
10
+ ;; A single xref instance for all our modules to share.
11
+ ;;
12
+ ;; Will block safely until ready, if used from e.g. delay/thread or
13
+ ;; delay/idle (which, although we're not doing now, we've done before,
14
+ ;; and might do again someday).
15
+ (define sema (make-semaphore 1 ))
16
+ (define xref (call-with-semaphore sema load-collections-xref))
17
+ (define (get-xref) (call-with-semaphore sema (λ () xref)))
You can’t perform that action at this time.
0 commit comments