PennMUSH Community

Changeset 835

Show
Ignore:
Timestamp:
05/08/07 22:02:49 (2 years ago)
Author:
shawnw
Message:

expr: #7321: lmath tweak

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.8.3/branches/experimental/src/funmath.c

    r834 r835  
    16571657  nptr = list2arr(ptr, BUFFER_LEN, args[1], sep); 
    16581658 
    1659   op = math_hash_lookup(args[0]); 
     1659  op = math_hash_lookup(args[0], arglens[0]); 
    16601660 
    16611661  if (!op) { 
  • 1.8.3/branches/experimental/src/lmath.c

    r834 r835  
    132132      54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 
    133133      54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 
    134       54, 54, 54, 54, 54,  5, 20, 54, 15,  5, 
    135       15, 54, 54, 20, 54, 54, 30, 10,  0,  0, 
     134      54, 54, 54, 54, 54,  5, 20, 54, 30,  5, 
     135      0, 54, 54, 20, 54, 54,  3, 10,  0,  0, 
    136136      54, 54,  0, 15,  5, 30, 54, 54, 25, 54, 
    137137      54, 54, 54, 54, 54, 54, 54,  5, 20, 54, 
    138       15,  5, 15, 54, 54, 20, 54, 54, 30, 10, 
     138      30,  5,  0, 54, 54, 20, 54, 54,  3, 10, 
    139139       0,  0, 54, 54,  0, 15,  5, 30, 54, 54, 
    140140      25, 54, 54, 54, 54, 54, 54, 54, 54, 54, 
     
    160160#endif 
    161161struct math * 
    162 find_mathfunc (register const char *str, register unsigned int len) 
     162math_hash_lookup (register const char *str, register unsigned int len) 
    163163{ 
    164164  enum 
     
    173173  static unsigned char lengthtable[] = 
    174174    { 
    175        0,  0,  2,  3,  0,  0,  0,  0,  3,  4,  0,  0,  0,  3, 
    176        9,  0,  6,  7,  3,  4,  0,  6,  0,  3,  4,  0,  6,  0, 
     175       0,  0,  2,  3,  0,  0,  0,  0,  3,  4,  0,  8,  0,  3, 
     176       9,  0,  6,  7,  3,  4,  0,  6,  0,  3,  0,  0,  6,  0, 
    177177       3,  4,  0,  0,  0,  3,  4,  0,  0,  0,  3,  0,  0,  0, 
    178        0,  3,  0,  0,  0,  0,  3,  4,  0,  0,  0,  8 
     178       0,  3,  0,  0,  0,  0,  3,  4,  0,  0,  0,  3 
    179179    }; 
    180180  static struct math wordlist[] = 
     
    190190#line 60 "lmath.gperf" 
    191191      {"NAND", math_nand}, 
    192       {""}, {""}, {""}, 
     192      {""}, 
     193#line 52 "lmath.gperf" 
     194      {"FLOORDIV", math_floordiv}, 
     195      {""}, 
    193196#line 53 "lmath.gperf" 
    194197      {"MOD", math_modulo}, 
     
    210213#line 65 "lmath.gperf" 
    211214      {"BOR", math_bor}, 
    212 #line 48 "lmath.gperf" 
    213       {"ADD ", math_add}, 
    214       {""}, 
     215      {""}, {""}, 
    215216#line 70 "lmath.gperf" 
    216217      {"STDDEV", math_stddev}, 
     
    226227      {"FDIV", math_fdiv}, 
    227228      {""}, {""}, {""}, 
    228 #line 51 "lmath.gperf" 
    229       {"DIV", math_div}, 
     229#line 48 "lmath.gperf" 
     230      {"ADD", math_add}, 
    230231      {""}, {""}, {""}, {""}, 
    231232#line 50 "lmath.gperf" 
     
    237238      {"BXOR", math_bxor}, 
    238239      {""}, {""}, {""}, 
    239 #line 52 "lmath.gperf" 
    240       {"FLOORDIV", math_floordiv} 
     240#line 51 "lmath.gperf" 
     241      {"DIV", math_div} 
    241242    }; 
    242243 
     
    261262typedef struct math MATH; 
    262263 
    263 static MATH * 
    264 math_hash_lookup(const char *name) 
    265 
    266   return find_mathfunc(name, strlen(name)); 
    267 
     264 
  • 1.8.3/branches/experimental/src/lmath.gperf

    r834 r835  
    22%language=ANSI-C 
    33%define hash-function-name math_hash 
    4 %define lookup-function-name find_mathfunc 
     4%define lookup-function-name math_hash_lookup 
    55/* %readonly-tables */ 
    66%enum  
     
    7373typedef struct math MATH; 
    7474 
    75 static MATH * 
    76 math_hash_lookup(const char *name) 
    77 
    78   return find_mathfunc(name, strlen(name)); 
    79 
     75