diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-11-24 22:05:56 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-11-24 22:11:46 -0800 |
commit | 4feb3daf812a15a2545374947701387657c90051 (patch) | |
tree | 3c5adeb2c022df05bffd0a3768c8367cd57110d2 /mu.arc | |
parent | 74dbd6c41b8a1ab25e607239e0b226da265935d4 (diff) | |
download | mu-4feb3daf812a15a2545374947701387657c90051.tar.gz |
319 - ack, forgot to handle blocks when tangling
Will the 'lightweight tools' really be all that useable if we encourage people to layer them one atop another and track precisely what inputs each can accept? Something to keep an eye on. In the meanwhile, we have a new (but very unrealistic) example demonstrating the tangling directives. There's still a big constraint on ordering: before/after clauses have to come before functions that need them.
Diffstat (limited to 'mu.arc')
-rw-r--r-- | mu.arc | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/mu.arc b/mu.arc index 1e34249a..6e37918e 100644 --- a/mu.arc +++ b/mu.arc @@ -859,19 +859,26 @@ ; see add-code below for adding to before* and after* (def insert-code (instrs) - (accum yield - (each instr instrs - (if (acons instr) - (yield instr) - ; label - (do - (each fragment (as cons before*.instr) - (each instr fragment - (yield instr))) - (yield instr) - (each fragment after*.instr - (each instr fragment - (yield instr)))))))) + (loop (instrs instrs) + (accum yield + (each instr instrs + (if (and (acons instr) (~is 'begin car.instr)) + ; simple instruction + (yield instr) + (and (acons instr) (is 'begin car.instr)) + ; block + (yield `{begin ,@(recur cdr.instr)}) + (atom instr) + ; label + (do +;? (prn "tangling " instr) + (each fragment (as cons before*.instr) + (each instr fragment + (yield instr))) + (yield instr) + (each fragment after*.instr + (each instr fragment + (yield instr))))))))) ;; system software @@ -1066,6 +1073,8 @@ def (let (name (_make-br-fn body)) rest (assert (is 'make-br-fn _make-br-fn)) +;? (prn keys.before* " -- " keys.after*) +;? (= function*.name (convert-names:convert-braces:prn:insert-code body))) (= function*.name (convert-names:convert-braces:insert-code body))) ; syntax: before <label> [ <instructions> ] |