Differences From
Artifact [5689af4629]:
28 28 (let [fd (file/open path :r)
29 29 rec {:id (reduce |(string/replace-all $1 "_" $0)
30 30 (basename path) ["-" "." "/"])
31 31 :vals (blob->c-array (:read fd :all))}]
32 32 (:close fd)
33 33 rec))
34 34
35 +(defn c-base [t]
36 + (string "const uint8_t gdjn_rsrc_" (t :id) " [" (length (t :vals))"]"))
35 37 (defn c-decl [t]
36 - (string "const uint8_t gdjn_rsrc_" (t :id) " []"))
38 + (string "extern " (c-base t)))
37 39 (defn c-def [t]
38 - (string (c-decl t) " = {" (t :vals) "}"))
40 + (string (c-base t) " = {" (t :vals) "}"))
39 41
40 42
41 43 (defn c-compile [c to-path]
42 44 (def cc (os/spawn [(dyn *cc*)
43 45 "-xc" "-c" "-"
44 46 "-o" to-path]
45 47 :p {:in :pipe}))