vrtc / pjass (public) (License: BSD) (since 2023-08-03) (hash sha1)
pjass is a free Jass scripting language parser. This repository is a fork of lep/pjass. The goal is to add Debian packaging. As of the time of this writing, it works for current stable, that is Debian 12 (bookworm).
List of commits:
Subject Hash Author Date (UTC)
Use the strhash hashfunc for our hashtables. d6f0de51cb54921b529799b9939cfe2dcdf7b4d0 lep 2020-07-29 11:13:13
Document installation methods 814075ef77bc8981684971bfc2a5c626f2e34035 lep 2020-07-18 08:11:43
Improved Readme c8d57e3c1953d5e67ca12f75f5685f7786eacaf2 lep 2020-07-18 07:43:09
Added some tests for the new StringHash check. 1f613e7c5b078cc3ce3a04a957291ca070856528 lep 2020-07-18 07:17:26
Added check for bad StringHash usage 3abbed6aa1cd87e202a0b038e8af2246e9ceadeb lep 2020-07-17 22:13:39
Fix release target 6eca932b6210f1ac93b3bc030c15797d88d529b6 lep 2019-10-17 12:58:24
Better error message for `type` as a name 665dc1efab9a5a8706bb0fcb95a13eabe3358436 lep 2019-10-17 12:53:35
Added reserved keyword 'alias' 7589b241e1179f85bf19b82696d97d8365034376 lep 2019-05-31 21:57:10
More newline stuff 3e57cdb92c766375430c701034db56e81dcc27e2 lep 2019-05-18 09:44:12
Report natives after function defintions eb58451c6e2df142a51e85e68ee11efa45c3215c lep 2019-04-01 12:49:24
Specify minimum bison version in readme 44b75417a7d01e2639a4b4acda031e95eca8ffb2 lep 2019-02-18 23:41:48
Support Apple by defining _aligned_malloc 596488eafa1e09c1120d2488c78959a8c63c5a5d Jesse Rogers 2019-01-03 17:08:49
Improved the amalgation build 4be0d720517e70920c7b716f95babc63df1f4ffa lep 2018-12-31 14:50:05
Added missing new tests c5c6dab555bec81e6a7b419ea88d195836b3762f lep 2018-12-30 18:40:02
A bit better error message for wrong typed array index ca37eb28822952a4ab3e58488b710317691d16a9 lep 2018-12-23 12:01:18
Also add git version to release build 2762d5e5f011aff820bbbbe87ae96f84f006c150 lep 2018-12-22 23:54:23
Pass cflags to release build 06b251bf0d4871df3e984aeac3e81e1bd03a5912 lep 2018-12-22 22:59:02
For release build make amalgation 700190b5d66996bdec2a7916faed1f85e799e308 lep 2018-12-22 20:22:06
Power of 2 hashing 065325daf390f5217310cbd5f19989a774af56c0 lep 2018-12-22 19:45:21
Small cleanup 48f7c95157d71e12b4ecea13315b6b4c144fc629 lep 2018-12-09 20:23:53
Commit d6f0de51cb54921b529799b9939cfe2dcdf7b4d0 - Use the strhash hashfunc for our hashtables.
Since we inlcude SStrHash2 now we can use the underlying hash functions
for our hashtables; this means a few less lines and it seems on par with
fnv in regards to performance.
Author: lep
Author date (UTC): 2020-07-29 11:13
Committer name: lep
Committer date (UTC): 2020-07-29 11:13
Parent(s): 814075ef77bc8981684971bfc2a5c626f2e34035
Signer:
Signing key:
Signing status: N
Tree: d865d80f577773512f0307fca77588135645c64f
File Lines added Lines deleted
hashtable.c 1 9
readme.md 3 3
sstrhash.c 26 23
sstrhash.h 1 0
File hashtable.c changed (mode: 100644) (index bf0d0de..3f87f5c)
3 3 #include <stdlib.h> #include <stdlib.h>
4 4
5 5 #include "hashtable.h" #include "hashtable.h"
6
7 static uint32_t hashfunc(const char *key)
8 {
9 // fnv
10 uint32_t hash = 2166136261;
11 while(*key)
12 hash = (hash ^ *key++) * 16777619;
13 return hash;
14 }
6 #include "sstrhash.h"
15 7
16 8 void ht_init(struct hashtable *h, size_t size) void ht_init(struct hashtable *h, size_t size)
17 9 { {
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 == '/'){
File sstrhash.h changed (mode: 100644) (index b7a003f..554d4f7)
3 3
4 4 #include <stdint.h> #include <stdint.h>
5 5
6 inline uint32_t hashfunc(uint8_t *key);
6 7 uint32_t SStrHash2(uint8_t *key); uint32_t SStrHash2(uint8_t *key);
7 8
8 9 #endif #endif
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/vrtc/pjass

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/vrtc/pjass

Clone this repository using git:
git clone git://git.rocketgit.com/user/vrtc/pjass

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main