read-line/raw

port buf


Summary

Reads in a line of user input and returns it

Bytecode

Probably only interesting to you if you want to understand more about the Nujel VM or care very much about performance.

(    0 ($push/int/byte 0))
(    2 ($det/val 'i))
(    4 ($drop))
(    5 ($push/int/byte 0))
(    7 ($det/val 'c))
(    9 ($drop))
(   10 ($get/val 'buffer/u8*))
(   12 ($get/val 'buf))
(   14 ($apply 1))
(   16 ($det/val 'view))
(   18 ($drop))
(   19 ($push/nil))
(   20 ($jmp* 104))
(   23 ($drop))
(   24 ($push/nil))
(   25 ($jmp* 17))
(   28 ($drop))
(   29 ($get/val 'buffer/length!))
(   31 ($push/val 128))
(   33 ($get/val 'buffer/length))
(   35 ($get/val 'buf))
(   37 ($apply 1))
(   39 ($add))
(   40 ($apply 1))
(   42 ($get/val 'i))
(   44 ($get/val 'buffer/length))
(   46 ($get/val 'buf))
(   48 ($apply 1))
(   50 ($>=))
(   51 ($jt* -23))
(   54 ($drop))
(   55 ($get/val 'port))
(   57 ($push/val 'char-read))
(   59 ($apply 1))
(   61 ($set/val 'c))
(   63 ($drop))
(   64 ($get/val 'c))
(   66 ($push/val :end-of-file))
(   68 ($=))
(   69 ($jf* 19))
(   72 ($get/val 'i))
(   74 ($zero?))
(   75 ($jf* 7))
(   78 ($push/nil))
(   79 ($jmp* 5))
(   82 ($get/val 'i))
(   84 ($ret))
(   85 ($jmp* 4))
(   88 ($push/nil))
(   89 ($drop))
(   90 ($get/val 'c))
(   92 ($push/int/byte 10))
(   94 ($=))
(   95 ($jf* 9))
(   98 ($get/val 'i))
(  100 ($ret))
(  101 ($jmp* 4))
(  104 ($push/nil))
(  105 ($drop))
(  106 ($get/val 'buffer/set!))
(  108 ($get/val 'view))
(  110 ($get/val 'i))
(  112 ($get/val 'c))
(  114 ($apply 3))
(  116 ($drop))
(  117 ($push/int/byte 1))
(  119 ($get/val 'i))
(  121 ($add))
(  122 ($set/val 'i))
(  124 ($push/true))
(  125 ($jt* -102))
(  128 ($ret))