move the text of error messages from ERROR to the functions
[unix-history] / usr / src / usr.bin / pascal / libpc / NAM.c
CommitLineData
3cdfbf8d
KM
1/* Copyright (c) 1979 Regents of the University of California */
2
86997b19 3static char sccsid[] = "@(#)NAM.c 1.3 %G%";
3cdfbf8d
KM
4
5#include "h00vars.h"
3cdfbf8d
KM
6
7char *
492cc5d3 8NAM(val, name)
3cdfbf8d 9
492cc5d3 10 long val; /* internal enumerated type value */
3cdfbf8d
KM
11 char *name; /* ptr to enumerated type name descriptor */
12{
492cc5d3 13 register int value = val;
3cdfbf8d
KM
14 register short *sptr;
15
16 sptr = (short *)name;
17 if (value < 0 || value >= *sptr) {
86997b19
KM
18 ERROR("Enumerated type value of %D is out of range on output\n",
19 val);
3cdfbf8d
KM
20 return;
21 }
22 sptr++;
23 return name + 2 + sptr[value];
24}