about summary refs log blame commit diff stats
path: root/load.arc
blob: b9037aa4d605fe7affc5e39191ff5b31b8b1fb5c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12



                                                                      
                                              






                                          
                               














                                                  
; 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))))
Agaram <vc@akkartik.com> 2015-04-20 12:36:05 -0700 1111 - start adding ncurses primitives' href='/akkartik/mu/commit/cpp/console.mu?h=main&id=54d48b25a08b5b238371b2d1bd0f594dad8dbeb9'>54d48b25 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

                                       
             
              
                                               
                                                          
                           
               

                               
                           
                             
                       
                           
                             
                           
                              
                           
                             
                           
                           
                           
               
 
# example program: managing the display

recipe main [
  open-console
  print-character-to-display 97, 1/red, 2/green
  1:number/raw, 2:number/raw <- cursor-position-on-display
  wait-for-some-interaction
  clear-display
  move-cursor-on-display 0, 4
  print-character-to-display 98
  wait-for-some-interaction
  move-cursor-on-display 0, 0
  clear-line-on-display
  wait-for-some-interaction
  move-cursor-down-on-display
  wait-for-some-interaction
  move-cursor-right-on-display
  wait-for-some-interaction
  move-cursor-left-on-display
  wait-for-some-interaction
  move-cursor-up-on-display
  wait-for-some-interaction
  close-console
]