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
LtoUset.e
StrAss.c
cap.c
absd.c
absf.e
absi.c

View file

@ -117,6 +117,10 @@ IMPLEMENTATION MODULE PascalIO;
PROCEDURE ReadChar(InputText: Text; VAR ch : CHAR);
BEGIN
ch := NextChar(InputText);
IF InputText^.eof THEN
Traps.Message("unexpected EOF");
HALT;
END;
InputText^.done := FALSE;
END ReadChar;
@ -140,16 +144,7 @@ IMPLEMENTATION MODULE PascalIO;
PROCEDURE Get(InputText: Text);
VAR dummy: CHAR;
BEGIN
WITH InputText^ DO
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;
ReadChar(InputText, dummy);
END Get;
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';
}