| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
(define-module (cairo vector-types)) |
| 25 |
|
| 26 |
(define-macro (define-accessors type accessor . fields) |
| 27 |
`(begin |
| 28 |
,@(map (lambda (field) |
| 29 |
|
| 30 |
`(define-public (,(string->symbol |
| 31 |
(string-append |
| 32 |
(symbol->string type) ":" (symbol->string field))) |
| 33 |
obj) |
| 34 |
(,accessor obj ,(list-index fields field)))) |
| 35 |
fields))) |
| 36 |
|
| 37 |
(define-macro (define-vector-type module type constructor . fields) |
| 38 |
`(begin |
| 39 |
(define-public (,(symbol-append module '-make- type) ,@fields) |
| 40 |
(,constructor ,@fields)) |
| 41 |
(define-accessors ,(symbol-append module '- type) |
| 42 |
,(symbol-append constructor '-ref) |
| 43 |
,@fields))) |
| 44 |
|
| 45 |
(define-vector-type cairo rectangle f64vector |
| 46 |
x y width height) |
| 47 |
|
| 48 |
(define-vector-type cairo rectangle-int s32vector |
| 49 |
x y width height) |
| 50 |
|
| 51 |
(define-vector-type cairo glyph vector |
| 52 |
index x y) |
| 53 |
|
| 54 |
(define-vector-type cairo text-extents f64vector |
| 55 |
x-bearing y-bearing width height x-advance y-advance) |
| 56 |
|
| 57 |
(define-vector-type cairo font-extents f64vector |
| 58 |
ascent descent height max-x-advance max-y-advance) |