Skip to content

Commit e0ba4dd

Browse files
committed
Create rhombus picts instead of racket picts when rhombus is installed
1 parent c42e67c commit e0ba4dd

File tree

9 files changed

+470
-82
lines changed

9 files changed

+470
-82
lines changed

redex-doc/redex/scribblings/ref/typesetting.scrbl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ picts inline in the paper. For producing
7171
papers with LaTeX, create @filepath{.ps} files from the picts with Redex,
7272
which can be included into a LaTeX document.
7373

74+
Redex picts can also be used with the
75+
@seclink["top" #:doc '(lib "rhombus/pict/scribblings/rhombus-pict.scrbl") #:indirect? #t]{
76+
Rhombus's pict library}. When the Rhombus library is installed, Redex
77+
creates Rhombus picts and when it is not installed, Redex
78+
creates Racket picts. Rhombus picts are
79+
@tech[#:doc '(lib "pict/scribblings/pict.scrbl")]{pict
80+
convertible}, however, so Rhombus picts can be used whenever the Racket library
81+
picts are expected.
82+
7483
@section{Generating Picts}
7584

7685
This section documents two sets of operations, one for

redex-lib/redex/private/loc-wrapper-rt.rkt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
(define (init-loc-wrapper e line column quoted?)
1212
(if quoted?
13-
(make-lw e line #f column #f #f #f)
14-
(make-lw e line #f column #f #t #f)))
13+
(make-lw e line #f column #f #f #f #f)
14+
(make-lw e line #f column #f #t #f #f)))
1515

1616
(define (init-loc-wrapper/unquoted e line column)
1717
(init-loc-wrapper e line column #f))
@@ -22,13 +22,16 @@
2222

2323
;; e : (union string symbol #f (listof lw))
2424
;; line, line-span, column, column-span : number
25-
(define-struct lw (e line line-span column column-span unq? metafunction?)
25+
;; pict-tag is used when making a rhombus pict; it ends up
26+
;; in the metadata of the pict generated from the elements
27+
;; of the list inside `e` (it shouldn't be there if there isn't a list)
28+
(define-struct lw (e line line-span column column-span unq? metafunction? pict-tag)
2629
#:mutable
2730
#:inspector (make-inspector))
2831

2932
;; build-lw is designed for external consumption
3033
(define (build-lw e line line-span column column-span)
31-
(make-lw e line line-span column column-span #f #f))
34+
(make-lw e line line-span column column-span #f #f #f))
3235

3336
(define curly-quotes-for-strings (make-parameter #t))
3437

@@ -49,7 +52,7 @@
4952
(init-loc-wrapper/unquoted (loop e) (loop line) (loop column))]
5053
[(vector 'make-lw e line line-span column column-span unq? metafunction?)
5154
(make-lw (loop e) (loop line) (loop line-span) (loop column)
52-
(loop column-span) (loop unq?) (loop metafunction?))]
55+
(loop column-span) (loop unq?) (loop metafunction?) #f)]
5356
[(vector 'rewrite-quotes arg)
5457
(rewrite-quotes (loop arg))]
5558
[(vector 'list x ...)

redex-lib/redex/private/loc-wrapper.rkt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#lang racket/base
22

33
(require racket/contract
4+
racket/math
5+
racket/treelist
46
(for-syntax racket/base)
57
(for-syntax "loc-wrapper-ct.rkt")
68
"loc-wrapper-rt.rkt")
@@ -23,7 +25,8 @@
2325
(column pnum)
2426
(column-span pnum)
2527
(unq? boolean?)
26-
(metafunction? boolean?))))
28+
(metafunction? boolean?)
29+
(pict-tag (or/c string? treelist? #f)))))
2730

2831
(provide to-lw
2932
to-lw/uq

redex-pict-lib/redex/pict.rkt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
"private/pict.rkt"
55
"private/core-layout.rkt"
66
"private/derivation-pict.rkt"
7+
"private/pict-interface.rkt"
78
redex/private/struct
89
redex/private/loc-wrapper
9-
redex/reduction-semantics
10-
texpict/mrpict
11-
(only-in pict/convert pict-convertible?))
10+
redex/reduction-semantics)
1211

1312
(define reduction-rule-style/c
1413
(or/c 'vertical

redex-pict-lib/redex/private/arrow.rkt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#lang racket/base
2-
(require texpict/mrpict
3-
racket/draw
2+
(require racket/draw
43
racket/class
5-
racket/contract)
4+
racket/contract
5+
"pict-interface.rkt")
66

77
(provide/contract
88
[make-arrow-pict

0 commit comments

Comments
 (0)