spook

A "game" for the 2023 Autumn Lisp Game Jam. Won first place! (from the bottom...)
git clone https://kaka.farm/~git/spook
Log | Files | Refs | LICENSE

sections.scm (1736B)


      1 ;;;; sections.scm - section handling for internal xref database
      2 
      3 
      4 ;; this must be portable syntax-rules, since it runs in the
      5 ;; host implementation
      6 
      7 (define-syntax define-library-section
      8   (syntax-rules (default strict depends define define-syntax define-inline)
      9     ((_ "walk" sec ()) 
     10      (void))
     11     ((_ "walk" sec ((default def ...) . more))
     12      (begin
     13        (define-library-section "walk-defs" sec (def ...))
     14        (define-library-section "walk" sec more)))
     15     ((_ "walk" sec ((strict def ...) . more))
     16      (begin
     17        (define-library-section "walk-defs" sec (def ...))
     18        (define-library-section "walk" sec more)))
     19     ((_ "walk" sec ((depends dep ...) . more))
     20      (begin
     21        (put! 'sec 'depends '(dep ...))
     22        (define-library-section "walk" sec more)))
     23     ((_ "walk" sec (clause . more))
     24      (define-library-section "walk" sec more))
     25     ((_ "walk-defs" sec ())
     26      (void))
     27     ((_ "walk-defs" sec ((define (name . llist) body ...) . more))
     28      (begin
     29        (put! 'name 'defined 'sec)
     30        (define-library-section "walk-defs" sec more)))
     31     ((_ "walk-defs" sec ((define name val) . more))
     32      (begin
     33        (put! 'name 'defined 'sec)
     34        (define-library-section "walk-defs" sec more)))
     35     ((_ "walk-defs" sec ((define-syntax name val) . more))
     36      (begin
     37        (put! 'name 'defined 'sec)
     38        (define-library-section "walk-defs" sec more)))
     39     ((_ "walk-defs" sec ((define-inline (name . llist) body ...) . more))
     40      (begin
     41        (put! 'name 'defined 'sec)
     42        (define-library-section "walk-defs" sec more)))
     43     ((_ "walk-defs" sec (form . more))
     44      (define-library-section "walk-defs" sec more))
     45     ((_ sec clauses ...)
     46      (define-library-section "walk" sec (clauses ...)))))