Text processing/Max licenses in use: Difference between revisions

Added XPL0 example.
m (syntax highlighting fixup automation)
(Added XPL0 example.)
Line 2,856:
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
=={{header|XPL0}}==
To run: maxlic < mlijobs.txt
<syntaxhighlight lang "XPL0">string 0; \use zero-terminated strings
char TimeMax(100, 25);
int Out, OutMax, I, Ch, ListInx;
[Out:= 0; OutMax:= 0; ListInx:= 0;
loop [for I:= 0 to 9-1 do
[Ch:= ChIn(1);
if Ch = $1A \EOF\ then quit;
];
if Ch = ^O then
[Out:= Out+1;
if Out >= OutMax then
[if Out > OutMax then ListInx:= 0;
OutMax:= Out;
for I:= 0 to 5-1 do Ch:= ChIn(1);
for I:= 0 to 19-1 do
TimeMax(ListInx, I):= ChIn(1);
TimeMax(ListInx, I):= 0;
ListInx:= ListInx+1;
];
]
else \Ch = ^I as in "IN"
Out:= Out-1;
repeat Ch:= ChIn(1) until Ch = $0A; \LF
];
Text(0, "Maximum simultaneous license use is ");
IntOut(0, OutMax);
Text(0, " at the following time(s):^m^j");
for I:= 0 to ListInx-1 do
[Text(0, @TimeMax(I,0)); CrLf(0)];
]</syntaxhighlight>
{{out}}
<pre>
Maximum simultaneous license use is 99 at the following time(s):
2008/10/03_08:39:34
2008/10/03_08:40:40
</pre>
 
291

edits