Text processing/Max licenses in use: Difference between revisions

Forth
m (→‎{{header|Ruby}}: more idiomatic Ruby)
(Forth)
Line 209:
println(` $time`)
}</lang>
 
=={{header|Forth}}==
<lang forth>
19 constant date-size
create max-date date-size allot
variable max-out
variable counter
 
stdin value input
 
: process ( addr len -- )
8 /string
over 3 s" OUT" compare 0= if
1 counter +!
counter @ max-out @ > if
counter @ max-out !
drop 6 + max-date date-size move
else 2drop then
else drop 2 s" IN" compare 0= if
-1 counter +!
then then ;
 
: main
0 max-out !
0 counter !
s" mlijobs.txt" r/o open-file throw to input
begin pad 80 input read-line throw
while pad swap process
repeat
input close-file throw
max-out @ . ." max licenses in use @ "
max-date date-size type cr ;
</lang>
 
== {{header|Fortran}} ==
Anonymous user