summaryrefslogtreecommitdiff
path: root/ghc/utils/ugen/id.c
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/utils/ugen/id.c')
-rw-r--r--ghc/utils/ugen/id.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/ghc/utils/ugen/id.c b/ghc/utils/ugen/id.c
new file mode 100644
index 0000000000..f8c02034c1
--- /dev/null
+++ b/ghc/utils/ugen/id.c
@@ -0,0 +1,49 @@
+# include "id.h"
+
+#define bool int
+#define true 1
+#define false 0
+
+char id_area[10000];
+char *id_top = &id_area[0];
+
+
+
+/*
+** Equalid returns true if the two identifiers are the same,
+** otherwise false.
+*/
+bool equalid(i1, i2)
+ id i1, i2;
+{
+ return(i1 == i2);
+}
+
+/*
+** Installid installs an identifier into the id_area.
+*/
+id installid(string)
+ char *string;
+{
+ char *startofid, *search, *s;
+
+ for(search = id_area; search < id_top;) {
+ startofid = search;
+ s = string;
+ while(*search++ == *s++) {
+ if(*search == 0 && *s == 0) {
+ return(startofid);
+ }
+ }
+ while(*search != 0)
+ search++;
+ search++;
+ }
+
+ startofid = id_top;
+ for(s = string; *s != 0;) {
+ *id_top++ = *s++;
+ }
+ *id_top++ = 0;
+ return(startofid);
+}