blob: b1fa0ebd979d3e2d032019afce8912e03e3424b2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
;; -*- mode: fennel; -*- vi:ft=fennel
(fn spit-lib [path to]
(with-open [lib (io.open path)]
(each [line (lib:lines)]
;; patching compile-time variable used to store macro module
;; namr because when loafing the combined file it will always
;; equal the the main module and will break macros in vendored
;; libraries.
(case (line:match "%(local lib%-name %(or %.%.%. (.*)")
name (to:write (.. "(local lib-name (or " name "\n"))
_ (to:write line "\n")))))
(with-open [cljlib (io.open "./cljlib.fnl" :w)]
(let [main (io.open "src/cljlib.fnl")]
(each [line (main:lines)]
(case (line:match ";;;###include (.*)")
(path) (spit-lib path cljlib)
_ (cljlib:write line "\n")))))
|