about summary refs log tree commit diff stats
path: root/037global_variables.cc
Commit message (Expand)AuthorAgeFilesLines
* 5892Kartik Agaram2020-01-141-2/+2
* 5670Kartik Agaram2019-09-191-0/+305
00:51:32 -0800 407' href='/akkartik/mu/commit/load.arc?h=main&id=cb7b0f84fe103a8d0b76ca3a0a9b4b8a5e0f1118'>cb7b0f84 ^
4f9f75dd ^






64d5ef2d ^
4f9f75dd ^














1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28



                                                                      
                                              






                                          
                               














                                                  
; support for dividing arc files into sections of different level, and
; selectively loading just sections at or less than a given level

; usage:
;   load.arc [level] [arc files] -- [mu files]

(def selective-load (file (o level 999))
;?   (prn "loading @file at level @level")
  (fromfile file
    (whilet expr (read)
;?       (prn car.expr)
      (if (is 'section expr.0)
        (when (<= expr.1 level)
          (each x (cut expr 2)
            (eval x)))
        (eval expr))
;?       (prn car.expr " done")
      )))

(= section-level 999)
(point break
(each x (map [fromstring _ (read)] cdr.argv)
  (if (isa x 'int)
        (= section-level x)
      (is '-- x)
        (break)  ; later args are mu files
      :else
        (selective-load string.x section-level))))