Blob Blame History Raw
/* Automatically generated from ./asm/pptok.dat by ./asm/pptok.pl */
/* Do not edit */

#include "compiler.h"
#include <ctype.h>
#include "nasmlib.h"
#include "hashtbl.h"
#include "preproc.h"

const char * const pp_directives[109] = {
    "%elif",
    "%elifn",
    "%elifctx",
    "%elifnctx",
    "%elifdef",
    "%elifndef",
    "%elifempty",
    "%elifnempty",
    "%elifenv",
    "%elifnenv",
    "%elifid",
    "%elifnid",
    "%elifidn",
    "%elifnidn",
    "%elifidni",
    "%elifnidni",
    "%elifmacro",
    "%elifnmacro",
    "%elifnum",
    "%elifnnum",
    "%elifstr",
    "%elifnstr",
    "%eliftoken",
    "%elifntoken",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "%if",
    "%ifn",
    "%ifctx",
    "%ifnctx",
    "%ifdef",
    "%ifndef",
    "%ifempty",
    "%ifnempty",
    "%ifenv",
    "%ifnenv",
    "%ifid",
    "%ifnid",
    "%ifidn",
    "%ifnidn",
    "%ifidni",
    "%ifnidni",
    "%ifmacro",
    "%ifnmacro",
    "%ifnum",
    "%ifnnum",
    "%ifstr",
    "%ifnstr",
    "%iftoken",
    "%ifntoken",
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    "%arg",
    "%assign",
    "%clear",
    "%define",
    "%defstr",
    "%deftok",
    "%depend",
    "%else",
    "%endif",
    "%endm",
    "%endmacro",
    "%endrep",
    "%error",
    "%exitmacro",
    "%exitrep",
    "%fatal",
    "%iassign",
    "%idefine",
    "%idefstr",
    "%ideftok",
    "%imacro",
    "%include",
    "%irmacro",
    "%ixdefine",
    "%line",
    "%local",
    "%macro",
    "%pathsearch",
    "%pop",
    "%pragma",
    "%push",
    "%rep",
    "%repl",
    "%rmacro",
    "%rotate",
    "%stacksize",
    "%strcat",
    "%strlen",
    "%substr",
    "%undef",
    "%unimacro",
    "%unmacro",
    "%use",
    "%warning",
    "%xdefine",
};
const uint8_t pp_directives_len[109] = {
    5,
    6,
    8,
    9,
    8,
    9,
    10,
    11,
    8,
    9,
    7,
    8,
    8,
    9,
    9,
    10,
    10,
    11,
    8,
    9,
    8,
    9,
    10,
    11,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    3,
    4,
    6,
    7,
    6,
    7,
    8,
    9,
    6,
    7,
    5,
    6,
    6,
    7,
    7,
    8,
    8,
    9,
    6,
    7,
    6,
    7,
    8,
    9,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    4,
    7,
    6,
    7,
    7,
    7,
    7,
    5,
    6,
    5,
    9,
    7,
    6,
    10,
    8,
    6,
    8,
    8,
    8,
    8,
    7,
    8,
    8,
    9,
    5,
    6,
    6,
    11,
    4,
    7,
    5,
    4,
    5,
    7,
    7,
    10,
    7,
    7,
    7,
    6,
    9,
    8,
    4,
    8,
    8,
};
enum preproc_token pp_token_hash(const char *token)
{
#define UNUSED (65535/3)
    static const int16_t hash1[128] = {
        UNUSED,
        UNUSED,
        0,
        0,
        0,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        0,
        0,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        -45,
        UNUSED,
        0,
        UNUSED,
        -60,
        0,
        UNUSED,
        UNUSED,
        -42,
        UNUSED,
        UNUSED,
        -49,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        48,
        UNUSED,
        UNUSED,
        49,
        5,
        UNUSED,
        -53,
        65,
        UNUSED,
        UNUSED,
        0,
        0,
        UNUSED,
        38,
        UNUSED,
        31,
        0,
        UNUSED,
        6,
        35,
        UNUSED,
        UNUSED,
        60,
        33,
        UNUSED,
        136,
        UNUSED,
        -87,
        -12,
        42,
        17,
        0,
        130,
        -85,
        UNUSED,
        UNUSED,
        82,
        0,
        UNUSED,
        16,
        98,
        -66,
        -100,
        0,
        -10,
        -76,
        UNUSED,
        84,
        UNUSED,
        1,
        UNUSED,
        0,
        12,
        UNUSED,
        -145,
        41,
        106,
        UNUSED,
        85,
        UNUSED,
        43,
        85,
        UNUSED,
        23,
        0,
        -14,
        UNUSED,
        UNUSED,
        77,
        -2,
        UNUSED,
        UNUSED,
        11,
        91,
        -7,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        107,
        44,
        UNUSED,
    };
    static const int16_t hash2[128] = {
        UNUSED,
        0,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        80,
        0,
        64,
        UNUSED,
        0,
        0,
        0,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        64,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        121,
        0,
        UNUSED,
        22,
        100,
        63,
        UNUSED,
        114,
        UNUSED,
        178,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        -40,
        UNUSED,
        88,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        87,
        UNUSED,
        42,
        UNUSED,
        UNUSED,
        141,
        UNUSED,
        UNUSED,
        UNUSED,
        103,
        UNUSED,
        46,
        106,
        149,
        UNUSED,
        23,
        53,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        0,
        UNUSED,
        UNUSED,
        UNUSED,
        33,
        0,
        0,
        92,
        UNUSED,
        50,
        72,
        UNUSED,
        7,
        43,
        66,
        UNUSED,
        UNUSED,
        113,
        52,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        UNUSED,
        99,
        101,
        71,
        UNUSED,
        20,
        63,
        32,
        UNUSED,
        UNUSED,
        UNUSED,
        97,
        18,
        84,
        132,
        UNUSED,
        37,
        UNUSED,
        9,
        20,
        UNUSED,
        UNUSED,
        75,
        98,
        UNUSED,
    };
    uint32_t k1, k2;
    uint64_t crc;
    uint16_t ix;

    crc = crc64i(UINT64_C(0xaee7ac5ccabdec91), token);
    k1 = (uint32_t)crc;
    k2 = (uint32_t)(crc >> 32);

    ix = hash1[k1 & 0x7f] + hash2[k2 & 0x7f];
    if (ix >= 109)
        return PP_INVALID;

    if (!pp_directives[ix] || nasm_stricmp(pp_directives[ix], token))
        return PP_INVALID;

    return ix;
}