File readme.md changed (mode: 100644) (index 7e11dd0..df630f4) |
... |
... |
All of these options are off by default. |
73 |
73 |
`shadow` | When enabled this checks if a local variable name is same as a previously defined global variable name. |
`shadow` | When enabled this checks if a local variable name is same as a previously defined global variable name. |
74 |
74 |
`checkglobalsinit` | When enabled pjass checks for potentially usage uninitialized global variables. |
`checkglobalsinit` | When enabled pjass checks for potentially usage uninitialized global variables. |
75 |
75 |
`checkstringhash` | When enabled pjass checks for calls to `StringHash` and reports when two different strings hash to the same integer. |
`checkstringhash` | When enabled pjass checks for calls to `StringHash` and reports when two different strings hash to the same integer. |
76 |
|
`noruntimeerror` | When enabled pjass ignores all runtime errors. Runtime errors are wrong usage of specific natives for example. |
|
77 |
|
`nosemanticerror` | When enabled pjass ignores all semantic errors. This is/was used to be able to check the memhack scripts. |
|
78 |
|
`nosyntaxerror` | When enabled pjass ignores all syntax errors. |
|
|
76 |
|
`noruntimeerror` | When enabled pjass ignores all runtime errors. Runtime errors are wrong usage of specific natives for example. |
|
77 |
|
`nosemanticerror` | When enabled pjass ignores all semantic errors. This is/was used to be able to check the memhack scripts. |
|
78 |
|
`nosyntaxerror` | When enabled pjass ignores all syntax errors. |
79 |
79 |
|
|
80 |
80 |
# Building |
# Building |
81 |
81 |
|
|
File sstrhash.c changed (mode: 100644) (index 4c51b6c..2da9278) |
2 |
2 |
|
|
3 |
3 |
#include <stdint.h> |
#include <stdint.h> |
4 |
4 |
|
|
5 |
|
typedef uint32_t ub4; /* unsigned 4-byte quantities */ |
|
6 |
|
typedef uint8_t ub1; /* unsigned 1-byte quantities */ |
|
7 |
|
|
|
8 |
5 |
#define mix(a,b,c) \ |
#define mix(a,b,c) \ |
9 |
6 |
{ \ |
{ \ |
10 |
7 |
a -= b; a -= c; a ^= (c>>13); \ |
a -= b; a -= c; a ^= (c>>13); \ |
|
... |
... |
typedef uint8_t ub1; /* unsigned 1-byte quantities */ |
18 |
15 |
c -= a; c -= b; c ^= (b>>15); \ |
c -= a; c -= b; c ^= (b>>15); \ |
19 |
16 |
} |
} |
20 |
17 |
|
|
21 |
|
static ub4 hash( k, length, initval) |
|
22 |
|
register ub1 *k; /* the key */ |
|
23 |
|
register ub4 length; /* the length of the key */ |
|
24 |
|
register ub4 initval; /* the previous hash, or an arbitrary value */ |
|
|
18 |
|
static uint32_t hash(k, length, initval) |
|
19 |
|
register uint8_t *k; /* the key */ |
|
20 |
|
register uint32_t length; /* the length of the key */ |
|
21 |
|
register uint32_t initval; /* the previous hash, or an arbitrary value */ |
25 |
22 |
{ |
{ |
26 |
|
register ub4 a,b,c,len; |
|
|
23 |
|
register uint32_t a,b,c,len; |
27 |
24 |
|
|
28 |
25 |
/* Set up the internal state */ |
/* Set up the internal state */ |
29 |
26 |
len = length; |
len = length; |
|
... |
... |
register ub4 initval; /* the previous hash, or an arbitrary value */ |
33 |
30 |
/*---------------------------------------- handle most of the key */ |
/*---------------------------------------- handle most of the key */ |
34 |
31 |
while (len >= 12) |
while (len >= 12) |
35 |
32 |
{ |
{ |
36 |
|
a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24)); |
|
37 |
|
b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24)); |
|
38 |
|
c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24)); |
|
|
33 |
|
a += (k[0] +((uint32_t)k[1]<<8) +((uint32_t)k[2]<<16) +((uint32_t)k[3]<<24)); |
|
34 |
|
b += (k[4] +((uint32_t)k[5]<<8) +((uint32_t)k[6]<<16) +((uint32_t)k[7]<<24)); |
|
35 |
|
c += (k[8] +((uint32_t)k[9]<<8) +((uint32_t)k[10]<<16)+((uint32_t)k[11]<<24)); |
39 |
36 |
mix(a,b,c); |
mix(a,b,c); |
40 |
37 |
k += 12; len -= 12; |
k += 12; len -= 12; |
41 |
38 |
} |
} |
|
... |
... |
register ub4 initval; /* the previous hash, or an arbitrary value */ |
44 |
41 |
c += length; |
c += length; |
45 |
42 |
switch(len) /* all the case statements fall through */ |
switch(len) /* all the case statements fall through */ |
46 |
43 |
{ |
{ |
47 |
|
case 11: c+=((ub4)k[10]<<24); |
|
48 |
|
case 10: c+=((ub4)k[9]<<16); |
|
49 |
|
case 9 : c+=((ub4)k[8]<<8); |
|
|
44 |
|
case 11: c+=((uint32_t)k[10]<<24); |
|
45 |
|
case 10: c+=((uint32_t)k[9]<<16); |
|
46 |
|
case 9 : c+=((uint32_t)k[8]<<8); |
50 |
47 |
/* the first byte of c is reserved for the length */ |
/* the first byte of c is reserved for the length */ |
51 |
|
case 8 : b+=((ub4)k[7]<<24); |
|
52 |
|
case 7 : b+=((ub4)k[6]<<16); |
|
53 |
|
case 6 : b+=((ub4)k[5]<<8); |
|
|
48 |
|
case 8 : b+=((uint32_t)k[7]<<24); |
|
49 |
|
case 7 : b+=((uint32_t)k[6]<<16); |
|
50 |
|
case 6 : b+=((uint32_t)k[5]<<8); |
54 |
51 |
case 5 : b+=k[4]; |
case 5 : b+=k[4]; |
55 |
|
case 4 : a+=((ub4)k[3]<<24); |
|
56 |
|
case 3 : a+=((ub4)k[2]<<16); |
|
57 |
|
case 2 : a+=((ub4)k[1]<<8); |
|
|
52 |
|
case 4 : a+=((uint32_t)k[3]<<24); |
|
53 |
|
case 3 : a+=((uint32_t)k[2]<<16); |
|
54 |
|
case 2 : a+=((uint32_t)k[1]<<8); |
58 |
55 |
case 1 : a+=k[0]; |
case 1 : a+=k[0]; |
59 |
56 |
/* case 0: nothing left to add */ |
/* case 0: nothing left to add */ |
60 |
57 |
} |
} |
|
... |
... |
register ub4 initval; /* the previous hash, or an arbitrary value */ |
63 |
60 |
return c; |
return c; |
64 |
61 |
} |
} |
65 |
62 |
|
|
66 |
|
ub4 SStrHash2(ub1 *key){ |
|
67 |
|
ub1 buff[0x400]; |
|
68 |
|
ub4 len=0; |
|
|
63 |
|
#undef mix |
|
64 |
|
|
|
65 |
|
uint32_t hashfunc(uint8_t *key){ |
|
66 |
|
return hash(key, strlen(key), 0); |
|
67 |
|
} |
|
68 |
|
|
|
69 |
|
uint32_t SStrHash2(uint8_t *key){ |
|
70 |
|
uint8_t buff[0x400]; |
|
71 |
|
uint32_t len=0; |
69 |
72 |
while(*key){ |
while(*key){ |
70 |
73 |
if(*key <'a' || *key>'z'){ |
if(*key <'a' || *key>'z'){ |
71 |
74 |
if(*key == '/'){ |
if(*key == '/'){ |