xref: /csrg-svn/usr.bin/pascal/libpc/PRED.c (revision 3858)
11675Smckusick /* Copyright (c) 1979 Regents of the University of California */
21675Smckusick 
3*3858Smckusic static char sccsid[] = "@(#)PRED.c 1.3 06/08/81";
41675Smckusick 
51675Smckusick #include "h01errs.h"
61675Smckusick 
73017Smckusic long
81675Smckusick PRED(value, lower, upper)
91675Smckusick 
103017Smckusic 	long	value;
113017Smckusic 	long	lower;
123017Smckusic 	long	upper;
131675Smckusick {
14*3858Smckusic 	if (value == lower) {
15*3858Smckusic 		ERROR("Cannot take pred of first element of a range\n");
16*3858Smckusic 		return;
17*3858Smckusic 	}
181675Smckusick 	value--;
191675Smckusick 	if (value < lower || value > upper) {
20*3858Smckusic 		ERROR("Value of %D is out of range\n", value);
211675Smckusick 		return;
221675Smckusick 	}
231675Smckusick 	return	value;
241675Smckusick }
25