History

codegen: produce #line directives pointing at otf.[ch].in

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit baa3c241 parent a4302051 file · +11 −6Browse files

Unified · Split

gen.rkt+11−6
@@ -594,6 +594,7 @@ · 593 unmodified lines
594 594
595(out (at out-dir "otf.h")595(out (at out-dir "otf.h")
596 (λ ()596 (λ ()
597 (printf "#line 1 \"otf.h.in\"\n")
597 (printf "~a" (port->string (open-input-file (at in-dir "otf.h.in")) #:close? #t))598 (printf "~a" (port->string (open-input-file (at in-dir "otf.h.in")) #:close? #t))
598 (printf "\n")599 (printf "\n")
599 (printf "~a" (format gen-h))))600 (printf "~a" (format gen-h))))
@@ -605,9 +606,13 @@ · 5 unmodified lines
605 606
606(out (at out-dir "otf.c")607(out (at out-dir "otf.c")
607 (λ ()608 (λ ()
608 (printf "~a"609 (begin
609 (string-replace (port->string (open-input-file (at in-dir "otf.c.in")) #:close? #t)610 (define c-data (port->lines (open-input-file (at in-dir "otf.c.in")) #:close? #t))
610 "OTF_EXTRA_FIELDS\n"611 (define extra-fields-index (index-of c-data "OTF_EXTRA_FIELDS"))
611 (format extra-context-fields #:on-all remove-duplicates)))612 (define extra-fields-data
612 (printf "\n")613 (string-append (format extra-context-fields #:on-all remove-duplicates)
613 (printf "~a" (format (λ (c) (gen-c c #f #f))))))614 (~a "#line " (+ extra-fields-index 2) "\"otf.c.in\"")))
615 (printf "#line 1 \"otf.c.in\"\n")
616 (for-each (λ (s) (printf "~a\n" s)) (list-set c-data extra-fields-index extra-fields-data))
617 (printf "\n")
618 (printf "~a" (format (λ (c) (gen-c c #f #f)))))))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t