fix other mandelbrot variants
[mu.git] / archive / 0.vm.arc / load.arc
blobb9037aa4d605fe7affc5e39191ff5b31b8b1fb5c
1 ; support for dividing arc files into sections of different level, and
2 ; selectively loading just sections at or less than a given level
4 ; usage:
5 ; load.arc [level] [arc files] -- [mu files]
7 (def selective-load (file (o level 999))
8 ;? (prn "loading @file at level @level")
9 (fromfile file
10 (whilet expr (read)
11 ;? (prn car.expr)
12 (if (is 'section expr.0)
13 (when (<= expr.1 level)
14 (each x (cut expr 2)
15 (eval x)))
16 (eval expr))
17 ;? (prn car.expr " done")
18 )))
20 (= section-level 999)
21 (point break
22 (each x (map [fromstring _ (read)] cdr.argv)
23 (if (isa x 'int)
24 (= section-level x)
25 (is '-- x)
26 (break) ; later args are mu files
27 :else
28 (selective-load string.x section-level))))