Commits

fperrad_ committed 2772cc4

refactor without dynops IO

Comments (0)

Files changed (2)

 
 .namespace [ 'shakespeare';'Compiler' ]
 
-.loadlib 'io_ops'
 .loadlib 'obscure_ops'
+.include 'stdio.pasm'
 
 .sub 'interactive' :method
     # ignored
     .local pmc rgx, stdin, match
     .local string output, prompt, code
     prompt = '>'
-    stdin = getstdin
+    $P0 = getinterp
+    stdin = $P0.'stdhandle'(.PIO_STDIN_FILENO)
     say "Thou hast entered the interactive sentence verifier"
     say "Enter a Sentence to see How It Parses"
     rgx= get_hll_global ['shakespeare';'Grammar'], 'sentence'

src/builtins/base.pir

 
 =head1
 
-bas.pir -- shakespeare runtime 
+bas.pir -- shakespeare runtime
 
 =cut
 
 .namespace []
 
 .sub 'onload' :anon :load :init
-  $P0 = new 'ResizablePMCArray' 
+  $P0 = new 'ResizablePMCArray'
   set_global 'the_cast', $P0
 
   $P0 = 0
   set_global 'the_condition', $P0
 
-  $P0 = new 'String' 
+  $P0 = new 'String'
   set_global 'the_speaker', $P0
 .end
 
 .sub 'assign'
     .param int val
     .local pmc char
-    char = 'find_other'() 
+    char = 'find_other'()
     'valset'(char,val)
 .end
 
     .local int i, size, status
     .local string name, speaker
     .local pmc person
-    speaker = 'get_speaker_name'() 
+    speaker = 'get_speaker_name'()
     get_global $P0, 'the_cast'
     size = $P0
     i = 0
   real_end:
     .return (person)
 .end
-  
+
 
 .sub 'valueof'
     .param string char
     set $P0, $I0
     set_global 'the_condition', $P0
 .end
-    
+
 .sub 'push'
     .param int a
     $P0 = 'find_other'()
 
 .sub 'listen_heart'
     $P0 = 'find_other'()
-    $P1 = getstdin
-    readline $S1, $P1
+    $P1 = getinterp
+    $P2 = $P1.'stdhandle'(.PIO_STDIN_FILENO)
+    $S1 = $P2.'readline'()
     $I1 = $S1
     'valset'($P0, $I1)
 .end
 
 .sub 'open_mind'
     $P0 = 'find_other'()
-    $P1 = getstdin
-    read $S1, 1
+    $P1 = getinterp
+    $P2 = $P1.'stdhandle'(.PIO_STDIN_FILENO)
+    $S1 = $P2.'read'(1)
     if ''==$S1 goto empty
     $I1 = ord $S1
     goto end