about summary refs log blame commit diff stats
path: root/arc/.traces/channel-new-empty-not-full
blob: 32175580e8b69a2ad88c4d8fa39a947a71b7f452 (plain) (tree)






















































































































































                                                                                                                                    
c{0: 0 (((1 channel-address)) <- ((init-channel)) ((3 literal))) -- nil
c{0: 1 (((2 boolean)) <- ((empty?)) ((1 channel-address) (deref))) -- nil
c{0: 2 (((3 boolean)) <- ((full?)) ((1 channel-address) (deref))) -- nil
c{1: 0 ✓ (((1 channel-address)) <- ((init-channel)) ((3 literal)))
c{1: 1 ✓ (((2 boolean)) <- ((empty?)) ((1 channel-address) (deref)))
c{1: 2 ✓ (((3 boolean)) <- ((full?)) ((1 channel-address) (deref)))
cn0: convert-names in main
cn0: (((1 channel-address)) <- ((init-channel)) ((3 literal))) nil nil
cn0: checking arg ((3 literal))
cn0: checking oarg ((1 channel-address))
maybe-add: ((1 channel-address))
cn0: (((2 boolean)) <- ((empty?)) ((1 channel-address) (deref))) nil nil
cn0: checking arg ((1 channel-address) (deref))
maybe-add: ((1 channel-address) (deref))
cn0: checking oarg ((2 boolean))
maybe-add: ((2 boolean))
cn0: (((3 boolean)) <- ((full?)) ((1 channel-address) (deref))) nil nil
cn0: checking arg ((1 channel-address) (deref))
maybe-add: ((1 channel-address) (deref))
cn0: checking oarg ((3 boolean))
maybe-add: ((3 boolean))
cn1: (((1 channel-address)) <- ((init-channel)) ((3 literal)))
cn1: (((2 boolean)) <- ((empty?)) ((1 channel-address) (deref)))
cn1: (((3 boolean)) <- ((full?)) ((1 channel-address) (deref)))
schedule: main
run: main 0: (((1 channel-address)) <- ((init-channel)) ((3 literal)))
run: init-channel/main 0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
run: init-channel/main 0: 1000 => ((default-space space-address))
run: init-channel/main 1: (((1 channel-address)) <- ((new)) ((channel literal)))
run: init-channel/main 1: 1031 => ((1 channel-address))
mem: ((1 channel-address)): 1002 <= 1031
run: init-channel/main 2: (((2 integer-address)) <- ((get-address)) ((1 channel-address) (deref)) ((0 offset)))
run: init-channel/main 2: 1031 => ((2 integer-address))
mem: ((2 integer-address)): 1003 <= 1031
run: init-channel/main 3: (((2 integer-address) (deref)) <- ((copy)) ((0 literal)))
run: init-channel/main 3: 0 => ((2 integer-address) (deref))
mem: ((2 integer-address) (deref)): 1031 <= 0
run: init-channel/main 4: (((3 integer-address)) <- ((get-address)) ((1 channel-address) (deref)) ((1 offset)))
run: init-channel/main 4: 1032 => ((3 integer-address))
mem: ((3 integer-address)): 1004 <= 1032
run: init-channel/main 5: (((3 integer-address) (deref)) <- ((copy)) ((0 literal)))
run: init-channel/main 5: 0 => ((3 integer-address) (deref))
mem: ((3 integer-address) (deref)): 1032 <= 0
run: init-channel/main 6: (((4 integer)) <- ((next-input)))
arg: nil 0 (3)
run: init-channel/main 6: 3 => ((4 integer))
mem: ((4 integer)): 1005 <= 3
run: init-channel/main 7: (((4 integer)) <- ((add)) ((4 integer)) ((1 literal)))
mem: ((4 integer)) => 3
run: init-channel/main 7: 4 => ((4 integer))
mem: ((4 integer)): 1005 <= 4
run: init-channel/main 8: (((5 tagged-value-array-address-address)) <- ((get-address)) ((1 channel-address) (deref)) ((2 offset)))
run: init-channel/main 8: 1033 => ((5 tagged-value-array-address-address))
mem: ((5 tagged-value-array-address-address)): 1006 <= 1033
run: init-channel/main 9: (((5 tagged-value-array-address-address) (deref)) <- ((new)) ((tagged-value-array literal)) ((4 integer)))
mem: ((4 integer)) => 4
run: init-channel/main 9: 1034 => ((5 tagged-value-array-address-address) (deref))
mem: ((5 tagged-value-array-address-address) (deref)): 1033 <= 1034
run: init-channel/main 10: (((reply)) ((1 channel-address)))
mem: ((1 channel-address)) => 1031
run: main 0: 1031 => ((1 channel-address))
mem: ((1 channel-address)): 1 <= 1031
run: main 1: (((2 boolean)) <- ((empty?)) ((1 channel-address) (deref)))
mem: ((1 channel-address) (deref)) => #(tagged record (0 0 1034 . nil))
run: empty?/main 0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
run: empty?/main 0: 1043 => ((default-space space-address))
run: empty?/main 1: (((1 channel)) <- ((next-input)))
arg: nil 0 (#(tagged record (0 0 1034 . nil)))
run: empty?/main 1: #(tagged record (0 0 1034 . nil)) => ((1 channel))
mem: ((1 channel)): 1045 <= 0
mem: ((1 channel)): 1046 <= 0
mem: ((1 channel)): 1047 <= 1034
run: empty?/main 2: (((4 integer)) <- ((get)) ((1 channel)) ((0 offset)))
mem: ((1045 integer) (raw)) => 0
run: empty?/main 2: 0 => ((4 integer))
mem: ((4 integer)): 1048 <= 0
run: empty?/main 3: (((5 integer)) <- ((get)) ((1 channel)) ((1 offset)))
mem: ((1046 integer) (raw)) => 0
run: empty?/main 3: 0 => ((5 integer))
mem: ((5 integer)): 1049 <= 0
run: empty?/main 4: (((6 boolean)) <- ((equal)) ((4 integer)) ((5 integer)))
mem: ((4 integer)) => 0
mem: ((5 integer)) => 0
run: empty?/main 4: t => ((6 boolean))
mem: ((6 boolean)): 1050 <= t
run: empty?/main 5: (((reply)) ((6 boolean)))
mem: ((6 boolean)) => t
run: main 1: t => ((2 boolean))
mem: ((2 boolean)): 2 <= t
run: main 2: (((3 boolean)) <- ((full?)) ((1 channel-address) (deref)))
mem: ((1 channel-address) (deref)) => #(tagged record (0 0 1034 . nil))
run: full?/main 0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
run: full?/main 0: 1074 => ((default-space space-address))
run: full?/main 1: (((1 channel)) <- ((next-input)))
arg: nil 0 (#(tagged record (0 0 1034 . nil)))
run: full?/main 1: #(tagged record (0 0 1034 . nil)) => ((1 channel))
mem: ((1 channel)): 1076 <= 0
mem: ((1 channel)): 1077 <= 0
mem: ((1 channel)): 1078 <= 1034
run: full?/main 2: (((4 integer)) <- ((get)) ((1 channel)) ((1 offset)))
mem: ((1077 integer) (raw)) => 0
run: full?/main 2: 0 => ((4 integer))
mem: ((4 integer)): 1079 <= 0
run: full?/main 3: (((4 integer)) <- ((add)) ((4 integer)) ((1 literal)))
mem: ((4 integer)) => 0
run: full?/main 3: 1 => ((4 integer))
mem: ((4 integer)): 1079 <= 1
run: full?/main 4: (((5 integer)) <- ((capacity)) ((1 channel)))
mem: ((1 channel)) => #(tagged record (0 0 1034 . nil))
run: capacity/full?/main 0: (((default-space space-address)) <- ((new)) ((space literal)) ((30 literal)))
run: capacity/full?/main 0: 1105 => ((default-space space-address))
run: capacity/full?/main 1: (((1 channel)) <- ((next-input)))
arg: nil 0 (#(tagged record (0 0 1034 . nil)))
run: capacity/full?/main 1: #(tagged record (0 0 1034 . nil)) => ((1 channel))
mem: ((1 channel)): 1107 <= 0
mem: ((1 channel)): 1108 <= 0
mem: ((1 channel)): 1109 <= 1034
run: capacity/full?/main 2: (((4 tagged-value-array-address)) <- ((get)) ((1 channel)) ((2 offset)))
mem: ((1109 tagged-value-array-address) (raw)) => 1034
run: capacity/full?/main 2: 1034 => ((4 tagged-value-array-address))
mem: ((4 tagged-value-array-address)): 1110 <= 1034
run: capacity/full?/main 3: (((5 integer)) <- ((length)) ((4 tagged-value-array-address) (deref)))
array-len: ((4 tagged-value-array-address) (deref))
mem: ((1034 integer) (raw)) => 4
run: capacity/full?/main 3: 4 => ((5 integer))
mem: ((5 integer)): 1111 <= 4
run: capacity/full?/main 4: (((reply)) ((5 integer)))
mem: ((5 integer)) => 4
run: full?/main 4: 4 => ((5 integer))
mem: ((5 integer)): 1080 <= 4
run: full?/main 5: (((6 boolean)) <- ((less-than)) ((4 integer)) ((5 integer)))
mem: ((4 integer)) => 1
mem: ((5 integer)) => 4
run: full?/main 5: t => ((6 boolean))
mem: ((6 boolean)): 1081 <= t
run: full?/main 6: (((jump-if)) ((6 boolean)) ((1 offset)))
mem: ((6 boolean)) => t
run: full?/main 8: (((7 integer)) <- ((get)) ((1 channel)) ((0 offset)))
mem: ((1076 integer) (raw)) => 0
run: full?/main 8: 0 => ((7 integer))
mem: ((7 integer)): 1082 <= 0
run: full?/main 9: (((8 boolean)) <- ((equal)) ((7 integer)) ((4 integer)))
mem: ((7 integer)) => 0
mem: ((4 integer)) => 1
run: full?/main 9: nil => ((8 boolean))
mem: ((8 boolean)): 1083 <= nil
run: full?/main 10: (((reply)) ((8 boolean)))
mem: ((8 boolean)) => nil
run: main 2: nil => ((3 boolean))
mem: ((3 boolean)): 3 <= nil
schedule: done with routine nil
1
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120












                                                                                                      
             
















                                                                             









                                                 
                                  


                          
                  
                                       
                 

                              
                                  


                          

                                                  
                                         

                                                  









                                                                                     
   








                                                 
                         
                          
              







                                                                                       
   








                                                 
                         
                          
              











                                                                                          

                

                                              
 
fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
  # initialize fs from args[1]
  var filename/eax: (addr array byte) <- first-arg args
  var file-state-storage: file-state
  var fs/esi: (addr file-state) <- address file-state-storage
  init-file-state fs, filename
  #
  enable-screen-grid-mode
  enable-keyboard-immediate-mode
  # initialize screen state from screen size
  var screen-position-state-storage: screen-position-state
  var screen-position-state/eax: (addr screen-position-state) <- address screen-position-state-storage
  init-screen-position-state screen-position-state
  normal-text
  {
    render fs, screen-position-state
    var key/eax: byte <- read-key
    compare key, 0x71  # 'q'
    loop-if-!=
  }
  enable-keyboard-type-mode
  enable-screen-type-mode
  exit-status <- copy 0
}

fn render fs: (addr file-state), state: (addr screen-position-state) {
  start-drawing state
  render-normal fs, state
}

fn render-normal fs: (addr file-state), state: (addr screen-position-state) {
$render-normal:body: {
    # if done-drawing?(state) break
    var done?/eax: boolean <- done-drawing? state
    compare done?, 0  # false
    break-if-!=
    #
    var c/eax: byte <- next-char fs
    # if (c == EOF) break
    compare c, 0xffffffff  # EOF marker
    break-if-=
    # if (c == '*') switch to bold
    compare c, 0x2a  # '*'
    {
      break-if-!=
      start-bold 0
        render-until-asterisk fs, state
      normal-text
      loop $render-normal:body
    }
    # if (c == '_') switch to bold
    compare c, 0x5f  # '_'
    {
      break-if-!=
      start-color 0, 0xec, 7  # 236 = darkish gray
      start-bold 0
        render-until-underscore fs, state
      reset-formatting 0
      start-color 0, 0xec, 7  # 236 = darkish gray
      loop $render-normal:body
    }
    #
    add-char state, c
    #
    loop
  }
}

fn render-until-asterisk fs: (addr file-state), state: (addr screen-position-state) {
  {
    # if done-drawing?(state) break
    var done?/eax: boolean <- done-drawing? state
    compare done?, 0  # false
    break-if-!=
    #
    var c/eax: byte <- next-char fs
    # if (c == EOF) break
    compare c, 0xffffffff  # EOF marker
    break-if-=
    # if (c == '*') break
    compare c, 0x2a  # '*'
    break-if-=
    #
    add-char state, c
    #
    loop
  }
}

fn render-until-underscore fs: (addr file-state), state: (addr screen-position-state) {
  {
    # if done-drawing?(state) break
    var done?/eax: boolean <- done-drawing? state
    compare done?, 0  # false
    break-if-!=
    #
    var c/eax: byte <- next-char fs
    # if (c == EOF) break
    compare c, 0xffffffff  # EOF marker
    break-if-=
    # if (c == '_') break
    compare c, 0x5f  # '_'
    break-if-=
    #
    add-char state, c
    #
    loop
  }
}

fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr array byte) {
  var args/eax: (addr array (addr array byte)) <- copy args-on-stack
  var result/eax: (addr addr array byte) <- index args, 1
  out <- copy *result
}

fn normal-text {
  reset-formatting 0
  start-color 0, 0xec, 7  # 236 = darkish gray
}