Changeset 835
- Timestamp:
- 05/08/07 22:02:49 (2 years ago)
- Files:
-
- 1.8.3/branches/experimental/src/funmath.c (modified) (1 diff)
- 1.8.3/branches/experimental/src/lmath.c (modified) (8 diffs)
- 1.8.3/branches/experimental/src/lmath.gperf (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.8.3/branches/experimental/src/funmath.c
r834 r835 1657 1657 nptr = list2arr(ptr, BUFFER_LEN, args[1], sep); 1658 1658 1659 op = math_hash_lookup(args[0] );1659 op = math_hash_lookup(args[0], arglens[0]); 1660 1660 1661 1661 if (!op) { 1.8.3/branches/experimental/src/lmath.c
r834 r835 132 132 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 133 133 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, 136 136 54, 54, 0, 15, 5, 30, 54, 54, 25, 54, 137 137 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, 139 139 0, 0, 54, 54, 0, 15, 5, 30, 54, 54, 140 140 25, 54, 54, 54, 54, 54, 54, 54, 54, 54, … … 160 160 #endif 161 161 struct math * 162 find_mathfunc(register const char *str, register unsigned int len)162 math_hash_lookup (register const char *str, register unsigned int len) 163 163 { 164 164 enum … … 173 173 static unsigned char lengthtable[] = 174 174 { 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, 177 177 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, 8178 0, 3, 0, 0, 0, 0, 3, 4, 0, 0, 0, 3 179 179 }; 180 180 static struct math wordlist[] = … … 190 190 #line 60 "lmath.gperf" 191 191 {"NAND", math_nand}, 192 {""}, {""}, {""}, 192 {""}, 193 #line 52 "lmath.gperf" 194 {"FLOORDIV", math_floordiv}, 195 {""}, 193 196 #line 53 "lmath.gperf" 194 197 {"MOD", math_modulo}, … … 210 213 #line 65 "lmath.gperf" 211 214 {"BOR", math_bor}, 212 #line 48 "lmath.gperf" 213 {"ADD ", math_add}, 214 {""}, 215 {""}, {""}, 215 216 #line 70 "lmath.gperf" 216 217 {"STDDEV", math_stddev}, … … 226 227 {"FDIV", math_fdiv}, 227 228 {""}, {""}, {""}, 228 #line 51"lmath.gperf"229 {" DIV", math_div},229 #line 48 "lmath.gperf" 230 {"ADD", math_add}, 230 231 {""}, {""}, {""}, {""}, 231 232 #line 50 "lmath.gperf" … … 237 238 {"BXOR", math_bxor}, 238 239 {""}, {""}, {""}, 239 #line 5 2"lmath.gperf"240 {" FLOORDIV", math_floordiv}240 #line 51 "lmath.gperf" 241 {"DIV", math_div} 241 242 }; 242 243 … … 261 262 typedef struct math MATH; 262 263 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 2 2 %language=ANSI-C 3 3 %define hash-function-name math_hash 4 %define lookup-function-name find_mathfunc4 %define lookup-function-name math_hash_lookup 5 5 /* %readonly-tables */ 6 6 %enum … … 73 73 typedef struct math MATH; 74 74 75 static MATH * 76 math_hash_lookup(const char *name) 77 { 78 return find_mathfunc(name, strlen(name)); 79 } 75
