Unified · Split
| @@ -594,6 +594,7 @@ · 593 unmodified lines | ||
| 594 | 594 | |
| 595 | 595 | (out (at out-dir "otf.h") |
| 596 | 596 | (λ () |
| 597 | + (printf "#line 1 \"otf.h.in\"\n") | |
| 597 | 598 | (printf "~a" (port->string (open-input-file (at in-dir "otf.h.in")) #:close? #t)) |
| 598 | 599 | (printf "\n") |
| 599 | 600 | (printf "~a" (format gen-h)))) |
| @@ -605,9 +606,13 @@ · 5 unmodified lines | ||
| 605 | 606 | |
| 606 | 607 | (out (at out-dir "otf.c") |
| 607 | 608 | (λ () |
| 608 | − (printf "~a" | |
| 609 | − (string-replace (port->string (open-input-file (at in-dir "otf.c.in")) #:close? #t) | |
| 610 | − "OTF_EXTRA_FIELDS\n" | |
| 611 | − (format extra-context-fields #:on-all remove-duplicates))) | |
| 612 | − (printf "\n") | |
| 613 | − (printf "~a" (format (λ (c) (gen-c c #f #f)))))) | |
| 609 | + (begin | |
| 610 | + (define c-data (port->lines (open-input-file (at in-dir "otf.c.in")) #:close? #t)) | |
| 611 | + (define extra-fields-index (index-of c-data "OTF_EXTRA_FIELDS")) | |
| 612 | + (define extra-fields-data | |
| 613 | + (string-append (format extra-context-fields #:on-all remove-duplicates) | |
| 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))))))) | |