Main Page | Class List | Directories | File List | Class Members | File Members

keywhash.c File Reference

Go to the source code of this file.

Defines

#define SLCONST   const
#define MIN_HASH_VALUE   2
#define MAX_HASH_VALUE   151
#define MIN_KEYWORD_LEN   2
#define MAX_KEYWORD_LEN   11

Typedefs

struct {
   char *   name
   unsigned int   type
   unsigned int   sizeof_type
   double(*   to_double_fun )(VOID_STAR)
   char *   name
   SLtt_Char_Type   color
   char *   msg
   int   sys_errno
   char *   symbolic_name
   char   name [3]
   int   offset
Keyword_Table_Type

Functions

static unsigned char keyword_hash (char *s, unsigned int len)
static Keyword_Table_Typeis_keyword (char *str, unsigned int len)

Variables

static SLCONST unsigned char Keyword_Hash_Table [256]
static Keyword_Table_Type Keyword_Table []


Define Documentation

#define MAX_HASH_VALUE   151
 

Definition at line 8 of file keywhash.c.

Referenced by is_keyword().

#define MAX_KEYWORD_LEN   11
 

Definition at line 10 of file keywhash.c.

Referenced by is_keyword().

#define MIN_HASH_VALUE   2
 

Definition at line 7 of file keywhash.c.

Referenced by is_keyword().

#define MIN_KEYWORD_LEN   2
 

Definition at line 9 of file keywhash.c.

Referenced by is_keyword().

#define SLCONST   const
 

Definition at line 5 of file keywhash.c.

Referenced by _pcre_compile_1(), _pSLerr_init_interp_exceptions(), get_op_token(), init_acs(), init_exceptions(), and map_or_contract_array().


Typedef Documentation

typedef { ... } Keyword_Table_Type
 


Function Documentation

static Keyword_Table_Type* is_keyword char *  str,
unsigned int  len
[static]
 

Definition at line 206 of file keywhash.c.

References keyword_hash(), Keyword_Table, MAX_HASH_VALUE, MAX_KEYWORD_LEN, MIN_HASH_VALUE, MIN_KEYWORD_LEN, and name.

Referenced by get_ident_token().

00207 {
00208    unsigned int hash;
00209    char *name;
00210    Keyword_Table_Type *kw;
00211 
00212    if ((len < MIN_KEYWORD_LEN)
00213        || (len > MAX_KEYWORD_LEN))
00214      return NULL;
00215 
00216    hash = keyword_hash (str, len);
00217    if ((hash > MAX_HASH_VALUE) || (hash < MIN_HASH_VALUE))
00218      return NULL;
00219 
00220    kw = &Keyword_Table[hash - MIN_HASH_VALUE];
00221    if ((NULL != (name = kw->name))
00222        && (*str == *name)
00223        && (0 == strcmp (str, name)))
00224      return kw;
00225    return NULL;
00226 }

static unsigned char keyword_hash char *  s,
unsigned int  len
[static]
 

Definition at line 32 of file keywhash.c.

References Keyword_Hash_Table.

Referenced by is_keyword().

00033 {
00034    unsigned int sum;
00035 
00036    sum = len;
00037    while (len)
00038      {
00039         len--;
00040         sum += (unsigned int) Keyword_Hash_Table [(unsigned char)s[len]];
00041      }
00042    return sum;
00043 }


Variable Documentation

SLCONST unsigned char Keyword_Hash_Table[256] [static]
 

Initial value:

{
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152,  15, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
   10,  15,  25,  30,  35, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152,   0,   0, 152,   0, 152, 152, 152,   5, 152,   0,   0, 152, 152,   0, 
  152, 152,   0,   0,   0,   0, 152, 152,   0, 152, 152, 152, 152, 152, 152,   5, 
  152,   5,   5,  20,  15,   0,   0,   0,  55,  25, 152,   0,  30,  10,  15,   0, 
   15, 152,   0,   0,   0,  50,   0,   0,   5,  20, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 
  152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152
}

Definition at line 12 of file keywhash.c.

Referenced by keyword_hash().

Keyword_Table_Type Keyword_Table[] [static]
 

Definition at line 52 of file keywhash.c.

Referenced by is_keyword().

char* name
 

Definition at line 47 of file keywhash.c.

unsigned int type
 

Definition at line 48 of file keywhash.c.

Referenced by _pSLang_is_ref_initialized(), _pSLang_peek_at_stack2(), _pSLang_pop_struct(), _pSLarray_free_array_elements(), _pSLcheck_identifier_syntax(), _pSLcompile_byte_compiled(), add_destroy_method(), add_string_method(), add_unary_op_intrin(), assignment_expression(), assoc_get_values(), check_for_lvalue(), class_id_intrinsic(), class_type_intrinsic(), compile_assign(), create_struct(), dereference_object(), do_binary_function(), do_multiple_assignment(), do_struct_method(), execute_intrinsic_fun(), find_empty_class_slot(), get_ident_token(), get_number_token(), get_op_token(), intrin_type_info1(), is_datatype_numeric_intrinsic(), is_numeric_intrinsic(), is_struct_type(), is_struct_type1(), lang_do_loops(), main(), make_unit_object(), map_token_to_string(), pop_array(), pop_ctrl_integer(), postfix_expression(), push_create_new_array(), push_struct_field(), set_struct_lvalue(), simple_expression(), SLang_peek_at_stack1_n(), SLexecute_function(), statement(), unary_expression(), and write_map().


© sourcejam.com 2005-2008