aboutsummaryrefslogtreecommitdiffstats
path: root/keywords.c
diff options
context:
space:
mode:
authornop <nop>1997-03-03 04:18:21 +0000
committernop <nop>1997-03-03 04:18:21 +0000
commit9cf5366eb0435a19fbc233d53765bb9aeae85be2 (patch)
tree2604ca1ea3ddf09fec07c7c26cea22637c23b5fa /keywords.c
parenta515162931c35db517995e3427cb41cee2a63a0a (diff)
downloadmoo-cvs-9cf5366eb0435a19fbc233d53765bb9aeae85be2.tar.gz
moo-cvs-9cf5366eb0435a19fbc233d53765bb9aeae85be2.tar.xz
moo-cvs-9cf5366eb0435a19fbc233d53765bb9aeae85be2.zip
GNU Indent normalization
Diffstat (limited to 'keywords.c')
-rw-r--r--keywords.c257
1 files changed, 154 insertions, 103 deletions
diff --git a/keywords.c b/keywords.c
index a8c6725..ed2f166 100644
--- a/keywords.c
+++ b/keywords.c
@@ -36,130 +36,178 @@
#define MAX_HASH_VALUE 106
/*
35 keywords
- 104 is the maximum key range
-*/
+ 104 is the maximum key range
+ */
static int
-hash (register const char *str, register int len)
+hash(register const char *str, register int len)
{
- static const unsigned char hash_table[] =
+ static const unsigned char hash_table[] =
{
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
- 106, 106, 106, 106, 106, 106, 106, 10, 0, 45,
- 0, 0, 0, 10, 106, 45, 106, 10, 106, 35,
- 5, 106, 5, 10, 0, 25, 55, 106, 35, 5,
- 106, 10, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
+ 106, 106, 106, 106, 106, 106, 106, 10, 0, 45,
+ 0, 0, 0, 10, 106, 45, 106, 10, 106, 35,
+ 5, 106, 5, 10, 0, 25, 55, 106, 35, 5,
+ 106, 10, 106, 106, 106, 106, 106, 106,
};
- register int hval = len;
-
- switch (hval)
- {
- default:
- case 3:
- hval += hash_table[tolower((unsigned char) str[2])];
- case 2:
- case 1:
- hval += hash_table[tolower((unsigned char) str[0])];
+ register int hval = len;
+
+ switch (hval) {
+ default:
+ case 3:
+ hval += hash_table[tolower((unsigned char) str[2])];
+ case 2:
+ case 1:
+ hval += hash_table[tolower((unsigned char) str[0])];
}
- return hval + hash_table[tolower((unsigned char) str[len - 1])];
+ return hval + hash_table[tolower((unsigned char) str[len - 1])];
}
static int
-case_strcmp (register const char *str, register const char *key)
+case_strcmp(register const char *str, register const char *key)
{
- int ans = 0;
+ int ans = 0;
- while (!(ans = tolower(*str) - (int) *key) && *str)
- str++, key++;
+ while (!(ans = tolower(*str) - (int) *key) && *str)
+ str++, key++;
- return ans;
+ return ans;
}
const struct keyword *
-in_word_set (register const char *str, register int len)
+in_word_set(register const char *str, register int len)
{
- static const struct keyword wordlist[] =
+ static const struct keyword wordlist[] =
{
- {"",}, {"",}, {"",},
- {"for", DBV_Prehistory, tFOR},
- {"",},
- {"endif", DBV_Prehistory, tENDIF},
- {"endfor", DBV_Prehistory, tENDFOR},
- {"e_range", DBV_Prehistory, tERROR, E_RANGE},
- {"endwhile", DBV_Prehistory, tENDWHILE},
- {"e_recmove", DBV_Prehistory, tERROR, E_RECMOVE},
- {"",},
- {"e_none", DBV_Prehistory, tERROR, E_NONE},
- {"",},
- {"e_propnf", DBV_Prehistory, tERROR, E_PROPNF},
- {"fork", DBV_Prehistory, tFORK},
- {"break", DBV_BreakCont, tBREAK},
- {"endtry", DBV_Exceptions, tENDTRY},
- {"endfork", DBV_Prehistory, tENDFORK},
- {"",}, {"",}, {"",}, {"",},
- {"finally", DBV_Exceptions, tFINALLY},
- {"",}, {"",}, {"",}, {"",},
- {"e_quota", DBV_Prehistory, tERROR, E_QUOTA},
- {"",},
- {"else", DBV_Prehistory, tELSE},
- {"",},
- {"elseif", DBV_Prehistory, tELSEIF},
- {"",},
- {"any", DBV_Exceptions, tANY},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"e_div", DBV_Prehistory, tERROR, E_DIV},
- {"e_args", DBV_Prehistory, tERROR, E_ARGS},
- {"e_varnf", DBV_Prehistory, tERROR, E_VARNF},
- {"e_verbnf", DBV_Prehistory, tERROR, E_VERBNF},
- {"",}, {"",},
- {"e_perm", DBV_Prehistory, tERROR, E_PERM},
- {"if", DBV_Prehistory, tIF},
- {"",}, {"",}, {"",}, {"",},
- {"in", DBV_Prehistory, tIN},
- {"e_invind", DBV_Prehistory, tERROR, E_INVIND},
- {"",},
- {"while", DBV_Prehistory, tWHILE},
- {"e_nacc", DBV_Prehistory, tERROR, E_NACC},
- {"",},
- {"continue", DBV_BreakCont, tCONTINUE},
- {"",}, {"",},
- {"e_type", DBV_Prehistory, tERROR, E_TYPE},
- {"e_float", DBV_Float, tERROR, E_FLOAT},
- {"e_invarg", DBV_Prehistory, tERROR, E_INVARG},
- {"",}, {"",},
- {"return", DBV_Prehistory, tRETURN},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"",}, {"",},
- {"try", DBV_Exceptions, tTRY},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"e_maxrec", DBV_Prehistory, tERROR, E_MAXREC},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
- {"except", DBV_Exceptions, tEXCEPT},
+ {"",},
+ {"",},
+ {"",},
+ {"for", DBV_Prehistory, tFOR},
+ {"",},
+ {"endif", DBV_Prehistory, tENDIF},
+ {"endfor", DBV_Prehistory, tENDFOR},
+ {"e_range", DBV_Prehistory, tERROR, E_RANGE},
+ {"endwhile", DBV_Prehistory, tENDWHILE},
+ {"e_recmove", DBV_Prehistory, tERROR, E_RECMOVE},
+ {"",},
+ {"e_none", DBV_Prehistory, tERROR, E_NONE},
+ {"",},
+ {"e_propnf", DBV_Prehistory, tERROR, E_PROPNF},
+ {"fork", DBV_Prehistory, tFORK},
+ {"break", DBV_BreakCont, tBREAK},
+ {"endtry", DBV_Exceptions, tENDTRY},
+ {"endfork", DBV_Prehistory, tENDFORK},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"finally", DBV_Exceptions, tFINALLY},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"e_quota", DBV_Prehistory, tERROR, E_QUOTA},
+ {"",},
+ {"else", DBV_Prehistory, tELSE},
+ {"",},
+ {"elseif", DBV_Prehistory, tELSEIF},
+ {"",},
+ {"any", DBV_Exceptions, tANY},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"e_div", DBV_Prehistory, tERROR, E_DIV},
+ {"e_args", DBV_Prehistory, tERROR, E_ARGS},
+ {"e_varnf", DBV_Prehistory, tERROR, E_VARNF},
+ {"e_verbnf", DBV_Prehistory, tERROR, E_VERBNF},
+ {"",},
+ {"",},
+ {"e_perm", DBV_Prehistory, tERROR, E_PERM},
+ {"if", DBV_Prehistory, tIF},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"in", DBV_Prehistory, tIN},
+ {"e_invind", DBV_Prehistory, tERROR, E_INVIND},
+ {"",},
+ {"while", DBV_Prehistory, tWHILE},
+ {"e_nacc", DBV_Prehistory, tERROR, E_NACC},
+ {"",},
+ {"continue", DBV_BreakCont, tCONTINUE},
+ {"",},
+ {"",},
+ {"e_type", DBV_Prehistory, tERROR, E_TYPE},
+ {"e_float", DBV_Float, tERROR, E_FLOAT},
+ {"e_invarg", DBV_Prehistory, tERROR, E_INVARG},
+ {"",},
+ {"",},
+ {"return", DBV_Prehistory, tRETURN},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"try", DBV_Exceptions, tTRY},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"e_maxrec", DBV_Prehistory, tERROR, E_MAXREC},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"",},
+ {"except", DBV_Exceptions, tEXCEPT},
};
- if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
- {
- register int key = hash (str, len);
+ if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) {
+ register int key = hash(str, len);
- if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
- {
- register const char *s = wordlist[key].name;
+ if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) {
+ register const char *s = wordlist[key].name;
- if (*s == tolower(*str) && !case_strcmp (str + 1, s + 1))
- return &wordlist[key];
- }
+ if (*s == tolower(*str) && !case_strcmp(str + 1, s + 1))
+ return &wordlist[key];
+ }
}
- return 0;
+ return 0;
}
const struct keyword *
@@ -171,9 +219,12 @@ find_keyword(const char *word)
char rcsid_keywords[] = "$Id$";
/* $Log$
-/* Revision 1.1 1997/03/03 03:45:00 nop
-/* Initial revision
+/* Revision 1.2 1997/03/03 04:18:45 nop
+/* GNU Indent normalization
/*
+ * Revision 1.1.1.1 1997/03/03 03:45:00 nop
+ * LambdaMOO 1.8.0p5
+ *
* Revision 2.2 1996/02/08 06:33:21 pavel
* Added `break', `continue', and E_FLOAT. Updated copyright notice for 1996.
* Release 1.8.0beta1.