[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / utils / ugen / id.c
1 # include "id.h"
2
3 #define bool int
4 #define true 1
5 #define false 0
6
7 char id_area[10000];
8 char *id_top = &id_area[0];
9
10
11
12 /*
13 **      Equalid returns true if the two identifiers are the same,
14 **      otherwise false.
15 */
16 bool equalid(i1, i2)
17     id i1, i2;
18 {
19         return(i1 == i2);
20 }
21
22 /*
23 **      Installid installs an identifier into the id_area.
24 */
25 id installid(string)
26     char *string;
27 {
28         char    *startofid, *search, *s;
29
30         for(search = id_area; search < id_top;) {
31                 startofid = search;
32                 s = string;
33                 while(*search++ == *s++) {
34                         if(*search == 0 && *s == 0) {
35                                 return(startofid);
36                         }
37                 }
38                 while(*search != 0)
39                         search++;
40                 search++;
41         }
42
43         startofid = id_top;
44         for(s = string; *s != 0;) {
45                 *id_top++ = *s++;
46         }
47         *id_top++ = 0;
48         return(startofid);
49 }