FROM random IMPORT Uniform;
FROM SYSTEM IMPORT BYTE, ADDRESS, NEWPROCESS, TRANSFER;
- FROM Storage IMPORT ALLOCATE, DEALLOCATE;
+ FROM Storage IMPORT Allocate, Deallocate;
IMPORT Traps;
CONST WorkSpaceSize = 1000;
BEGIN
Pop(free, newprocess);
IF newprocess = NIL THEN
- ALLOCATE(newprocess,SIZE(ProcessDescriptor));
- ALLOCATE(newprocess^.wsp, WorkSpaceSize)
+ Allocate(newprocess,SIZE(ProcessDescriptor));
+ Allocate(newprocess^.wsp, WorkSpaceSize)
END;
WITH newprocess^ DO
father := cp;
PROCEDURE InitChannel(VAR ch: Channel);
(* Initialize the channel ch *)
BEGIN
- ALLOCATE(ch, SIZE(ChannelDescriptor));
+ Allocate(ch, SIZE(ChannelDescriptor));
WITH ch^ DO
InitQueue(senders);
owner := NIL;
BEGIN
WITH ch^ DO
Push(cp, senders);
- ALLOCATE(cp^.msgadr, SIZE(data));
+ Allocate(cp^.msgadr, SIZE(data));
m := cp^.msgadr;
cp^.msglen := HIGH(data);
FOR i := 0 TO HIGH(data) DO
Push(cp, ready);
Push(aux, ready)
END;
- DEALLOCATE(aux^.msgadr, aux^.msglen+1);
+ Deallocate(aux^.msgadr, aux^.msglen+1);
DoTransfer
END
END Receive;
BEGIN
InitQueue(free);
InitQueue(ready);
- ALLOCATE(cp,SIZE(ProcessDescriptor));
+ Allocate(cp,SIZE(ProcessDescriptor));
WITH cp^ DO
sons := 0;
father := NIL
FROM Streams IMPORT Stream, StreamKind, StreamMode, StreamResult,
InputStream, OutputStream, OpenStream, CloseStream,
EndOfStream, Read, Write, StreamBuffering;
- FROM Storage IMPORT ALLOCATE;
+ FROM Storage IMPORT Allocate;
FROM SYSTEM IMPORT ADR;
TYPE charset = SET OF CHAR;
Xtext := Xtext^.next;
END;
IF Xtext = NIL THEN
- ALLOCATE(Xtext,SIZE(IOstream));
+ Allocate(Xtext,SIZE(IOstream));
Xtext^.next := head;
head := Xtext;
END;
WITH InputText^ DO
IF type # Preading THEN Error(Preading); END;
IF NOT done THEN
- Get(InputText);
- done := TRUE;
+ IF EndOfStream(stream, result) THEN
+ eof := TRUE;
+ ch := 0C;
+ ELSE
+ Read(stream, ch, result);
+ done := TRUE;
+ END;
END;
RETURN ch;
END;
END NextChar;
PROCEDURE Get(InputText: Text);
+ VAR dummy: CHAR;
BEGIN
WITH InputText^ DO
IF type # Preading THEN Error(Preading); END;
Traps.Message("unexpected EOF");
HALT;
END;
- IF EndOfStream(stream, result) THEN
- eof := TRUE;
- ch := 0C;
- ELSE
- Read(stream, ch, result);
+ IF done THEN done := FALSE;
+ ELSE dummy := NextChar(InputText);
END;
END;
END Get;
FROM SYSTEM IMPORT ADDRESS, TSIZE, NEWPROCESS, TRANSFER;
- FROM Storage IMPORT ALLOCATE;
+ FROM Storage IMPORT Allocate;
FROM Traps IMPORT Message;
wsp: ADDRESS;
BEGIN
s0 := cp;
- ALLOCATE(wsp, n);
- ALLOCATE(cp, TSIZE(ProcessDescriptor));
+ Allocate(wsp, n);
+ Allocate(cp, TSIZE(ProcessDescriptor));
WITH cp^ DO
next := s0^.next;
s0^.next := cp;
END Init;
BEGIN
- ALLOCATE(cp, TSIZE(ProcessDescriptor));
+ Allocate(cp, TSIZE(ProcessDescriptor));
WITH cp^ DO
next := cp;
ready := TRUE;
*)
FROM SYSTEM IMPORT ADDRESS, NEWPROCESS, TRANSFER;
- FROM Storage IMPORT ALLOCATE;
+ FROM Storage IMPORT Allocate;
FROM random IMPORT Uniform;
FROM Traps IMPORT Message;
wsp: ADDRESS;
BEGIN
s0 := cp;
- ALLOCATE(wsp, n);
- ALLOCATE(cp, SIZE(Process));
+ Allocate(wsp, n);
+ Allocate(cp, SIZE(Process));
WITH cp^ DO
next := s0^.next;
s0^.next := cp;
PROCEDURE NewSema(n: CARDINAL): Sema;
VAR s: Sema;
BEGIN
- ALLOCATE(s, SIZE(Semaphore));
+ Allocate(s, SIZE(Semaphore));
s^.level := n;
RETURN s;
END NewSema;
RETURN FALSE;
END Runnable;
BEGIN
- ALLOCATE(cp, SIZE(Process));
+ Allocate(cp, SIZE(Process));
WITH cp^ DO
next := cp;
waiting := NIL;
IF NOT Storage.Available(SIZE(IOB)) THEN
RETURN;
END;
- Storage.ALLOCATE(stream,SIZE(IOB));
+ Storage.Allocate(stream,SIZE(IOB));
stream^.next := head;
head := stream;
END;