Added cap.c

This commit is contained in:
ceriel 1988-04-05 15:27:50 +00:00
parent e566fc551d
commit f47d49b1c0
3 changed files with 22 additions and 10 deletions

View file

@ -20,6 +20,7 @@ Traps.mod
Arguments.c Arguments.c
LtoUset.e LtoUset.e
StrAss.c StrAss.c
cap.c
absd.c absd.c
absf.e absf.e
absi.c absi.c

View file

@ -117,6 +117,10 @@ IMPLEMENTATION MODULE PascalIO;
PROCEDURE ReadChar(InputText: Text; VAR ch : CHAR); PROCEDURE ReadChar(InputText: Text; VAR ch : CHAR);
BEGIN BEGIN
ch := NextChar(InputText); ch := NextChar(InputText);
IF InputText^.eof THEN
Traps.Message("unexpected EOF");
HALT;
END;
InputText^.done := FALSE; InputText^.done := FALSE;
END ReadChar; END ReadChar;
@ -140,16 +144,7 @@ IMPLEMENTATION MODULE PascalIO;
PROCEDURE Get(InputText: Text); PROCEDURE Get(InputText: Text);
VAR dummy: CHAR; VAR dummy: CHAR;
BEGIN BEGIN
WITH InputText^ DO ReadChar(InputText, dummy);
IF type # Preading THEN Error(Preading); END;
IF eof THEN
Traps.Message("unexpected EOF");
HALT;
END;
IF done THEN done := FALSE;
ELSE dummy := NextChar(InputText);
END;
END;
END Get; END Get;
PROCEDURE Eoln(InputText: Text): BOOLEAN; PROCEDURE Eoln(InputText: Text): BOOLEAN;

16
lang/m2/libm2/cap.c Normal file
View file

@ -0,0 +1,16 @@
/*
(c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
See the copyright notice in the ACK home directory, in the file "Copyright".
*/
/*
Module: cap; implementation of CAP
Author: Ceriel J.H. Jacobs
Version: $Header$
*/
cap(u)
unsigned u;
{
if (u >= 'a' && u <= 'z') u += 'A'-'a';
}