summaryrefslogtreecommitdiff
path: root/ACE/apps/gperf/tests/test-4.exp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/apps/gperf/tests/test-4.exp')
-rw-r--r--ACE/apps/gperf/tests/test-4.exp170
1 files changed, 170 insertions, 0 deletions
diff --git a/ACE/apps/gperf/tests/test-4.exp b/ACE/apps/gperf/tests/test-4.exp
new file mode 100644
index 00000000000..a6077d4fd69
--- /dev/null
+++ b/ACE/apps/gperf/tests/test-4.exp
@@ -0,0 +1,170 @@
+/* C code produced by gperf version 2.8 (ACE version) */
+/* Command-line: ../src/gperf -D -p -t */
+/* Command-line: gperf -p -j1 -i 1 -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
+#include <string.h>
+struct resword { const char *name; short token; enum rid rid; };
+
+#define TOTAL_KEYWORDS 51
+#define MIN_WORD_LENGTH 2
+#define MAX_WORD_LENGTH 13
+#define MIN_HASH_VALUE 4
+#define MAX_HASH_VALUE 82
+#define HASH_VALUE_RANGE 79
+#define DUPLICATES 3
+#define WORDLIST_SIZE 55
+
+static unsigned int
+hash (str, len)
+ char *str;
+ unsigned int len;
+{
+ static unsigned char asso_values[] =
+ {
+#if defined (ACE_MVS)
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 0,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 40,
+ 20, 50, 25, 10, 30, 0, 0, 50, 83, 83,
+ 83, 83, 83, 83, 83, 83, 0, 15, 0, 35,
+ 0, 83, 83, 20, 83, 83, 83, 83, 83, 83,
+ 83, 83, 0, 10, 40, 5, 15, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83,
+#else
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
+ 83, 83, 83, 83, 83, 0, 83, 40, 20, 50,
+ 25, 10, 30, 0, 0, 50, 83, 0, 15, 0,
+ 35, 0, 83, 83, 20, 0, 10, 40, 5, 15,
+ 83, 83, 83, 83, 83, 83, 83, 83,
+#endif /* ACE_MVS */
+ };
+ return len + asso_values[(int) str[len - 1]] + asso_values[(int) str[0]];
+}
+
+struct resword *
+in_word_set (str, len)
+ char *str;
+ unsigned int len;
+{
+ static struct resword wordlist[] =
+ {
+ {"",},{"",},{"",},{"",},
+ {"goto", GOTO, NORID},
+ {"__asm", ASM, NORID},
+ {"switch", SWITCH, NORID},
+ {"__asm__", ASM, NORID},
+ {"__const__", TYPE_QUAL, RID_CONST},
+ {"__inline__", SCSPEC, RID_INLINE},
+ {"__typeof__", TYPEOF, NORID},
+ {"__signed__", TYPESPEC, RID_SIGNED},
+ {"__alignof__", ALIGNOF, NORID},
+ {"__volatile__", TYPE_QUAL, RID_VOLATILE},
+ {"__attribute__", ATTRIBUTE, NORID},
+ {"enum", ENUM, NORID},
+ {"short", TYPESPEC, RID_SHORT},
+ {"struct", STRUCT, NORID},
+ {"__const", TYPE_QUAL, RID_CONST},
+ {"__inline", SCSPEC, RID_INLINE},
+ {"long", TYPESPEC, RID_LONG},
+ {"__volatile", TYPE_QUAL, RID_VOLATILE},
+ {"__attribute", ATTRIBUTE, NORID},
+ {"volatile", TYPE_QUAL, RID_VOLATILE},
+ {"else", ELSE, NORID},
+ {"break", BREAK, NORID},
+ {"do", DO, NORID},
+ {"while", WHILE, NORID},
+ {"signed", TYPESPEC, RID_SIGNED},
+ {"__signed", TYPESPEC, RID_SIGNED},
+ {"void", TYPESPEC, RID_VOID},
+ {"sizeof", SIZEOF, NORID},
+ {"__typeof", TYPEOF, NORID},
+ {"__alignof", ALIGNOF, NORID},
+ {"double", TYPESPEC, RID_DOUBLE},
+ {"default", DEFAULT, NORID},
+ {"asm", ASM, NORID},
+ {"auto", SCSPEC, RID_AUTO},
+ {"float", TYPESPEC, RID_FLOAT},
+ {"typeof", TYPEOF, NORID},
+ {"typedef", SCSPEC, RID_TYPEDEF},
+ {"register", SCSPEC, RID_REGISTER},
+ {"extern", SCSPEC, RID_EXTERN},
+ {"for", FOR, NORID},
+ {"static", SCSPEC, RID_STATIC},
+ {"return", RETURN, NORID},
+ {"int", TYPESPEC, RID_INT},
+ {"case", CASE, NORID},
+ {"const", TYPE_QUAL, RID_CONST},
+ {"inline", SCSPEC, RID_INLINE},
+ {"continue", CONTINUE, NORID},
+ {"unsigned", TYPESPEC, RID_UNSIGNED},
+ {"char", TYPESPEC, RID_CHAR},
+ {"union", UNION, NORID},
+ {"if", IF, NORID},
+ };
+
+ static signed char lookup[] =
+ {
+ -1, -1, -9, -3, 4, 5, 6, 7, -1, 8, -90, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, -1, 23, 24, 25, -1, 26,
+ -1, -1, 27, 28, -1, 29, 30, -1, 31, -1, 32, 33, -1, 34,
+ 35, 36, 37, 38, 39, 40, 41, -1, -1, 42, -1, 43, -1, -1,
+ 44, -1, -1, -1, -1, 45, -1, 46, 47, 48, 49, -1, 50, -1,
+ -1, -1, -1, 51, 52, -1, -1, -1, -1, -1, 53, -1, 54,
+ };
+
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
+ {
+ unsigned int key = hash (str, len);
+
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+ {
+ int slot = lookup[key];
+
+ if (slot >= 0 && slot < WORDLIST_SIZE)
+ {
+ char *s = wordlist[slot].name;
+
+ if (*str == *s && !strcmp (str + 1, s + 1))
+ return &wordlist[slot];
+ }
+ else if (slot < 0 && slot >= -MAX_HASH_VALUE)
+ return 0;
+ else
+ {
+ unsigned int offset = key + slot + (slot > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
+ struct resword *base = &wordlist[-lookup[offset]];
+ struct resword *ptr = base + -lookup[offset + 1];
+
+ while (--ptr >= base)
+ if (*str == *ptr->name && !strcmp (str + 1, ptr->name + 1))
+ return ptr;
+ }
+ }
+ }
+ return 0;
+}