/* C code produced by gperf version 2.5 (GNU C++ version) */
/* Command-line: gperf -a -p -o -t -G -D keywords */
#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include "math_defs.h"
#include "math_parser.h"
/* maximum key range = 483, duplicates = 40 */
static unsigned int
-hash (register const char *str, register int len)
+hash (register char const *str, register int len)
{
- static unsigned short asso_values[] =
+ static unsigned short asso_values[] =
{
491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
491, 491, 491, 491, 491, 491, 491, 491, 491, 491,
return len + asso_values[str[len - 1]] + asso_values[str[0]];
}
-static struct latexkeys wordlist[] =
+static struct latexkeys wordlist[] =
{
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
{"setminus", LM_TK_SYM, LM_setminus},
{"vdash", LM_TK_SYM, LM_vdash},
};
-static short lookup[] =
+static short lookup[] =
{
-1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1,
-1, 9, 10, -1, 11, -1, -1, -1, 12, -1, -1, 491, -13, -2,
};
struct latexkeys *
-in_word_set (register const char *str, register int len)
+in_word_set (register char const *str, register int len)
{
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
{
if (key <= MAX_HASH_VALUE && key >= 0)
{
- register int index = lookup[key];
+ register int idx = lookup[key];
- if (index >= 0 && index < MAX_HASH_VALUE)
+ if (idx >= 0 && idx < MAX_HASH_VALUE)
{
- register char const *s = wordlist[index].name;
+ register char const * s = wordlist[idx].name;
if (*s == *str && !strcmp (str + 1, s + 1))
- return &wordlist[index];
+ return &wordlist[idx];
}
- else if (index < 0 && index >= -MAX_HASH_VALUE)
+ else if (idx < 0 && idx >= -MAX_HASH_VALUE)
return 0;
else
{
- register int offset = key + index + (index > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
+ register int offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
register struct latexkeys *base = &wordlist[-lookup[offset]];
register struct latexkeys *ptr = base + -lookup[offset + 1];
latexkeys* l = &wordlist[MIN_HASH_VALUE+TOTAL_KEYWORDS];
latexkeys* base = &wordlist[MIN_HASH_VALUE];
while (--l >= base) {
- if (t==l->id && tk==l->token)
+ if (t == l->id && tk == l->token)
return l;
}
return 0;