1--> #!/usr/bin/env regina 1--> /* this program tests the behaviour of reaching EOF using LINEIN */ 1--> 1--> Parse Source os . fn 1--> do while lines(fn) > 0 1--> say '1-->' linein(fn) 1--> end 1--> call stream fn, 'C', 'CLOSE' 1--> 1--> signal on notready name eof 1--> do forever 1--> say '2-->' linein(fn) 1--> end 1--> Say "Shouldn't get here!" 1--> Return 1--> eof: 1--> say 'Got NOTREADY from' sigl 'This is correct!' 1--> 1--> file='eoftest.dat' 1--> if os = 'UNIX' Then 1--> call charout file,'a'|| '0a'x || '1a'x,1 1--> else 1--> call charout file,'a'|| '0d0a'x || '1a'x,1 1--> call stream file, 'c', 'close' 1--> call on notready name linein_err 1--> rc=0 1--> do while rc=0 1--> say c2x(linein(file)) 1--> end 1--> say 'Should get here! Returning...' 1--> return 1--> linein_err: 1--> say 'got NOTREADY from line' sigl 'This is correct!' 1--> rc=1 1--> return 1--> /* last line */ 2--> #!/usr/bin/env regina 2--> /* this program tests the behaviour of reaching EOF using LINEIN */ 2--> 2--> Parse Source os . fn 2--> do while lines(fn) > 0 2--> say '1-->' linein(fn) 2--> end 2--> call stream fn, 'C', 'CLOSE' 2--> 2--> signal on notready name eof 2--> do forever 2--> say '2-->' linein(fn) 2--> end 2--> Say "Shouldn't get here!" 2--> Return 2--> eof: 2--> say 'Got NOTREADY from' sigl 'This is correct!' 2--> 2--> file='eoftest.dat' 2--> if os = 'UNIX' Then 2--> call charout file,'a'|| '0a'x || '1a'x,1 2--> else 2--> call charout file,'a'|| '0d0a'x || '1a'x,1 2--> call stream file, 'c', 'close' 2--> call on notready name linein_err 2--> rc=0 2--> do while rc=0 2--> say c2x(linein(file)) 2--> end 2--> say 'Should get here! Returning...' 2--> return 2--> linein_err: 2--> say 'got NOTREADY from line' sigl 'This is correct!' 2--> rc=1 2--> return 2--> /* last line */ Got NOTREADY from 12 This is correct! 61 1A got NOTREADY from line 28 This is correct! Should get here! Returning...