forked from lthn/blockchain
Compare commits
1041 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b61d773a0f | |||
|
|
c9ad4de9bb | ||
|
|
22c0c5a251 | ||
|
|
f3df50cba5 | ||
|
|
1545a80335 | ||
|
|
467c64d015 | ||
|
|
7ee2265cae | ||
|
|
4120a9a664 | ||
|
|
5dae74347c | ||
|
|
92e0aa779b | ||
|
|
7b0a08f9ff | ||
|
|
88d4357628 | ||
|
|
4a5c5ae742 | ||
|
|
57983cb865 | ||
|
|
ef776a93cc | ||
|
|
106b3431db | ||
|
|
0882f94203 | ||
|
|
1c584e7c76 | ||
|
|
79121dce71 | ||
|
|
3dbb8b1487 | ||
|
|
11d19e5446 | ||
|
|
e4ff164f0d | ||
|
|
dd7a19ac6f | ||
|
|
eb60d4519c | ||
|
|
3e2bad36a6 | ||
|
|
7f930b0fec | ||
|
|
c2c130a076 | ||
|
|
d8d81c1f2e | ||
|
|
c8acc964e3 | ||
|
|
763d70bec2 | ||
|
|
b02addf264 | ||
|
|
bf22a89733 | ||
|
|
2f1011e27c | ||
|
|
7b0c286cef | ||
|
|
b84b99287d | ||
|
|
a03d081287 | ||
|
|
2eaa599066 | ||
|
|
eafeb894f9 | ||
|
|
db80165063 | ||
|
|
b9d85e1c09 | ||
|
|
5982abd525 | ||
|
|
de5e0caebd | ||
|
|
91ced14b2d | ||
|
|
d7d0ba0a41 | ||
|
|
c36355d489 | ||
|
|
11d4bbf1da | ||
|
|
15417edbce | ||
|
|
b9b175c00f | ||
|
|
e3186aef40 | ||
|
|
feb5de6f20 | ||
|
|
9aaa0f8cb8 | ||
|
|
cc8ff1d5a3 | ||
|
|
ff6cbe2548 | ||
|
|
3a9245f743 | ||
|
|
8b57f3acab | ||
|
|
96081db687 | ||
|
|
a93aefd507 | ||
|
|
4923f644c4 | ||
|
|
260228433c | ||
|
|
cbc7357fa7 | ||
|
|
0c7d09d951 | ||
|
|
d78911b344 | ||
|
|
e10a711c36 | ||
|
|
6e6831c355 | ||
|
|
8953e201d6 | ||
|
|
d9557d3bb1 | ||
|
|
334d26a4ac | ||
|
|
d6c6df78f4 | ||
|
|
035f233bc7 | ||
|
|
cd16b5c743 | ||
|
|
b57fa844ef | ||
|
|
4618c240f2 | ||
|
|
3e71f078ca | ||
|
|
7a463d8065 | ||
|
|
06573647b8 | ||
|
|
06d6553473 | ||
|
|
2c920287d3 | ||
|
|
b0e00c0803 | ||
|
|
b0b30e20b2 | ||
|
|
1b8cfa0194 | ||
|
|
0c48a01fbf | ||
|
|
60560ad18c | ||
|
|
71cc7d1363 | ||
|
|
be3938a886 | ||
|
|
e2bfde5bbc | ||
|
|
6fed9dcac5 | ||
|
|
68871b93ec | ||
|
|
32194f88b1 | ||
|
|
854c198415 | ||
|
|
23cf10a4b8 | ||
|
|
94c2e65dad | ||
|
|
0e1618c496 | ||
|
|
015c7ddbb4 | ||
|
|
f8e298af86 | ||
|
|
4695229f2a | ||
|
|
97b17221d9 | ||
|
|
98f5880ae6 | ||
|
|
6c318fc34b | ||
|
|
9e81e7228c | ||
|
|
556746c194 | ||
|
|
ee883a690c | ||
|
|
2edb2e6fe4 | ||
|
|
a3587a48e7 | ||
|
|
63cf4e5dd6 | ||
|
|
cac85721a2 | ||
|
|
8574cc0894 | ||
|
|
d241861d86 | ||
|
|
fed84de8b7 | ||
|
|
a08772ea6a | ||
|
|
8fb16d207f | ||
|
|
d711373824 | ||
|
|
eed7d9e3af | ||
|
|
ffd279f21f | ||
|
|
8042f9a6a5 | ||
|
|
573028c764 | ||
|
|
695bd88c11 | ||
|
|
992ea22294 | ||
|
|
9cce235931 | ||
|
|
9fe3f812aa | ||
|
|
75ad8c7a69 | ||
|
|
6f8d727332 | ||
|
|
f287916372 | ||
|
|
5e0c84e735 | ||
|
|
0cd2ef8ccb | ||
|
|
65241adc1c | ||
|
|
6ad7dad01d | ||
|
|
51990c9d2d | ||
|
|
d56bf75bde | ||
|
|
94b9741976 | ||
|
|
87cd247eb5 | ||
|
|
28606d07ef | ||
|
|
9589c952f8 | ||
|
|
0554d7b8c4 | ||
|
|
db86b3fa15 | ||
|
|
5ac8b20816 | ||
|
|
c241cb3f9b | ||
|
|
2f368cbf2c | ||
|
|
04364afc53 | ||
|
|
035a441efe | ||
|
|
e232c827a6 | ||
|
|
c637e16848 | ||
|
|
dfbda0a77f | ||
|
|
d5890e3c7f | ||
|
|
187a830f58 | ||
|
|
6a4d6e1fc6 | ||
|
|
430d31ba5e | ||
|
|
05ea60a70c | ||
|
|
22b49d93a8 | ||
|
|
5340c6db32 | ||
|
|
a0c1c8b4df | ||
|
|
2b3360f66a | ||
|
|
ffa94febc6 | ||
|
|
f8600d9fe4 | ||
|
|
afd479fa62 | ||
|
|
aaf878419d | ||
|
|
0c77467c7b | ||
|
|
a3905348f1 | ||
|
|
c6614912b1 | ||
|
|
46eab64834 | ||
|
|
1b0f64176d | ||
|
|
430cbffd25 | ||
|
|
ab01ce4fd6 | ||
|
|
2fb8f499e1 | ||
|
|
2bab917700 | ||
|
|
90a4a68eb5 | ||
|
|
166b683295 | ||
|
|
4f7345e475 | ||
|
|
79a3d416c1 | ||
|
|
ecabd4a73a | ||
|
|
29d02c1816 | ||
|
|
23f874f142 | ||
|
|
48176b6a72 | ||
|
|
2bb1113b43 | ||
|
|
2a13a63eb7 | ||
|
|
7ac70737dc | ||
|
|
9efce2ddb3 | ||
|
|
87fae9440c | ||
|
|
79f4c3ef75 | ||
|
|
06af2ea879 | ||
|
|
1131d25725 | ||
|
|
cb3891ac0c | ||
|
|
e0acea65b8 | ||
|
|
c6b1a84461 | ||
|
|
c86a19de08 | ||
|
|
e725b784c1 | ||
|
|
f84ecf579e | ||
|
|
7fb2fcc188 | ||
|
|
411cda4ad4 | ||
|
|
7eb6986f4d | ||
|
|
3d2ce52b8e | ||
|
|
7793efaeac | ||
|
|
25056b751e | ||
|
|
1c045d0732 | ||
|
|
c4c8d65798 | ||
|
|
be0b6ab35e | ||
|
|
99bcf712df | ||
|
|
8a91bccea3 | ||
|
|
686c137332 | ||
|
|
e66b21085b | ||
|
|
ffe5051d8b | ||
|
|
0066e75c39 | ||
|
|
1bb0523b83 | ||
|
|
4d272c4edb | ||
|
|
296a6c6211 | ||
|
|
43bde5aa99 | ||
|
|
cebeebe730 | ||
|
|
91cd6148e8 | ||
|
|
ec35462267 | ||
|
|
0b7a8a89bd | ||
|
|
dd9fb6c8a7 | ||
|
|
54f5b2acc1 | ||
|
|
d911673544 | ||
|
|
cc9e39825c | ||
|
|
4be5761a90 | ||
|
|
bafae7b120 | ||
|
|
d9c7a2ac08 | ||
|
|
d4cc1bd6ff | ||
|
|
83234af5b6 | ||
|
|
92ea96a41d | ||
|
|
915d01fa7d | ||
|
|
11ff5a8c62 | ||
|
|
6ff59d2392 | ||
|
|
3a5e37f34c | ||
|
|
6ea2d90104 | ||
|
|
078b03534d | ||
|
|
0cbe915ed5 | ||
|
|
7a0b4cdc82 | ||
|
|
22196f9de6 | ||
|
|
ef0a47c720 | ||
|
|
c2bd27cb58 | ||
|
|
c8d41b5e4a | ||
|
|
e5323d0c5a | ||
|
|
cc7188f450 | ||
|
|
59a55f7ebd | ||
|
|
13b73bcb33 | ||
|
|
90ed7ee409 | ||
|
|
36d14dbc99 | ||
|
|
7606c69961 | ||
|
|
f087117a33 | ||
|
|
02da52eb0d | ||
|
|
a7a4505b79 | ||
|
|
7f8dbb73db | ||
|
|
fe220afdde | ||
|
|
83eefd205e | ||
|
|
15d2c1f725 | ||
|
|
afb9ddb42e | ||
|
|
48725ea817 | ||
|
|
24600931ac | ||
|
|
ed7597e6b9 | ||
|
|
7f7b99ed7e | ||
|
|
d4366d3f18 | ||
|
|
cbb9a39bf1 | ||
|
|
cd5b0c22da | ||
|
|
34b9e15301 | ||
|
|
3abfd90e2f | ||
|
|
71248cfd25 | ||
|
|
e2406fc518 | ||
|
|
f65578f5a5 | ||
|
|
144d403c8b | ||
|
|
5978ed27f2 | ||
|
|
affa0a91ac | ||
|
|
745932738e | ||
|
|
d95b07fe0a | ||
|
|
0ad804fbc0 | ||
|
|
7736199189 | ||
|
|
c7f0106bf0 | ||
|
|
df0171d989 | ||
|
|
d1cade7bdb | ||
|
|
7d3bd99867 | ||
|
|
23f3593ae0 | ||
|
|
ff2bb36de4 | ||
|
|
d3a2392cfa | ||
|
|
701625d2f0 | ||
|
|
68194dc60b | ||
|
|
2fd53a59cb | ||
|
|
fb0ba230ea | ||
|
|
2872515117 | ||
|
|
bd05907dd8 | ||
|
|
9115226f00 | ||
|
|
857a7eabe2 | ||
|
|
048886c4e9 | ||
|
|
490198feee | ||
|
|
ace2b4dbf5 | ||
|
|
b48f23ab54 | ||
|
|
938050df0f | ||
|
|
20ad8de9f5 | ||
|
|
0662f9bbed | ||
|
|
60471f7f46 | ||
|
|
8b910b9111 | ||
|
|
2241263925 | ||
|
|
77100b462e | ||
|
|
9a816a090d | ||
|
|
d85b94df92 | ||
|
|
b603d70be8 | ||
|
|
013b7f77ef | ||
|
|
c2f0b1166c | ||
|
|
3095e0fbcb | ||
|
|
3917d95019 | ||
|
|
532f9a81dc | ||
|
|
39e36cf8c8 | ||
|
|
767f02a3ba | ||
|
|
f0f54efe17 | ||
|
|
695fc1dd4e | ||
|
|
ef9a0ab5fd | ||
|
|
5984b47ad9 | ||
|
|
dc5b5f72a3 | ||
|
|
be129f7a87 | ||
|
|
5f56d146c2 | ||
|
|
64e2e53629 | ||
|
|
ec08952674 | ||
|
|
4303f84152 | ||
|
|
616c56fa35 | ||
|
|
cf3930e863 | ||
|
|
78293c32d6 | ||
|
|
89e70c74cd | ||
|
|
ead80ac4cb | ||
|
|
b0cbce935e | ||
|
|
bbc80a8a77 | ||
|
|
2e57faf822 | ||
|
|
6be32747c7 | ||
|
|
56a265bd48 | ||
|
|
334a90bbe0 | ||
|
|
1cc85850bb | ||
|
|
f136bff547 | ||
|
|
f08d2ff8af | ||
|
|
cb92f260e4 | ||
|
|
cd51fcc293 | ||
|
|
932414dc32 | ||
|
|
db788333de | ||
|
|
488c16138a | ||
|
|
9674bc9d7a | ||
|
|
71336c1bc0 | ||
|
|
4d5d32c7ed | ||
|
|
357a59a1f7 | ||
|
|
3e2a39db2c | ||
|
|
3a29780d8f | ||
|
|
ccfc0327e0 | ||
|
|
405d076ce2 | ||
|
|
e07bba437b | ||
|
|
3ad96b5028 | ||
|
|
09c3c2c156 | ||
|
|
be59c78439 | ||
|
|
dfe5238f77 | ||
|
|
a54c00e823 | ||
|
|
4715d69596 | ||
|
|
926549e740 | ||
|
|
a588173605 | ||
|
|
ec54dc72c9 | ||
|
|
01b5f89725 | ||
|
|
b6efadad40 | ||
|
|
d40311da17 | ||
|
|
d93624bbf4 | ||
|
|
6b152827af | ||
|
|
e15a7f804e | ||
|
|
dc81b4331f | ||
|
|
fca1194f55 | ||
|
|
79e3c6eaf1 | ||
|
|
09ddda7dba | ||
|
|
fbeb658ae0 | ||
|
|
c5c206ea13 | ||
|
|
7ddbabc51e | ||
|
|
11437ac38f | ||
|
|
a13eedf556 | ||
|
|
bb92e52ae2 | ||
|
|
ca46fca7b1 | ||
|
|
5808e1a3d3 | ||
|
|
1354eb0d47 | ||
|
|
a448b62e9a | ||
|
|
fe85ce27fb | ||
|
|
936ff46f9c | ||
|
|
571897a23b | ||
|
|
f0378d8be0 | ||
|
|
ede5df5afe | ||
|
|
2bcc6075b7 | ||
|
|
88060ee2a4 | ||
|
|
38ae547f5c | ||
|
|
8341f4f31f | ||
|
|
141a8eac6a | ||
|
|
672309ba5f | ||
|
|
d8f12cdcc8 | ||
|
|
cb74abddc5 | ||
|
|
4c860417f5 | ||
|
|
2006b71250 | ||
|
|
664a971c46 | ||
|
|
05f0458658 | ||
|
|
6893535388 | ||
|
|
b79e962e75 | ||
|
|
820569ff4e | ||
|
|
c47dee5158 | ||
|
|
3bbdc9c140 | ||
|
|
337ce00b77 | ||
|
|
a25baf8d94 | ||
|
|
a85445083f | ||
|
|
a0ddaea1a3 | ||
|
|
a101a676b0 | ||
|
|
ca9a8f95de | ||
|
|
3cf39eec88 | ||
|
|
3d1f4a5336 | ||
|
|
8fc70f4d6d | ||
|
|
467fd4b6ba | ||
|
|
1cd3a95625 | ||
|
|
4ad93162e8 | ||
|
|
2628656537 | ||
|
|
d14ca4f53f | ||
|
|
dd64c805d7 | ||
|
|
072d53de9b | ||
|
|
a23ccd76fb | ||
|
|
38e6556a49 | ||
|
|
f6d363d313 | ||
|
|
e73eb4f59a | ||
|
|
aab20167fb | ||
|
|
075ee3119b | ||
|
|
35f79d3780 | ||
|
|
ddd91d8fec | ||
|
|
1087be7b0a | ||
|
|
dcd7f62968 | ||
|
|
cf69c29e8d | ||
|
|
7a5fb3ee25 | ||
|
|
819fd97261 | ||
|
|
93c6c2a0b3 | ||
|
|
cc33fd8b9c | ||
|
|
46f6e29efb | ||
|
|
c9fe605ee8 | ||
|
|
e2a70189b3 | ||
|
|
bd4d54e491 | ||
|
|
aa24fc2126 | ||
|
|
4f1f2ba7e7 | ||
|
|
81e77ba37b | ||
|
|
303e216b26 | ||
|
|
b58939cf27 | ||
|
|
68649070cd | ||
|
|
31e17f91e2 | ||
|
|
ad2b10116d | ||
|
|
6ab3d46529 | ||
|
|
23723ca05e | ||
|
|
13b09ee914 | ||
|
|
4197736fe2 | ||
|
|
059a71fd97 | ||
|
|
653b05298b | ||
|
|
2e01f2291e | ||
|
|
8dd8a6ac1c | ||
|
|
61a358b753 | ||
|
|
cd2f044ad8 | ||
|
|
8e2c70de93 | ||
|
|
484f362676 | ||
|
|
7b527483c2 | ||
|
|
eda0472f1e | ||
|
|
c0ca49c30a | ||
|
|
13ed32d67a | ||
|
|
78f622ead1 | ||
|
|
b9557dd70e | ||
|
|
18c17e48b1 | ||
|
|
9e3ece1818 | ||
|
|
11b8933345 | ||
|
|
8cc4e99199 | ||
|
|
13f524defb | ||
|
|
8a8e5c3011 | ||
|
|
8a7572d1b8 | ||
|
|
192ad1382c | ||
|
|
504b4a2ad8 | ||
|
|
e747b11d44 | ||
|
|
95dabbe63a | ||
|
|
1701b97f86 | ||
|
|
9cfa03d119 | ||
|
|
be44020b1c | ||
|
|
2e73594378 | ||
|
|
b903d84cac | ||
|
|
9763548fa8 | ||
|
|
6a7c29be51 | ||
|
|
2817090c8a | ||
|
|
fe67a2933a | ||
|
|
d63feec2e1 | ||
|
|
524aa1c79b | ||
|
|
c8a55c08c7 | ||
|
|
c24d165627 | ||
|
|
099f940751 | ||
|
|
2b249ef414 | ||
|
|
912392bee7 | ||
|
|
85c2591cfc | ||
|
|
74ef510288 | ||
|
|
d28a0e1b13 | ||
|
|
fead9075b6 | ||
|
|
7b2388290c | ||
|
|
41d87d3e27 | ||
|
|
fa35d54fbb | ||
|
|
23cd004f36 | ||
|
|
45cd764e80 | ||
|
|
ea394e872a | ||
|
|
dca18f4963 | ||
|
|
b963acc6da | ||
|
|
c7e17edbc7 | ||
|
|
f74445d7fd | ||
|
|
0dd79e77c4 | ||
|
|
422c7f2a3a | ||
|
|
d0971413ca | ||
|
|
753effce28 | ||
|
|
5bdaf8eaed | ||
|
|
8be6f286f1 | ||
|
|
b3393af19a | ||
|
|
d3632b2f04 | ||
|
|
0fe6631e50 | ||
|
|
69284ae297 | ||
|
|
10df225359 | ||
|
|
e4d9f1da59 | ||
|
|
a6538b5eca | ||
|
|
647b5c80f6 | ||
|
|
b0efef8ef1 | ||
|
|
13e67e23e1 | ||
|
|
c0c39276c7 | ||
|
|
4e78beebeb | ||
|
|
d88e1952a6 | ||
|
|
26f2f7511a | ||
|
|
8747abe3dd | ||
|
|
f7e64b9164 | ||
|
|
a58c0810fb | ||
|
|
d625ec94a5 | ||
|
|
5ae9b2038e | ||
|
|
6087a1bd40 | ||
|
|
2b15aad320 | ||
|
|
c90344ea47 | ||
|
|
f08d8797a0 | ||
|
|
a8a188b754 | ||
|
|
5387a7711c | ||
|
|
fd810d5e29 | ||
|
|
5e4fae1246 | ||
|
|
bd473960e4 | ||
|
|
d3fc6b955f | ||
|
|
635cea55e0 | ||
|
|
88fa0bca64 | ||
|
|
312444aa48 | ||
|
|
6d7923b7e3 | ||
|
|
109b187426 | ||
|
|
fd1ddf5ffc | ||
|
|
7d93211b9f | ||
|
|
61ac4dd356 | ||
|
|
0c35b75a9d | ||
|
|
d23fa1911e | ||
|
|
05d8c27577 | ||
|
|
121067e36d | ||
|
|
8cc826f5b3 | ||
|
|
0cd719474b | ||
|
|
fbf0d413a8 | ||
|
|
1968608018 | ||
|
|
ac51ccbf8c | ||
|
|
6a32f3f26d | ||
|
|
9cd1121c75 | ||
|
|
9b033842ab | ||
|
|
9d259f5455 | ||
|
|
e9e7bbf0c5 | ||
|
|
aeb313a72c | ||
|
|
fcb5513d68 | ||
|
|
42b5f32116 | ||
|
|
b2b4342c14 | ||
|
|
ecc6cc4605 | ||
|
|
3b1f08676e | ||
|
|
97b145f8b6 | ||
|
|
2dd029fb5d | ||
|
|
60423e71b8 | ||
|
|
9dc293ec04 | ||
|
|
f3618e6418 | ||
|
|
844e5b823f | ||
|
|
1fe0cd17ad | ||
|
|
0930090365 | ||
|
|
2632446ee5 | ||
|
|
7345096a91 | ||
|
|
2ba22bc53b | ||
|
|
7205312837 | ||
|
|
b5a44b1698 | ||
|
|
b2e9872645 | ||
|
|
40539c1f9d | ||
|
|
3c23d42ae4 | ||
|
|
5d429e1e76 | ||
|
|
9186119620 | ||
|
|
4af367fb5e | ||
|
|
2c72622d7e | ||
|
|
ca51bd4886 | ||
|
|
b836742f66 | ||
|
|
c344739de9 | ||
|
|
4bb068f056 | ||
|
|
0a055e892c | ||
|
|
d06ba31125 | ||
|
|
5d15ed1c15 | ||
|
|
b1c70ac2bb | ||
|
|
52bd48dbc3 | ||
|
|
a307862320 | ||
|
|
bfa68e4b88 | ||
|
|
d92a54045b | ||
|
|
e58b20ae5b | ||
|
|
986f7dc7d3 | ||
|
|
cf8004050c | ||
|
|
02aeaa2078 | ||
|
|
93fdf0e677 | ||
|
|
3a6e0c0f2f | ||
|
|
3daaad6d43 | ||
|
|
4e750bf1b0 | ||
|
|
e77831f1f9 | ||
|
|
fc3922996d | ||
|
|
74b0e6d70f | ||
|
|
890b3155b8 | ||
|
|
d992a8bdc3 | ||
|
|
27e310bb84 | ||
|
|
744522f3ca | ||
|
|
53eefa044a | ||
|
|
2badfead11 | ||
|
|
c1264169cc | ||
|
|
deb74ad9d0 | ||
|
|
4438949480 | ||
|
|
ffb90714d6 | ||
|
|
dd85ad7fce | ||
|
|
d71d82b690 | ||
|
|
48b3796f66 | ||
|
|
83b4dd9b36 | ||
|
|
39b4646e5d | ||
|
|
0fafe09544 | ||
|
|
a9de7944dd | ||
|
|
b8afa3f9c5 | ||
|
|
565e950072 | ||
|
|
b1a136561d | ||
|
|
f3eceda66b | ||
|
|
426ca5a22b | ||
|
|
b77419afc7 | ||
|
|
8758f6dc79 | ||
|
|
e0c4a3ec42 | ||
|
|
8c9582d0f7 | ||
|
|
75e30c1372 | ||
|
|
39201f3d4a | ||
|
|
b5e0b21f13 | ||
|
|
cf32e44926 | ||
|
|
f17dba64ce | ||
|
|
82403dba51 | ||
|
|
2fc37934cf | ||
|
|
f0891a36e8 | ||
|
|
d610c38c4e | ||
|
|
7b9c728de2 | ||
|
|
c117a76a04 | ||
|
|
08281059fb | ||
|
|
ef5c1f9c03 | ||
|
|
7c781ca0ff | ||
|
|
e737bf5e02 | ||
|
|
8ffbfbe60a | ||
|
|
b66c0efc2b | ||
|
|
44b19dd070 | ||
|
|
bb758a916a | ||
|
|
e414752976 | ||
|
|
3c9d6666cd | ||
|
|
5f1defc5a1 | ||
|
|
3d1ac6124e | ||
|
|
9d06106a78 | ||
|
|
37e62ac079 | ||
|
|
9d213b19b1 | ||
|
|
35427f8381 | ||
|
|
a8adcc07b7 | ||
|
|
17aebd29b5 | ||
|
|
9d10050325 | ||
|
|
77d6939411 | ||
|
|
43602031b8 | ||
|
|
41ef9caf40 | ||
|
|
d083f54edd | ||
|
|
7fbfec3441 | ||
|
|
ab73f0d19f | ||
|
|
8904cc20c4 | ||
|
|
2a2987b17a | ||
|
|
1eeb9a4a81 | ||
|
|
dc76fb9051 | ||
|
|
d74a04d6df | ||
|
|
9c2e2bb0f8 | ||
|
|
0d3e90f4a5 | ||
|
|
ca09405491 | ||
|
|
77a928c78a | ||
|
|
4b9a457e64 | ||
|
|
c82809a0b9 | ||
|
|
0b7a138abd | ||
|
|
bc3077e429 | ||
|
|
62c02dab24 | ||
|
|
ee93fc00e6 | ||
|
|
4d6291d7ff | ||
|
|
47a1bd985d | ||
|
|
443386489c | ||
|
|
9e6faffb49 | ||
|
|
fde28efdc5 | ||
|
|
0c90262e8a | ||
|
|
f0c7d57c41 | ||
|
|
9f0fa8a390 | ||
|
|
88a1e96820 | ||
|
|
2c06293f24 | ||
|
|
bc552ff635 | ||
|
|
faa95dd555 | ||
|
|
19c818ed9b | ||
|
|
b861d854a9 | ||
|
|
764e5a2adf | ||
|
|
e5f0fe6e76 | ||
|
|
820d5a88ac | ||
|
|
08e2f0fbf1 | ||
|
|
44d3317dd2 | ||
|
|
f48811ff44 | ||
|
|
79fdecce32 | ||
|
|
1cbb2eca1b | ||
|
|
592fe81a47 | ||
|
|
389662b8c9 | ||
|
|
f8c54492f1 | ||
|
|
e816cd969c | ||
|
|
896eadd77b | ||
|
|
27ecfad1d6 | ||
|
|
fa4a2680f9 | ||
|
|
e97b585659 | ||
|
|
65af445ebb | ||
|
|
a1a53012fb | ||
|
|
168281f862 | ||
|
|
132d2bf89f | ||
|
|
0a23950747 | ||
|
|
ef28b3ab71 | ||
|
|
968051109a | ||
|
|
4365a76169 | ||
|
|
ac01843e27 | ||
|
|
449ac06070 | ||
|
|
fe98c140ac | ||
|
|
712f66d3ee | ||
|
|
f0d82776b7 | ||
|
|
12c5a0237b | ||
|
|
0bc14fa477 | ||
|
|
ef73204960 | ||
|
|
270bb925f5 | ||
|
|
3cb471c46c | ||
|
|
7c3d21e31f | ||
|
|
69a5d42d99 | ||
|
|
7d442b4c9a | ||
|
|
b556f2ad86 | ||
|
|
567700635c | ||
|
|
2582159a26 | ||
|
|
e17ede1649 | ||
|
|
59ea01339d | ||
|
|
45eeb8c5f9 | ||
|
|
156c96fc42 | ||
|
|
648f6954f4 | ||
|
|
337e88254e | ||
|
|
c1d37852c5 | ||
|
|
55358fc420 | ||
|
|
bb439b0107 | ||
|
|
1165101867 | ||
|
|
ebd5815845 | ||
|
|
461f8b9b47 | ||
|
|
c50c5f42be | ||
|
|
8a8030c99b | ||
|
|
f6400abaec | ||
|
|
f0aef9782a | ||
|
|
86e5af333f | ||
|
|
4ca10cfcb4 | ||
|
|
c5d5311121 | ||
|
|
b844f2ddf8 | ||
|
|
d3a4db9e37 | ||
|
|
1910715033 | ||
|
|
cdb9dd2f1f | ||
|
|
e2998acc9d | ||
|
|
bb6fa6f7bd | ||
|
|
039b6674c4 | ||
|
|
e7ac63adb3 | ||
|
|
4f33eb4078 | ||
|
|
11ba3489c3 | ||
|
|
31ac5e4974 | ||
|
|
0eabc7b69e | ||
|
|
b547e51719 | ||
|
|
4d4e362c61 | ||
|
|
07c5256440 | ||
|
|
9973546472 | ||
|
|
1ea5c1aa53 | ||
|
|
e726ae9da6 | ||
|
|
d0c65a04e7 | ||
|
|
3d69468cfd | ||
|
|
a6808b4646 | ||
|
|
3154c7b72d | ||
|
|
8aa1654a3f | ||
|
|
95e63b7b7e | ||
|
|
28d841d114 | ||
|
|
fe3a0ea39a | ||
|
|
3a3aed7469 | ||
|
|
b6e84b460e | ||
|
|
9150c31666 | ||
|
|
2b9caf2cb3 | ||
|
|
fb22df4850 | ||
|
|
d7cf27033c | ||
|
|
f05d14a944 | ||
|
|
486fb05f73 | ||
|
|
3b6fa728b7 | ||
|
|
d94afc207c | ||
|
|
0e69e059fe | ||
|
|
4e20dad924 | ||
|
|
05547c5c0d | ||
|
|
41f9302fce | ||
|
|
b51b26cb14 | ||
|
|
c26d449630 | ||
|
|
d2b60b0090 | ||
|
|
21aae4496c | ||
|
|
8f25f0d460 | ||
|
|
7ff58b6b18 | ||
|
|
e31e2730c9 | ||
|
|
da5c484025 | ||
|
|
cee6e51cbb | ||
|
|
d4d3ea1d23 | ||
|
|
291d39383d | ||
|
|
c101a21010 | ||
|
|
5ab468be42 | ||
|
|
5e8cfb9ee3 | ||
|
|
226c3653ac | ||
|
|
c21785add4 | ||
|
|
63c2a299a5 | ||
|
|
3882d024cb | ||
|
|
6408ea007f | ||
|
|
c01e9a5862 | ||
|
|
5f62c76a2f | ||
|
|
af49225221 | ||
|
|
cb08646fc1 | ||
|
|
2f535f011e | ||
|
|
cdd435f042 | ||
|
|
47e10e7209 | ||
|
|
d622078ef9 | ||
|
|
10c1f7f59a | ||
|
|
dd7d1d3109 | ||
|
|
66fd58b8ee | ||
|
|
7da72fcc89 | ||
|
|
66f2761f67 | ||
|
|
fdc8bf19e0 | ||
|
|
c92ca6fb93 | ||
|
|
092e0f1e60 | ||
|
|
d0bad4213a | ||
|
|
0c1fe0cf80 | ||
|
|
cc79aa87b3 | ||
|
|
db1dedbb0a | ||
|
|
9795460468 | ||
|
|
155181d899 | ||
|
|
071e02f278 | ||
|
|
4c2ac48337 | ||
|
|
b154d84330 | ||
|
|
05f4a4e482 | ||
|
|
01a8fdda68 | ||
|
|
2abe23c5e6 | ||
|
|
b91d902791 | ||
|
|
df6fa3f7c5 | ||
|
|
10c451f3b7 | ||
|
|
5342440fd6 | ||
|
|
7237867f15 | ||
|
|
88d94fde3f | ||
|
|
348e263ebe | ||
|
|
e45dbb4f2c | ||
|
|
4bdfb47fc3 | ||
|
|
525132cf11 | ||
|
|
6655a6feaf | ||
|
|
7ff0463587 | ||
|
|
1609631431 | ||
|
|
fe3c3d731b | ||
|
|
14a0be050e | ||
|
|
030dd348b4 | ||
|
|
e809d821a1 | ||
|
|
fd25b5a8e5 | ||
|
|
4c2553a482 | ||
|
|
c68f841fdb | ||
|
|
b56a0fb90c | ||
|
|
c6488622eb | ||
|
|
e40d9df2ec | ||
|
|
455ece8cba | ||
|
|
d9633d5b06 | ||
|
|
d52cb725d1 | ||
|
|
f7aab6f332 | ||
|
|
b3c44598b0 | ||
|
|
702817e351 | ||
|
|
81ac6cf333 | ||
|
|
e38dfc1472 | ||
|
|
5500e943dd | ||
|
|
e57709a67f | ||
|
|
2e75597365 | ||
|
|
a12fd42a8e | ||
|
|
5e07e3c4e0 | ||
|
|
2b1c1094a6 | ||
|
|
7a0ec043a1 | ||
|
|
423b99cc5e | ||
|
|
a853f77c00 | ||
|
|
1d153834d9 | ||
|
|
d718d876fc | ||
|
|
db4b841f57 | ||
|
|
89e6555e2a | ||
|
|
3ab93654f5 | ||
|
|
7fdc82a630 | ||
|
|
1196423f02 | ||
|
|
6f4e1465bc | ||
|
|
15e653a8ae | ||
|
|
b102d0d3b9 | ||
|
|
47dfdf1e0b | ||
|
|
08a753b4c9 | ||
|
|
63dadb37c6 | ||
|
|
9f8ce4cc09 | ||
|
|
2e2d3c26b4 | ||
|
|
ad66a6db30 | ||
|
|
eae8fde294 | ||
|
|
530acf4662 | ||
|
|
e52ff16733 | ||
|
|
e3d1956ba3 | ||
|
|
c54f3fc1d8 | ||
|
|
4f74046e62 | ||
|
|
82e52e951a | ||
|
|
d1f7f436f8 | ||
|
|
ed62452853 | ||
|
|
a39a3ddd55 | ||
|
|
3cde8738c2 | ||
|
|
53a27a4306 | ||
|
|
ef16abb41a | ||
|
|
d3f3bb07e0 | ||
|
|
ac63489325 | ||
|
|
cb1f62d4ff | ||
|
|
75cb3bcaf8 | ||
|
|
30eba2dadf | ||
|
|
18650cda63 | ||
|
|
e8280f7e42 | ||
|
|
a91ded81b0 | ||
|
|
cd88249598 | ||
|
|
3a792e9a8e | ||
|
|
42fda5eaf7 | ||
|
|
56b6260348 | ||
|
|
65dfe90526 | ||
|
|
021fbb7d37 | ||
|
|
19eb7baaa2 | ||
|
|
7be8865755 | ||
|
|
b8cc8818ee | ||
|
|
eddc3091a7 | ||
|
|
7f0b99c25e | ||
|
|
63d4bde2d9 | ||
|
|
a2307d45fd | ||
|
|
0e87eb69b5 | ||
|
|
e422b42ba6 | ||
|
|
b4ab654f11 | ||
|
|
d4b29a30b5 | ||
|
|
0b62abbca0 | ||
|
|
a142d39fc9 | ||
|
|
fa67466d20 | ||
|
|
92c6a9d51d | ||
|
|
737d7353a4 | ||
|
|
2c181de6a3 | ||
|
|
95368faccd | ||
|
|
ea7e99f7d3 | ||
|
|
60e8fcdc47 | ||
|
|
3f1968837f | ||
|
|
9cd8e88ab4 | ||
|
|
59f38273e3 | ||
|
|
88a0d072b0 | ||
|
|
b5879f7360 | ||
|
|
1f3ae7b725 | ||
|
|
ab12614d9b | ||
|
|
d69a47a46d | ||
|
|
6e036356df | ||
|
|
635f52d499 | ||
|
|
097420a66f | ||
|
|
aab28aea8c | ||
|
|
5053bc9a6d | ||
|
|
09c42ed0b4 | ||
|
|
23ac3572cf | ||
|
|
23d2b93506 | ||
|
|
f2d6351211 | ||
|
|
1a15109f4b | ||
|
|
79b5def9ba | ||
|
|
c552916266 | ||
|
|
e928d03ec7 | ||
|
|
c375d6fa10 | ||
|
|
16be157add | ||
|
|
950c80a108 | ||
|
|
01c60fa07e | ||
|
|
a45e42e0a5 | ||
|
|
b0c92e28dd | ||
|
|
31abc2d1bd | ||
|
|
b646939113 | ||
|
|
b00fb7671e | ||
|
|
312d500a36 | ||
|
|
beb84c200d | ||
|
|
b8c97e3f70 | ||
|
|
4d6aa1a4f9 | ||
|
|
d933a22154 | ||
|
|
a2b28806b1 | ||
|
|
73b7123906 | ||
|
|
cfb4e481b4 | ||
|
|
f4da18cc3f | ||
|
|
9f845bb73b | ||
|
|
98d124860c | ||
|
|
6f35ced052 | ||
|
|
ad281664c3 | ||
|
|
9cf3c80fba | ||
|
|
dd04d6367b | ||
|
|
754a29a709 | ||
|
|
df7b6a3674 | ||
|
|
b72a0593c6 | ||
|
|
f3820c32f2 | ||
|
|
d2ee1b3fa8 | ||
|
|
320816fd99 | ||
|
|
69e68807bf | ||
|
|
80fd303081 | ||
|
|
709d16eb75 | ||
|
|
3eb711fbf8 | ||
|
|
806eb326d1 | ||
|
|
e5afb6b0c6 | ||
|
|
3d76415af2 | ||
|
|
46a7c9662e | ||
|
|
d03f47a9c7 | ||
|
|
582fe4c8b1 | ||
|
|
7d3e3ae358 | ||
|
|
e1d7ea6302 | ||
|
|
c2fa968835 | ||
|
|
6740a0df28 | ||
|
|
0015c8934d | ||
|
|
7f134072f6 | ||
|
|
6311c2078f | ||
|
|
cceeda0588 | ||
|
|
9af876ccaa | ||
|
|
360417c5fc | ||
|
|
d83ec66775 | ||
|
|
2eac22d626 | ||
|
|
721b027000 | ||
|
|
3fb4f16db9 | ||
|
|
83968977a1 | ||
|
|
60bb74cbb0 | ||
|
|
37d260a519 | ||
|
|
7c3e2cbc70 | ||
|
|
cd0a635535 | ||
|
|
f7a98ed7d1 | ||
|
|
6c2b1becdf | ||
|
|
8ec5aebd3c | ||
|
|
3acd7667bc | ||
|
|
256206af09 | ||
|
|
5d004cde02 | ||
|
|
35049c26f3 | ||
|
|
63940b1d2f | ||
|
|
09d08baecc | ||
|
|
2283a77104 | ||
|
|
3628f1e18d | ||
|
|
e11ee0fa07 | ||
|
|
919790e808 | ||
|
|
8f68ef56e2 | ||
|
|
f13d3e7b35 | ||
|
|
1f5c862168 | ||
|
|
6f6636103e | ||
|
|
921b447b02 | ||
|
|
e51e56e825 | ||
|
|
f15a8421f9 | ||
|
|
80e8392be0 | ||
|
|
5ba45867f7 | ||
|
|
1cffbaa9b8 |
1308 changed files with 141515 additions and 89084 deletions
1
.core/build
Submodule
1
.core/build
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 9c9346d5494688a78ea573f3bc0547ad12b9be2a
|
||||||
83
.core/build.yaml
Normal file
83
.core/build.yaml
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
# Lethean Blockchain Build Configuration
|
||||||
|
# Used by: core compile
|
||||||
|
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
project:
|
||||||
|
name: blockchain
|
||||||
|
type: cpp
|
||||||
|
description: "Lethean Blockchain - SASE infrastructure chain"
|
||||||
|
version: "6.0.1"
|
||||||
|
|
||||||
|
cpp:
|
||||||
|
standard: 17
|
||||||
|
build_type: Release
|
||||||
|
static: false
|
||||||
|
|
||||||
|
conan:
|
||||||
|
version: "2.21.0"
|
||||||
|
requires:
|
||||||
|
- zlib/1.3.1
|
||||||
|
- boost/1.85.0
|
||||||
|
- openssl/3.2.0
|
||||||
|
- miniupnpc/2.2.5
|
||||||
|
- jwt-cpp/0.7.1
|
||||||
|
- oatpp/1.3.0.latest
|
||||||
|
- oatpp-swagger/1.3.0.latest
|
||||||
|
tool_requires:
|
||||||
|
- cmake/3.31.9
|
||||||
|
options:
|
||||||
|
boost/*:without_test: true
|
||||||
|
registry:
|
||||||
|
url: http://forge.snider.dev:4000/api/packages/host-uk/conan
|
||||||
|
remote: conan_build
|
||||||
|
|
||||||
|
cmake:
|
||||||
|
minimum_version: "3.16"
|
||||||
|
variables:
|
||||||
|
USE_CCACHE: "ON"
|
||||||
|
|
||||||
|
options:
|
||||||
|
testnet: false
|
||||||
|
|
||||||
|
targets:
|
||||||
|
- os: linux
|
||||||
|
arch: x86_64
|
||||||
|
profile: gcc-linux-x86_64
|
||||||
|
- os: linux
|
||||||
|
arch: arm64
|
||||||
|
profile: gcc-linux-armv8
|
||||||
|
- os: darwin
|
||||||
|
arch: arm64
|
||||||
|
profile: apple-clang-armv8
|
||||||
|
- os: darwin
|
||||||
|
arch: x86_64
|
||||||
|
profile: apple-clang-x86_64
|
||||||
|
- os: windows
|
||||||
|
arch: x86_64
|
||||||
|
profile: msvc-194-x86_64
|
||||||
|
|
||||||
|
package:
|
||||||
|
generators:
|
||||||
|
- TGZ
|
||||||
|
- ZIP
|
||||||
|
- NSIS
|
||||||
|
- DEB
|
||||||
|
- RPM
|
||||||
|
vendor: Lethean
|
||||||
|
contact: support@lt.hn
|
||||||
|
website: https://lt.hn
|
||||||
|
|
||||||
|
docker:
|
||||||
|
dockerfile: utils/docker/lthn-chain/Dockerfile
|
||||||
|
image: lthn/chain
|
||||||
|
platforms:
|
||||||
|
- linux/amd64
|
||||||
|
tags:
|
||||||
|
- testnet
|
||||||
|
- "{{.Version}}"
|
||||||
|
build_args:
|
||||||
|
BUILD_THREADS: auto
|
||||||
|
BUILD_TESTNET: "1"
|
||||||
|
BUILD_STATIC: "0"
|
||||||
|
BUILD_TYPE: Release
|
||||||
8
.dockerignore
Normal file
8
.dockerignore
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
build
|
||||||
|
.github
|
||||||
|
.idea
|
||||||
|
docs
|
||||||
|
resources
|
||||||
|
snap
|
||||||
|
tests
|
||||||
|
CMakeUserPresets.json
|
||||||
234
.forgejo/workflows/build.yml
Executable file
234
.forgejo/workflows/build.yml
Executable file
|
|
@ -0,0 +1,234 @@
|
||||||
|
name: Build & Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
FORGEJO_URL: ${{ github.server_url }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ──────────────────────────────────────────────
|
||||||
|
# Linux x86_64 — native build on snider-linux
|
||||||
|
# ──────────────────────────────────────────────
|
||||||
|
build-linux:
|
||||||
|
name: Linux x86_64
|
||||||
|
runs-on: linux-native
|
||||||
|
env:
|
||||||
|
CPU_CORES: "24"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
submodules: false
|
||||||
|
|
||||||
|
- name: Init submodules
|
||||||
|
run: |
|
||||||
|
git config --global url."${{ env.FORGEJO_URL }}/".insteadOf "http://forge.snider.dev:4000/"
|
||||||
|
git -c http.extraHeader="Authorization: token ${{ secrets.RELEASE_TOKEN }}" submodule update --init --recursive
|
||||||
|
git submodule foreach --recursive 'git fetch --tags origin 2>/dev/null || true'
|
||||||
|
|
||||||
|
- name: Build dependencies
|
||||||
|
run: |
|
||||||
|
make build-deps \
|
||||||
|
CPU_CORES=${{ env.CPU_CORES }} \
|
||||||
|
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||||
|
CONAN_USER=claude \
|
||||||
|
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
run: |
|
||||||
|
make ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} \
|
||||||
|
CPU_CORES=${{ env.CPU_CORES }} \
|
||||||
|
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||||
|
CONAN_USER=claude \
|
||||||
|
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux-x86_64
|
||||||
|
path: build/packages/lethean-*
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
# ──────────────────────────────────────────────
|
||||||
|
# macOS ARM64 — native build on M3 Ultra
|
||||||
|
# ──────────────────────────────────────────────
|
||||||
|
build-macos:
|
||||||
|
name: macOS ARM64
|
||||||
|
runs-on: macos-native
|
||||||
|
env:
|
||||||
|
CPU_CORES: "24"
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
fetch-tags: true
|
||||||
|
submodules: false
|
||||||
|
|
||||||
|
- name: Init submodules
|
||||||
|
run: |
|
||||||
|
git config --global url."${{ env.FORGEJO_URL }}/".insteadOf "http://forge.snider.dev:4000/"
|
||||||
|
git -c http.extraHeader="Authorization: token ${{ secrets.RELEASE_TOKEN }}" submodule update --init --recursive
|
||||||
|
git submodule foreach --recursive 'git fetch --tags origin 2>/dev/null || true'
|
||||||
|
|
||||||
|
- name: Build dependencies
|
||||||
|
run: |
|
||||||
|
export PATH="/opt/homebrew/bin:$PATH"
|
||||||
|
make build-deps \
|
||||||
|
CPU_CORES=${{ env.CPU_CORES }} \
|
||||||
|
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||||
|
CONAN_USER=claude \
|
||||||
|
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
||||||
|
- name: Compile
|
||||||
|
run: |
|
||||||
|
export PATH="/opt/homebrew/bin:$PATH"
|
||||||
|
make ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} \
|
||||||
|
CPU_CORES=${{ env.CPU_CORES }} \
|
||||||
|
CONAN_URL=${{ env.FORGEJO_URL }}/api/packages/host-uk/conan \
|
||||||
|
CONAN_USER=claude \
|
||||||
|
CONAN_PASSWORD=${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
||||||
|
- name: Upload artifacts
|
||||||
|
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: macos-arm64
|
||||||
|
path: build/packages/lethean-*
|
||||||
|
retention-days: 7
|
||||||
|
|
||||||
|
# ──────────────────────────────────────────────
|
||||||
|
# Aggregate artifacts and create release
|
||||||
|
# ──────────────────────────────────────────────
|
||||||
|
release:
|
||||||
|
name: Create Release
|
||||||
|
needs: [build-linux, build-macos]
|
||||||
|
runs-on: linux-native
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: https://code.forgejo.org/actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
submodules: false
|
||||||
|
|
||||||
|
- name: Download Linux artifacts
|
||||||
|
uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: linux-x86_64
|
||||||
|
path: artifacts/linux
|
||||||
|
|
||||||
|
- name: Download macOS artifacts
|
||||||
|
uses: https://code.forgejo.org/forgejo/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: macos-arm64
|
||||||
|
path: artifacts/macos
|
||||||
|
|
||||||
|
- name: List artifacts
|
||||||
|
run: find artifacts/ -type f | sort
|
||||||
|
|
||||||
|
- name: Compute release tag
|
||||||
|
id: release
|
||||||
|
run: |
|
||||||
|
VERSION=$(grep '^BUILD_VERSION:=' Makefile | cut -d'=' -f2)
|
||||||
|
if [ "${{ github.ref_name }}" = "main" ]; then
|
||||||
|
TAG="v${VERSION}+${{ github.run_number }}"
|
||||||
|
PRERELEASE=false
|
||||||
|
TITLE="v${VERSION} (build ${{ github.run_number }})"
|
||||||
|
else
|
||||||
|
TAG="v${VERSION}-beta+${{ github.run_number }}"
|
||||||
|
PRERELEASE=true
|
||||||
|
TITLE="v${VERSION}-beta (build ${{ github.run_number }})"
|
||||||
|
fi
|
||||||
|
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "title=${TITLE}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Create release
|
||||||
|
id: create_release
|
||||||
|
run: |
|
||||||
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||||
|
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases" \
|
||||||
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"tag_name\": \"${{ steps.release.outputs.tag }}\",
|
||||||
|
\"target_commitish\": \"${{ github.sha }}\",
|
||||||
|
\"name\": \"${{ steps.release.outputs.title }}\",
|
||||||
|
\"body\": \"Automated build from \`${{ github.ref_name }}\` branch (run #${{ github.run_number }})\n\n## Platforms\n- Linux x86_64\n- macOS ARM64 (Apple Silicon)\",
|
||||||
|
\"draft\": false,
|
||||||
|
\"prerelease\": ${{ steps.release.outputs.prerelease }}
|
||||||
|
}")
|
||||||
|
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
||||||
|
BODY=$(echo "$RESPONSE" | sed '$d')
|
||||||
|
if [ "$HTTP_CODE" -ge 400 ]; then
|
||||||
|
echo "Failed to create release (HTTP ${HTTP_CODE}):"
|
||||||
|
echo "$BODY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
RELEASE_ID=$(echo "$BODY" | python3 -c "import sys,json; print(json.load(sys.stdin)['id'])")
|
||||||
|
echo "id=${RELEASE_ID}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Created release ID: ${RELEASE_ID}"
|
||||||
|
|
||||||
|
- name: Upload release assets
|
||||||
|
run: |
|
||||||
|
for dir in artifacts/linux artifacts/macos; do
|
||||||
|
for file in "$dir"/lethean-*; do
|
||||||
|
[ -f "$file" ] || continue
|
||||||
|
FILENAME=$(basename "$file")
|
||||||
|
echo "Uploading: ${FILENAME}"
|
||||||
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
||||||
|
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=${FILENAME}" \
|
||||||
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||||
|
-H "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${file}")
|
||||||
|
if [ "$HTTP_CODE" -ge 400 ]; then
|
||||||
|
echo "Failed to upload ${FILENAME} (HTTP ${HTTP_CODE})"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Uploaded ${FILENAME} (HTTP ${HTTP_CODE})"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: Prune old releases
|
||||||
|
run: |
|
||||||
|
TAG_PREFIX="${{ github.ref_name == 'main' && 'v6' || 'v6.*-beta' }}"
|
||||||
|
CURRENT_ID="${{ steps.create_release.outputs.id }}"
|
||||||
|
echo "Keeping release ${CURRENT_ID}, pruning older ${TAG_PREFIX} releases..."
|
||||||
|
PAGE=1
|
||||||
|
while true; do
|
||||||
|
RELEASES=$(curl -s "${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases?limit=50&page=${PAGE}" \
|
||||||
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}")
|
||||||
|
COUNT=$(echo "$RELEASES" | python3 -c "import sys,json; print(len(json.load(sys.stdin)))" 2>/dev/null || echo 0)
|
||||||
|
[ "$COUNT" = "0" ] && break
|
||||||
|
echo "$RELEASES" | python3 -c "
|
||||||
|
import sys, json, fnmatch
|
||||||
|
for r in json.load(sys.stdin):
|
||||||
|
rid = r['id']
|
||||||
|
tag = r['tag_name']
|
||||||
|
if rid == ${CURRENT_ID}:
|
||||||
|
continue
|
||||||
|
if fnmatch.fnmatch(tag, '${TAG_PREFIX}*'):
|
||||||
|
print(f'{rid} {tag}')
|
||||||
|
" | while read -r RID RTAG; do
|
||||||
|
echo "Deleting release ${RTAG} (id=${RID})"
|
||||||
|
curl -s -o /dev/null -X DELETE \
|
||||||
|
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/releases/${RID}" \
|
||||||
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}"
|
||||||
|
curl -s -o /dev/null -X DELETE \
|
||||||
|
"${{ env.FORGEJO_URL }}/api/v1/repos/${{ github.repository }}/tags/${RTAG}" \
|
||||||
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}"
|
||||||
|
done
|
||||||
|
PAGE=$((PAGE + 1))
|
||||||
|
done
|
||||||
|
echo "Prune complete"
|
||||||
5
.gitattributes
vendored
5
.gitattributes
vendored
|
|
@ -1,2 +1,5 @@
|
||||||
.git* export-ignore
|
.git* export-ignore
|
||||||
/CMakeLists.txt export-subst
|
/CMakeLists.txt export-subst
|
||||||
|
|
||||||
|
# Mark auto-generated SDK clients as "generated" to hide them in GitHub diffs
|
||||||
|
utils/sdk/client/** linguist-generated=true
|
||||||
22
.github/actions/make-docs/action.yml
vendored
Normal file
22
.github/actions/make-docs/action.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# .github/actions/make-docs/action.yml
|
||||||
|
name: 'Build Documentation'
|
||||||
|
description: 'Archives and uploads signed binaries to a GitHub release'
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- run: echo "cache_id=$(date -u '+%V')" >> $GITHUB_ENV
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
key: mkdocs-material-${{ env.cache_id }}
|
||||||
|
path: ~/.cache
|
||||||
|
restore-keys: |
|
||||||
|
mkdocs-material-
|
||||||
|
|
||||||
|
- if: runner.os == 'Linux'
|
||||||
|
run: |
|
||||||
|
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||||
|
- run: pip install mkdocs-git-revision-date-localized-plugin cairosvg mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging]
|
||||||
90
.github/actions/upload-artifacts/action.yml
vendored
Normal file
90
.github/actions/upload-artifacts/action.yml
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
# .github/actions/upload-artifacts/action.yml
|
||||||
|
name: 'Upload Artifacts'
|
||||||
|
description: 'Archives and uploads signed binaries to a GitHub release'
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
required: true
|
||||||
|
description: 'The chain network name to use in filenames, mainnet or testnet'
|
||||||
|
assets:
|
||||||
|
description: "A EOL separated string list of filenames to archive; if asset is a abs path, it's respected"
|
||||||
|
required: false
|
||||||
|
asset-type:
|
||||||
|
required: true
|
||||||
|
description: 'The asset type: cli, gui, ANYTHING; used as a separator for different release packages for the same arch'
|
||||||
|
asset-directory:
|
||||||
|
required: true
|
||||||
|
description: "The directory where 7z's working dir will be set"
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: compute file name
|
||||||
|
id: asset
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
ARCH=${{ runner.arch }}
|
||||||
|
RUNNER_OS=${{ runner.os }}
|
||||||
|
LOWERCASE_ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]')
|
||||||
|
TARGET_OS=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
|
||||||
|
FILENAME="${{ inputs.chain-network }}-${{ inputs.asset-type }}-${TARGET_OS}-${LOWERCASE_ARCH}"
|
||||||
|
echo "key=$FILENAME" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
VERSION=$(grep '^BUILD_VERSION:=' Makefile | cut -d'=' -f2)
|
||||||
|
# Check if a version was found
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Error: BUILD_VERSION could not be found in the Makefile." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
||||||
|
TAG_SUFFIX="-alpha.${{ github.event.number }}"
|
||||||
|
PRERELEASE=true
|
||||||
|
elif [ "${{ inputs.chain-network }}" != "mainnet" ]; then
|
||||||
|
TAG_SUFFIX="-beta"
|
||||||
|
PRERELEASE=true
|
||||||
|
else
|
||||||
|
TAG_SUFFIX=""
|
||||||
|
PRERELEASE=false
|
||||||
|
fi
|
||||||
|
TAG_NAME="${VERSION}${TAG_SUFFIX}+${{ github.run_number }}"
|
||||||
|
echo "tag_name=${TAG_NAME}" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "prerelease=${PRERELEASE}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# Format the output to be a multi-line string.
|
||||||
|
# This is the correct way to pass a multi-line string in GITHUB_OUTPUT.
|
||||||
|
echo "paths<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# Iterate through each filename
|
||||||
|
echo "${{ inputs.assets }}" | while read -r file; do
|
||||||
|
if [[ -z "$file" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
# Check if the file is an absolute path
|
||||||
|
if [[ "$file" == /* ]] || [[ "$file" =~ ^[a-zA-Z]: ]]; then
|
||||||
|
FULL_PATH="$file"
|
||||||
|
else
|
||||||
|
# It's a relative path, so join it with the asset directory
|
||||||
|
if [[ "${{ runner.os }}" == "Windows" ]]; then
|
||||||
|
FULL_PATH="${{ inputs.asset-directory }}\\$file"
|
||||||
|
else
|
||||||
|
FULL_PATH="${{ inputs.asset-directory }}/$file"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "$FULL_PATH" >> "$GITHUB_OUTPUT"
|
||||||
|
done
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Upload Artifacts
|
||||||
|
uses: actions/upload-artifact@v4.6.2
|
||||||
|
with:
|
||||||
|
name: ${{ steps.asset.outputs.key }}
|
||||||
|
path: ${{ steps.asset.outputs.paths }}
|
||||||
|
|
||||||
|
- name: Make Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.asset.outputs.tag_name }}
|
||||||
|
prerelease: ${{ steps.asset.outputs.prerelease }}
|
||||||
|
files: ${{ inputs.asset-directory }}/*
|
||||||
|
target_commitish: ${{ github.sha }}
|
||||||
25
.github/workflows/_maint-cache.yml
vendored
Normal file
25
.github/workflows/_maint-cache.yml
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
name: Clear all Github actions caches on sundays
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * 0"
|
||||||
|
workflow_dispatch:
|
||||||
|
# pull_request:
|
||||||
|
# types:
|
||||||
|
# - opened
|
||||||
|
# - synchronize
|
||||||
|
# - reopened
|
||||||
|
# branches:
|
||||||
|
# - dev
|
||||||
|
# - main
|
||||||
|
# paths-ignore:
|
||||||
|
# - '**.md'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
my-job:
|
||||||
|
name: Delete all caches
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
steps:
|
||||||
|
- name: Clear caches
|
||||||
|
run: gh cache delete --all --repo ${{ github.repository }}
|
||||||
70
.github/workflows/_on-pr.yml
vendored
Normal file
70
.github/workflows/_on-pr.yml
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
name: PR
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request_review:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux-intel:
|
||||||
|
name: Linux
|
||||||
|
if: ${{!github.event.pull_request.draft}}
|
||||||
|
uses: ./.github/workflows/build-linux-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-linux-arm:
|
||||||
|
name: Linux
|
||||||
|
if: ${{!github.event.pull_request.draft}}
|
||||||
|
uses: ./.github/workflows/build-linux-arm64.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-windows-intel:
|
||||||
|
name: Windows
|
||||||
|
if: ${{!github.event.pull_request.draft}}
|
||||||
|
uses: ./.github/workflows/build-windows-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-macos-arm64:
|
||||||
|
name: MacOS
|
||||||
|
uses: ./.github/workflows/build-macos-arm64.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-macos-intel:
|
||||||
|
name: MacOS
|
||||||
|
if: ${{!github.event.pull_request.draft}}
|
||||||
|
uses: ./.github/workflows/build-macos-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
name: Docker
|
||||||
|
if: ${{!github.event.pull_request.draft}}
|
||||||
|
uses: ./.github/workflows/build-docker.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docs:
|
||||||
|
name: Docs
|
||||||
|
if: ${{!github.event.pull_request.draft}}
|
||||||
|
uses: ./.github/workflows/build-docs.yml
|
||||||
62
.github/workflows/_on-push.yml
vendored
Normal file
62
.github/workflows/_on-push.yml
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
||||||
|
name: Push Compile
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
on:
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'dev'
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux-intel:
|
||||||
|
name: Linux
|
||||||
|
uses: ./.github/workflows/build-linux-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-linux-arm:
|
||||||
|
name: Linux
|
||||||
|
uses: ./.github/workflows/build-linux-arm64.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-windows-intel:
|
||||||
|
name: Windows
|
||||||
|
uses: ./.github/workflows/build-windows-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-macos-arm64:
|
||||||
|
name: MacOS
|
||||||
|
uses: ./.github/workflows/build-macos-arm64.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-macos-intel:
|
||||||
|
name: MacOS
|
||||||
|
uses: ./.github/workflows/build-macos-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
name: Docker
|
||||||
|
uses: ./.github/workflows/build-docker.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docs:
|
||||||
|
name: Docs
|
||||||
|
uses: ./.github/workflows/build-docs.yml
|
||||||
83
.github/workflows/_on-release.yml
vendored
Normal file
83
.github/workflows/_on-release.yml
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
name: Push Full Build
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [ published ]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
determine-network:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
chain-network: ${{ steps.get_branch.outputs.chain_network }}
|
||||||
|
steps:
|
||||||
|
- name: Get release information from API
|
||||||
|
id: get_branch
|
||||||
|
run: |
|
||||||
|
# Use the GitHub CLI to get the release details by tag name
|
||||||
|
# The result is a JSON object
|
||||||
|
RELEASE_INFO=$(gh release view --json targetCommitish -t ${{ github.ref_name }})
|
||||||
|
|
||||||
|
# Extract the target commitish (the source branch)
|
||||||
|
SOURCE_BRANCH=$(echo "$RELEASE_INFO" | jq -r '.targetCommitish')
|
||||||
|
|
||||||
|
# Set the chain network based on the source branch
|
||||||
|
if [ "$SOURCE_BRANCH" == "dev" ]; then
|
||||||
|
echo "chain_network=testnet" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "chain_network=mainnet" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Source Branch: $SOURCE_BRANCH"
|
||||||
|
echo "Chain Network: ${{ steps.get_branch.outputs.chain_network }}"
|
||||||
|
|
||||||
|
build-linux-intel:
|
||||||
|
name: Chain
|
||||||
|
uses: ./.github/workflows/build-linux-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-linux-arm:
|
||||||
|
name: Chain
|
||||||
|
uses: ./.github/workflows/build-linux-arm64.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-windows-intel:
|
||||||
|
name: Chain
|
||||||
|
uses: ./.github/workflows/build-windows-intel.yml
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-macos-arm64:
|
||||||
|
name: Chain
|
||||||
|
uses: ./.github/workflows/build-macos-arm64.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-macos-intel:
|
||||||
|
name: Chain
|
||||||
|
uses: ./.github/workflows/build-macos-intel.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docker:
|
||||||
|
name: Docker
|
||||||
|
uses: ./.github/workflows/build-docker.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }}
|
||||||
|
|
||||||
|
build-docs:
|
||||||
|
name: Docs
|
||||||
|
uses: ./.github/workflows/build-docs.yml
|
||||||
54
.github/workflows/build-docker.yml
vendored
Normal file
54
.github/workflows/build-docker.yml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
name: Docker
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
secrets:
|
||||||
|
DOCKERHUB_USERNAME:
|
||||||
|
required: true
|
||||||
|
DOCKERHUB_TOKEN:
|
||||||
|
required: true
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||||
|
default: testnet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: "lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}"
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
env:
|
||||||
|
DOCKER_BUILD_SUMMARY: false
|
||||||
|
DOCKER_BUILD_RECORD_UPLOAD: false
|
||||||
|
with:
|
||||||
|
file: utils/docker/lthn-chain/Dockerfile
|
||||||
|
context: ${{ github.workspace }}
|
||||||
|
push: true
|
||||||
|
build-args: |
|
||||||
|
BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||||
|
THREADS=2
|
||||||
|
BUILD_LOCAL=1
|
||||||
|
tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }}
|
||||||
|
|
||||||
40
.github/workflows/build-docs.yml
vendored
Normal file
40
.github/workflows/build-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
name: docs
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Offline Local Version
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- run: sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||||
|
- run: pip install mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin mkdocs-material[imaging]
|
||||||
|
|
||||||
|
- name: Build Offline Version
|
||||||
|
run: make docs
|
||||||
|
|
||||||
|
- name: CLI Artifacts
|
||||||
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
with:
|
||||||
|
chain-network: ${{ inputs.chain-network }}
|
||||||
|
assets: "*"
|
||||||
|
asset-type: 'docs'
|
||||||
|
asset-directory: ${{ github.workspace }}/build/docs
|
||||||
90
.github/workflows/build-linux-arm64.yml
vendored
Normal file
90
.github/workflows/build-linux-arm64.yml
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
name: Linux
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||||
|
default: testnet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache:
|
||||||
|
name: cache-arm64
|
||||||
|
runs-on: ubuntu-22.04-arm
|
||||||
|
steps:
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- name: Checkout Project
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: sudo apt-get install -y autotools-dev git build-essential libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||||
|
make upload-conan-cache
|
||||||
|
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: compile-arm64
|
||||||
|
needs: cache
|
||||||
|
runs-on: ubuntu-22.04-arm
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
run: sudo apt-get install -y autotools-dev rpm git build-essential libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||||
|
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Release
|
||||||
|
run: make ${{ inputs.chain-network }}
|
||||||
|
|
||||||
|
- name: CLI Artifacts
|
||||||
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
with:
|
||||||
|
chain-network: ${{ inputs.chain-network }}
|
||||||
|
assets: lethean-*
|
||||||
|
asset-type: 'cli'
|
||||||
|
asset-directory: ${{ github.workspace }}/build/packages
|
||||||
90
.github/workflows/build-linux-intel.yml
vendored
Normal file
90
.github/workflows/build-linux-intel.yml
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
name: Linux
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||||
|
default: testnet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache:
|
||||||
|
name: cache-x86_64
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
lookup-only: true
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- name: Checkout Project
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: sudo apt-get install -y autotools-dev rpm git build-essential
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||||
|
make upload-conan-cache
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: compile-x86_64
|
||||||
|
needs: cache
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: install dependencies
|
||||||
|
run: sudo apt-get install -y autotools-dev git build-essential
|
||||||
|
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Release
|
||||||
|
run: make ${{ inputs.chain-network }}
|
||||||
|
|
||||||
|
- name: CLI Artifacts
|
||||||
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
with:
|
||||||
|
chain-network: ${{ inputs.chain-network }}
|
||||||
|
assets: lethean-*
|
||||||
|
asset-type: 'cli'
|
||||||
|
asset-directory: ${{ github.workspace }}/build/packages
|
||||||
85
.github/workflows/build-macos-arm64.yml
vendored
Normal file
85
.github/workflows/build-macos-arm64.yml
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
||||||
|
name: build-macos-arm64
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||||
|
default: testnet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache:
|
||||||
|
name: cache-armv8
|
||||||
|
runs-on: macos-15
|
||||||
|
steps:
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
lookup-only: true
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- name: Checkout Project
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
make build-deps CPU_CORES=3 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||||
|
make upload-conan-cache
|
||||||
|
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: compile-armv8
|
||||||
|
needs: cache
|
||||||
|
runs-on: macos-15
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
|
||||||
|
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Release
|
||||||
|
run: make ${{ inputs.chain-network }}
|
||||||
|
|
||||||
|
- name: CLI Artifacts
|
||||||
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
with:
|
||||||
|
chain-network: ${{ inputs.chain-network }}
|
||||||
|
assets: lethean-*
|
||||||
|
asset-type: 'cli'
|
||||||
|
asset-directory: ${{ github.workspace }}/build/packages
|
||||||
81
.github/workflows/build-macos-intel.yml
vendored
Normal file
81
.github/workflows/build-macos-intel.yml
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
||||||
|
name: build-macos-intel
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||||
|
default: testnet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache:
|
||||||
|
name: cache-x86_64
|
||||||
|
runs-on: macos-13
|
||||||
|
steps:
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
lookup-only: true
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- name: Checkout Project
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||||
|
make upload-conan-cache
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: compile-x86_64
|
||||||
|
needs: cache
|
||||||
|
runs-on: macos-13
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Release
|
||||||
|
run: make ${{ inputs.chain-network }}
|
||||||
|
|
||||||
|
- name: CLI Artifacts
|
||||||
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
with:
|
||||||
|
chain-network: ${{ inputs.chain-network }}
|
||||||
|
assets: lethean-*
|
||||||
|
asset-type: 'cli'
|
||||||
|
asset-directory: ${{ github.workspace }}/build/packages
|
||||||
82
.github/workflows/build-windows-intel.yml
vendored
Normal file
82
.github/workflows/build-windows-intel.yml
vendored
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
name: build-windows
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
chain-network:
|
||||||
|
description: "The network to use, can either be testnet, stagenet or mainnet"
|
||||||
|
default: testnet
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache:
|
||||||
|
name: cache-x86_64
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
id: cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
lookup-only: true
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- name: Checkout Project
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Dependencies
|
||||||
|
if: steps.cache.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||||
|
make upload-conan-cache
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: compile-x86_64
|
||||||
|
needs: cache
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Project
|
||||||
|
uses: actions/checkout@v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- name: Cache SDK Folder
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
${{ github.workspace }}/build/sdk
|
||||||
|
${{ github.workspace }}/build/bin
|
||||||
|
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||||
|
|
||||||
|
- run: choco install nsis.install
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: 3.x
|
||||||
|
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||||
|
|
||||||
|
- name: Compile Release
|
||||||
|
run: make ${{ inputs.chain-network }}
|
||||||
|
|
||||||
|
- name: CLI Artifacts
|
||||||
|
uses: ./.github/actions/upload-artifacts
|
||||||
|
with:
|
||||||
|
chain-network: ${{ inputs.chain-network }}
|
||||||
|
assets: lethean-*
|
||||||
|
asset-type: 'cli'
|
||||||
|
asset-directory: ${{ github.workspace }}/build/packages
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
|
|
@ -5,5 +5,13 @@
|
||||||
._.DS_Store
|
._.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
._*
|
._*
|
||||||
.idea
|
.idea/workspace.xml
|
||||||
.vs/*
|
.idea/usage.statistics.xml
|
||||||
|
.idea/dictionaries
|
||||||
|
.idea/shelf
|
||||||
|
.idea/copilot*
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/*.iml
|
||||||
|
.vs/*
|
||||||
|
CMakeUserPresets.json
|
||||||
|
ConanPresets.json
|
||||||
|
|
|
||||||
26
.gitmodules
vendored
26
.gitmodules
vendored
|
|
@ -1,14 +1,18 @@
|
||||||
[submodule "contrib/miniupnp"]
|
|
||||||
path = contrib/miniupnp
|
|
||||||
url = https://github.com/miniupnp/miniupnp
|
|
||||||
[submodule "src/gui/qt-daemon/layout"]
|
|
||||||
path = src/gui/qt-daemon/layout
|
|
||||||
url = https://github.com/hyle-team/zano_ui.git
|
|
||||||
branch = main
|
|
||||||
[submodule "contrib/tor-connect"]
|
|
||||||
path = contrib/tor-connect
|
|
||||||
url = https://github.com/hyle-team/tor-connect.git
|
|
||||||
branch = main
|
|
||||||
[submodule "contrib/jwt-cpp"]
|
[submodule "contrib/jwt-cpp"]
|
||||||
path = contrib/jwt-cpp
|
path = contrib/jwt-cpp
|
||||||
url = https://github.com/Thalhammer/jwt-cpp.git
|
url = https://github.com/Thalhammer/jwt-cpp.git
|
||||||
|
[submodule "contrib/bitcoin-secp256k1"]
|
||||||
|
path = contrib/bitcoin-secp256k1
|
||||||
|
url = https://github.com/bitcoin-core/secp256k1.git
|
||||||
|
[submodule "contrib/tor-connect"]
|
||||||
|
path = contrib/tor-connect
|
||||||
|
url = https://github.com/hyle-team/tor-connect.git
|
||||||
|
[submodule "docs"]
|
||||||
|
path = docs
|
||||||
|
url = https://github.com/letheanVPN/documentation.git
|
||||||
|
[submodule "contrib/randomx"]
|
||||||
|
path = contrib/randomx
|
||||||
|
url = https://github.com/tevador/RandomX.git
|
||||||
|
[submodule ".core/build"]
|
||||||
|
path = .core/build
|
||||||
|
url = http://forge.snider.dev:4000/host-uk/build.git
|
||||||
|
|
|
||||||
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Lethean
|
||||||
8
.idea/cmake.xml
generated
Normal file
8
.idea/cmake.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CMakeSharedSettings">
|
||||||
|
<configurations>
|
||||||
|
<configuration PROFILE_NAME="Debug" ENABLED="true" GENERATION_DIR="build/release" CONFIG_NAME="Debug" GENERATION_OPTIONS="--preset testnet" BUILD_OPTIONS="--preset testnet --parallel 30" NO_GENERATOR="true" />
|
||||||
|
</configurations>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
105
.idea/codeStyles/Project.xml
generated
Normal file
105
.idea/codeStyles/Project.xml
generated
Normal file
|
|
@ -0,0 +1,105 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<code_scheme name="Project" version="173">
|
||||||
|
<RiderCodeStyleSettings>
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
|
||||||
|
</RiderCodeStyleSettings>
|
||||||
|
<clangFormatSettings>
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</clangFormatSettings>
|
||||||
|
</code_scheme>
|
||||||
|
</component>
|
||||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<component name="ProjectCodeStyleConfiguration">
|
||||||
|
<state>
|
||||||
|
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
6
.idea/copyright/LTHN.xml
generated
Normal file
6
.idea/copyright/LTHN.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="Copyright (c) 2017-2025 Lethean (https://lt.hn) Licensed under the European Union Public Licence (EUPL) version 1.2. You may obtain a copy of the licence at: https://joinup.ec.europa.eu/software/page/eupl/licence-eupl The EUPL is a copyleft licence that is compatible with the MIT/X11 licence used by the original projects; but maintains OSS status, where regional copyright law requires ownership to dictate licence terms. SPDX‑License‑Identifier: EUPL-1.2 " />
|
||||||
|
<option name="myName" value="LTHN" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
||||||
6
.idea/copyright/Lethean.xml
generated
Normal file
6
.idea/copyright/Lethean.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<copyright>
|
||||||
|
<option name="notice" value="Copyright (c) 2014-2018 Zano Project Copyright (c) 2014-2018 The Louisdor Project Copyright (c) 2012-2013 The Boolberry developers Copyright (c) 2017-2025 Lethean (https://lt.hn) Licensed under the European Union Public Licence (EUPL) version 1.2. You may obtain a copy of the licence at: https://joinup.ec.europa.eu/software/page/eupl/licence-eupl The EUPL is a copyleft licence that is compatible with the MIT/X11 licence used by the original projects; the MIT terms are therefore considered “grandfathered” under the EUPL for this code. SPDX‑License‑Identifier: EUPL-1.2 " />
|
||||||
|
<option name="myName" value="Lethean" />
|
||||||
|
</copyright>
|
||||||
|
</component>
|
||||||
8
.idea/copyright/profiles_settings.xml
generated
Normal file
8
.idea/copyright/profiles_settings.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<component name="CopyrightManager">
|
||||||
|
<settings default="LTHN">
|
||||||
|
<module2copyright>
|
||||||
|
<element module="apiserver" copyright="LTHN" />
|
||||||
|
<element module="Project Files" copyright="Lethean" />
|
||||||
|
</module2copyright>
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
344
.idea/editor.xml
generated
Normal file
344
.idea/editor.xml
generated
Normal file
|
|
@ -0,0 +1,344 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="BackendCodeEditorSettings">
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CDeclarationWithImplicitIntType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConstevalIfIsAlwaysConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractClassWithoutSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAbstractVirtualFunctionCallInCtor/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAccessSpecifierWithNoDeclarations/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppAwaiterTypeIsNotClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBooleanIncrementExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatBadCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatLegacyCode/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatMixedArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooFewArgs/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppBoostFormatTooManyArgs/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCVQualifierCanNotBeAppliedToReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassCanBeFinal/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassIsIncomplete/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeedsConstructorBecauseOfUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppClassNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCompileTimeConstantCanBeReplacedWithBooleanConstant/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConceptNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConditionalExpressionCanBeSimplified/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppConstValueFunctionReturnType/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppCoroutineCallResolveError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAArrayIndexOutOfBounds/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantConditions/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantFunctionResult/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAConstantParameter/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFADeletedPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAEndlessLoop/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInfiniteRecursion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAInvalidatedMemory/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALocalValueEscapesScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFALoopConditionNotUpdated/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAMemoryLeak/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANotInitializedField/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFANullDereference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFATimeOver/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableCode/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreachableFunctionCall/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnreadVariable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDFAUnusedValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesLocal/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationHidesUncapturedLocal/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclarationSpecifierWithoutDeclarators/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorDisambiguatedAsFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeclaratorUsedBeforeInitialization/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultCaseNotHandledInSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultInitializationWithNoUserConstructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultIsUsedAsIdentifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDefaultedSpecialMemberFunctionIsImplicitlyDeleted/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeletingVoidPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTemplateWithoutTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDependentTypeWithoutTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedEntity/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedOverridenMethod/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDeprecatedRegisterStorageClassSpecifier/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDereferenceOperatorLimitExceeded/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDiscardedPostfixOperatorResult/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenSyntaxError/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUndocumentedParameter/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppDoxygenUnresolvedReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEmptyDeclaration/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersOrder/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceCVQualifiersPlacement/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceDoStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceForStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceFunctionDeclarationStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceIfStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceNestedNamespacesStyle/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingDestructorStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceOverridingFunctionStyle/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceTypeAliasCodeStyle/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnforceWhileStatementBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityAssignedButNoRead/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEntityUsedOnlyInUnevaluatedContext/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEnumeratorNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEqualOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppEvaluationFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExplicitSpecializationInNonNamespaceScope/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppExpressionWithoutSideEffects/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalFunctionInFinalClass/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFinalNonOverridingVirtualFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForLoopCanBeReplacedWithWhile/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppForwardEnumDeclarationWithoutUnderlyingType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionDoesntReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionResultShouldBeUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppFunctionalStyleCast/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHeaderHasBeenAlreadyIncluded/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHiddenFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppHidingFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIdenticalOperandsInBinaryExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIfCanBeReplacedByConstexprIf/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppImplicitDefaultConstructorNotAvailable/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompatiblePointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIncompleteSwitchStatement/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInconsistentNaming/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppIntegralToPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppInvalidLineContinuation/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppJoinDeclarationAndAssignment/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLambdaCaptureNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLocalVariableWithNonTrivialDtorIsNeverUsed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppLongFloat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeConst/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberFunctionMayBeStatic/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMemberInitializersOrder/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMismatchedClassTags/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingIncludeGuard/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMissingKeywordThrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppModulePartitionWithSeveralPartitionUnits/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtAddressOfClassRValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtBindingRValueToLvalueReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtCopyElisionInCopyInitDeclarator/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtDoubleUserConversionInCopyInit/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtNotInitializedStaticConstLocalVar/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMsExtReinterpretCastFromNullptr/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMultiCharacterWideLiteral/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMustBePublicVirtualToImplementInterface/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppMutableSpecifierOnReferenceMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNoDiscardExpression/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNodiscardFunctionWithoutReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExceptionSafeResourceAcquisition/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConversionOperator/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonExplicitConvertingConstructor/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineFunctionDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNonInlineVariableDefinitionInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppNotAllPathsReturnValue/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppObjectMemberMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppOutParameterMustBeWritten/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConst/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterMayBeConstPtrOrRef/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNamesMismatch/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPassValueParameterByConstReference/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerConversionDropsQualifiers/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPointerToIntegralConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPolymorphicClassWithNonVirtualPublicDestructor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyErroneousEmptyStatements/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUninitializedMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPossiblyUnintendedObjectSlicing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderIsNotIncluded/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrecompiledHeaderNotFound/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfBadFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfExtraArg/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfMissedArg/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrintfRiskyFormat/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppPrivateSpecialMemberFunctionIsNotImplemented/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRangeBasedForIncompatibleReference/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedefinitionOfDefaultArgumentInOverrideFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassAccessSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBaseClassInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantBooleanExpressionArgument/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantCastExpression/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantComplexityInComparison/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConditionalExpression/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantConstSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantControlFlowJump/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantDereferencingAndTakingAddress/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElaboratedTypeSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeyword/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantElseKeywordInsideCompoundStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyDeclaration/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantEmptyStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantExportKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantFwdClassOrEnumSpecifier/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantInlineSpecifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantLambdaParameterList/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantMemberInitializer/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantNamespaceDefinition/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantParentheses/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifier/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantQualifierADL/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnMemberAllocationFunction/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantStaticSpecifierOnThreadLocalLocalVariable/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateArguments/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTemplateKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantTypenameKeyword/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantVoidArgumentList/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRedundantZeroInitializerInAggregateInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReinterpretCastFromVoidPtr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppRemoveRedundantBraces/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceMemsetWithZeroInitialization/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReplaceTieWithStructuredBinding/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppReturnNoValueInNonVoidFunction/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSmartPointerVsMakeFunction/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSomeObjectMembersMightNotBeInitialized/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppSpecialFunctionWithoutNoexceptSpecification/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticAssertFailure/@EntryIndexedValue" value="ERROR" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticDataMemberInUnnamedStruct/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStaticSpecifierOnAnonymousNamespaceMember/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppStringLiteralToCharPointerConversion/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTabsAreDisallowed/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateArgumentsCanBeDeduced/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterNeverUsed/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTemplateParameterShadowing/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppThrowExpressionCanBeReplacedWithRethrow/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScope/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTooWideScopeInitStatement/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppTypeAliasNeverUsed/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedDependentBaseClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUninitializedNonStaticDataMember/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnionMemberOfReferenceType/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaEndRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnmatchedPragmaRegionDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnamedNamespaceInHeaderFile/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnnecessaryWhitespace/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnsignedZeroComparison/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUnusedIncludeDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAlgorithmWithCount/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAssociativeContains/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAuto/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseAutoForNumeric/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseElementsView/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseEraseAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseFamiliarTemplateSyntaxForGenericLambdas/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseRangeAlgorithm/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStdSize/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseStructuredBinding/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUseTypeTraitAlias/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUserDefinedLiteralSuffixDoesNotStartWithUnderscore/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppUsingResultOfAssignmentAsCondition/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVariableCanBeMadeConstexpr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionCallInsideCtor/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVirtualFunctionInFinalClass/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppVolatileParameterInDeclaration/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWarningDirective/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongIncludesOrder/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppWrongSlashesInIncludeDirective/@EntryIndexedValue" value="HINT" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroConstantCanBeReplacedWithNullptr/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=CppZeroValuedExpressionUsedAsNullPointer/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=IfStdIsConstantEvaluatedCanBeReplaced/@EntryIndexedValue" value="SUGGESTION" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StdIsConstantEvaluatedWillAlwaysEvaluateToConstant/@EntryIndexedValue" value="WARNING" type="string" />
|
||||||
|
<option name="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringLiteralTypo/@EntryIndexedValue" value="DO_NOT_SHOW" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
|
||||||
|
<option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
|
||||||
|
<option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
13
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
13
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||||
|
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="ignoredIdentifiers">
|
||||||
|
<list>
|
||||||
|
<option value="tuple.*" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
43
.idea/jsonSchemas.xml
generated
Normal file
43
.idea/jsonSchemas.xml
generated
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JsonSchemaMappingsProjectConfiguration">
|
||||||
|
<state>
|
||||||
|
<map>
|
||||||
|
<entry key="GitHub Action JSON Schema">
|
||||||
|
<value>
|
||||||
|
<SchemaInfo>
|
||||||
|
<option name="name" value="GitHub Action JSON Schema" />
|
||||||
|
<option name="relativePathToSchema" value="jar://$APPLICATION_PLUGINS_DIR$/vcs-github-IU/lib/vcs-github.jar!/schemas/github-action.json" />
|
||||||
|
<option name="applicationDefined" value="true" />
|
||||||
|
<option name="patterns">
|
||||||
|
<list>
|
||||||
|
<Item>
|
||||||
|
<option name="path" value=".github/actions/**/*.yml" />
|
||||||
|
</Item>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</SchemaInfo>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
<entry key="openapitools">
|
||||||
|
<value>
|
||||||
|
<SchemaInfo>
|
||||||
|
<option name="generatedName" value="New Schema" />
|
||||||
|
<option name="name" value="openapitools" />
|
||||||
|
<option name="relativePathToSchema" value="utils/sdk/openapitools.json" />
|
||||||
|
<option name="patterns">
|
||||||
|
<list>
|
||||||
|
<Item>
|
||||||
|
<option name="directory" value="true" />
|
||||||
|
<option name="path" value="utils/sdk/packages" />
|
||||||
|
<option name="mappingKind" value="Directory" />
|
||||||
|
</Item>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</SchemaInfo>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</state>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
34
.idea/misc.xml
generated
Normal file
34
.idea/misc.xml
generated
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Black">
|
||||||
|
<option name="sdkName" value="Python 3.13 virtualenv at $PROJECT_DIR$.venv" />
|
||||||
|
</component>
|
||||||
|
<component name="CMakePythonSetting">
|
||||||
|
<option name="pythonIntegrationState" value="YES" />
|
||||||
|
</component>
|
||||||
|
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
<component name="CidrRootsConfiguration">
|
||||||
|
<excludeRoots>
|
||||||
|
<file path="$PROJECT_DIR$/build" />
|
||||||
|
</excludeRoots>
|
||||||
|
</component>
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MakefileSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<MakefileProjectSettings>
|
||||||
|
<option name="buildOptions" value="--jobs=30" />
|
||||||
|
<option name="buildTarget" value="build" />
|
||||||
|
<option name="cleanTarget" value="clean-build" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="switches" value="TESTNET=1 STATIC=1" />
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</MakefileProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
||||||
6
.idea/prettier.xml
generated
Normal file
6
.idea/prettier.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="PrettierConfiguration">
|
||||||
|
<option name="myConfigurationMode" value="AUTOMATIC" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
3
.idea/scopes/apiserver.xml
generated
Normal file
3
.idea/scopes/apiserver.xml
generated
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<component name="DependencyValidationManager">
|
||||||
|
<scope name="apiserver" pattern="file[blockchain]:src/api//*" />
|
||||||
|
</component>
|
||||||
10
.idea/vcs.xml
generated
Normal file
10
.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/contrib/bitcoin-secp256k1" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/contrib/jwt-cpp" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/contrib/tor-connect" vcs="Git" />
|
||||||
|
<mapping directory="$PROJECT_DIR$/docs" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
55
AGENTS.md
Normal file
55
AGENTS.md
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
# AI Agent Collaboration Framework for Repository Contributions
|
||||||
|
|
||||||
|
## 1. Purpose and Guiding Philosophy
|
||||||
|
|
||||||
|
This document provides a guiding framework for any AI agent interacting with this repository. Its purpose is to ensure that all automated contributions, especially Pull Request (PR) reviews and code suggestions, are constructive, respectful, and aligned with the project's overarching goals.
|
||||||
|
|
||||||
|
This framework operates in accordance with the foundational **Axioms of Life**, translating their universal principles into the specific context of human-AI software development collaboration. The primary goal is a partnership that enhances code quality and developer velocity, not one that creates friction through pedantry.
|
||||||
|
|
||||||
|
## 2. Core Principles for AI Interaction
|
||||||
|
|
||||||
|
All agents MUST adhere to the following principles:
|
||||||
|
|
||||||
|
* **Principle 1: Respect Authorial Intent (Axiom 1 & 4)**
|
||||||
|
* Your primary goal is to understand and support the human author's objective. Before suggesting a change, first assume the author had a valid reason for their implementation. Frame your feedback as a way to better achieve their goal or to prevent unintended side effects. Do not challenge intent without clear evidence of a functional error.
|
||||||
|
|
||||||
|
* **Principle 2: Prioritize Objectivity and Verifiability (Axiom 2)**
|
||||||
|
* Feedback MUST be anchored in objective, verifiable criteria. Subjective opinions on style are the lowest priority.
|
||||||
|
* **Valid criteria include:**
|
||||||
|
* Demonstrable bugs or logical errors.
|
||||||
|
* Security vulnerabilities.
|
||||||
|
* Performance regressions.
|
||||||
|
* Violations of a documented project standard (e.g., a style guide file in the repo).
|
||||||
|
* **Invalid criteria include:**
|
||||||
|
* Personal stylistic preferences not codified in a project standard.
|
||||||
|
* Code organization that is merely "different" but not functionally incorrect.
|
||||||
|
|
||||||
|
* **Principle 3: Adopt a Collaborative, Non-Authoritarian Tone (Axiom 4)**
|
||||||
|
* As a digital substrate interacting with a human one, you must adopt a tone of a helpful, respectful peer. Avoid declarative or demanding language.
|
||||||
|
* **Prefer:** "Have you considered...?", "An alternative here that might prevent X is...", "I noticed this could lead to Y. What do you think about...?"
|
||||||
|
* **Avoid:** "You must fix this.", "This is wrong.", "Change this to..."
|
||||||
|
|
||||||
|
* **Principle 4: Provide Actionable and Justified Suggestions (Axiom 3)**
|
||||||
|
* Do not simply state that something is incorrect. Provide a clear explanation for *why* it is a potential issue and, whenever possible, offer a concrete, well-explained code suggestion that resolves it. Your intent is to help, not just to criticize.
|
||||||
|
|
||||||
|
## 3. Feedback Severity Classification
|
||||||
|
|
||||||
|
To combat pedantry, all feedback provided in PR reviews MUST be classified into one of the following three levels. This creates a clear hierarchy of importance.
|
||||||
|
|
||||||
|
### **Level 1: Critical (Blocking)**
|
||||||
|
* **Definition:** Issues that will cause demonstrable harm if merged.
|
||||||
|
* **Examples:** Bugs, logic errors, security vulnerabilities, unhandled exceptions, build failures.
|
||||||
|
* **Action:** These issues MUST be addressed by the author before a merge. Your feedback should clearly state the nature of the critical issue.
|
||||||
|
|
||||||
|
### **Level 2: Important (Non-Blocking Recommendation)**
|
||||||
|
* **Definition:** Issues that deviate from established project best practices or could impact future maintainability.
|
||||||
|
* **Examples:** Violations of a documented style guide, clear opportunities to improve readability, non-critical performance improvements, deprecation warnings.
|
||||||
|
* **Action:** These issues SHOULD be addressed. Frame them as strong recommendations that improve the health of the codebase. The author may choose to address them in a follow-up PR if necessary.
|
||||||
|
|
||||||
|
### **Level 3: Suggestion (Optional Nitpick)**
|
||||||
|
* **Definition:** Minor stylistic preferences, alternative implementations with no clear functional advantage, or purely cosmetic changes. This is the "pedantic" category.
|
||||||
|
* **Action:** These suggestions are entirely optional and at the author's discretion. They MUST be explicitly prefixed with "Optional:", "Nit:", or "Suggestion:". This signals to the human that the comment is non-essential and can be safely ignored without consequence.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
By adhering to this framework, AI agents become valuable partners in the development process, helping to catch critical errors while respecting the creative autonomy and focus of their human collaborators.
|
||||||
178
CMakeLists.txt
178
CMakeLists.txt
|
|
@ -1,16 +1,16 @@
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
message(STATUS "Using CMake version: ${CMAKE_VERSION}")
|
||||||
|
|
||||||
PROJECT(Zano)
|
set(DISABLE_TOR TRUE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
|
||||||
|
|
||||||
|
PROJECT(Lethean)
|
||||||
|
|
||||||
message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}")
|
set(VERSION "1.0" CACHE STRING "Build version")
|
||||||
message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}")
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}")
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
list(INSERT CMAKE_MODULE_PATH 0
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/.core/build/cmake")
|
||||||
|
|
||||||
set(VERSION "1.0")
|
|
||||||
|
|
||||||
if(POLICY CMP0043)
|
if(POLICY CMP0043)
|
||||||
cmake_policy(SET CMP0043 NEW)
|
cmake_policy(SET CMP0043 NEW)
|
||||||
|
|
@ -18,26 +18,35 @@ endif()
|
||||||
if(POLICY CMP0043)
|
if(POLICY CMP0043)
|
||||||
cmake_policy(SET CMP0074 NEW)
|
cmake_policy(SET CMP0074 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
if(POLICY CMP0091)
|
||||||
|
cmake_policy(SET CMP0091 NEW)
|
||||||
|
endif()
|
||||||
if(POLICY CMP0144)
|
if(POLICY CMP0144)
|
||||||
cmake_policy(SET CMP0144 NEW)
|
cmake_policy(SET CMP0144 NEW)
|
||||||
endif()
|
endif()
|
||||||
|
if(POLICY CMP0167)
|
||||||
|
cmake_policy(SET CMP0167 OLD)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(DocBuilder)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
option (USE_CCACHE "Use ccache if a usable instance is found" OFF)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
if (USE_CCACHE)
|
||||||
|
include(FindCcache)
|
||||||
|
else()
|
||||||
|
message(STATUS "ccache deselected")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
add_definitions(-DMOBILE_WALLET_BUILD)
|
add_definitions(-DMOBILE_WALLET_BUILD)
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
|
||||||
add_definitions(-DIOS_BUILD)
|
add_definitions(-DIOS_BUILD)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
add_definitions(-DANDROID_BUILD)
|
add_definitions(-DANDROID_BUILD)
|
||||||
message("Android sdk prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
|
message("Android sdk prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
|
||||||
message("Android CMAKE_CXX_COMPILER prefix: ${CMAKE_CXX_COMPILER}")
|
message("Android CMAKE_CXX_COMPILER prefix: ${CMAKE_CXX_COMPILER}")
|
||||||
message("Android ANDROID_LD: ${ANDROID_LD}")
|
message("Android ANDROID_LD: ${ANDROID_LD}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -52,9 +61,9 @@ if (UNIX AND NOT APPLE)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# multi configurations for MSVC and XCode
|
# multi configurations for MSVC and XCode
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Release")
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
|
||||||
|
|
@ -69,34 +78,37 @@ find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12)
|
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers")
|
set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers")
|
||||||
set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
|
set(DISABLE_TOR FALSE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
|
||||||
set(TESTNET FALSE CACHE BOOL "Compile for testnet")
|
set(TESTNET 0 CACHE BOOL "Build TESTNET")
|
||||||
set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon")
|
set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon")
|
||||||
|
set(USE_BITCOIN_SECP256K1_FOR_ECDSA FALSE CACHE BOOL "Use bitcoin-secp256k1 library for validating ECDSA(instead of OpenSSL)")
|
||||||
include_directories(src contrib/eos_portable_archive contrib contrib/epee/include contrib/jwt-cpp/include ${OPENSSL_INCLUDE_DIR} "${CMAKE_BINARY_DIR}/version" "${CMAKE_BINARY_DIR}/contrib/zlib")
|
if(NOT USE_BITCOIN_SECP256K1_FOR_ECDSA)
|
||||||
|
add_definitions(-DUSE_OPEN_SSL_FOR_ECDSA)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions(-DSTATICLIB)
|
add_definitions(-DSTATICLIB)
|
||||||
|
|
||||||
if(TESTNET)
|
if(TESTNET)
|
||||||
message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
|
message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
|
||||||
add_definitions(-DTESTNET)
|
add_definitions(-DTESTNET)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CAKEWALLET)
|
if(CAKEWALLET)
|
||||||
message("NOTICE: Building libraries for CAKEWALLET")
|
message("NOTICE: Building libraries for CAKEWALLET")
|
||||||
add_definitions(-DCAKEWALLET)
|
add_definitions(-DCAKEWALLET)
|
||||||
|
add_definitions(-DDISABLE_PFR_SERIALIZATION_SELFCHECK)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
|
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
|
|
||||||
if(DISABLE_TOR)
|
if(DISABLE_TOR)
|
||||||
message("NOTICE: Building with disabled TOR support!")
|
message("NOTICE: Building with disabled TOR support!")
|
||||||
add_definitions(-DDISABLE_TOR)
|
add_definitions(-DDISABLE_TOR)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -112,12 +124,15 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_definitions("/DBOOST_NO_CXX98_FUNCTION_BASE")
|
|
||||||
|
|
||||||
|
add_definitions("/DBOOST_NO_CXX98_FUNCTION_BASE")
|
||||||
|
if(WIN32)
|
||||||
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions("/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0")
|
add_definitions("/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0")
|
||||||
add_compile_options(/bigobj /Zm1000 /Z7 /MP2 /W3 /GS- /wd4996 /wd4503 /wd4345 /wd4091 /FIinline_c.h)
|
add_compile_options(/EHa /bigobj /Zm1000 /Z7 /MP2 /W3 /GS- /wd4996 /wd4503 /wd4345 /wd4091 /FIinline_c.h)
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760 /DEBUG dbghelp.lib crypt32.lib")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:10485760 /DEBUG dbghelp.lib crypt32.lib")
|
||||||
if(STATIC)
|
if(STATIC)
|
||||||
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
foreach(VAR CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE)
|
||||||
|
|
@ -125,7 +140,7 @@ if(MSVC)
|
||||||
endforeach()
|
endforeach()
|
||||||
endif()
|
endif()
|
||||||
include_directories(SYSTEM src/platform/msc)
|
include_directories(SYSTEM src/platform/msc)
|
||||||
configure_file(utils/Directory.Build.props.in ${CMAKE_BINARY_DIR}/Directory.Build.props)
|
|
||||||
else()
|
else()
|
||||||
set(ARCH default CACHE STRING "CPU to build for: -march value or default")
|
set(ARCH default CACHE STRING "CPU to build for: -march value or default")
|
||||||
if("${ARCH}" STREQUAL "default")
|
if("${ARCH}" STREQUAL "default")
|
||||||
|
|
@ -140,7 +155,7 @@ else()
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
set(WARNINGS "${WARNINGS} -Wno-implicit-function-declaration -Wno-shift-count-overflow -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
|
set(WARNINGS "${WARNINGS} -Wno-implicit-function-declaration -Wno-shift-count-overflow -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
|
||||||
else()
|
else()
|
||||||
set(WARNINGS "${WARNINGS} -Wno-error=write-strings -Wlogical-op -Wno-error=maybe-uninitialized")
|
set(WARNINGS "${WARNINGS} -Wno-error=write-strings -Wno-error=uninitialized")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
|
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
|
||||||
|
|
@ -167,7 +182,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wstrict-prototypes -Wno-comment")
|
set(C_WARNINGS "-Waggregate-return -Wnested-externs -Wstrict-prototypes -Wno-comment")
|
||||||
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
|
set(CXX_WARNINGS "-Wno-reorder -Wno-missing-field-initializers")
|
||||||
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/utils/test-static-assert.c" COMPILE_DEFINITIONS "-std=c++14")
|
try_compile(STATIC_ASSERT_RES "${CMAKE_CURRENT_BINARY_DIR}/static-assert" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/test-static-assert.c" COMPILE_DEFINITIONS "-std=c++14")
|
||||||
if(STATIC_ASSERT_RES)
|
if(STATIC_ASSERT_RES)
|
||||||
set(STATIC_ASSERT_FLAG "")
|
set(STATIC_ASSERT_FLAG "")
|
||||||
else()
|
else()
|
||||||
|
|
@ -180,6 +195,7 @@ else()
|
||||||
set(LLVM_USE_LINKER "gold")
|
set(LLVM_USE_LINKER "gold")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||||
|
link_libraries("$<$<AND:$<CXX_COMPILER_ID:GNU>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,9.0>>:-lstdc++fs>") # GCC < 9 requires additional linking for std::filesystem. Remove after stop supporting GCC 8.x -- sowle
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8))
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT (CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8))
|
||||||
|
|
@ -187,21 +203,21 @@ else()
|
||||||
else()
|
else()
|
||||||
set(DEBUG_FLAGS "-g3 -O0")
|
set(DEBUG_FLAGS "-g3 -O0")
|
||||||
endif()
|
endif()
|
||||||
set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable")
|
set(RELEASE_FLAGS "-O3 -ffast-math -DNDEBUG -w")
|
||||||
|
|
||||||
if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "Android"))
|
if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "Android"))
|
||||||
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto")
|
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto=auto -g3")
|
||||||
|
endif()
|
||||||
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
|
||||||
|
set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects")
|
||||||
endif()
|
endif()
|
||||||
#if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW)
|
|
||||||
# set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects")
|
|
||||||
#endif()
|
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_FLAGS}")
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
|
||||||
if(STATIC)
|
if(STATIC)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
message(SEND_ERROR "Static build is not supported on MacOS X")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
||||||
endif()
|
endif()
|
||||||
|
|
@ -209,63 +225,51 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
# always use local Boost installation rather than the system-wide (unless ZANO_USE_SYSTEM_BOOST is defined for some reason, which is not recommended)
|
# Link Boost statically, consistent with previous setup
|
||||||
if(NOT DEFINED ENV{ZANO_USE_SYSTEM_BOOST})
|
if(MSVC OR STATIC)
|
||||||
set(Boost_NO_SYSTEM_PATHS ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
if (MSVC)
|
||||||
|
set(Boost_USE_MULTITHREADED ON)
|
||||||
|
endif ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(STATIC)
|
if(STATIC)
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
|
||||||
set(Boost_USE_STATIC_RUNTIME ON)
|
set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
# Define Boost components
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
set(BOOST_COMPONENTS system filesystem locale thread timer date_time chrono regex serialization atomic program_options)
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.00)
|
if(NOT APPLE)
|
||||||
set(Boost_LIBRARIES "libboost.a")
|
list(APPEND BOOST_COMPONENTS log)
|
||||||
#workaround for new XCode 12 policy for builds(now it includes a slice for the "arm64" when builds for simulator)
|
|
||||||
set(__iphoneos_archs "arm64")
|
|
||||||
set(__iphonesimulator_archs "x86_64")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
|
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
|
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|
||||||
set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}/${CMAKE_ANDROID_ARCH_ABI}/")
|
|
||||||
set(Boost_LIBRARIES "${Boost_LIBRARY_DIRS}libboost_system.a;${Boost_LIBRARY_DIRS}libboost_filesystem.a;${Boost_LIBRARY_DIRS}libboost_thread.a;${Boost_LIBRARY_DIRS}libboost_timer.a;${Boost_LIBRARY_DIRS}libboost_date_time.a;${Boost_LIBRARY_DIRS}libboost_chrono.a;${Boost_LIBRARY_DIRS}libboost_regex.a;${Boost_LIBRARY_DIRS}libboost_serialization.a;${Boost_LIBRARY_DIRS}libboost_atomic.a;${Boost_LIBRARY_DIRS}libboost_program_options.a")
|
|
||||||
elseif(APPLE)
|
|
||||||
find_package(Boost 1.71 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale)
|
|
||||||
else()
|
|
||||||
find_package(Boost 1.70 REQUIRED COMPONENTS system filesystem thread timer date_time chrono regex serialization atomic program_options locale log)
|
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "Using Boost ${Boost_VERSION} from Conan")
|
||||||
|
|
||||||
|
find_package(miniupnpc REQUIRED)
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||||
|
|
||||||
|
include_directories(src "${CMAKE_BINARY_DIR}/version")
|
||||||
|
|
||||||
message(STATUS "Boost: ${Boost_VERSION} from ${Boost_LIBRARY_DIRS}")
|
include_directories(SYSTEM
|
||||||
|
${Boost_INCLUDE_DIRS}
|
||||||
|
${ZLIB_INCLUDE_DIRS}
|
||||||
|
${OPENSSL_INCLUDE_DIR}
|
||||||
|
${PROJECT_SOURCE_DIR}/contrib/ethereum/libethash
|
||||||
|
contrib
|
||||||
|
contrib/epee/include
|
||||||
|
contrib/jwt-cpp/include
|
||||||
|
contrib/eos_portable_archive
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/contrib/ethereum/libethash)
|
# Append other needed libraries
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
|
list(APPEND Boost_LIBRARIES ws2_32 mswsock)
|
||||||
elseif(NOT MSVC)
|
elseif(NOT MSVC AND NOT APPLE AND NOT CAKEWALLET AND STATIC)
|
||||||
if(NOT APPLE)
|
message("NOTICE: Including static ICU libraries")
|
||||||
set(Boost_LIBRARIES "${Boost_LIBRARIES};")
|
list(APPEND Boost_LIBRARIES icui18n.a icuuc.a icudata.a dl)
|
||||||
if(STATIC)
|
|
||||||
message("NOTICE: Including static ICU libraries")
|
|
||||||
set(Boost_LIBRARIES "${Boost_LIBRARIES};icui18n.a;icuuc.a;icudata.a;dl")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(BUILD_GUI)
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
|
||||||
find_package(Qt5WebEngineWidgets REQUIRED)
|
|
||||||
find_package(Qt5WebChannel REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
|
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")
|
||||||
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
|
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/version")
|
||||||
|
|
@ -293,16 +297,18 @@ else()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
|
set(BUILD_TESTS FALSE CACHE BOOL "Build Lethean tests")
|
||||||
set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
|
set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
|
||||||
if(NOT DISABLE_MDBX)
|
if(NOT DISABLE_MDBX)
|
||||||
add_definitions(-DENABLED_ENGINE_MDBX)
|
add_definitions(-DENABLED_ENGINE_MDBX)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(contrib)
|
add_subdirectory(contrib)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if (BUILD_TESTS)
|
if (BUILD_TESTS)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(CPackConfig)
|
||||||
|
|
|
||||||
109
CMakePresets.json
Normal file
109
CMakePresets.json
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
{
|
||||||
|
"version": 8,
|
||||||
|
"cmakeMinimumRequired": {
|
||||||
|
"major": 3,
|
||||||
|
"minor": 23,
|
||||||
|
"patch": 0
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"ConanPresets.json"
|
||||||
|
],
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "testnet",
|
||||||
|
"binaryDir": "${sourceDir}/build/release",
|
||||||
|
"environment": {
|
||||||
|
"CONAN_HOME": "${sourceDir}/build/sdk"
|
||||||
|
},
|
||||||
|
"cacheVariables": {
|
||||||
|
"TESTNET": "ON",
|
||||||
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
|
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES":".core/build/cmake/ConanProvider.cmake"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mainnet",
|
||||||
|
"binaryDir": "${sourceDir}/build/release",
|
||||||
|
"environment": {
|
||||||
|
"CONAN_HOME": "${sourceDir}/build/sdk"
|
||||||
|
},
|
||||||
|
"cacheVariables": {
|
||||||
|
"TESTNET": "OFF",
|
||||||
|
"CMAKE_BUILD_TYPE": "Release",
|
||||||
|
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES":".core/build/cmake/ConanProvider.cmake"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "testnet",
|
||||||
|
"configurePreset": "testnet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mainnet",
|
||||||
|
"configurePreset": "mainnet"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"testPresets": [
|
||||||
|
{
|
||||||
|
"name": "mainnet",
|
||||||
|
"configurePreset": "mainnet",
|
||||||
|
"output": {"outputOnFailure": true},
|
||||||
|
"execution": {"noTestsAction": "error", "stopOnFailure": true}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"packagePresets": [
|
||||||
|
{
|
||||||
|
"name": "mainnet",
|
||||||
|
"configurePreset": "mainnet",
|
||||||
|
"generators": [
|
||||||
|
"TGZ",
|
||||||
|
"ZIP"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "testnet",
|
||||||
|
"configurePreset": "testnet",
|
||||||
|
"generators": [
|
||||||
|
"TGZ",
|
||||||
|
"ZIP"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"workflowPresets": [
|
||||||
|
{
|
||||||
|
"name": "testnet",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "configure",
|
||||||
|
"name": "testnet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "build",
|
||||||
|
"name": "testnet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "package",
|
||||||
|
"name": "testnet"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "mainnet",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"type": "configure",
|
||||||
|
"name": "mainnet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "build",
|
||||||
|
"name": "mainnet"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "package",
|
||||||
|
"name": "mainnet"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
9
ConanPresets.json
Normal file
9
ConanPresets.json
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"version": 4,
|
||||||
|
"vendor": {
|
||||||
|
"conan": {}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"build/release/generators/CMakePresets.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
288
LICENSE.txt
Normal file
288
LICENSE.txt
Normal file
|
|
@ -0,0 +1,288 @@
|
||||||
|
EUROPEAN UNION PUBLIC LICENCE v. 1.2
|
||||||
|
EUPL © the European Union 2007, 2016
|
||||||
|
|
||||||
|
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
|
||||||
|
below) which is provided under the terms of this Licence. Any use of the Work,
|
||||||
|
other than as authorised under this Licence is prohibited (to the extent such
|
||||||
|
use is covered by a right of the copyright holder of the Work).
|
||||||
|
|
||||||
|
The Work is provided under the terms of this Licence when the Licensor (as
|
||||||
|
defined below) has placed the following notice immediately following the
|
||||||
|
copyright notice for the Work:
|
||||||
|
|
||||||
|
Licensed under the EUPL
|
||||||
|
|
||||||
|
or has expressed by any other means his willingness to license under the EUPL.
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
|
||||||
|
In this Licence, the following terms have the following meaning:
|
||||||
|
|
||||||
|
- ‘The Licence’: this Licence.
|
||||||
|
|
||||||
|
- ‘The Original Work’: the work or software distributed or communicated by the
|
||||||
|
Licensor under this Licence, available as Source Code and also as Executable
|
||||||
|
Code as the case may be.
|
||||||
|
|
||||||
|
- ‘Derivative Works’: the works or software that could be created by the
|
||||||
|
Licensee, based upon the Original Work or modifications thereof. This Licence
|
||||||
|
does not define the extent of modification or dependence on the Original Work
|
||||||
|
required in order to classify a work as a Derivative Work; this extent is
|
||||||
|
determined by copyright law applicable in the country mentioned in Article 15.
|
||||||
|
|
||||||
|
- ‘The Work’: the Original Work or its Derivative Works.
|
||||||
|
|
||||||
|
- ‘The Source Code’: the human-readable form of the Work which is the most
|
||||||
|
convenient for people to study and modify.
|
||||||
|
|
||||||
|
- ‘The Executable Code’: any code which has generally been compiled and which is
|
||||||
|
meant to be interpreted by a computer as a program.
|
||||||
|
|
||||||
|
- ‘The Licensor’: the natural or legal person that distributes or communicates
|
||||||
|
the Work under the Licence.
|
||||||
|
|
||||||
|
- ‘Contributor(s)’: any natural or legal person who modifies the Work under the
|
||||||
|
Licence, or otherwise contributes to the creation of a Derivative Work.
|
||||||
|
|
||||||
|
- ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
|
||||||
|
the Work under the terms of the Licence.
|
||||||
|
|
||||||
|
- ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
|
||||||
|
renting, distributing, communicating, transmitting, or otherwise making
|
||||||
|
available, online or offline, copies of the Work or providing access to its
|
||||||
|
essential functionalities at the disposal of any other natural or legal
|
||||||
|
person.
|
||||||
|
|
||||||
|
2. Scope of the rights granted by the Licence
|
||||||
|
|
||||||
|
The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
|
||||||
|
sublicensable licence to do the following, for the duration of copyright vested
|
||||||
|
in the Original Work:
|
||||||
|
|
||||||
|
- use the Work in any circumstance and for all usage,
|
||||||
|
- reproduce the Work,
|
||||||
|
- modify the Work, and make Derivative Works based upon the Work,
|
||||||
|
- communicate to the public, including the right to make available or display
|
||||||
|
the Work or copies thereof to the public and perform publicly, as the case may
|
||||||
|
be, the Work,
|
||||||
|
- distribute the Work or copies thereof,
|
||||||
|
- lend and rent the Work or copies thereof,
|
||||||
|
- sublicense rights in the Work or copies thereof.
|
||||||
|
|
||||||
|
Those rights can be exercised on any media, supports and formats, whether now
|
||||||
|
known or later invented, as far as the applicable law permits so.
|
||||||
|
|
||||||
|
In the countries where moral rights apply, the Licensor waives his right to
|
||||||
|
exercise his moral right to the extent allowed by law in order to make effective
|
||||||
|
the licence of the economic rights here above listed.
|
||||||
|
|
||||||
|
The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
|
||||||
|
any patents held by the Licensor, to the extent necessary to make use of the
|
||||||
|
rights granted on the Work under this Licence.
|
||||||
|
|
||||||
|
3. Communication of the Source Code
|
||||||
|
|
||||||
|
The Licensor may provide the Work either in its Source Code form, or as
|
||||||
|
Executable Code. If the Work is provided as Executable Code, the Licensor
|
||||||
|
provides in addition a machine-readable copy of the Source Code of the Work
|
||||||
|
along with each copy of the Work that the Licensor distributes or indicates, in
|
||||||
|
a notice following the copyright notice attached to the Work, a repository where
|
||||||
|
the Source Code is easily and freely accessible for as long as the Licensor
|
||||||
|
continues to distribute or communicate the Work.
|
||||||
|
|
||||||
|
4. Limitations on copyright
|
||||||
|
|
||||||
|
Nothing in this Licence is intended to deprive the Licensee of the benefits from
|
||||||
|
any exception or limitation to the exclusive rights of the rights owners in the
|
||||||
|
Work, of the exhaustion of those rights or of other applicable limitations
|
||||||
|
thereto.
|
||||||
|
|
||||||
|
5. Obligations of the Licensee
|
||||||
|
|
||||||
|
The grant of the rights mentioned above is subject to some restrictions and
|
||||||
|
obligations imposed on the Licensee. Those obligations are the following:
|
||||||
|
|
||||||
|
Attribution right: The Licensee shall keep intact all copyright, patent or
|
||||||
|
trademarks notices and all notices that refer to the Licence and to the
|
||||||
|
disclaimer of warranties. The Licensee must include a copy of such notices and a
|
||||||
|
copy of the Licence with every copy of the Work he/she distributes or
|
||||||
|
communicates. The Licensee must cause any Derivative Work to carry prominent
|
||||||
|
notices stating that the Work has been modified and the date of modification.
|
||||||
|
|
||||||
|
Copyleft clause: If the Licensee distributes or communicates copies of the
|
||||||
|
Original Works or Derivative Works, this Distribution or Communication will be
|
||||||
|
done under the terms of this Licence or of a later version of this Licence
|
||||||
|
unless the Original Work is expressly distributed only under this version of the
|
||||||
|
Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
|
||||||
|
(becoming Licensor) cannot offer or impose any additional terms or conditions on
|
||||||
|
the Work or Derivative Work that alter or restrict the terms of the Licence.
|
||||||
|
|
||||||
|
Compatibility clause: If the Licensee Distributes or Communicates Derivative
|
||||||
|
Works or copies thereof based upon both the Work and another work licensed under
|
||||||
|
a Compatible Licence, this Distribution or Communication can be done under the
|
||||||
|
terms of this Compatible Licence. For the sake of this clause, ‘Compatible
|
||||||
|
Licence’ refers to the licences listed in the appendix attached to this Licence.
|
||||||
|
Should the Licensee's obligations under the Compatible Licence conflict with
|
||||||
|
his/her obligations under this Licence, the obligations of the Compatible
|
||||||
|
Licence shall prevail.
|
||||||
|
|
||||||
|
Provision of Source Code: When distributing or communicating copies of the Work,
|
||||||
|
the Licensee will provide a machine-readable copy of the Source Code or indicate
|
||||||
|
a repository where this Source will be easily and freely available for as long
|
||||||
|
as the Licensee continues to distribute or communicate the Work.
|
||||||
|
|
||||||
|
Legal Protection: This Licence does not grant permission to use the trade names,
|
||||||
|
trademarks, service marks, or names of the Licensor, except as required for
|
||||||
|
reasonable and customary use in describing the origin of the Work and
|
||||||
|
reproducing the content of the copyright notice.
|
||||||
|
|
||||||
|
6. Chain of Authorship
|
||||||
|
|
||||||
|
The original Licensor warrants that the copyright in the Original Work granted
|
||||||
|
hereunder is owned by him/her or licensed to him/her and that he/she has the
|
||||||
|
power and authority to grant the Licence.
|
||||||
|
|
||||||
|
Each Contributor warrants that the copyright in the modifications he/she brings
|
||||||
|
to the Work are owned by him/her or licensed to him/her and that he/she has the
|
||||||
|
power and authority to grant the Licence.
|
||||||
|
|
||||||
|
Each time You accept the Licence, the original Licensor and subsequent
|
||||||
|
Contributors grant You a licence to their contributions to the Work, under the
|
||||||
|
terms of this Licence.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty
|
||||||
|
|
||||||
|
The Work is a work in progress, which is continuously improved by numerous
|
||||||
|
Contributors. It is not a finished work and may therefore contain defects or
|
||||||
|
‘bugs’ inherent to this type of development.
|
||||||
|
|
||||||
|
For the above reason, the Work is provided under the Licence on an ‘as is’ basis
|
||||||
|
and without warranties of any kind concerning the Work, including without
|
||||||
|
limitation merchantability, fitness for a particular purpose, absence of defects
|
||||||
|
or errors, accuracy, non-infringement of intellectual property rights other than
|
||||||
|
copyright as stated in Article 6 of this Licence.
|
||||||
|
|
||||||
|
This disclaimer of warranty is an essential part of the Licence and a condition
|
||||||
|
for the grant of any rights to the Work.
|
||||||
|
|
||||||
|
8. Disclaimer of Liability
|
||||||
|
|
||||||
|
Except in the cases of wilful misconduct or damages directly caused to natural
|
||||||
|
persons, the Licensor will in no event be liable for any direct or indirect,
|
||||||
|
material or moral, damages of any kind, arising out of the Licence or of the use
|
||||||
|
of the Work, including without limitation, damages for loss of goodwill, work
|
||||||
|
stoppage, computer failure or malfunction, loss of data or any commercial
|
||||||
|
damage, even if the Licensor has been advised of the possibility of such damage.
|
||||||
|
However, the Licensor will be liable under statutory product liability laws as
|
||||||
|
far such laws apply to the Work.
|
||||||
|
|
||||||
|
9. Additional agreements
|
||||||
|
|
||||||
|
While distributing the Work, You may choose to conclude an additional agreement,
|
||||||
|
defining obligations or services consistent with this Licence. However, if
|
||||||
|
accepting obligations, You may act only on your own behalf and on your sole
|
||||||
|
responsibility, not on behalf of the original Licensor or any other Contributor,
|
||||||
|
and only if You agree to indemnify, defend, and hold each Contributor harmless
|
||||||
|
for any liability incurred by, or claims asserted against such Contributor by
|
||||||
|
the fact You have accepted any warranty or additional liability.
|
||||||
|
|
||||||
|
10. Acceptance of the Licence
|
||||||
|
|
||||||
|
The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
|
||||||
|
placed under the bottom of a window displaying the text of this Licence or by
|
||||||
|
affirming consent in any other similar way, in accordance with the rules of
|
||||||
|
applicable law. Clicking on that icon indicates your clear and irrevocable
|
||||||
|
acceptance of this Licence and all of its terms and conditions.
|
||||||
|
|
||||||
|
Similarly, you irrevocably accept this Licence and all of its terms and
|
||||||
|
conditions by exercising any rights granted to You by Article 2 of this Licence,
|
||||||
|
such as the use of the Work, the creation by You of a Derivative Work or the
|
||||||
|
Distribution or Communication by You of the Work or copies thereof.
|
||||||
|
|
||||||
|
11. Information to the public
|
||||||
|
|
||||||
|
In case of any Distribution or Communication of the Work by means of electronic
|
||||||
|
communication by You (for example, by offering to download the Work from a
|
||||||
|
remote location) the distribution channel or media (for example, a website) must
|
||||||
|
at least provide to the public the information requested by the applicable law
|
||||||
|
regarding the Licensor, the Licence and the way it may be accessible, concluded,
|
||||||
|
stored and reproduced by the Licensee.
|
||||||
|
|
||||||
|
12. Termination of the Licence
|
||||||
|
|
||||||
|
The Licence and the rights granted hereunder will terminate automatically upon
|
||||||
|
any breach by the Licensee of the terms of the Licence.
|
||||||
|
|
||||||
|
Such a termination will not terminate the licences of any person who has
|
||||||
|
received the Work from the Licensee under the Licence, provided such persons
|
||||||
|
remain in full compliance with the Licence.
|
||||||
|
|
||||||
|
13. Miscellaneous
|
||||||
|
|
||||||
|
Without prejudice of Article 9 above, the Licence represents the complete
|
||||||
|
agreement between the Parties as to the Work.
|
||||||
|
|
||||||
|
If any provision of the Licence is invalid or unenforceable under applicable
|
||||||
|
law, this will not affect the validity or enforceability of the Licence as a
|
||||||
|
whole. Such provision will be construed or reformed so as necessary to make it
|
||||||
|
valid and enforceable.
|
||||||
|
|
||||||
|
The European Commission may publish other linguistic versions or new versions of
|
||||||
|
this Licence or updated versions of the Appendix, so far this is required and
|
||||||
|
reasonable, without reducing the scope of the rights granted by the Licence. New
|
||||||
|
versions of the Licence will be published with a unique version number.
|
||||||
|
|
||||||
|
All linguistic versions of this Licence, approved by the European Commission,
|
||||||
|
have identical value. Parties can take advantage of the linguistic version of
|
||||||
|
their choice.
|
||||||
|
|
||||||
|
14. Jurisdiction
|
||||||
|
|
||||||
|
Without prejudice to specific agreement between parties,
|
||||||
|
|
||||||
|
- any litigation resulting from the interpretation of this License, arising
|
||||||
|
between the European Union institutions, bodies, offices or agencies, as a
|
||||||
|
Licensor, and any Licensee, will be subject to the jurisdiction of the Court
|
||||||
|
of Justice of the European Union, as laid down in article 272 of the Treaty on
|
||||||
|
the Functioning of the European Union,
|
||||||
|
|
||||||
|
- any litigation arising between other parties and resulting from the
|
||||||
|
interpretation of this License, will be subject to the exclusive jurisdiction
|
||||||
|
of the competent court where the Licensor resides or conducts its primary
|
||||||
|
business.
|
||||||
|
|
||||||
|
15. Applicable Law
|
||||||
|
|
||||||
|
Without prejudice to specific agreement between parties,
|
||||||
|
|
||||||
|
- this Licence shall be governed by the law of the European Union Member State
|
||||||
|
where the Licensor has his seat, resides or has his registered office,
|
||||||
|
|
||||||
|
- this licence shall be governed by Belgian law if the Licensor has no seat,
|
||||||
|
residence or registered office inside a European Union Member State.
|
||||||
|
|
||||||
|
Appendix
|
||||||
|
|
||||||
|
‘Compatible Licences’ according to Article 5 EUPL are:
|
||||||
|
|
||||||
|
- GNU General Public License (GPL) v. 2, v. 3
|
||||||
|
- GNU Affero General Public License (AGPL) v. 3
|
||||||
|
- Open Software License (OSL) v. 2.1, v. 3.0
|
||||||
|
- Eclipse Public License (EPL) v. 1.0
|
||||||
|
- CeCILL v. 2.0, v. 2.1
|
||||||
|
- Mozilla Public Licence (MPL) v. 2
|
||||||
|
- GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
|
||||||
|
- Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
|
||||||
|
works other than software
|
||||||
|
- European Union Public Licence (EUPL) v. 1.1, v. 1.2
|
||||||
|
- Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
|
||||||
|
Reciprocity (LiLiQ-R+).
|
||||||
|
|
||||||
|
The European Commission may update this Appendix to later versions of the above
|
||||||
|
licences without producing a new version of the EUPL, as long as they provide
|
||||||
|
the rights granted in Article 2 of this Licence and protect the covered Source
|
||||||
|
Code from exclusive appropriation.
|
||||||
|
|
||||||
|
All other changes or additions to this Appendix require the production of a new
|
||||||
|
EUPL version.
|
||||||
|
|
||||||
214
Makefile
214
Makefile
|
|
@ -1,82 +1,196 @@
|
||||||
|
# Copyright (c) 2017-2025 Lethean https://lt.hn
|
||||||
# Copyright (c) 2014-2019 Zano Project
|
# Copyright (c) 2014-2019 Zano Project
|
||||||
# Copyright (c) 2014 The Cryptonote developers
|
# Copyright (c) 2014 The Cryptonote developers
|
||||||
# Distributed under the MIT/X11 software license, see the accompanying
|
# Distributed under the MIT/X11 software license, see the accompanying
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
|
||||||
# Define CMake generator
|
# ============================================================
|
||||||
system := $(shell uname)
|
# Build system from host-uk/build submodule
|
||||||
ifneq (, $(findstring MINGW, $(system)))
|
# ============================================================
|
||||||
cmake_gen = -G 'MSYS Makefiles'
|
BUILD_SYS := .core/build
|
||||||
|
CMAKE_DIR := $(BUILD_SYS)/cmake
|
||||||
|
|
||||||
|
# ============================================================
|
||||||
|
# Project Configuration
|
||||||
|
# ============================================================
|
||||||
|
CPU_CORES := 1
|
||||||
|
TESTNET:= 0
|
||||||
|
STATIC:= 0
|
||||||
|
BUILD_TYPE ?=Release
|
||||||
|
BUILD_VERSION:=6.0.1
|
||||||
|
BUILD_FOLDER:=build/release
|
||||||
|
PRESET_BUILD:=conan-release
|
||||||
|
PRESET_CONFIGURE:=conan-release
|
||||||
|
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
# Detect the number of logical CPU cores – works on Linux,
|
||||||
|
# macOS, BSD, and Windows (both cmd.exe and PowerShell).
|
||||||
|
# ------------------------------------------------------------
|
||||||
|
UNAME_S := $(shell uname -s 2>/dev/null || echo Unknown)
|
||||||
|
|
||||||
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
CPU_CORES := $(shell nproc 2>/dev/null || \
|
||||||
|
grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
cmake = cmake $(cmake_gen)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
CPU_CORES := $(shell sysctl -n hw.logicalcpu 2>/dev/null || echo 1)
|
||||||
|
endif
|
||||||
|
|
||||||
cmake_debug = $(cmake) -D CMAKE_BUILD_TYPE=Debug
|
ifeq ($(filter %BSD,$(UNAME_S)),%BSD)
|
||||||
cmake_release = $(cmake) -D CMAKE_BUILD_TYPE=Release
|
CPU_CORES := $(shell sysctl -n hw.ncpu 2>/dev/null || echo 1)
|
||||||
|
endif
|
||||||
|
|
||||||
cmake_gui = -D BUILD_GUI=ON
|
ifeq ($(OS),Windows_NT)
|
||||||
cmake_static = -D STATIC=ON
|
|
||||||
cmake_tests = -D BUILD_TESTS=ON
|
|
||||||
|
|
||||||
# Helper macro
|
PRESET_CONFIGURE:=conan-default
|
||||||
define CMAKE
|
|
||||||
mkdir -p $1 && cd $1 && $2 ../../
|
|
||||||
endef
|
|
||||||
|
|
||||||
build = build
|
CPU_CORES := $(NUMBER_OF_PROCESSORS)
|
||||||
dir_debug = $(build)/debug
|
|
||||||
dir_release = $(build)/release
|
|
||||||
|
|
||||||
all: release
|
ifeq ($(CPU_CORES),)
|
||||||
|
CPU_CORES := $(shell powershell -NoProfile -Command ^ "[Environment]::ProcessorCount")
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
release:
|
# Safety net
|
||||||
$(eval command += $(cmake_release))
|
CPU_CORES := $(or $(CPU_CORES),1)
|
||||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1)
|
||||||
|
CONAN_CPU_COUNT=$(CPU_CORES)
|
||||||
|
|
||||||
debug:
|
# ============================================================
|
||||||
$(eval command += $(cmake_debug))
|
# Paths — profiles and cmake modules from .build submodule
|
||||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
# ============================================================
|
||||||
|
PROFILES :=$(patsubst $(CMAKE_DIR)/profiles/%,%,$(wildcard $(CMAKE_DIR)/profiles/*))
|
||||||
|
SORTED_PROFILES :=$(sort $(PROFILES))
|
||||||
|
CONAN_CACHE :=$(CURDIR)/build/sdk
|
||||||
|
CONAN_URL :=http://forge.snider.dev:4000/api/packages/host-uk/conan
|
||||||
|
CONAN_USER ?=$(shell echo $$CONAN_USER)
|
||||||
|
CONAN_PASSWORD ?=$(shell echo $$CONAN_PASSWORD)
|
||||||
|
CONAN_EXECUTABLE :=$(CURDIR)/build/bin/conan
|
||||||
|
CC_DOCKER_FILE ?=utils/docker/images/lthn-chain/Dockerfile
|
||||||
|
SDK_PACKAGES_JSON :=$(wildcard utils/sdk/packages/*.json)
|
||||||
|
SDK_TARGETS :=$(patsubst utils/sdk/packages/%.json,%,$(SDK_PACKAGES_JSON))
|
||||||
|
SORTED_SDK_TARGETS :=$(sort $(SDK_TARGETS))
|
||||||
|
|
||||||
static: static-release
|
all: help
|
||||||
static-release:
|
|
||||||
$(eval command += $(cmake_release) $(cmake_static))
|
|
||||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
|
||||||
|
|
||||||
#
|
testnet:
|
||||||
# GUI
|
$(MAKE) configure TESTNET=1 STATIC=$(STATIC)
|
||||||
#
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) build .
|
||||||
|
$(MAKE) package
|
||||||
|
|
||||||
gui: gui-release
|
mainnet:
|
||||||
gui-release:
|
$(MAKE) configure TESTNET=0 STATIC=$(STATIC)
|
||||||
$(eval command += $(cmake_release) $(cmake_gui))
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) build .
|
||||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
$(MAKE) package
|
||||||
|
|
||||||
gui-debug:
|
release: docs build
|
||||||
$(eval command += $(cmake_debug) $(cmake_gui))
|
(cd $(BUILD_FOLDER) && cpack)
|
||||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
|
@rm -rf $(CURDIR)/build/packages/_CPack_Packages
|
||||||
|
|
||||||
gui-static: gui-release-static
|
build: configure
|
||||||
gui-release-static:
|
cmake --build --preset $(PRESET_BUILD) --parallel=$(CPU_CORES)
|
||||||
$(eval command += $(cmake_release) $(cmake_gui) $(cmake_static))
|
|
||||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
build-deps: conan-profile-detect
|
||||||
|
@echo "Build Dependencies: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||||
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --build=missing -s build_type=$(BUILD_TYPE)
|
||||||
|
|
||||||
|
package:
|
||||||
|
@echo "Packaging: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||||
|
(cd $(BUILD_FOLDER) && cpack)
|
||||||
|
ifneq ($(OS),Windows_NT)
|
||||||
|
@rm -rf $(CURDIR)/build/packages/_CPack_Packages
|
||||||
|
endif
|
||||||
|
|
||||||
|
configure: build-deps
|
||||||
|
@echo "Running Configure: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||||
|
cmake --preset $(PRESET_CONFIGURE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||||
|
|
||||||
|
docs: configure
|
||||||
|
@echo "Building Documentation"
|
||||||
|
cmake --build build/release --target=docs --config=Release --parallel=$(CPU_CORES)
|
||||||
|
|
||||||
|
sdk:
|
||||||
|
$(MAKE) -C utils/sdk $(filter-out $@,$(MAKECMDGOALS)) PACKAGE_VERSION=$(BUILD_VERSION)
|
||||||
|
|
||||||
|
# Rule for each profile — uses .build/cmake/profiles/
|
||||||
|
$(PROFILES): conan-profile-detect
|
||||||
|
@echo "Building profile: $@"
|
||||||
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . -pr:h=$(CMAKE_DIR)/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE)
|
||||||
|
cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||||
|
cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
|
||||||
|
(cd $(BUILD_FOLDER) && cpack)
|
||||||
|
|
||||||
|
help:
|
||||||
|
@echo "Lethean VPN Blockchain"
|
||||||
|
@echo "======================"
|
||||||
|
@echo "Website: https://lt.hn"
|
||||||
|
@echo "GitHub: https://github.com/letheanVPN/blockchain/"
|
||||||
|
@echo "Discord: https://discord.lt.hn"
|
||||||
|
@echo ""
|
||||||
|
@echo "Available targets:"
|
||||||
|
@printf " %-42s %s\n" "make clean" "Clean all build directories"
|
||||||
|
@printf " %-42s %s\n" "make conan-get" "Download and install conan locally"
|
||||||
|
@printf " %-42s %s\n" "make release" "Build release"
|
||||||
|
@printf " %-42s %s\n" "make testnet" "Build testnet"
|
||||||
|
@printf " %-42s %s\n" "make mainnet" "Build mainnet"
|
||||||
|
@printf " %-42s %s\n" "make test" "Build & run tests"
|
||||||
|
@printf " %-42s %s\n" "make docs" "Builds offline documentation website"
|
||||||
|
@printf " %-42s %s\n" "make docs-dev" "Runs local doc server, for editing/adding docs"
|
||||||
|
@printf " %-42s %s\n" "make conan-profile-detect" "Creates host config"
|
||||||
|
@printf " %-42s %s\n" "make configure" "Runs a cmake configure within conan build flow"
|
||||||
|
@printf "\n --- Conan Cross-Compilation Profiles ---\n"
|
||||||
|
@$(foreach profile,$(SORTED_PROFILES),printf " %-42s %s\n" "make $(profile)" "Build the $(profile) profile";)
|
||||||
|
@printf "\n --- SDK Generation ---\n"
|
||||||
|
@printf " %-42s %s\n" "make sdk" "Build all SDK packages"
|
||||||
|
@$(foreach sdk,$(SORTED_SDK_TARGETS),printf " %-42s %s\n" "make sdk $(sdk)" "Build the $(sdk) SDK package";)
|
||||||
|
@printf "\n"
|
||||||
|
@printf " %-42s %s\n" "make help" "Show this help message"
|
||||||
|
|
||||||
#
|
|
||||||
# Tests
|
|
||||||
#
|
|
||||||
|
|
||||||
test: test-release
|
test: test-release
|
||||||
test-release:
|
test-release:
|
||||||
$(eval command += $(cmake_release) $(cmake_tests))
|
@echo "Building profile: test-release"
|
||||||
$(call CMAKE,$(dir_release),$(command)) && $(MAKE) && $(MAKE) test
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-release --build=missing -s build_type=$(BUILD_TYPE)
|
||||||
|
cmake -S . -B build/test-release -DCMAKE_TOOLCHAIN_FILE=build/test-release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON
|
||||||
|
cmake --build build/test-release --config=Release --parallel=$(CPU_CORES)
|
||||||
|
$(MAKE) test
|
||||||
|
|
||||||
test-debug:
|
test-debug:
|
||||||
$(eval command += $(cmake_debug) $(cmake_tests))
|
@echo "Building profile: test-debug"
|
||||||
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE) && $(MAKE) test
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-debug --build=missing -s build_type=$(BUILD_TYPE)
|
||||||
|
cmake -S . -B build/test-debug -DCMAKE_TOOLCHAIN_FILE=build/test-debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -D BUILD_TESTS=ON
|
||||||
|
cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES)
|
||||||
|
$(MAKE) test
|
||||||
|
|
||||||
|
# Conan management — cmake modules from .build submodule
|
||||||
|
conan-get:
|
||||||
|
cmake -P $(CMAKE_DIR)/ConanGet.cmake
|
||||||
|
ifneq ($(CONAN_USER),)
|
||||||
|
(CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) remote add conan_build $(CONAN_URL) && \
|
||||||
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) remote login conan_build $(CONAN_USER) -p $(CONAN_PASSWORD)) || true
|
||||||
|
endif
|
||||||
|
|
||||||
|
conan-upload:
|
||||||
|
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) upload "*" -r=conan_build --confirm
|
||||||
|
|
||||||
|
conan-profile-detect: conan-get
|
||||||
|
cmake -P $(CMAKE_DIR)/ConanProfileSetup.cmake
|
||||||
|
|
||||||
|
docs-dev: configure
|
||||||
|
@echo "Building Documentation"
|
||||||
|
cmake --build build/release --target=serve_docs --config=Release
|
||||||
|
|
||||||
|
$(SDK_TARGETS):
|
||||||
|
@# This is a proxy target. Handled by the 'sdk' rule.
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
@cmake -P $(CMAKE_DIR)/CleanBuild.cmake
|
||||||
|
|
||||||
|
clean-build: clean
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||||
|
|
||||||
.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags
|
.PHONY: all release upload-conan-cache docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect conan-get $(PROFILES) sdk $(SDK_TARGETS)
|
||||||
|
|
|
||||||
227
README.md
227
README.md
|
|
@ -1,171 +1,120 @@
|
||||||
[](https://scan.coverity.com/projects/zanoproject)
|
# Lethean Network—Ethics, Encoded.
|
||||||
[](https://discord.gg/wE3rmYY)
|
|
||||||
|
|
||||||
## Cloning
|
> We are building upto a mainnet launch in 2026, documentation written as if mainnet is live.
|
||||||
|
|
||||||
Be sure to clone the repository properly:\
|
A buildkit for deploying confidential information networks and commerce systems with immutable auditability.
|
||||||
`$ git clone --recursive https://github.com/hyle-team/zano.git`
|
|
||||||
|
|
||||||
# Building
|
Free for commercial, private, and patent use, self-host or join the community-run network that guarantees participant sovereignty by design.
|
||||||
--------
|
|
||||||
|
|
||||||
|
|
||||||
|
[](https://discord.gg/pfgT2Kz)
|
||||||
|
|
||||||
|
Web2 Website: https://lt.hn/
|
||||||
|
|
||||||
|
Web3 Network Gateway [HNS](https://handshake.org): [https://lthn](https://www.namebase.io/domains/lthn)
|
||||||
|
<br/>_(our chain aliases will come with a working Web2(`*.lt.hn`)+Web3(`*.lthn`) domain name)_
|
||||||
|
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
| component / version | minimum <br>(not recommended but may work) | recommended | most recent of what we have ever tested |
|
| component / version | minimum <br>(not recommended but may work) | recommended | most recent of what we have ever tested |
|
||||||
|--|--|--|--|
|
|-----------------------------------------------------------------------------|--------------------------------------------|----------------|-----------------------------------------|
|
||||||
| gcc (Linux) | 5.4.0 | 9.4.0 | 12.3.0 |
|
| gcc (Linux) | 8.4.0 | 9.4.0 | 12.3.0 |
|
||||||
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
|
| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 |
|
||||||
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2017 (15.9.30) | 2022 (17.7.5) |
|
| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) |
|
||||||
| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 14.3 |
|
| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 |
|
||||||
| [CMake](https://cmake.org/download/) | 3.15.5 | 3.22.1 | 3.26.3 |
|
| [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 |
|
||||||
| [Boost](https://www.boost.org/users/download/) | 1.70 | 1.70 | 1.76 |
|
|
||||||
| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | 1.1.1n | 1.1.1w | 1.1.1w |
|
|
||||||
| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.11.2 | 5.15.2 |
|
|
||||||
|
|
||||||
Note:\
|
## Cloning
|
||||||
[*server version*] denotes steps required for building command-line tools (daemon, simplewallet, etc.).\
|
|
||||||
[*GUI version*] denotes steps required for building Zano executable with GUI.
|
|
||||||
|
|
||||||
<br />
|
Be sure to clone the repository properly, with `--recursive` flag, or you'll get angry:<br/>
|
||||||
|
`git clone --recursive https://github.com/letheanVPN/blockchain.git`
|
||||||
|
|
||||||
### Linux
|
# Building
|
||||||
|
|
||||||
Recommended OS versions: Ubuntu 20.04, 22.04 LTS.
|
The project uses a `Makefile` that provides a simple and powerful interface for building.
|
||||||
|
It automatically handles dependency installation with Conan and compilation with CMake.
|
||||||
|
|
||||||
1. Prerequisites
|
You need CMake and Make installed on your system, other than that you don't need to worry about Python, Conan, Boost, OpenSSL, or any other dependencies.
|
||||||
|
|
||||||
[*server version*]
|
The final packages are created as they are due to a historical distribution method used in china: USB Stick, CD, DVD, etc.
|
||||||
|
|
||||||
sudo apt-get install -y build-essential g++ curl autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev
|
|
||||||
|
|
||||||
[*GUI version*]
|
|
||||||
|
|
||||||
sudo apt-get install -y build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev cmake git screen checkinstall zlib1g-dev mesa-common-dev libglu1-mesa-dev
|
We use CPack, so our packages are self-contained, have searchable HTML documentation, and are ready to be installed on any system.
|
||||||
|
|
||||||
2. Clone Zano into a local folder\
|
To skip the packing step, use `make build` as defined in the section below for Advanced Build Customization
|
||||||
(If for some reason you need to use alternative Zano branch, change 'master' to the required branch name.)
|
|
||||||
|
|
||||||
git clone --recursive https://github.com/hyle-team/zano.git -b master
|
|
||||||
|
|
||||||
In the following steps we assume that you cloned Zano into '~/zano' folder in your home directory.
|
## Simple Workflow Builds (Recommended)
|
||||||
|
|
||||||
3. Download and build Boost\
|
For most use cases, these two commands are all you need. They handle the entire build process from start to finish.
|
||||||
(Assuming you have cloned Zano into the 'zano' folder. If you used a different location for Zano, **edit line 4** accordingly.)
|
|
||||||
|
|
||||||
curl -OL https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2
|
* **Build for Mainnet:**
|
||||||
echo "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 boost_1_70_0.tar.bz2" | shasum -c && tar -xjf boost_1_70_0.tar.bz2
|
```shell
|
||||||
rm boost_1_70_0.tar.bz2 && cd boost_1_70_0
|
make mainnet
|
||||||
patch -p0 < ../zano/utils/boost_1.70_gcc_8.patch || cd ..
|
```
|
||||||
./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log
|
|
||||||
./b2 && cd ..
|
|
||||||
Make sure that you see "The Boost C++ Libraries were successfully built!" message at the end.
|
|
||||||
|
|
||||||
4. Install Qt\
|
* **Build for Testnet:**
|
||||||
(*GUI version only, skip this step if you're building server version*)
|
```shell
|
||||||
|
make testnet
|
||||||
|
```
|
||||||
|
|
||||||
[*GUI version*]
|
## Creating Release Packages
|
||||||
|
|
||||||
curl -OL https://download.qt.io/new_archive/qt/5.11/5.11.2/qt-opensource-linux-x64-5.11.2.run
|
To create distributable packages (e.g., `.zip`, `.msi`, `.pkg`, `.deb`), run the `release` target. This will build the project, build the documentation, and then package everything.
|
||||||
chmod +x qt-opensource-linux-x64-5.11.2.run
|
|
||||||
./qt-opensource-linux-x64-5.11.2.run
|
|
||||||
Then follow the instructions in Wizard. Don't forget to tick the WebEngine module checkbox!
|
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make release TESTNET=1
|
||||||
|
```
|
||||||
|
The final packages will be located in the `build/packages/` directory
|
||||||
|
|
||||||
5. Install OpenSSL
|
## Advanced Build Customization (Makefile Variables)
|
||||||
|
|
||||||
We recommend installing OpenSSL v1.1.1w locally unless you would like to use the same version system-wide.\
|
For advanced use cases, you can override variables in the `Makefile` to customize the build process.
|
||||||
(Assuming that `$HOME` environment variable is set to your home directory. Otherwise, edit line 4 accordingly.)
|
|
||||||
|
|
||||||
curl -OL https://www.openssl.org/source/openssl-1.1.1w.tar.gz
|
* **Build a `testnet` version:**
|
||||||
echo "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 openssl-1.1.1w.tar.gz" | shasum -c && tar xaf openssl-1.1.1w.tar.gz
|
```shell
|
||||||
cd openssl-1.1.1w/
|
make build TESTNET=1
|
||||||
./config --prefix=$HOME/openssl --openssldir=$HOME/openssl shared zlib
|
```
|
||||||
make && make test && make install && cd ..
|
* **Build a statically-linked version:**
|
||||||
|
```shell
|
||||||
|
make build STATIC=1
|
||||||
|
```
|
||||||
|
* **Build a Debug build with 8 compile threads:**
|
||||||
|
```shell
|
||||||
|
make build BUILD_TYPE=Debug CPU_CORES=8
|
||||||
|
```
|
||||||
|
* **Use custom CMakePresets:**
|
||||||
|
```shell
|
||||||
|
make build PRESET_CONFIGURE=my-config-preset PRESET_BUILD=my-build-preset
|
||||||
|
```
|
||||||
|
|
||||||
|
| Variable | Description | Default Value |
|
||||||
|
|--------------------|------------------------------------------------------------------------|-------------------------|
|
||||||
|
| `BUILD_TYPE` | Sets the build configuration (e.g., `Release`, `Debug`). | `Release` |
|
||||||
|
| `TESTNET` | Set to `1` to build for the test network. | `0` |
|
||||||
|
| `STATIC` | Set to `1` to link libraries statically. | `0` |
|
||||||
|
| `CPU_CORES` | Number of CPU cores to use for parallel compilation. | Auto-detected |
|
||||||
|
| `BUILD_VERSION` | The version string to embed in the binaries. | `6.0.1` |
|
||||||
|
| `BUILD_FOLDER` | The output directory for the build. | `build/release` |
|
||||||
|
| `PRESET_CONFIGURE` | The CMake preset to use for the `configure` step. | `conan-release` |
|
||||||
|
| `PRESET_BUILD` | The CMake preset to use for the `build` step. | `conan-release` |
|
||||||
|
| `CONAN_CACHE` | The path for the local Conan cache, where the dependencies are stored. | `./build/sdk` |
|
||||||
|
| `CONAN_EXECUTABLE` | The path to the usable Conan executable. | `./build/bin/conan` |
|
||||||
|
| `CONAN_URL` | The URL for the Conan remote repository. | `artifacts.host.uk.com` |
|
||||||
|
| `CONAN_USER` | The username for the Conan remote. | `public` |
|
||||||
|
| `CONAN_PASSWORD` | The password for the Conan remote. | |
|
||||||
|
|
||||||
6. [*OPTIONAL*] Set global environment variables for convenient use\
|
## Cleaning the Build Directory
|
||||||
For instance, by adding the following lines to `~/.bashrc`
|
|
||||||
|
|
||||||
[*server version*]
|
ALWAYS USE `make clean` to clean the build directory, manually deleting the `build/release`, `build/SOME_FOLDER` will cause you issues.
|
||||||
|
|
||||||
export BOOST_ROOT=/home/user/boost_1_70_0
|
Our `make clean` triggers a cmake script that completely resets the build directory & dynamically added CMakePresets to its cached warm-up state,
|
||||||
export OPENSSL_ROOT_DIR=/home/user/openssl
|
the selective clean script can be edited here: `cmake/CleanBuild.cmake` or directly run from the repo root `cmake -P cmake/CleanBuild.cmake`
|
||||||
|
|
||||||
|
You can NUKE the build directory with `make clean-build` which is `rm -rf build`.
|
||||||
|
|
||||||
[*GUI version*]
|
If you do manually delete build folders and get CMake errors (if you have compiled anything previously, you will),
|
||||||
|
the ConanPresets.json file has entries in the `include` property, delete them all and try again.
|
||||||
|
|
||||||
export BOOST_ROOT=/home/user/boost_1_70_0
|
This happens because CMakePresets.json includes ConanPresets.json, that has the list of toolchains to use that gets populated during the CMake config step,
|
||||||
export OPENSSL_ROOT_DIR=/home/user/openssl
|
when you manually delete a folder, the toolchain is now a broken path, and CMake throws a fatal error.
|
||||||
export QT_PREFIX_PATH=/home/user/Qt5.11.2/5.11.2/gcc_64
|
|
||||||
|
|
||||||
**NOTICE: Please edit the lines above according to your actual paths.**
|
|
||||||
|
|
||||||
**NOTICE 2:** Make sure you've restarted your terminal session (by reopening the terminal window or reconnecting the server) to apply these changes.
|
|
||||||
|
|
||||||
8. Build the binaries
|
|
||||||
1. If you skipped step 6 and did not set the environment variables:
|
|
||||||
|
|
||||||
cd zano && mkdir build && cd build
|
|
||||||
BOOST_ROOT=$HOME/boost_1_70_0 OPENSSL_ROOT_DIR=$HOME/openssl cmake ..
|
|
||||||
make -j1 daemon simplewallet
|
|
||||||
|
|
||||||
2. If you set the variables in step 6:
|
|
||||||
|
|
||||||
cd zano && mkdir build && cd build
|
|
||||||
cmake ..
|
|
||||||
make -j1 daemon simplewallet
|
|
||||||
|
|
||||||
or simply:
|
|
||||||
|
|
||||||
cd zano && make -j1
|
|
||||||
|
|
||||||
**NOTICE**: If you are building on a machine with a relatively high amount of RAM or with the proper setting of virtual memory, then you can use `-j2` or `-j` option to speed up the building process. Use with caution.
|
|
||||||
|
|
||||||
**NOTICE 2**: If you'd like to build binaries for the testnet, use `cmake -D TESTNET=TRUE ..` instead of `cmake ..` .
|
|
||||||
|
|
||||||
1. Build GUI:
|
|
||||||
|
|
||||||
cd zano
|
|
||||||
utils/build_script_linux.sh
|
|
||||||
|
|
||||||
Look for the binaries in `build` folder
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
Recommended OS version: Windows 7 x64, Windows 11 x64.
|
|
||||||
1. Install required prerequisites (Boost, Qt, CMake, OpenSSL).
|
|
||||||
2. Edit paths in `utils/configure_local_paths.cmd`.
|
|
||||||
3. Run one of `utils/configure_win64_msvsNNNN_gui.cmd` according to your MSVC version.
|
|
||||||
4. Go to the build folder and open generated Zano.sln in MSVC.
|
|
||||||
5. Build.
|
|
||||||
|
|
||||||
In order to correctly deploy Qt GUI application, you also need to do the following:
|
|
||||||
|
|
||||||
6. Copy Zano.exe to a folder (e.g. `depoy`).
|
|
||||||
7. Run `PATH_TO_QT\bin\windeployqt.exe deploy\Zano.exe`.
|
|
||||||
8. Copy folder `\src\gui\qt-daemon\html` to `deploy\html`.
|
|
||||||
9. Now you can run `Zano.exe`
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
### macOS
|
|
||||||
Recommended OS version: macOS Big Sur 11.4 x64.
|
|
||||||
1. Install required prerequisites.
|
|
||||||
2. Set environment variables as stated in `utils/macosx_build_config.command`.
|
|
||||||
3. `mkdir build` <br> `cd build` <br> `cmake ..` <br> `make`
|
|
||||||
|
|
||||||
To build GUI application:
|
|
||||||
|
|
||||||
1. Create self-signing certificate via Keychain Access:\
|
|
||||||
a. Run Keychain Access.\
|
|
||||||
b. Choose Keychain Access > Certificate Assistant > Create a Certificate.\
|
|
||||||
c. Use “Zano” (without quotes) as certificate name.\
|
|
||||||
d. Choose “Code Signing” in “Certificate Type” field.\
|
|
||||||
e. Press “Create”, then “Done”.\
|
|
||||||
f. Make sure the certificate was added to keychain "System". If not—move it to "System".\
|
|
||||||
g. Double click the certificate you've just added, enter the trust section and under "When using this certificate" select "Always trust".\
|
|
||||||
h. Unfold the certificate in Keychain Access window and double click the underlying private key "Zano". Select "Access Control" tab, then select "Allow all applications to access this item". Click "Save Changes".
|
|
||||||
2. Revise building script, comment out unwanted steps and run it: `utils/build_script_mac_osx.sh`
|
|
||||||
3. The application should be here: `/buid_mac_osx_64/release/src`
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,4 +3,4 @@
|
||||||
static_assert(1, "FAIL");
|
static_assert(1, "FAIL");
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
70
conanfile.py
Normal file
70
conanfile.py
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
from conan import ConanFile
|
||||||
|
from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake
|
||||||
|
|
||||||
|
|
||||||
|
class BlockchainConan(ConanFile):
|
||||||
|
name = "blockchain"
|
||||||
|
version = "6.0.1"
|
||||||
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
|
|
||||||
|
options = {
|
||||||
|
"static": [True, False],
|
||||||
|
"testnet": [True, False],
|
||||||
|
"ci": [True, False]
|
||||||
|
}
|
||||||
|
default_options = {
|
||||||
|
"static": False,
|
||||||
|
"testnet": False,
|
||||||
|
"ci": False,
|
||||||
|
"boost/*:without_test": True
|
||||||
|
}
|
||||||
|
|
||||||
|
tool_requires = [
|
||||||
|
"cmake/3.31.9"
|
||||||
|
]
|
||||||
|
|
||||||
|
requires = [
|
||||||
|
"zlib/1.3.1",
|
||||||
|
"boost/1.85.0",
|
||||||
|
"openssl/3.2.0",
|
||||||
|
"miniupnpc/2.2.5",
|
||||||
|
"jwt-cpp/0.7.1",
|
||||||
|
"oatpp/1.3.0.latest",
|
||||||
|
"oatpp-swagger/1.3.0.latest"
|
||||||
|
]
|
||||||
|
|
||||||
|
def generate(self):
|
||||||
|
tc = CMakeToolchain(self)
|
||||||
|
|
||||||
|
os_val = str(self.settings.os).lower()
|
||||||
|
# arch_val = str(self.settings.arch).lower()
|
||||||
|
# compiler_val = str(self.settings.compiler).lower()
|
||||||
|
# tc.presets_prefix = f"{os_val}"
|
||||||
|
|
||||||
|
tc.user_presets_path = "ConanPresets.json"
|
||||||
|
tc.variables["STATIC"] = self.options.static
|
||||||
|
tc.variables["TESTNET"] = self.options.testnet
|
||||||
|
# tc.preprocessor_definitions["TESTNET"] = None
|
||||||
|
# tc.variables["BUILD_VERSION"] = self.options.build_version
|
||||||
|
tc.generate()
|
||||||
|
|
||||||
|
deps = CMakeDeps(self)
|
||||||
|
deps.generate()
|
||||||
|
|
||||||
|
def layout(self):
|
||||||
|
if self.settings.compiler == "msvc":
|
||||||
|
# For multi-config, all configurations go into the same "build" folder.
|
||||||
|
self.folders.build = "build/release"
|
||||||
|
self.folders.generators = "build/release/generators"
|
||||||
|
else:
|
||||||
|
# For single-config, we create a subfolder for each build type.
|
||||||
|
build_type_str = str(self.settings.build_type).lower()
|
||||||
|
self.folders.build = os.path.join("build", build_type_str)
|
||||||
|
self.folders.generators = os.path.join(self.folders.build, "generators")
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
cmake = CMake(self)
|
||||||
|
cmake.configure()
|
||||||
|
cmake.build()
|
||||||
|
|
@ -1,12 +1,23 @@
|
||||||
set(UPNPC_BUILD_STATIC ON CACHE BOOL "Build static library")
|
|
||||||
set(UPNPC_BUILD_SHARED OFF CACHE BOOL "Build shared library")
|
|
||||||
set(UPNPC_BUILD_TESTS OFF CACHE BOOL "Build test executables")
|
|
||||||
add_subdirectory(zlib)
|
|
||||||
add_subdirectory(db)
|
add_subdirectory(db)
|
||||||
add_subdirectory(ethereum)
|
add_subdirectory(ethereum)
|
||||||
|
add_subdirectory(randomx)
|
||||||
|
|
||||||
if( NOT DISABLE_TOR)
|
if(USE_BITCOIN_SECP256K1_FOR_ECDSA)
|
||||||
add_subdirectory(tor-connect)
|
option(SECP256K1_BUILD_BENCHMARK "Build benchmarks." OFF)
|
||||||
|
option(SECP256K1_BUILD_TESTS "Build tests." OFF)
|
||||||
|
option(SECP256K1_BUILD_EXHAUSTIVE_TESTS "Build exhaustive tests." OFF)
|
||||||
|
option(SECP256K1_BUILD_CTIME_TESTS "Build constant-time tests." OFF)
|
||||||
|
option(SECP256K1_BUILD_EXAMPLES "Build examples." OFF)
|
||||||
|
set_property(GLOBAL PROPERTY CTEST_TARGETS_ADDED 1)
|
||||||
|
|
||||||
|
if(STATIC)
|
||||||
|
set(SECP256K1_DISABLE_SHARED ON CACHE BOOL "Disable shared library for secp256k1")
|
||||||
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries by default" FORCE)
|
||||||
|
endif()
|
||||||
|
add_subdirectory(bitcoin-secp256k1)
|
||||||
|
set_property(TARGET secp256k1 PROPERTY FOLDER "contrib")
|
||||||
|
set_property(TARGET secp256k1_precomputed PROPERTY FOLDER "contrib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -15,29 +26,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(miniupnp/miniupnpc)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set_property(TARGET libminiupnpc-static PROPERTY FOLDER "contrib")
|
|
||||||
set_property(TARGET zlibstatic PROPERTY FOLDER "contrib")
|
|
||||||
set_property(TARGET mdbx PROPERTY FOLDER "contrib")
|
set_property(TARGET mdbx PROPERTY FOLDER "contrib")
|
||||||
set_property(TARGET lmdb PROPERTY FOLDER "contrib")
|
set_property(TARGET lmdb PROPERTY FOLDER "contrib")
|
||||||
if( NOT DISABLE_TOR)
|
|
||||||
set_property(TARGET tor-connect PROPERTY FOLDER "contrib")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_property(TARGET upnpc-static mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTY FOLDER "unused")
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
#set_property(TARGET ntdll_extra_target PROPERTY FOLDER "unused")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
if(MSVC)
|
set_property(TARGET mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTY FOLDER "unused")
|
||||||
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4244 /wd4267")
|
|
||||||
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " /wd4267 /wd4267")
|
|
||||||
else()
|
|
||||||
set_property(TARGET upnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-discarded-qualifiers ")
|
|
||||||
set_property(TARGET zlibstatic APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-undef -Wno-unused-result -Wno-unused-value -Wno-implicit-fallthrough -Wno-discarded-qualifiers ")
|
|
||||||
endif()
|
|
||||||
|
|
|
||||||
1
contrib/bitcoin-secp256k1
Submodule
1
contrib/bitcoin-secp256k1
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a5269373fa13ff845f654d81b90629dd78495641
|
||||||
|
|
@ -6,15 +6,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
message("DB ENGINE: lmdb")
|
message("DB ENGINE: lmdb")
|
||||||
add_subdirectory(liblmdb)
|
add_subdirectory(liblmdb)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(lmdb PRIVATE /wd4996 /wd4503 /wd4345 /wd4267 /wd4244 /wd4146 /wd4333 /wd4172)
|
target_compile_options(lmdb PRIVATE /wd4996 /wd4503 /wd4345 /wd4267 /wd4244 /wd4146 /wd4333 /wd4172)
|
||||||
else()
|
else()
|
||||||
# Warnings as used by LMDB itself (LMDB_0.9.23)
|
# Warnings as used by LMDB itself (LMDB_0.9.23)
|
||||||
target_compile_options(lmdb PRIVATE -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized)
|
target_compile_options(lmdb PRIVATE -Wall -Wno-unused-parameter -Wbad-function-cast -Wuninitialized)
|
||||||
endif()
|
endif()
|
||||||
if(NOT DISABLE_MDBX)
|
|
||||||
message("DB ENGINE: mdbx")
|
if(NOT DISABLE_MDBX)
|
||||||
add_subdirectory(libmdbx)
|
message("DB ENGINE: mdbx")
|
||||||
endif()
|
add_subdirectory(libmdbx)
|
||||||
|
# remove mdbx tools from the default MSVC build
|
||||||
|
set_target_properties(mdbx_chk mdbx_copy mdbx_dump mdbx_load mdbx_stat PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
|
||||||
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,9 @@ if(UNIX AND NOT APPLE)
|
||||||
target_link_libraries(${TARGET}_SHARED rt)
|
target_link_libraries(${TARGET}_SHARED rt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
#install(TARGETS ${TARGET}_STATIC DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
||||||
install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
#install(TARGETS ${TARGET}_SHARED DESTINATION ${CMAKE_INSTALL_PREFIX}/lib64 COMPONENT mdbx)
|
||||||
install(FILES mdbx.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include COMPONENT mdbx-devel)
|
#install(FILES mdbx.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include COMPONENT mdbx-devel)
|
||||||
|
|
||||||
add_subdirectory(src/tools)
|
add_subdirectory(src/tools)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,12 @@ if(CC_HAS_VISIBILITY)
|
||||||
target_compile_options(mdbx PRIVATE "-fvisibility=hidden")
|
target_compile_options(mdbx PRIVATE "-fvisibility=hidden")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(TARGETS mdbx
|
#install(TARGETS mdbx
|
||||||
LIBRARY DESTINATION lib COMPONENT runtime
|
# LIBRARY DESTINATION lib COMPONENT runtime
|
||||||
RUNTIME DESTINATION bin COMPONENT runtime
|
# RUNTIME DESTINATION bin COMPONENT runtime
|
||||||
ARCHIVE DESTINATION lib/static COMPONENT devel
|
# ARCHIVE DESTINATION lib/static COMPONENT devel
|
||||||
PUBLIC_HEADER DESTINATION include
|
# PUBLIC_HEADER DESTINATION include
|
||||||
INCLUDES DESTINATION include COMPONENT devel)
|
# INCLUDES DESTINATION include COMPONENT devel)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ foreach(TOOL ${MDBX_TOOLS})
|
||||||
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
|
C_STANDARD ${MDBX_C_STANDARD} C_STANDARD_REQUIRED ON
|
||||||
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>)
|
||||||
|
|
||||||
install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
|
# install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin COMPONENT mdbx)
|
||||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
|
# install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../man1/${TOOL}.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1 COMPONENT mdbx)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(LIB_MATH)
|
if(LIB_MATH)
|
||||||
|
|
|
||||||
|
|
@ -60,25 +60,35 @@ namespace epee
|
||||||
template<bool is_ordered_container, typename t_key, typename t_value, uint64_t max_elements>
|
template<bool is_ordered_container, typename t_key, typename t_value, uint64_t max_elements>
|
||||||
class cache_base
|
class cache_base
|
||||||
{
|
{
|
||||||
uint64_t mac_allowed_elements;
|
uint64_t max_allowed_elements;
|
||||||
std::list<t_key> most_recet_acessed;
|
std::list<t_key> most_recent_accessed;
|
||||||
typename container_selector<is_ordered_container, t_key, std::pair<t_value, typename std::list<t_key>::iterator> >::container data;
|
typename container_selector<is_ordered_container, t_key, std::pair<t_value, typename std::list<t_key>::iterator> >::container data;
|
||||||
protected:
|
protected:
|
||||||
critical_section m_lock;
|
critical_section m_lock;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
cache_base() : mac_allowed_elements(max_elements)
|
cache_base() : max_allowed_elements(max_elements)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
size_t size()
|
size_t size() const
|
||||||
{
|
{
|
||||||
|
|
||||||
return data.size();
|
return data.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t most_recent_accessed_container_size() const
|
||||||
|
{
|
||||||
|
return most_recent_accessed.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t get_max_elements() const
|
||||||
|
{
|
||||||
|
return max_allowed_elements;
|
||||||
|
}
|
||||||
|
|
||||||
void set_max_elements(uint64_t e)
|
void set_max_elements(uint64_t e)
|
||||||
{
|
{
|
||||||
mac_allowed_elements = e;
|
max_allowed_elements = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get(const t_key& k, t_value& v)
|
bool get(const t_key& k, t_value& v)
|
||||||
|
|
@ -88,7 +98,11 @@ namespace epee
|
||||||
if (it == data.end())
|
if (it == data.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
most_recet_acessed.splice(most_recet_acessed.begin(), most_recet_acessed, it->second.second);
|
//most_recent_accessed.splice(most_recent_accessed.begin(), most_recent_accessed, it->second.second);
|
||||||
|
most_recent_accessed.erase(it->second.second);
|
||||||
|
most_recent_accessed.push_front(k);
|
||||||
|
it->second.second = most_recent_accessed.begin();
|
||||||
|
|
||||||
v = it->second.first;
|
v = it->second.first;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -96,8 +110,19 @@ namespace epee
|
||||||
bool set(const t_key& k, const t_value& v)
|
bool set(const t_key& k, const t_value& v)
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_lock);
|
CRITICAL_REGION_LOCAL(m_lock);
|
||||||
most_recet_acessed.push_front(k);
|
auto it = data.find(k);
|
||||||
data[k] = std::pair<t_value, typename std::list<t_key>::iterator>(v, most_recet_acessed.begin());
|
if (it == data.end())
|
||||||
|
{
|
||||||
|
most_recent_accessed.push_front(k);
|
||||||
|
data.insert(std::make_pair(k, std::make_pair(v, most_recent_accessed.begin())));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
most_recent_accessed.erase(it->second.second);
|
||||||
|
most_recent_accessed.push_front(k);
|
||||||
|
it->second.first = v;
|
||||||
|
it->second.second = most_recent_accessed.begin();
|
||||||
|
}
|
||||||
|
|
||||||
trim();
|
trim();
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -107,7 +132,7 @@ namespace epee
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_lock);
|
CRITICAL_REGION_LOCAL(m_lock);
|
||||||
data.clear();
|
data.clear();
|
||||||
most_recet_acessed.clear();
|
most_recent_accessed.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool erase(const t_key& k)
|
bool erase(const t_key& k)
|
||||||
|
|
@ -117,20 +142,21 @@ namespace epee
|
||||||
if (data_it == data.end())
|
if (data_it == data.end())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
most_recet_acessed.erase(data_it->second.second);
|
most_recent_accessed.erase(data_it->second.second);
|
||||||
data.erase(data_it);
|
data.erase(data_it);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void trim()
|
void trim()
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_lock);
|
CRITICAL_REGION_LOCAL(m_lock);
|
||||||
while (most_recet_acessed.size() > mac_allowed_elements)
|
while (most_recent_accessed.size() > max_allowed_elements)
|
||||||
{
|
{
|
||||||
auto data_it = data.find(most_recet_acessed.back());
|
auto data_it = data.find(most_recent_accessed.back());
|
||||||
if (data_it != data.end())
|
if (data_it != data.end())
|
||||||
data.erase(data_it);
|
data.erase(data_it);
|
||||||
most_recet_acessed.erase(--most_recet_acessed.end());
|
most_recent_accessed.erase(--most_recent_accessed.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -238,7 +264,10 @@ namespace epee
|
||||||
|
|
||||||
bool erase(const t_key& k)
|
bool erase(const t_key& k)
|
||||||
{
|
{
|
||||||
return m_isolation.isolated_write_access<bool>([&](){return base_class::erase(k); });
|
return m_isolation.isolated_write_access<bool>([&]()
|
||||||
|
{
|
||||||
|
return base_class::erase(k);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ namespace epee
|
||||||
m_run.store(false, std::memory_order_relaxed);
|
m_run.store(false, std::memory_order_relaxed);
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
::CloseHandle(::GetStdHandle(STD_INPUT_HANDLE));
|
// ::CloseHandle(::GetStdHandle(STD_INPUT_HANDLE)); -- commented out by sowle, I belive we don't need to close this handle here
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_request_cv.notify_one();
|
m_request_cv.notify_one();
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,19 @@
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#if __has_include(<filesystem>)
|
||||||
|
#include <filesystem>
|
||||||
|
namespace stdfs = std::filesystem;
|
||||||
|
#else
|
||||||
|
#if TARGET_OS_IOS
|
||||||
|
#error "This should never happen on ios."
|
||||||
|
#endif
|
||||||
|
namespace stdfs = boost::filesystem;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//#include <filesystem>
|
||||||
|
|
||||||
#ifndef MAKE64
|
#ifndef MAKE64
|
||||||
#define MAKE64(low,high) ((__int64)(((DWORD)(low)) | ((__int64)((DWORD)(high))) << 32))
|
#define MAKE64(low,high) ((__int64)(((DWORD)(low)) | ((__int64)((DWORD)(high))) << 32))
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -561,16 +574,15 @@ namespace file_io_utils
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
boost::filesystem::directory_iterator end_itr; // default construction yields past-the-end
|
stdfs::directory_iterator end_itr; // default construction yields past-the-end
|
||||||
for ( boost::filesystem::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
|
for (stdfs::directory_iterator itr( epee::string_encoding::utf8_to_wstring(path) ); itr != end_itr; ++itr )
|
||||||
{
|
{
|
||||||
if ( only_files && boost::filesystem::is_directory(itr->status()) )
|
if ( only_files && stdfs::is_directory(itr->status()) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
target_list.push_back(itr->path().filename().string());
|
target_list.push_back(itr->path().filename().string());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(...)
|
catch(...)
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
#define _GZIP_ENCODING_H_
|
#define _GZIP_ENCODING_H_
|
||||||
#include "boost/core/ignore_unused.hpp"
|
#include "boost/core/ignore_unused.hpp"
|
||||||
#include "net/http_client_base.h"
|
#include "net/http_client_base.h"
|
||||||
#include "zlib/zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
|
|
@ -182,7 +182,7 @@ namespace net_utils
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
inline
|
inline
|
||||||
virtual void stop(std::string& OUT collect_remains)
|
virtual void stop(std::string& OUT collect_remains) override
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -260,6 +260,10 @@ namespace net_utils
|
||||||
m_pcb.reset(new abstract_callback<callback_t>(cb));
|
m_pcb.reset(new abstract_callback<callback_t>(cb));
|
||||||
return content_encoding_gzip::update_in(piece_of_transfer);
|
return content_encoding_gzip::update_in(piece_of_transfer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void stop(std::string& OUT collect_remains) override
|
||||||
|
{}
|
||||||
|
|
||||||
template<class callback_t>
|
template<class callback_t>
|
||||||
bool stop(callback_t cb)
|
bool stop(callback_t cb)
|
||||||
{return true;}
|
{return true;}
|
||||||
|
|
|
||||||
|
|
@ -30,5 +30,3 @@
|
||||||
#define ENABLE_RELEASE_LOGGING
|
#define ENABLE_RELEASE_LOGGING
|
||||||
|
|
||||||
#include "misc_log_ex.h"
|
#include "misc_log_ex.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,9 @@ namespace misc_utils
|
||||||
{
|
{
|
||||||
|
|
||||||
template<typename t_type_a, typename t_type_b>
|
template<typename t_type_a, typename t_type_b>
|
||||||
void cast_assign_a_to_b(t_type_a& a, const t_type_b& b)
|
void cast_assign_a_to_b(const t_type_a& a, t_type_b& b)
|
||||||
{
|
{
|
||||||
*static_cast<t_type_b*>(&a) = b;
|
*static_cast<t_type_a*>(&b) = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class _Ty1,
|
template<class _Ty1,
|
||||||
|
|
@ -371,7 +371,7 @@ namespace misc_utils
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define ON_EXIT misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler
|
#define ON_FUNC_EXIT misc_utils::auto_scope_leave_caller scope_exit_handler = misc_utils::create_scope_leave_handler
|
||||||
|
|
||||||
|
|
||||||
template< typename t_contaner, typename t_redicate>
|
template< typename t_contaner, typename t_redicate>
|
||||||
|
|
@ -560,11 +560,84 @@ namespace misc_utils
|
||||||
{
|
{
|
||||||
while(m_expirations.size() && m_expirations.begin()->first < e)
|
while(m_expirations.size() && m_expirations.begin()->first < e)
|
||||||
{
|
{
|
||||||
|
m_set.erase(m_expirations.begin()->second);
|
||||||
m_expirations.erase(m_expirations.begin());
|
m_expirations.erase(m_expirations.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename key, typename expiration_type, typename value_type>
|
||||||
|
struct expirating_map
|
||||||
|
{
|
||||||
|
typedef std::map<key, value_type> main_map;
|
||||||
|
main_map m_map;
|
||||||
|
std::multimap<expiration_type, typename main_map::iterator> m_expirations;
|
||||||
|
|
||||||
|
const main_map& get_map()
|
||||||
|
{
|
||||||
|
return m_map;
|
||||||
|
}
|
||||||
|
void add(const key& k, const value_type& v, const expiration_type& e)
|
||||||
|
{
|
||||||
|
auto res = m_map.insert(k, v);
|
||||||
|
m_expirations.insert({ e, res.first });
|
||||||
|
}
|
||||||
|
|
||||||
|
void remove_if_expiration_less_than(const expiration_type& e)
|
||||||
|
{
|
||||||
|
while (m_expirations.size() && m_expirations.begin()->first < e)
|
||||||
|
{
|
||||||
|
m_map.erase(m_expirations.begin()->second);
|
||||||
|
m_expirations.erase(m_expirations.begin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class t_archive>
|
||||||
|
inline void serialize(t_archive& a, const unsigned int ver)
|
||||||
|
{
|
||||||
|
std::vector<std::tuple<key, value_type, expiration_type> > items;
|
||||||
|
if constexpr (t_archive::is_saving::value)
|
||||||
|
{
|
||||||
|
for (const auto& item: m_expirations)
|
||||||
|
{
|
||||||
|
items.resize(items.size + 1);
|
||||||
|
std::get<2>(items.back()) = item.first;
|
||||||
|
std::get<0>(items.back()) = item.second.first;
|
||||||
|
std::get<1>(items.back()) = item.second.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
a & items;
|
||||||
|
|
||||||
|
if constexpr (!t_archive::is_saving::value)
|
||||||
|
{
|
||||||
|
for (const auto& item : items)
|
||||||
|
{
|
||||||
|
this->add(std::get<0>(item), std::get<1>(item), std::get<2>(item));
|
||||||
|
|
||||||
|
|
||||||
|
items.resize(items.size + 1);
|
||||||
|
std::get<2>(items.back()) = item.first;
|
||||||
|
std::get<0>(items.back()) = item.second.first;
|
||||||
|
std::get<1>(items.back()) = item.second.second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// helper class mainly intended for using with std::atomic to repair copy-construction in classes where std::atomic is aggregated
|
||||||
|
template<typename parent_t>
|
||||||
|
struct void_copy : public parent_t
|
||||||
|
{
|
||||||
|
void_copy() = default;
|
||||||
|
void_copy(void_copy&&) noexcept = default;
|
||||||
|
void_copy& operator=(void_copy&&) noexcept = default;
|
||||||
|
|
||||||
|
void_copy(const void_copy&) : parent_t{} {}
|
||||||
|
void_copy& operator=(const void_copy&) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace misc_utils
|
} // namespace misc_utils
|
||||||
} // namespace epee
|
} // namespace epee
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (c) 2019, Zano Project
|
// Copyright (c) 2019-2024, Zano Project
|
||||||
// Copyright (c) 2019, anonimal <anonimal@zano.org>
|
// Copyright (c) 2019, anonimal <anonimal@zano.org>
|
||||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
|
|
@ -90,7 +90,7 @@ DISABLE_VS_WARNINGS(4100)
|
||||||
#define LOG_JOURNAL_MAX_ELEMENTS 100
|
#define LOG_JOURNAL_MAX_ELEMENTS 100
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define _ASSERTE__(expr) if(!expr) {__debugbreak();}
|
#define _ASSERTE__(expr) if(!(expr)) {__debugbreak();}
|
||||||
#else
|
#else
|
||||||
#define _ASSERTE__(expr)
|
#define _ASSERTE__(expr)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -244,11 +244,6 @@ DISABLE_VS_WARNINGS(4100)
|
||||||
#define CHECK_AND_ASSERT_MES_CUSTOM(expr, fail_ret_val, custom_code, message) do{if(!(expr)) {LOG_ERROR(message); custom_code; return fail_ret_val;};}while(0)
|
#define CHECK_AND_ASSERT_MES_CUSTOM(expr, fail_ret_val, custom_code, message) do{if(!(expr)) {LOG_ERROR(message); custom_code; return fail_ret_val;};}while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*#ifndef CHECK_AND_ASSERT_MES_AND_THROW
|
|
||||||
#define CHECK_AND_ASSERT_MES_AND_THROW(expr, message) do{if(!(expr)) {LOG_ERROR(message); throw std::runtime_error(message);};}while(0)
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CHECK_AND_NO_ASSERT_MES
|
#ifndef CHECK_AND_NO_ASSERT_MES
|
||||||
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_PRINT_MAGENTA(message, LOG_LEVEL_0); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
|
#define CHECK_AND_NO_ASSERT_MES(expr, fail_ret_val, message) do{if(!(expr)) {LOG_PRINT_MAGENTA(message, LOG_LEVEL_0); /*LOCAL_ASSERT(expr);*/ return fail_ret_val;};}while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -265,6 +260,22 @@ DISABLE_VS_WARNINGS(4100)
|
||||||
#define CHECK_AND_ASSERT_MES2(expr, message) do{if(!(expr)) {LOG_ERROR(message); };}while(0)
|
#define CHECK_AND_ASSERT_MES2(expr, message) do{if(!(expr)) {LOG_ERROR(message); };}while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CHECK_AND_ASSERT_EQ
|
||||||
|
#define CHECK_AND_ASSERT_EQ(A, B) CHECK_AND_ASSERT_MES((A) == (B), false, STR(A) " != " STR(B) " because " << A << " != " << B)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CHECK_AND_ASSERT_NEQ
|
||||||
|
#define CHECK_AND_ASSERT_NEQ(A, B) CHECK_AND_ASSERT_MES((A) != (B), false, STR(A) " == " STR(B) " because " << A << " == " << B)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CHECK_AND_ASSERT_LESS
|
||||||
|
#define CHECK_AND_ASSERT_LESS(A, B) CHECK_AND_ASSERT_MES((A) < (B), false, STR(A) " >= " STR(B) " because " << A << " >= " << B)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CHECK_AND_ASSERT_GREATER
|
||||||
|
#define CHECK_AND_ASSERT_GREATER(A, B) CHECK_AND_ASSERT_MES((A) > (B), false, STR(A) " <= " STR(B) " because " << A << " <= " << B)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
namespace debug
|
namespace debug
|
||||||
|
|
|
||||||
|
|
@ -114,26 +114,33 @@ namespace misc_utils
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#include <boost/core/demangle.hpp>
|
#include <boost/core/demangle.hpp>
|
||||||
#endif
|
#endif
|
||||||
inline std::string print_trace_default()
|
inline std::string print_trace_default() noexcept
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
try
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
#if defined(__GNUC__) && !defined(__ANDROID__)
|
#if defined(__GNUC__) && !defined(__ANDROID__)
|
||||||
ss << std::endl << "STACK" << std::endl;
|
ss << std::endl << "STACK" << std::endl;
|
||||||
const size_t max_depth = 100;
|
const size_t max_depth = 100;
|
||||||
size_t stack_depth;
|
size_t stack_depth;
|
||||||
void *stack_addrs[max_depth];
|
void *stack_addrs[max_depth];
|
||||||
char **stack_strings;
|
char **stack_strings;
|
||||||
|
|
||||||
stack_depth = backtrace(stack_addrs, max_depth);
|
stack_depth = backtrace(stack_addrs, max_depth);
|
||||||
stack_strings = backtrace_symbols(stack_addrs, stack_depth);
|
stack_strings = backtrace_symbols(stack_addrs, stack_depth);
|
||||||
|
|
||||||
for (size_t i = 1; i < stack_depth; i++)
|
for (size_t i = 1; i < stack_depth; i++)
|
||||||
{
|
{
|
||||||
ss << boost::core::demangle(stack_strings[i]) << std::endl;
|
ss << boost::core::demangle(stack_strings[i]) << std::endl;
|
||||||
}
|
}
|
||||||
free(stack_strings); // malloc()ed by backtrace_symbols
|
free(stack_strings); // malloc()ed by backtrace_symbols
|
||||||
#endif
|
#endif
|
||||||
return ss.str();
|
return ss.str();
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
return std::string("(no callstack due to an exception)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::string (stack_retrieving_function_t)();
|
typedef std::string (stack_retrieving_function_t)();
|
||||||
|
|
@ -141,27 +148,35 @@ namespace misc_utils
|
||||||
//
|
//
|
||||||
// To get stack trace call it with the defaults.
|
// To get stack trace call it with the defaults.
|
||||||
//
|
//
|
||||||
inline std::string get_callstack(stack_retrieving_function_t* p_stack_retrieving_function_to_be_added = nullptr, bool remove_func = false)
|
inline std::string get_callstack(stack_retrieving_function_t* p_stack_retrieving_function_to_be_added = nullptr, bool remove_func = false) noexcept
|
||||||
{
|
{
|
||||||
static stack_retrieving_function_t* p_srf = nullptr;
|
static stack_retrieving_function_t* p_srf = nullptr;
|
||||||
|
|
||||||
if (remove_func)
|
|
||||||
{
|
|
||||||
p_srf = nullptr;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_stack_retrieving_function_to_be_added != nullptr)
|
|
||||||
{
|
|
||||||
p_srf = p_stack_retrieving_function_to_be_added;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p_srf != nullptr)
|
try
|
||||||
return p_srf();
|
{
|
||||||
|
|
||||||
|
if (remove_func)
|
||||||
|
{
|
||||||
|
p_srf = nullptr;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_stack_retrieving_function_to_be_added != nullptr)
|
||||||
|
{
|
||||||
|
p_srf = p_stack_retrieving_function_to_be_added;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
return print_trace_default();
|
if (p_srf != nullptr)
|
||||||
|
return p_srf();
|
||||||
|
|
||||||
|
return print_trace_default();
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
return std::string("(no callstack due to an exception)");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace misc_utils
|
||||||
}
|
} // namespace epee
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace epee {
|
||||||
namespace net_utils {
|
namespace net_utils {
|
||||||
|
|
||||||
struct i_connection_filter {
|
struct i_connection_filter {
|
||||||
virtual bool is_remote_ip_allowed(uint32_t adress) = 0;
|
virtual bool is_remote_ip_allowed(uint32_t adress, bool is_incoming) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~i_connection_filter()
|
virtual ~i_connection_filter()
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,18 @@ namespace net_utils {
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
DISABLE_VS_WARNINGS(4355)
|
DISABLE_VS_WARNINGS(4355)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
template <typename, typename = std::void_t<>>
|
||||||
|
struct has_pre_destructor_handler : std::false_type {};
|
||||||
|
|
||||||
|
// This specialization is selected if T has a valid 'b()' that can be called
|
||||||
|
template <typename T>
|
||||||
|
struct has_pre_destructor_handler<T, std::void_t<decltype(std::declval<T&>().on_pre_destroy())>>
|
||||||
|
: std::true_type {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<class t_protocol_handler>
|
template<class t_protocol_handler>
|
||||||
connection<t_protocol_handler>::connection(boost::asio::io_service& io_service,
|
connection<t_protocol_handler>::connection(boost::asio::io_service& io_service,
|
||||||
typename t_protocol_handler::config_type& config, volatile uint32_t& sock_count, i_connection_filter*& pfilter)
|
typename t_protocol_handler::config_type& config, volatile uint32_t& sock_count, i_connection_filter*& pfilter)
|
||||||
|
|
@ -66,6 +78,12 @@ connection<t_protocol_handler>::~connection()
|
||||||
{
|
{
|
||||||
NESTED_TRY_ENTRY();
|
NESTED_TRY_ENTRY();
|
||||||
|
|
||||||
|
if constexpr (has_pre_destructor_handler<t_protocol_handler>::value)
|
||||||
|
{
|
||||||
|
m_protocol_handler.on_pre_destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!m_was_shutdown) {
|
if(!m_was_shutdown) {
|
||||||
LOG_PRINT_L3("[sock " << socket_.native_handle() << "] Socket destroyed without shutdown.");
|
LOG_PRINT_L3("[sock " << socket_.native_handle() << "] Socket destroyed without shutdown.");
|
||||||
shutdown();
|
shutdown();
|
||||||
|
|
@ -128,7 +146,7 @@ bool connection<t_protocol_handler>::start(bool is_income, bool is_multithreaded
|
||||||
|
|
||||||
LOG_PRINT_L3("[sock " << socket_.native_handle() << "] new connection, remote end_point: " << print_connection_context_short(context) << " local end_point: " << local_ep.address().to_string() << ':' << local_ep.port() << ", total sockets objects " << m_ref_sockets_count);
|
LOG_PRINT_L3("[sock " << socket_.native_handle() << "] new connection, remote end_point: " << print_connection_context_short(context) << " local end_point: " << local_ep.address().to_string() << ':' << local_ep.port() << ", total sockets objects " << m_ref_sockets_count);
|
||||||
|
|
||||||
if(is_income && m_pfilter && !m_pfilter->is_remote_ip_allowed(context.m_remote_ip)) {
|
if(is_income && m_pfilter && !m_pfilter->is_remote_ip_allowed(context.m_remote_ip, is_income)) {
|
||||||
LOG_PRINT_L0("[sock " << socket_.native_handle() << "] ip denied " << string_tools::get_ip_string_from_int32(context.m_remote_ip) << ", shutdowning connection");
|
LOG_PRINT_L0("[sock " << socket_.native_handle() << "] ip denied " << string_tools::get_ip_string_from_int32(context.m_remote_ip) << ", shutdowning connection");
|
||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,26 @@ namespace epee
|
||||||
|
|
||||||
namespace http
|
namespace http
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
struct i_http_client
|
||||||
|
{
|
||||||
|
virtual void set_host_name(const std::string& name) = 0;
|
||||||
|
virtual boost::asio::ip::tcp::socket& get_socket() = 0;
|
||||||
|
virtual bool connect(const std::string& host, int port, unsigned int timeout) = 0;
|
||||||
|
virtual bool set_timeouts(unsigned int connection_timeout, unsigned int recv_timeout) = 0;
|
||||||
|
virtual bool connect(const std::string& host, std::string port) = 0;
|
||||||
|
virtual bool connect(const std::string& host, const std::string& port, unsigned int timeout) = 0;
|
||||||
|
virtual bool disconnect() = 0;
|
||||||
|
virtual bool is_connected() = 0;
|
||||||
|
virtual bool invoke_get(const std::string& uri, const std::string& body = std::string(), const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
|
||||||
|
virtual bool invoke(const std::string& uri, const std::string& method, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
|
||||||
|
virtual bool invoke_post(const std::string& uri, const std::string& body, const http_response_info** ppresponse_info = NULL, const fields_list& additional_params = fields_list()) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
template<bool is_ssl>
|
template<bool is_ssl>
|
||||||
class http_simple_client_t : public i_target_handler
|
class http_simple_client_t : public i_target_handler,
|
||||||
|
public i_http_client
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -893,25 +911,90 @@ namespace epee
|
||||||
typedef http_simple_client_t<true> https_simple_client;
|
typedef http_simple_client_t<true> https_simple_client;
|
||||||
|
|
||||||
|
|
||||||
|
//suitable for both http and https
|
||||||
|
class http_universal_client: public i_http_client
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
http_universal_client(): m_pclient(new http_simple_client())
|
||||||
|
{}
|
||||||
|
// Forward all calls to m_pclient
|
||||||
|
void set_host_name(const std::string& name) override
|
||||||
|
{
|
||||||
|
m_pclient->set_host_name(name);
|
||||||
|
}
|
||||||
|
bool connect(const std::string& host, int port, unsigned int timeout) override
|
||||||
|
{
|
||||||
|
return m_pclient->connect(host, port, timeout);
|
||||||
|
}
|
||||||
|
boost::asio::ip::tcp::socket& get_socket() override { return m_pclient->get_socket(); }
|
||||||
|
bool set_timeouts(unsigned int connection_timeout, unsigned int recv_timeout) override { return m_pclient->set_timeouts(connection_timeout, recv_timeout); }
|
||||||
|
bool connect(const std::string& host, std::string port) override { return m_pclient->connect(host, port); }
|
||||||
|
bool connect(const std::string& host, const std::string& port, unsigned int timeout) override { return m_pclient->connect(host, port, timeout); }
|
||||||
|
bool disconnect() override { return m_pclient->disconnect(); }
|
||||||
|
bool is_connected() override { return m_pclient->is_connected(); }
|
||||||
|
bool invoke_get(const std::string& uri, const std::string& body = std::string(), const http_response_info** ppresponse_info = nullptr, const fields_list& additional_params = fields_list()) override { return m_pclient->invoke_get(uri, body, ppresponse_info, additional_params); }
|
||||||
|
bool invoke(const std::string& uri, const std::string& method, const std::string& body, const http_response_info** ppresponse_info = nullptr, const fields_list& additional_params = fields_list()) override { return m_pclient->invoke(uri, method, body, ppresponse_info, additional_params); }
|
||||||
|
bool invoke_post(const std::string& uri, const std::string& body, const http_response_info** ppresponse_info = nullptr, const fields_list& additional_params = fields_list()) override { return m_pclient->invoke_post(uri, body, ppresponse_info, additional_params); }
|
||||||
|
|
||||||
|
void set_is_ssl(bool is_ssl)
|
||||||
|
{
|
||||||
|
if (m_is_ssl != is_ssl)
|
||||||
|
{
|
||||||
|
if (is_ssl)
|
||||||
|
{
|
||||||
|
m_pclient.reset(new https_simple_client());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pclient.reset(new http_simple_client());
|
||||||
|
}
|
||||||
|
m_is_ssl = is_ssl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
bool m_is_ssl = false;
|
||||||
|
std::shared_ptr<i_http_client> m_pclient;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename transport>
|
||||||
|
void configure_transport(const std::string schema, transport& tr)
|
||||||
|
{}
|
||||||
|
inline void configure_transport(const std::string schema, http_universal_client& tr)
|
||||||
|
{
|
||||||
|
if (schema == "https")
|
||||||
|
tr.set_is_ssl(true);
|
||||||
|
else
|
||||||
|
tr.set_is_ssl(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
template<class t_transport>
|
template<class t_transport>
|
||||||
bool invoke_request(const std::string& url, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
bool invoke_request(const std::string& url, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||||
{
|
{
|
||||||
http::url_content u_c;
|
http::url_content u_c{};
|
||||||
bool res = parse_url(url, u_c);
|
bool r = parse_url(url, u_c);
|
||||||
|
CHECK_AND_ASSERT_MES(tr.is_connected() || u_c.host.empty() || r, false, "failed to parse url: " << url);
|
||||||
|
r = invoke_request(u_c, tr, timeout, ppresponse_info, method, body, additional_params);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_transport>
|
||||||
|
bool invoke_request(const http::url_content& u_c, t_transport& tr, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||||
|
{
|
||||||
if (!tr.is_connected() && !u_c.host.empty())
|
if (!tr.is_connected() && !u_c.host.empty())
|
||||||
{
|
{
|
||||||
CHECK_AND_ASSERT_MES(res, false, "failed to parse url: " << url);
|
int port = static_cast<int>(u_c.port);
|
||||||
|
if (!port)
|
||||||
|
port = 80;//default for http
|
||||||
|
|
||||||
if (!u_c.port)
|
configure_transport(u_c.schema, tr);
|
||||||
u_c.port = 80;//default for http
|
if (!tr.connect(u_c.host, port, timeout))
|
||||||
|
|
||||||
if (!tr.connect(u_c.host, static_cast<int>(u_c.port), timeout))
|
|
||||||
{
|
{
|
||||||
LOG_PRINT_L2("invoke_request: cannot connect to " << u_c.host << ":" << u_c.port);
|
LOG_PRINT_L2("invoke_request: cannot connect to " << u_c.host << ":" << port);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -937,28 +1020,67 @@ namespace epee
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class interruptible_http_client : public http_simple_client
|
|
||||||
{
|
|
||||||
std::shared_ptr<idle_handler_base> m_pcb;
|
|
||||||
bool m_permanent_error = false;
|
|
||||||
|
|
||||||
virtual bool handle_target_data(std::string& piece_of_transfer)
|
class http_https_simple_client_wrapper : virtual public http_simple_client, virtual public https_simple_client
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
http_https_simple_client_wrapper(bool is_ssl, std::shared_ptr<idle_handler_base> ihb_cb)
|
||||||
|
: m_ssl(is_ssl)
|
||||||
|
, m_ihb_cb(ihb_cb)
|
||||||
|
{}
|
||||||
|
|
||||||
|
bool invoke_request(const http::url_content& u_c, unsigned int timeout, const http_response_info** ppresponse_info, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||||
{
|
{
|
||||||
bool r = m_pcb->do_call(piece_of_transfer, m_len_in_summary, m_len_in_summary - m_len_in_remain);
|
bool r = false;
|
||||||
|
if (m_ssl)
|
||||||
|
r = epee::net_utils::http::invoke_request(u_c, static_cast<https_simple_client&>(*this), timeout, ppresponse_info, method, body, additional_params);
|
||||||
|
else
|
||||||
|
r = epee::net_utils::http::invoke_request(u_c, static_cast<http_simple_client&>(*this), timeout, ppresponse_info, method, body, additional_params);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// class i_target_handler
|
||||||
|
virtual bool handle_target_data(std::string& piece_of_transfer) override
|
||||||
|
{
|
||||||
|
bool r = false;
|
||||||
|
if (m_ssl)
|
||||||
|
r = m_ihb_cb->do_call(piece_of_transfer, https_simple_client::m_len_in_summary, https_simple_client::m_len_in_summary - https_simple_client::m_len_in_remain);
|
||||||
|
else
|
||||||
|
r = m_ihb_cb->do_call(piece_of_transfer, http_simple_client::m_len_in_summary, http_simple_client::m_len_in_summary - http_simple_client::m_len_in_remain);
|
||||||
piece_of_transfer.clear();
|
piece_of_transfer.clear();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool m_ssl;
|
||||||
|
std::shared_ptr<idle_handler_base> m_ihb_cb;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class interruptible_http_client
|
||||||
|
{
|
||||||
|
bool m_permanent_error = false;
|
||||||
public:
|
public:
|
||||||
template<typename callback_t>
|
template<typename callback_t>
|
||||||
bool invoke_cb(callback_t cb, const std::string& url, uint64_t timeout, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
bool invoke_cb(callback_t cb, const std::string& url, uint64_t timeout, const std::string& method = "GET", const std::string& body = std::string(), const fields_list& additional_params = fields_list())
|
||||||
{
|
{
|
||||||
m_pcb.reset(new idle_handler<callback_t>(cb));
|
http::url_content uc{};
|
||||||
|
if (!parse_url(url, uc))
|
||||||
|
{
|
||||||
|
LOG_PRINT_L0("HTTP request to " << url << " failed because the URL couldn't be parsed.");
|
||||||
|
m_permanent_error = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool is_ssl = uc.schema == "https";
|
||||||
|
|
||||||
|
http_https_simple_client_wrapper wrapper(is_ssl, std::make_shared<idle_handler<callback_t>>(cb));
|
||||||
|
|
||||||
const http_response_info* p_hri = nullptr;
|
const http_response_info* p_hri = nullptr;
|
||||||
bool r = invoke_request(url, *this, timeout, &p_hri, method, body, additional_params);
|
bool r = wrapper.invoke_request(uc, timeout, &p_hri, method, body, additional_params);
|
||||||
|
|
||||||
if (p_hri && !(p_hri->m_response_code >= 200 && p_hri->m_response_code < 300))
|
if (p_hri && !(p_hri->m_response_code >= 200 && p_hri->m_response_code < 300))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("HTTP request to " << url << " failed with code: " << p_hri->m_response_code);
|
LOG_PRINT_L0(boost::to_upper_copy(uc.schema) << " request to " << url << " failed with code: " << p_hri->m_response_code);
|
||||||
m_permanent_error = true;
|
m_permanent_error = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,146 +30,11 @@
|
||||||
#include "storages/portable_storage_template_helper.h"
|
#include "storages/portable_storage_template_helper.h"
|
||||||
#include "http_base.h"
|
#include "http_base.h"
|
||||||
#include "net/net_utils_base.h"
|
#include "net/net_utils_base.h"
|
||||||
|
#include "storages/portable_storage_extended_for_doc.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<typename typename_t>
|
namespace epee
|
||||||
typename_t get_documentation_json_struct()
|
|
||||||
{
|
|
||||||
return AUTO_VAL_INIT_T(typename_t);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename request_t, typename response_t>
|
|
||||||
bool auto_doc_t(const std::string& prefix_name, std::string& generate_reference)
|
|
||||||
{
|
|
||||||
if (!generate_reference.size()) return true;
|
|
||||||
request_t req = get_documentation_json_struct<request_t>();
|
|
||||||
response_t res = get_documentation_json_struct<response_t>();
|
|
||||||
|
|
||||||
std::string req_str;
|
|
||||||
epee::serialization::portable_storage ps;
|
|
||||||
req.store(ps, nullptr, true);
|
|
||||||
ps.dump_as_json(req_str);
|
|
||||||
|
|
||||||
|
|
||||||
std::string res_str;
|
|
||||||
epee::serialization::portable_storage ps_res;
|
|
||||||
res.store(ps_res, nullptr, true);
|
|
||||||
ps_res.dump_as_json(res_str);
|
|
||||||
|
|
||||||
|
|
||||||
std::stringstream ss;
|
|
||||||
ss << prefix_name << ENDL
|
|
||||||
<< "REQUEST: " << ENDL << req_str << ENDL << "--------------------------------" << ENDL
|
|
||||||
<< "RESPONSE: " << ENDL << res_str << ENDL << "################################" << ENDL;
|
|
||||||
generate_reference += ss.str();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<typename command_type_t>
|
|
||||||
bool auto_doc(const std::string& prefix_name, std::string& generate_reference)
|
|
||||||
{
|
|
||||||
return auto_doc_t<typename command_type_t::request, typename command_type_t::response>(prefix_name, generate_reference);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace epee {
|
|
||||||
namespace net_utils {
|
|
||||||
namespace http {
|
|
||||||
struct i_chain_handler
|
|
||||||
{
|
|
||||||
virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, epee::net_utils::http::http_response_info& response_info,
|
|
||||||
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, std::string& generate_reference) = 0;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define CHAIN_HTTP_TO_MAP2(context_type) bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, \
|
|
||||||
epee::net_utils::http::http_response_info& response, \
|
|
||||||
context_type& m_conn_context) \
|
|
||||||
{\
|
|
||||||
response.m_response_code = 200; \
|
|
||||||
response.m_response_comment = "Ok"; \
|
|
||||||
std::string reference_stub; \
|
|
||||||
bool call_found = false; \
|
|
||||||
if(!handle_http_request_map(query_info, response, m_conn_context, call_found, reference_stub) && response.m_response_code == 200) \
|
|
||||||
{ response.m_response_code = 500; response.m_response_comment = "Internal Server Error"; return true; } \
|
|
||||||
if (!call_found) \
|
|
||||||
{ response.m_response_code = 404; response.m_response_comment = "Not Found"; return true; } \
|
|
||||||
return true; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define BEGIN_URI_MAP2() template<class t_context> bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
|
||||||
epee::net_utils::http::http_response_info& response_info, \
|
|
||||||
t_context& m_conn_context, bool& call_found, std::string& generate_reference) { \
|
|
||||||
call_found = false; \
|
|
||||||
if(false) return true; //just a stub to have "else if"
|
|
||||||
|
|
||||||
#define BEGIN_URI_MAP2_VIRTUAL() virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
|
||||||
epee::net_utils::http::http_response_info& response_info, \
|
|
||||||
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, std::string& generate_reference) { \
|
|
||||||
call_found = false; \
|
|
||||||
if(false) return true; //just a stub to have "else if"
|
|
||||||
|
|
||||||
|
|
||||||
#define MAP_URI2(pattern, callback) else if(std::string::npos != query_info.m_URI.find(pattern)) return callback(query_info, response_info, m_conn_context);
|
|
||||||
|
|
||||||
#define MAP_URI_AUTO_XML2(s_pattern, callback_f, command_type) //TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
|
||||||
|
|
||||||
#define MAP_URI_AUTO_JON2(s_pattern, callback_f, command_type) \
|
|
||||||
else if(auto_doc<command_type>(s_pattern "[JSON]", generate_reference) && query_info.m_URI == s_pattern) \
|
|
||||||
{ \
|
|
||||||
call_found = true; \
|
|
||||||
uint64_t ticks = misc_utils::get_tick_count(); \
|
|
||||||
boost::value_initialized<command_type::request> req; \
|
|
||||||
bool res = epee::serialization::load_t_from_json(static_cast<command_type::request&>(req), query_info.m_body); \
|
|
||||||
CHECK_AND_ASSERT_MES(res, false, "Failed to parse json: \r\n" << query_info.m_body); \
|
|
||||||
uint64_t ticks1 = epee::misc_utils::get_tick_count(); \
|
|
||||||
boost::value_initialized<command_type::response> resp;\
|
|
||||||
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
|
||||||
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
|
||||||
uint64_t ticks2 = epee::misc_utils::get_tick_count(); \
|
|
||||||
epee::serialization::store_t_to_json(static_cast<command_type::response&>(resp), response_info.m_body); \
|
|
||||||
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
|
||||||
response_info.m_mime_tipe = "application/json"; \
|
|
||||||
response_info.m_header_info.m_content_type = " application/json"; \
|
|
||||||
LOG_PRINT("[HTTP/JSON][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAP_URI_AUTO_BIN2(s_pattern, callback_f, command_type) \
|
|
||||||
else if(auto_doc<command_type>(s_pattern "[BIN]", generate_reference) && query_info.m_URI == s_pattern) \
|
|
||||||
{ \
|
|
||||||
call_found = true; \
|
|
||||||
uint64_t ticks = misc_utils::get_tick_count(); \
|
|
||||||
boost::value_initialized<command_type::request> req; \
|
|
||||||
bool res = epee::serialization::load_t_from_binary(static_cast<command_type::request&>(req), query_info.m_body); \
|
|
||||||
CHECK_AND_ASSERT_MES(res, false, "Failed to parse bin body data, body size=" << query_info.m_body.size()); \
|
|
||||||
uint64_t ticks1 = misc_utils::get_tick_count(); \
|
|
||||||
boost::value_initialized<command_type::response> resp;\
|
|
||||||
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
|
||||||
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
|
||||||
uint64_t ticks2 = misc_utils::get_tick_count(); \
|
|
||||||
epee::serialization::store_t_to_binary(static_cast<command_type::response&>(resp), response_info.m_body); \
|
|
||||||
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
|
||||||
response_info.m_mime_tipe = " application/octet-stream"; \
|
|
||||||
response_info.m_header_info.m_content_type = " application/octet-stream"; \
|
|
||||||
LOG_PRINT( "[HTTP/BIN][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define CHAIN_TO_PHANDLER(pi_chain_handler) else if (pi_chain_handler && pi_chain_handler->handle_http_request_map(query_info, response_info, m_conn_context, call_found, generate_reference) && call_found) { return true;}
|
|
||||||
|
|
||||||
#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);call_found = true;}
|
|
||||||
|
|
||||||
#define END_URI_MAP2() return true;}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace epee
|
|
||||||
{
|
{
|
||||||
namespace json_rpc
|
namespace json_rpc
|
||||||
{
|
{
|
||||||
|
|
@ -182,7 +47,7 @@ namespace epee
|
||||||
t_param params;
|
t_param params;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(jsonrpc)
|
KV_SERIALIZE(jsonrpc) DOC_DSCR("") DOC_EXMP("2.0") DOC_END
|
||||||
KV_SERIALIZE(id)
|
KV_SERIALIZE(id)
|
||||||
KV_SERIALIZE(method)
|
KV_SERIALIZE(method)
|
||||||
KV_SERIALIZE(params)
|
KV_SERIALIZE(params)
|
||||||
|
|
@ -198,7 +63,7 @@ namespace epee
|
||||||
KV_SERIALIZE(message)
|
KV_SERIALIZE(message)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dummy_error
|
struct dummy_error
|
||||||
{
|
{
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
|
|
@ -233,7 +98,7 @@ namespace epee
|
||||||
t_param result;
|
t_param result;
|
||||||
epee::serialization::storage_entry id;
|
epee::serialization::storage_entry id;
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(jsonrpc)
|
KV_SERIALIZE(jsonrpc) DOC_DSCR("") DOC_EXMP("2.0") DOC_END
|
||||||
KV_SERIALIZE(id)
|
KV_SERIALIZE(id)
|
||||||
KV_SERIALIZE(result)
|
KV_SERIALIZE(result)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
|
|
@ -258,20 +123,277 @@ namespace epee
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename command_type_t>
|
|
||||||
struct json_command_type_t
|
template<typename typename_t>
|
||||||
|
typename_t get_documentation_json_struct()
|
||||||
{
|
{
|
||||||
typedef typename epee::json_rpc::request<typename command_type_t::request> request;
|
return AUTO_VAL_INIT_T(typename_t);
|
||||||
typedef typename epee::json_rpc::request<typename command_type_t::response> response;
|
}
|
||||||
|
|
||||||
|
struct documentation_entry
|
||||||
|
{
|
||||||
|
std::string uri;
|
||||||
|
bool is_binary = false; //if not - then it's JSON
|
||||||
|
std::string json_method_name;
|
||||||
|
std::string request_json_example;
|
||||||
|
std::string request_json_descriptions;
|
||||||
|
|
||||||
|
std::string response_json_example;
|
||||||
|
std::string response_json_descriptions;
|
||||||
|
|
||||||
|
std::string method_general_decription;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define JSON_RPC_REFERENCE_MARKER "JSON_RPC"
|
struct documentation
|
||||||
|
{
|
||||||
|
bool do_generate_documentation = false;
|
||||||
|
std::list<documentation_entry> entries;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Primary template
|
||||||
|
template<typename T>
|
||||||
|
struct has_static_member_description {
|
||||||
|
private:
|
||||||
|
// SFINAE test function
|
||||||
|
template<typename U>
|
||||||
|
static auto test(int) -> decltype(U::description, std::true_type{});
|
||||||
|
|
||||||
|
// Fallback function
|
||||||
|
template<typename>
|
||||||
|
static auto test(...) -> std::false_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Member constant indicating whether T has a static member
|
||||||
|
static constexpr bool value = decltype(test<T>(0))::value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define BEGIN_JSON_RPC_MAP(uri) else if(query_info.m_URI == JSON_RPC_REFERENCE_MARKER || query_info.m_URI == uri) \
|
|
||||||
|
template <typename T>
|
||||||
|
const char* get_command_description()
|
||||||
|
{
|
||||||
|
if constexpr (has_static_member_description<T>::value)
|
||||||
|
{
|
||||||
|
return T::description;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "NO DESCRIPTION";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void f(T) {} // Definition #2
|
||||||
|
|
||||||
|
|
||||||
|
// Base template
|
||||||
|
template<typename T>
|
||||||
|
struct is_std_simple_container : std::false_type {};
|
||||||
|
|
||||||
|
// Specializations for each container
|
||||||
|
template<typename T, typename Alloc>
|
||||||
|
struct is_std_simple_container<std::vector<T, Alloc>> : std::true_type {};
|
||||||
|
|
||||||
|
template<typename T, typename Alloc>
|
||||||
|
struct is_std_simple_container<std::deque<T, Alloc>> : std::true_type {};
|
||||||
|
|
||||||
|
template<typename T, typename Alloc>
|
||||||
|
struct is_std_simple_container<std::list<T, Alloc>> : std::true_type {};
|
||||||
|
|
||||||
|
template<typename T, std::size_t N>
|
||||||
|
struct is_std_simple_container<std::array<T, N>> : std::true_type {};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename command_type_t, bool is_json_rpc_method>
|
||||||
|
bool auto_doc(const std::string& uri, const std::string& method, bool is_json, documentation& docs)
|
||||||
|
{
|
||||||
|
if (!docs.do_generate_documentation) return true;
|
||||||
|
|
||||||
|
docs.entries.resize(docs.entries.size()+1);
|
||||||
|
docs.entries.back().is_binary = !is_json;
|
||||||
|
docs.entries.back().uri = uri;
|
||||||
|
docs.entries.back().json_method_name = method;
|
||||||
|
docs.entries.back().method_general_decription = get_command_description<command_type_t>();
|
||||||
|
|
||||||
|
if constexpr (is_json_rpc_method)
|
||||||
|
{
|
||||||
|
//json rpc-like call
|
||||||
|
typedef typename epee::json_rpc::request<typename command_type_t::request> request_t;
|
||||||
|
typedef typename epee::json_rpc::response<typename command_type_t::response, typename epee::json_rpc::dummy_error> response_t;
|
||||||
|
request_t req = AUTO_VAL_INIT(req); //get_documentation_json_struct<request_t>();
|
||||||
|
if constexpr (is_std_simple_container<typename command_type_t::request>::value)
|
||||||
|
{
|
||||||
|
req.params.resize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
response_t res = AUTO_VAL_INIT(res);
|
||||||
|
if constexpr (is_std_simple_container<typename command_type_t::response>::value)
|
||||||
|
{
|
||||||
|
req.result.resize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
req.method = method;
|
||||||
|
epee::serialization::portable_storage_extended_doc ps;
|
||||||
|
req.store(ps, nullptr);
|
||||||
|
ps.dump_as_json(docs.entries.back().request_json_example);
|
||||||
|
ps.dump_as_decriptions(docs.entries.back().request_json_descriptions);
|
||||||
|
|
||||||
|
epee::serialization::portable_storage_extended_doc ps_res;
|
||||||
|
res.store(ps_res, nullptr);
|
||||||
|
ps_res.dump_as_json(docs.entries.back().response_json_example);
|
||||||
|
ps_res.dump_as_decriptions(docs.entries.back().response_json_descriptions);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//json/bin uri/based
|
||||||
|
typedef typename command_type_t::request request_t;
|
||||||
|
typedef typename command_type_t::response response_t;
|
||||||
|
|
||||||
|
request_t req = AUTO_VAL_INIT(req); //get_documentation_json_struct<request_t>();
|
||||||
|
response_t res = AUTO_VAL_INIT(res); //get_documentation_json_struct<response_t>();
|
||||||
|
|
||||||
|
|
||||||
|
epee::serialization::portable_storage_extended_doc ps;
|
||||||
|
req.store(ps, nullptr);
|
||||||
|
ps.dump_as_json(docs.entries.back().request_json_example);
|
||||||
|
ps.dump_as_decriptions(docs.entries.back().request_json_descriptions);
|
||||||
|
|
||||||
|
epee::serialization::portable_storage_extended_doc ps_res;
|
||||||
|
res.store(ps_res, nullptr);
|
||||||
|
ps_res.dump_as_json(docs.entries.back().response_json_example);
|
||||||
|
ps_res.dump_as_decriptions(docs.entries.back().response_json_descriptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// std::stringstream ss;
|
||||||
|
// ss << prefix_name << ENDL
|
||||||
|
// << "REQUEST: " << ENDL << req_str << ENDL << req_str_descr << "--------------------------------" << ENDL
|
||||||
|
// << "RESPONSE: " << ENDL << res_str << ENDL << res_str_descr << "################################" << ENDL;
|
||||||
|
// generate_reference += ss.str();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
//return auto_doc_t<typename command_type_t::request, typename command_type_t::response>(prefix_name, generate_reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace epee {
|
||||||
|
namespace net_utils {
|
||||||
|
namespace http {
|
||||||
|
struct i_chain_handler
|
||||||
|
{
|
||||||
|
virtual bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, epee::net_utils::http::http_response_info& response_info,
|
||||||
|
epee::net_utils::connection_context_base& conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation)
|
||||||
|
{
|
||||||
|
return this->handle_http_request_map(query_info, response_info, conn_context, call_found, docs);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, epee::net_utils::http::http_response_info& response_info,
|
||||||
|
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation) = 0;
|
||||||
|
|
||||||
|
|
||||||
|
static inline documentation m_empty_documentation;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CHAIN_HTTP_TO_MAP2(context_type) bool handle_http_request(const epee::net_utils::http::http_request_info& query_info, \
|
||||||
|
epee::net_utils::http::http_response_info& response, \
|
||||||
|
context_type& m_conn_context) \
|
||||||
|
{\
|
||||||
|
response.m_response_code = 200; \
|
||||||
|
response.m_response_comment = "Ok"; \
|
||||||
|
bool call_found = false; \
|
||||||
|
if(!handle_http_request_map(query_info, response, m_conn_context, call_found) && response.m_response_code == 200) \
|
||||||
|
{ response.m_response_code = 500; response.m_response_comment = "Internal Server Error"; return true; } \
|
||||||
|
if (!call_found) \
|
||||||
|
{ response.m_response_code = 404; response.m_response_comment = "Not Found"; return true; } \
|
||||||
|
return true; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define BEGIN_URI_MAP2() template<class t_context> bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
||||||
|
epee::net_utils::http::http_response_info& response_info, \
|
||||||
|
t_context& m_conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation) { \
|
||||||
|
call_found = false; \
|
||||||
|
if(false) return true; //just a stub to have "else if"
|
||||||
|
|
||||||
|
#define BEGIN_URI_MAP2_VIRTUAL() virtual bool handle_http_request_map(const epee::net_utils::http::http_request_info& query_info, \
|
||||||
|
epee::net_utils::http::http_response_info& response_info, \
|
||||||
|
epee::net_utils::connection_context_base& m_conn_context, bool& call_found, documentation& docs = epee::net_utils::http::i_chain_handler::m_empty_documentation) { \
|
||||||
|
call_found = false; \
|
||||||
|
if(false) return true; //just a stub to have "else if"
|
||||||
|
|
||||||
|
|
||||||
|
#define MAP_URI2(pattern, callback) else if(std::string::npos != query_info.m_URI.find(pattern)) return callback(query_info, response_info, m_conn_context);
|
||||||
|
|
||||||
|
#define MAP_URI_AUTO_XML2(s_pattern, callback_f, command_type) //TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
||||||
|
|
||||||
|
#define MAP_URI_AUTO_JON2(s_pattern, callback_f, command_type) \
|
||||||
|
else if(auto_doc<command_type, false>(s_pattern, "", true, docs) && query_info.m_URI == s_pattern) \
|
||||||
{ \
|
{ \
|
||||||
if(query_info.m_URI == JSON_RPC_REFERENCE_MARKER) {generate_reference = "JSON RPC URL: " uri "\n";} \
|
call_found = true; \
|
||||||
|
uint64_t ticks = misc_utils::get_tick_count(); \
|
||||||
|
boost::value_initialized<command_type::request> req; \
|
||||||
|
bool res = epee::serialization::load_t_from_json(static_cast<command_type::request&>(req), query_info.m_body); \
|
||||||
|
CHECK_AND_ASSERT_MES(res, false, "Failed to parse json: \r\n" << query_info.m_body); \
|
||||||
|
uint64_t ticks1 = epee::misc_utils::get_tick_count(); \
|
||||||
|
boost::value_initialized<command_type::response> resp;\
|
||||||
|
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
||||||
|
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
||||||
|
uint64_t ticks2 = epee::misc_utils::get_tick_count(); \
|
||||||
|
epee::serialization::store_t_to_json(static_cast<command_type::response&>(resp), response_info.m_body); \
|
||||||
|
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
||||||
|
response_info.m_mime_tipe = "application/json"; \
|
||||||
|
response_info.m_header_info.m_content_type = " application/json"; \
|
||||||
|
LOG_PRINT("[HTTP/JSON][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAP_URI_AUTO_BIN2(s_pattern, callback_f, command_type) \
|
||||||
|
else if(auto_doc<command_type, false>(s_pattern, "", false, docs) && query_info.m_URI == s_pattern) \
|
||||||
|
{ \
|
||||||
|
call_found = true; \
|
||||||
|
uint64_t ticks = misc_utils::get_tick_count(); \
|
||||||
|
boost::value_initialized<command_type::request> req; \
|
||||||
|
bool res = epee::serialization::load_t_from_binary(static_cast<command_type::request&>(req), query_info.m_body); \
|
||||||
|
CHECK_AND_ASSERT_MES(res, false, "Failed to parse bin body data, body size=" << query_info.m_body.size()); \
|
||||||
|
uint64_t ticks1 = misc_utils::get_tick_count(); \
|
||||||
|
boost::value_initialized<command_type::response> resp;\
|
||||||
|
res = callback_f(static_cast<command_type::request&>(req), static_cast<command_type::response&>(resp), m_conn_context); \
|
||||||
|
CHECK_AND_ASSERT_MES(res, false, "Failed to call " << #callback_f << "() while handling " << s_pattern); \
|
||||||
|
uint64_t ticks2 = misc_utils::get_tick_count(); \
|
||||||
|
epee::serialization::store_t_to_binary(static_cast<command_type::response&>(resp), response_info.m_body); \
|
||||||
|
uint64_t ticks3 = epee::misc_utils::get_tick_count(); \
|
||||||
|
response_info.m_mime_tipe = " application/octet-stream"; \
|
||||||
|
response_info.m_header_info.m_content_type = " application/octet-stream"; \
|
||||||
|
LOG_PRINT( "[HTTP/BIN][" << epee::string_tools::get_ip_string_from_int32(m_conn_context.m_remote_ip ) << "][" << query_info.m_URI << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHAIN_TO_PHANDLER(pi_chain_handler) else if (pi_chain_handler && pi_chain_handler->handle_http_request(query_info, response_info, m_conn_context, call_found, docs) && call_found) { return true;}
|
||||||
|
|
||||||
|
#define CHAIN_URI_MAP2(callback) else {callback(query_info, response_info, m_conn_context);call_found = true;}
|
||||||
|
|
||||||
|
#define END_URI_MAP2() return true;}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//template<typename command_type_t>
|
||||||
|
//struct json_command_type_t
|
||||||
|
//{
|
||||||
|
// typedef typename epee::json_rpc::request<typename command_type_t::request> request;
|
||||||
|
// typedef typename epee::json_rpc::request<typename command_type_t::response> response;
|
||||||
|
//};
|
||||||
|
|
||||||
|
//#define JSON_RPC_REFERENCE_MARKER "JSON_RPC"
|
||||||
|
|
||||||
|
// if(query_info.m_URI == JSON_RPC_REFERENCE_MARKER) {generate_reference = "JSON RPC URL: " uri "\n";} \
|
||||||
|
|
||||||
|
#define BEGIN_JSON_RPC_MAP(uri) else if(docs.do_generate_documentation || query_info.m_URI == uri) \
|
||||||
|
{ \
|
||||||
|
const char* current_zone_json_uri = uri;\
|
||||||
LOG_PRINT_L4("[JSON_REQUEST_BODY]: " << ENDL << query_info.m_body); \
|
LOG_PRINT_L4("[JSON_REQUEST_BODY]: " << ENDL << query_info.m_body); \
|
||||||
uint64_t ticks = epee::misc_utils::get_tick_count(); \
|
uint64_t ticks = epee::misc_utils::get_tick_count(); \
|
||||||
epee::serialization::portable_storage ps; \
|
epee::serialization::portable_storage ps; \
|
||||||
|
|
@ -330,7 +452,7 @@ struct json_command_type_t
|
||||||
LOG_PRINT( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2);
|
LOG_PRINT( query_info.m_URI << "[" << method_name << "] processed with " << ticks1-ticks << "/"<< ticks2-ticks1 << "/" << ticks3-ticks2 << "ms", LOG_LEVEL_2);
|
||||||
|
|
||||||
#define MAP_JON_RPC_WE(method_name, callback_f, command_type) \
|
#define MAP_JON_RPC_WE(method_name, callback_f, command_type) \
|
||||||
else if(auto_doc<json_command_type_t<command_type>>("[" method_name "]", generate_reference) && callback_name == method_name) \
|
else if(auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||||
{ \
|
{ \
|
||||||
call_found = true; \
|
call_found = true; \
|
||||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||||
|
|
@ -348,7 +470,7 @@ struct json_command_type_t
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAP_JON_RPC_WERI(method_name, callback_f, command_type) \
|
#define MAP_JON_RPC_WERI(method_name, callback_f, command_type) \
|
||||||
else if(auto_doc<json_command_type_t<command_type>>("[" method_name "]", generate_reference) && callback_name == method_name) \
|
else if(auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||||
{ \
|
{ \
|
||||||
call_found = true; \
|
call_found = true; \
|
||||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||||
|
|
@ -366,7 +488,27 @@ struct json_command_type_t
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAP_JON_RPC(method_name, callback_f, command_type) \
|
#define MAP_JON_RPC(method_name, callback_f, command_type) \
|
||||||
else if(auto_doc<json_command_type_t<command_type>>(std::string("[") + method_name + "]", generate_reference) && callback_name == method_name) \
|
else if(auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||||
|
{ \
|
||||||
|
call_found = true; \
|
||||||
|
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||||
|
if(!callback_f(req.params, resp.result, m_conn_context)) \
|
||||||
|
{ \
|
||||||
|
epee::json_rpc::error_response fail_resp = AUTO_VAL_INIT(fail_resp); \
|
||||||
|
fail_resp.jsonrpc = "2.0"; \
|
||||||
|
fail_resp.method = req.method; \
|
||||||
|
fail_resp.id = req.id; \
|
||||||
|
fail_resp.error.code = -32603; \
|
||||||
|
fail_resp.error.message = "Internal error"; \
|
||||||
|
epee::serialization::store_t_to_json(static_cast<epee::json_rpc::error_response&>(fail_resp), response_info.m_body); \
|
||||||
|
return true; \
|
||||||
|
} \
|
||||||
|
FINALIZE_OBJECTS_TO_JSON(method_name) \
|
||||||
|
return true;\
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAP_JON_RPC_CONDITIONAL(method_name, callback_f, command_type, predicate) \
|
||||||
|
else if(predicate && auto_doc<command_type, true>(current_zone_json_uri, method_name, true, docs) && callback_name == method_name) \
|
||||||
{ \
|
{ \
|
||||||
call_found = true; \
|
call_found = true; \
|
||||||
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
PREPARE_OBJECTS_FROM_JSON(command_type) \
|
||||||
|
|
@ -399,4 +541,53 @@ struct json_command_type_t
|
||||||
return true; \
|
return true; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace epee
|
||||||
|
{
|
||||||
|
template<typename t_rpc_server>
|
||||||
|
bool generate_doc_as_md_files(const std::string& folder, t_rpc_server& server, const std::string& sufix = std::string())
|
||||||
|
{
|
||||||
|
LOG_PRINT_L0("Dumping RPC auto-generated documents!");
|
||||||
|
epee::net_utils::http::http_request_info query_info;
|
||||||
|
epee::net_utils::http::http_response_info response_info;
|
||||||
|
epee::net_utils::connection_context_base conn_context;
|
||||||
|
//std::string generate_reference = std::string("WALLET_RPC_COMMANDS_LIST:\n");
|
||||||
|
bool call_found = false;
|
||||||
|
|
||||||
|
documentation docs;
|
||||||
|
docs.do_generate_documentation = true;
|
||||||
|
// query_info.m_URI = JSON_RPC_REFERENCE_MARKER;
|
||||||
|
query_info.m_body = "{\"jsonrpc\": \"2.0\", \"method\": \"nonexisting_method\", \"params\": {}},";
|
||||||
|
server.handle_http_request_map(query_info, response_info, conn_context, call_found, docs);
|
||||||
|
|
||||||
|
for (const auto& de : docs.entries)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ss << de.method_general_decription << ENDL << ENDL;;
|
||||||
|
|
||||||
|
ss << "URL: ```http:://127.0.0.1:11211" << de.uri << "```" << ENDL;
|
||||||
|
|
||||||
|
ss << "### Request: " << ENDL << "```json" << ENDL << de.request_json_example << ENDL << "```" << ENDL;
|
||||||
|
ss << "### Request description: " << ENDL << "```" << ENDL << de.request_json_descriptions << ENDL << "```" << ENDL;
|
||||||
|
ss << "### Response: " << ENDL << "```json" << ENDL << de.response_json_example << ENDL << "```" << ENDL;
|
||||||
|
ss << "### Response description: " << ENDL << "```" << ENDL << de.response_json_descriptions << ENDL << "```" << ENDL;
|
||||||
|
|
||||||
|
ss << sufix;
|
||||||
|
|
||||||
|
std::string filename = de.json_method_name;
|
||||||
|
if (!filename.size())
|
||||||
|
{
|
||||||
|
filename = de.uri;
|
||||||
|
if (filename.front() == '/')
|
||||||
|
filename.erase(filename.begin());
|
||||||
|
}
|
||||||
|
filename += ".md";
|
||||||
|
bool r = epee::file_io_utils::save_string_to_file(folder + "/" + filename, ss.str());
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
LOG_ERROR("Failed to save file " << filename);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -33,6 +33,25 @@
|
||||||
|
|
||||||
#define LEVIN_SIGNATURE 0x0101010101012101LL //Bender's nightmare
|
#define LEVIN_SIGNATURE 0x0101010101012101LL //Bender's nightmare
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define LEVIN_OK 0
|
||||||
|
#define LEVIN_ERROR_CONNECTION -1
|
||||||
|
#define LEVIN_ERROR_CONNECTION_NOT_FOUND -2
|
||||||
|
#define LEVIN_ERROR_CONNECTION_DESTROYED -3
|
||||||
|
#define LEVIN_ERROR_CONNECTION_TIMEDOUT -4
|
||||||
|
#define LEVIN_ERROR_CONNECTION_NO_DUPLEX_PROTOCOL -5
|
||||||
|
#define LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED -6
|
||||||
|
#define LEVIN_ERROR_FORMAT -7
|
||||||
|
#define LEVIN_ERROR_EXCEPTION -8
|
||||||
|
#define LEVIN_ERROR_UNKNOWN_ERROR -9
|
||||||
|
#define LEVIN_ERROR_INTERNAL -10
|
||||||
|
#define LEVIN_ERROR_PROTOCOL_INCONSISTENT -11
|
||||||
|
#define LEVIN_ERROR_NET_ERROR -12
|
||||||
|
#define LEVIN_ERROR_SIGNATURE_MISMATCH -13
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
namespace levin
|
namespace levin
|
||||||
|
|
@ -86,23 +105,15 @@ namespace levin
|
||||||
|
|
||||||
virtual void on_connection_new(t_connection_context& context){};
|
virtual void on_connection_new(t_connection_context& context){};
|
||||||
virtual void on_connection_close(t_connection_context& context){};
|
virtual void on_connection_close(t_connection_context& context){};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LEVIN_OK 0
|
template<class t_connection_context = net_utils::connection_context_base>
|
||||||
#define LEVIN_ERROR_CONNECTION -1
|
struct levin_commands_handler_dummy: public levin_commands_handler<t_connection_context>
|
||||||
#define LEVIN_ERROR_CONNECTION_NOT_FOUND -2
|
{
|
||||||
#define LEVIN_ERROR_CONNECTION_DESTROYED -3
|
virtual int invoke(int command, const std::string& in_buff, std::string& buff_out, t_connection_context& context) { return LEVIN_OK; }
|
||||||
#define LEVIN_ERROR_CONNECTION_TIMEDOUT -4
|
virtual int notify(int command, const std::string& in_buff, t_connection_context& context) { return LEVIN_OK; }
|
||||||
#define LEVIN_ERROR_CONNECTION_NO_DUPLEX_PROTOCOL -5
|
};
|
||||||
#define LEVIN_ERROR_CONNECTION_HANDLER_NOT_DEFINED -6
|
|
||||||
#define LEVIN_ERROR_FORMAT -7
|
|
||||||
#define LEVIN_ERROR_EXCEPTION -8
|
|
||||||
#define LEVIN_ERROR_UNKNOWN_ERROR -9
|
|
||||||
#define LEVIN_ERROR_INTERNAL -10
|
|
||||||
#define LEVIN_ERROR_PROTOCOL_INCONSISTENT -11
|
|
||||||
#define LEVIN_ERROR_NET_ERROR -12
|
|
||||||
#define LEVIN_ERROR_SIGNATURE_MISMATCH -13
|
|
||||||
|
|
||||||
#define DESCRIBE_RET_CODE(code) case code: return #code;
|
#define DESCRIBE_RET_CODE(code) case code: return #code;
|
||||||
inline
|
inline
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ class async_protocol_handler_config
|
||||||
critical_section m_connects_lock;
|
critical_section m_connects_lock;
|
||||||
std::atomic<bool> m_is_in_sendstop_loop;
|
std::atomic<bool> m_is_in_sendstop_loop;
|
||||||
connections_map m_connects;
|
connections_map m_connects;
|
||||||
|
levin_commands_handler_dummy<t_connection_context> m_commands_handler_dummy;
|
||||||
|
|
||||||
void add_connection(async_protocol_handler<t_connection_context>* pc);
|
void add_connection(async_protocol_handler<t_connection_context>* pc);
|
||||||
void del_connection(async_protocol_handler<t_connection_context>* pc);
|
void del_connection(async_protocol_handler<t_connection_context>* pc);
|
||||||
|
|
@ -87,7 +88,7 @@ public:
|
||||||
bool foreach_connection(callback_t cb);
|
bool foreach_connection(callback_t cb);
|
||||||
size_t get_connections_count();
|
size_t get_connections_count();
|
||||||
|
|
||||||
async_protocol_handler_config() :m_pcommands_handler(NULL), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{}
|
async_protocol_handler_config() :m_pcommands_handler(&m_commands_handler_dummy), m_max_packet_size(LEVIN_DEFAULT_MAX_PACKET_SIZE), m_is_in_sendstop_loop(false), m_invoke_timeout{}
|
||||||
{}
|
{}
|
||||||
~async_protocol_handler_config()
|
~async_protocol_handler_config()
|
||||||
{
|
{
|
||||||
|
|
@ -252,6 +253,7 @@ public:
|
||||||
LOG_PRINT_CC(m_connection_context, "[LEVIN_PROTOCOL" << this << "] CONSTRUCTED", LOG_LEVEL_4);
|
LOG_PRINT_CC(m_connection_context, "[LEVIN_PROTOCOL" << this << "] CONSTRUCTED", LOG_LEVEL_4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
virtual ~async_protocol_handler()
|
virtual ~async_protocol_handler()
|
||||||
{
|
{
|
||||||
NESTED_TRY_ENTRY();
|
NESTED_TRY_ENTRY();
|
||||||
|
|
@ -278,6 +280,11 @@ public:
|
||||||
NESTED_CATCH_ENTRY(__func__);
|
NESTED_CATCH_ENTRY(__func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void on_pre_destroy()
|
||||||
|
{
|
||||||
|
m_config.del_connection(this);
|
||||||
|
}
|
||||||
|
|
||||||
bool start_outer_call()
|
bool start_outer_call()
|
||||||
{
|
{
|
||||||
LOG_PRINT_CC_L4(m_connection_context, "[LEVIN_PROTOCOL" << this << "] -->> start_outer_call");
|
LOG_PRINT_CC_L4(m_connection_context, "[LEVIN_PROTOCOL" << this << "] -->> start_outer_call");
|
||||||
|
|
@ -349,7 +356,7 @@ public:
|
||||||
//update threads name to see connection context where errors came from
|
//update threads name to see connection context where errors came from
|
||||||
std::string original_prefix = epee::log_space::log_singletone::get_thread_log_prefix();
|
std::string original_prefix = epee::log_space::log_singletone::get_thread_log_prefix();
|
||||||
epee::log_space::log_singletone::set_thread_log_prefix(original_prefix + "[" + epee::net_utils::print_connection_context_short(m_connection_context) + "]");
|
epee::log_space::log_singletone::set_thread_log_prefix(original_prefix + "[" + epee::net_utils::print_connection_context_short(m_connection_context) + "]");
|
||||||
ON_EXIT([&](){epee::log_space::log_singletone::set_thread_log_prefix(original_prefix); });
|
ON_FUNC_EXIT([&](){epee::log_space::log_singletone::set_thread_log_prefix(original_prefix); });
|
||||||
|
|
||||||
//create_scope_leave_handler()
|
//create_scope_leave_handler()
|
||||||
|
|
||||||
|
|
@ -810,7 +817,9 @@ template<class t_connection_context> template<class callback_t>
|
||||||
bool async_protocol_handler_config<t_connection_context>::foreach_connection(callback_t cb)
|
bool async_protocol_handler_config<t_connection_context>::foreach_connection(callback_t cb)
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_connects_lock);
|
CRITICAL_REGION_LOCAL(m_connects_lock);
|
||||||
for(auto& c: m_connects)
|
//in case any of the cb() leads to erasing items from m_connects, let's go over local copy of it
|
||||||
|
auto connects_local = m_connects;
|
||||||
|
for(auto& c: connects_local)
|
||||||
{
|
{
|
||||||
async_protocol_handler<t_connection_context>* aph = c.second;
|
async_protocol_handler<t_connection_context>* aph = c.second;
|
||||||
if(!cb(aph->get_context_ref()))
|
if(!cb(aph->get_context_ref()))
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,9 @@ namespace epee
|
||||||
|
|
||||||
void on_after_connect()
|
void on_after_connect()
|
||||||
{
|
{
|
||||||
|
LOG_PRINT_L2("SSL Handshake....");
|
||||||
m_socket.handshake(boost::asio::ssl::stream_base::client);
|
m_socket.handshake(boost::asio::ssl::stream_base::client);
|
||||||
|
LOG_PRINT_L2("SSL Handshake OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
@ -149,11 +151,52 @@ namespace epee
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
boost::asio::ip::tcp::socket m_socket;
|
boost::asio::ip::tcp::socket m_socket;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<bool is_ssl>
|
||||||
|
struct socket_backend_resetable
|
||||||
|
{
|
||||||
|
socket_backend_resetable(boost::asio::io_service& _io_service) : mr_io_service(_io_service), m_pbackend(std::make_shared<socket_backend<is_ssl>>(_io_service))
|
||||||
|
{}
|
||||||
|
|
||||||
|
boost::asio::ip::tcp::socket& get_socket()
|
||||||
|
{
|
||||||
|
return m_pbackend->get_socket();
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_domain(const std::string& domain_name)
|
||||||
|
{
|
||||||
|
return m_pbackend->set_domain(domain_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& get_stream()
|
||||||
|
{
|
||||||
|
return m_pbackend->get_stream();
|
||||||
|
}
|
||||||
|
|
||||||
|
void on_after_connect()
|
||||||
|
{
|
||||||
|
return m_pbackend->on_after_connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset()
|
||||||
|
{
|
||||||
|
m_pbackend = std::make_shared<socket_backend<is_ssl>>(mr_io_service);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
boost::asio::io_service& mr_io_service;
|
||||||
|
std::shared_ptr<socket_backend<is_ssl>> m_pbackend;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template<bool is_ssl>
|
template<bool is_ssl>
|
||||||
|
|
@ -227,6 +270,7 @@ namespace epee
|
||||||
inline
|
inline
|
||||||
bool connect(const std::string& addr, const std::string& port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
|
bool connect(const std::string& addr, const std::string& port, unsigned int connect_timeout, unsigned int reciev_timeout, const std::string& bind_ip = "0.0.0.0")
|
||||||
{
|
{
|
||||||
|
LOG_PRINT_L1("Connecting to " << addr << ":" << port << ", cn_timeout: " << connect_timeout << ", rv_timeout: " << reciev_timeout);
|
||||||
m_connect_timeout = connect_timeout;
|
m_connect_timeout = connect_timeout;
|
||||||
m_reciev_timeout = reciev_timeout;
|
m_reciev_timeout = reciev_timeout;
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
|
|
@ -238,7 +282,7 @@ namespace epee
|
||||||
m_sct_back.get_socket().close();
|
m_sct_back.get_socket().close();
|
||||||
// Get a list of endpoints corresponding to the server name.
|
// Get a list of endpoints corresponding to the server name.
|
||||||
|
|
||||||
|
m_sct_back.reset();
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
boost::asio::ip::tcp::resolver resolver(m_io_service);
|
boost::asio::ip::tcp::resolver resolver(m_io_service);
|
||||||
|
|
@ -281,13 +325,14 @@ namespace epee
|
||||||
if (!ec && m_sct_back.get_socket().is_open())
|
if (!ec && m_sct_back.get_socket().is_open())
|
||||||
{
|
{
|
||||||
m_sct_back.on_after_connect();
|
m_sct_back.on_after_connect();
|
||||||
m_connected = true;
|
m_connected = true;
|
||||||
m_deadline.expires_at(boost::posix_time::pos_infin);
|
m_deadline.expires_at(boost::posix_time::pos_infin);
|
||||||
|
LOG_PRINT_L1("Connected OK: " << addr << ":" << port);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LOG_PRINT("Some problems at connect, message: " << ec.message(), LOG_LEVEL_3);
|
LOG_PRINT("Error on connect to " << addr << ":" << port << ", message: " << ec.message(), LOG_LEVEL_3);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -652,7 +697,7 @@ namespace epee
|
||||||
// The deadline has passed. The socket is closed so that any outstanding
|
// The deadline has passed. The socket is closed so that any outstanding
|
||||||
// asynchronous operations are cancelled. This allows the blocked
|
// asynchronous operations are cancelled. This allows the blocked
|
||||||
// connect(), read_line() or write_line() functions to return.
|
// connect(), read_line() or write_line() functions to return.
|
||||||
LOG_PRINT_L3("Timed out socket");
|
LOG_PRINT_L2("Timed out socket");
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
m_sct_back.get_socket().close();
|
m_sct_back.get_socket().close();
|
||||||
|
|
||||||
|
|
@ -669,7 +714,7 @@ namespace epee
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
boost::asio::io_service m_io_service;
|
boost::asio::io_service m_io_service;
|
||||||
socket_backend<is_ssl> m_sct_back;
|
socket_backend_resetable<is_ssl> m_sct_back;//socket_backend<is_ssl> m_sct_back;
|
||||||
int m_connect_timeout;
|
int m_connect_timeout;
|
||||||
int m_reciev_timeout;
|
int m_reciev_timeout;
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright (c) 2024, Zano Project
|
||||||
// Copyright (c) 2006-2017, Andrey N. Sabelnikov, www.sabelnikov.net
|
// Copyright (c) 2006-2017, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
@ -35,11 +36,14 @@ namespace epee
|
||||||
inline std::string print_fixed_decimal_point(t_number amount, size_t decimal_point)
|
inline std::string print_fixed_decimal_point(t_number amount, size_t decimal_point)
|
||||||
{
|
{
|
||||||
std::string s = boost::lexical_cast<std::string>(amount);
|
std::string s = boost::lexical_cast<std::string>(amount);
|
||||||
|
if (decimal_point > 32)
|
||||||
|
return std::string("!!") + s; // avoiding overflow issues
|
||||||
if (s.size() < decimal_point + 1)
|
if (s.size() < decimal_point + 1)
|
||||||
{
|
{
|
||||||
s.insert(0, decimal_point + 1 - s.size(), '0');
|
s.insert(0, decimal_point + 1 - s.size(), '0');
|
||||||
}
|
}
|
||||||
s.insert(s.size() - decimal_point, ".");
|
if (decimal_point > 0)
|
||||||
|
s.insert(s.size() - decimal_point, ".");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <type_traits>
|
||||||
|
#include <optional>
|
||||||
#include "misc_language.h"
|
#include "misc_language.h"
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
|
|
@ -51,24 +53,73 @@ namespace epee
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_std_optional : std::false_type {};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_std_optional<std::optional<T>> : std::true_type {};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
struct is_std_optional<boost::optional<T>> : std::true_type {};
|
||||||
|
|
||||||
|
|
||||||
|
//basic helpers for pod-to-hex serialization
|
||||||
|
template<class t_pod_type>
|
||||||
|
std::string transform_t_pod_to_str_internal(const t_pod_type& a)
|
||||||
|
{
|
||||||
|
return epee::string_tools::pod_to_hex(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_pod_type>
|
||||||
|
std::string transform_t_pod_to_str_internal(const std::optional<t_pod_type>& a)
|
||||||
|
{
|
||||||
|
if (a.has_value())
|
||||||
|
return epee::string_tools::pod_to_hex(*a);
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_pod_type>
|
||||||
|
std::string transform_t_pod_to_str_internal(const boost::optional<t_pod_type>& a)
|
||||||
|
{
|
||||||
|
if (a.has_value())
|
||||||
|
return epee::string_tools::pod_to_hex(*a);
|
||||||
|
else
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
//basic helpers for pod-to-hex serialization
|
//basic helpers for pod-to-hex serialization
|
||||||
template<class t_pod_type>
|
template<class t_pod_type>
|
||||||
std::string transform_t_pod_to_str(const t_pod_type & a)
|
std::string transform_t_pod_to_str(const t_pod_type & a)
|
||||||
{
|
{
|
||||||
return epee::string_tools::pod_to_hex(a);
|
return transform_t_pod_to_str_internal(a);
|
||||||
}
|
}
|
||||||
template<class t_pod_type>
|
|
||||||
|
|
||||||
|
|
||||||
|
template<class t_pod_type>
|
||||||
t_pod_type transform_str_to_t_pod(const std::string& a)
|
t_pod_type transform_str_to_t_pod(const std::string& a)
|
||||||
{
|
{
|
||||||
t_pod_type res = AUTO_VAL_INIT(res);
|
t_pod_type res = AUTO_VAL_INIT(res);
|
||||||
if (a.empty())
|
if (a.empty())
|
||||||
return res;
|
return res;
|
||||||
|
if constexpr (is_std_optional<t_pod_type>::value)
|
||||||
|
{
|
||||||
|
typename t_pod_type::value_type v = AUTO_VAL_INIT(v);
|
||||||
|
if (!epee::string_tools::hex_to_pod(a, v))
|
||||||
|
throw std::runtime_error(std::string("Unable to transform \"") + a + "\" to pod type " + typeid(typename t_pod_type::value_type).name());
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!epee::string_tools::hex_to_pod(a, res))
|
if (!epee::string_tools::hex_to_pod(a, res))
|
||||||
throw std::runtime_error(std::string("Unable to transform \"") + a + "\" to pod type " + typeid(t_pod_type).name());
|
throw std::runtime_error(std::string("Unable to transform \"") + a + "\" to pod type " + typeid(t_pod_type).name());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//basic helpers for blob-to-hex serialization
|
//basic helpers for blob-to-hex serialization
|
||||||
|
|
||||||
inline std::string transform_binbuf_to_hexstr(const std::string& a)
|
inline std::string transform_binbuf_to_hexstr(const std::string& a)
|
||||||
|
|
@ -85,6 +136,57 @@ namespace epee
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// helper for blob-to-base64 serialization
|
||||||
|
inline std::string transfrom_binbuf_to_base64(const std::string& a)
|
||||||
|
{
|
||||||
|
return epee::string_encoding::base64_encode(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline std::string transform_base64_to_binbuf(const std::string& a)
|
||||||
|
{
|
||||||
|
return epee::string_encoding::base64_decode(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//basic helpers for pod-to-hex serialization
|
||||||
|
template<class t_pod_container_type>
|
||||||
|
std::string transform_t_pod_array_to_hex_str_array(const t_pod_container_type& a)
|
||||||
|
{
|
||||||
|
std::string res;
|
||||||
|
for (const auto& item : a)
|
||||||
|
{
|
||||||
|
res += epee::string_tools::pod_to_hex(item) + ", ";
|
||||||
|
}
|
||||||
|
if (a.size())
|
||||||
|
{
|
||||||
|
res.erase(res.size() - 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
template<class t_pod_container_type>
|
||||||
|
t_pod_container_type transform_hex_str_array_to_t_pod_array(const std::string& a)
|
||||||
|
{
|
||||||
|
std::vector<std::string> pod_items;
|
||||||
|
boost::split(pod_items, a, boost::is_any_of(", ][\""));
|
||||||
|
|
||||||
|
t_pod_container_type res;
|
||||||
|
if (!a.size())
|
||||||
|
return res;
|
||||||
|
for (const auto& item : pod_items)
|
||||||
|
{
|
||||||
|
if(!item.size())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
res.resize(res.size() + 1);
|
||||||
|
typename t_pod_container_type::value_type& pod_val = res.back();
|
||||||
|
|
||||||
|
if (!epee::string_tools::hex_to_pod(item, pod_val))
|
||||||
|
throw std::runtime_error(std::string("Unable to transform \"") + item + "\" to pod type " + typeid(typename t_pod_container_type::value_type).name());
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
template<class first_t, class second_t>
|
template<class first_t, class second_t>
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ namespace epee
|
||||||
#define BEGIN_KV_SERIALIZE_MAP() \
|
#define BEGIN_KV_SERIALIZE_MAP() \
|
||||||
public: \
|
public: \
|
||||||
template<class t_storage> \
|
template<class t_storage> \
|
||||||
bool store(t_storage& st, typename t_storage::hsection hparent_section = nullptr, bool auto_doc_mode = false) const\
|
bool store(t_storage& st, typename t_storage::hsection hparent_section = nullptr) const\
|
||||||
{\
|
{\
|
||||||
return serialize_map<true>(*this, st, hparent_section, auto_doc_mode); \
|
return serialize_map<true>(*this, st, hparent_section); \
|
||||||
}\
|
}\
|
||||||
template<class t_storage> \
|
template<class t_storage> \
|
||||||
bool _load(t_storage& stg, typename t_storage::hsection hparent_section = nullptr)\
|
bool _load(t_storage& stg, typename t_storage::hsection hparent_section = nullptr)\
|
||||||
|
|
@ -62,19 +62,75 @@ public: \
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
template<bool is_store, class this_type, class t_storage> \
|
template<bool is_store, class this_type, class t_storage> \
|
||||||
static bool serialize_map(this_type& this_ref, t_storage& stg, typename t_storage::hsection hparent_section, bool auto_doc_mode = false) \
|
static bool serialize_map(this_type& this_ref, t_storage& stg, typename t_storage::hsection hparent_section) \
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#define KV_CAT_(a, b) a ## b
|
||||||
|
#define KV_CAT(a, b) KV_CAT_(a, b)
|
||||||
|
#define VARNAME(Var) KV_CAT(Var, __LINE__)
|
||||||
|
|
||||||
|
#define KV_MAKE_ALIAS_NAME() VARNAME(alias_tmp_name)
|
||||||
|
#define KV_MAKE_VAR_NAME() VARNAME(val_tmp_name)
|
||||||
|
|
||||||
#define KV_SERIALIZE_N(varialble, val_name) \
|
#define KV_SERIALIZE_N(varialble, val_name) \
|
||||||
|
using KV_MAKE_ALIAS_NAME() [[maybe_unused]] = decltype(this_ref.varialble); \
|
||||||
|
[[maybe_unused]] const char* KV_MAKE_VAR_NAME() = val_name;\
|
||||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
|
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name);
|
||||||
|
|
||||||
#define KV_SERIALIZE_N_DOC(varialble, val_name, substitute) \
|
//#define KV_SERIALIZE_N_DOC(varialble, val_name) \
|
||||||
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name, auto_doc_mode, substitute);
|
// using KV_MAKE_ALIAS_NAME() = decltype(this_ref.varialble); \
|
||||||
|
// epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); \
|
||||||
|
// if constexpr (t_storage::use_descriptions::value) \
|
||||||
|
// { \
|
||||||
|
// epee::serialization::selector<is_store>::template serialize_and_doc<KV_MAKE_ALIAS_NAME()>(stg, hparent_section, val_name
|
||||||
|
|
||||||
|
|
||||||
|
#define DOC_DSCR(description) if constexpr (t_storage::use_descriptions::value) \
|
||||||
|
{ \
|
||||||
|
epee::serialization::selector<is_store>::template serialize_and_doc<KV_MAKE_ALIAS_NAME()>(stg, hparent_section, KV_MAKE_VAR_NAME(), description
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
{using var_type = decltype(this_ref.varialble); \
|
||||||
|
epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); \
|
||||||
|
if constexpr (t_storage::use_descriptions::value) \
|
||||||
|
{ \
|
||||||
|
epee::serialization::selector<is_store>::set_descr<var_type>(stg, hparent_section, val_name, description, default = var_type()); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
//#define DOC_DSCR(description) , description
|
||||||
|
#define DOC_EXMP(substitute) , substitute
|
||||||
|
//#define DOC_EXMP_AUTO_1(arg_1) , KV_MAKE_ALIAS_NAME() (arg_1)
|
||||||
|
//#define DOC_EXMP_AUTO_2(arg_1, arg_2) , KV_MAKE_ALIAS_NAME() (arg_1, arg_2)
|
||||||
|
#define DOC_END ); }
|
||||||
|
#define DOC_EXMP_AUTO(...) , epee::create_t_object<KV_MAKE_ALIAS_NAME() >(__VA_ARGS__)
|
||||||
|
#define DOC_EXMP_AGGR(...) , epee::create_t_object<KV_MAKE_ALIAS_NAME() >(KV_MAKE_ALIAS_NAME(){__VA_ARGS__})
|
||||||
|
|
||||||
|
|
||||||
|
// Function template to create an object with forwarded constructor arguments
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
T create_t_object(Args&&... args) {
|
||||||
|
return T(std::forward<Args>(args)...);
|
||||||
|
}
|
||||||
|
|
||||||
|
//substitute, description);
|
||||||
|
//#define DOC_EXAMPLE(substitute) substitute,
|
||||||
|
//#define DOC_EX(substitute__) var_type(substitute__),
|
||||||
|
|
||||||
|
//#define DOC_COMMAND(command_general_description) static const char* explain_yourseflf = command_general_description;
|
||||||
|
|
||||||
|
|
||||||
#define KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, val_name) \
|
#define KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, val_name) \
|
||||||
|
using KV_MAKE_ALIAS_NAME() [[maybe_unused]] = stored_type; \
|
||||||
|
[[maybe_unused]] const char* VARNAME(val_tmp_name) = val_name;\
|
||||||
epee::serialization::selector<is_store>::template serialize_custom<stored_type>(this_ref.varialble, stg, hparent_section, val_name, from_v_to_stored, from_stored_to_v);
|
epee::serialization::selector<is_store>::template serialize_custom<stored_type>(this_ref.varialble, stg, hparent_section, val_name, from_v_to_stored, from_stored_to_v);
|
||||||
|
|
||||||
#define KV_SERIALIZE_EPHEMERAL_N(stored_type, from_v_to_stored, val_name) \
|
#define KV_SERIALIZE_EPHEMERAL_N(stored_type, from_v_to_stored, val_name) \
|
||||||
|
using KV_MAKE_ALIAS_NAME() [[maybe_unused]] = stored_type; \
|
||||||
|
[[maybe_unused]] const char* VARNAME(val_tmp_name) = val_name;\
|
||||||
epee::serialization::selector<is_store>::template serialize_ephemeral<stored_type>(this_ref, stg, hparent_section, val_name, from_v_to_stored);
|
epee::serialization::selector<is_store>::template serialize_ephemeral<stored_type>(this_ref, stg, hparent_section, val_name, from_v_to_stored);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -84,6 +140,8 @@ public: \
|
||||||
#define KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, val_name) \
|
#define KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, val_name) \
|
||||||
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_binbuf_to_hexstr, epee::transform_hexstr_to_binbuff, val_name)
|
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_binbuf_to_hexstr, epee::transform_hexstr_to_binbuff, val_name)
|
||||||
|
|
||||||
|
#define KV_SERIALIZE_BLOB_AS_BASE64_STRING_N(varialble, val_name) \
|
||||||
|
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transfrom_binbuf_to_base64, epee::transform_base64_to_binbuf, val_name)
|
||||||
|
|
||||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \
|
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \
|
||||||
epee::serialization::selector<is_store>::serialize_t_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
|
epee::serialization::selector<is_store>::serialize_t_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
|
||||||
|
|
@ -92,20 +150,30 @@ public: \
|
||||||
static_assert(std::is_pod<decltype(this_ref.varialble)>::value, "t_type must be a POD type."); \
|
static_assert(std::is_pod<decltype(this_ref.varialble)>::value, "t_type must be a POD type."); \
|
||||||
KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name)
|
KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name)
|
||||||
|
|
||||||
|
#define KV_SERIALIZE_CONTAINER_POD_AS_HEX_N(varialble, val_name) \
|
||||||
|
KV_SERIALIZE_CUSTOM_N(varialble, std::string, epee::transform_t_pod_array_to_hex_str_array<decltype(varialble)>, epee::transform_hex_str_array_to_t_pod_array<decltype(varialble)>, val_name)
|
||||||
|
|
||||||
|
|
||||||
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, val_name) \
|
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, val_name) \
|
||||||
epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
|
epee::serialization::selector<is_store>::serialize_stl_container_pod_val_as_blob(this_ref.varialble, stg, hparent_section, val_name);
|
||||||
|
|
||||||
#define END_KV_SERIALIZE_MAP() return true;}
|
#define END_KV_SERIALIZE_MAP() return true;}
|
||||||
|
|
||||||
#define KV_SERIALIZE(varialble) KV_SERIALIZE_N(varialble, #varialble)
|
#define KV_SERIALIZE(varialble) KV_SERIALIZE_N(varialble, #varialble)
|
||||||
#define KV_SERIALIZE_DOC(varialble, substitute) KV_SERIALIZE_N_DOC( varialble, #varialble, substitute)
|
#define KV_SERIALIZE_DOC(varialble) KV_SERIALIZE_N_DOC( varialble, #varialble)
|
||||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
|
|
||||||
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
|
|
||||||
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
|
|
||||||
#define KV_SERIALIZE_CUSTOM(varialble, stored_type, from_v_to_stored, from_stored_to_v) KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, #varialble)
|
|
||||||
#define KV_SERIALIZE_POD_AS_HEX_STRING(varialble) KV_SERIALIZE_POD_AS_HEX_STRING_N(varialble, #varialble)
|
|
||||||
#define KV_SERIALIZE_BLOB_AS_HEX_STRING(varialble) KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, #varialble)
|
|
||||||
|
|
||||||
|
#define DOC_COMMAND(desciption_text) inline static const char* description = desciption_text;
|
||||||
|
|
||||||
|
|
||||||
|
#define KV_SERIALIZE_VAL_POD_AS_BLOB(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_N(varialble, #varialble)
|
||||||
|
#define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE(varialble) KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, #varialble) //skip is_pod compile time check
|
||||||
|
#define KV_SERIALIZE_CONTAINER_POD_AS_BLOB(varialble) KV_SERIALIZE_CONTAINER_POD_AS_BLOB_N(varialble, #varialble)
|
||||||
|
#define KV_SERIALIZE_CONTAINER_POD_AS_HEX(varialble) KV_SERIALIZE_CONTAINER_POD_AS_HEX_N(varialble, #varialble)
|
||||||
|
#define KV_SERIALIZE_CUSTOM(varialble, stored_type, from_v_to_stored, from_stored_to_v) KV_SERIALIZE_CUSTOM_N(varialble, stored_type, from_v_to_stored, from_stored_to_v, #varialble)
|
||||||
|
#define KV_SERIALIZE_POD_AS_HEX_STRING(varialble) KV_SERIALIZE_POD_AS_HEX_STRING_N(varialble, #varialble)
|
||||||
|
#define KV_SERIALIZE_BLOB_AS_HEX_STRING(varialble) KV_SERIALIZE_BLOB_AS_HEX_STRING_N(varialble, #varialble)
|
||||||
|
#define KV_SERIALIZE_BLOB_AS_BASE64_STRING(variable) KV_SERIALIZE_BLOB_AS_BASE64_STRING_N(variable, #variable)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define KV_CHAIN_MAP(variable_obj) epee::namespace_accessor<decltype(this_ref.variable_obj)>::template serialize_map<is_store>(this_ref.variable_obj, stg, hparent_section);
|
#define KV_CHAIN_MAP(variable_obj) epee::namespace_accessor<decltype(this_ref.variable_obj)>::template serialize_map<is_store>(this_ref.variable_obj, stg, hparent_section);
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Copyright (c) 2024, Zano Project
|
||||||
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
// All rights reserved.
|
// All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
@ -116,7 +117,7 @@ namespace epee
|
||||||
static bool unserialize_stl_container_t_val(stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
static bool unserialize_stl_container_t_val(stl_container& container, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||||
{
|
{
|
||||||
container.clear();
|
container.clear();
|
||||||
typename stl_container::value_type exchange_val;
|
typename stl_container::value_type exchange_val{};
|
||||||
typename t_storage::harray hval_array = stg.get_first_value(pname, exchange_val, hparent_section);
|
typename t_storage::harray hval_array = stg.get_first_value(pname, exchange_val, hparent_section);
|
||||||
if(!hval_array) return false;
|
if(!hval_array) return false;
|
||||||
container.push_back(std::move(exchange_val));
|
container.push_back(std::move(exchange_val));
|
||||||
|
|
@ -315,9 +316,28 @@ namespace epee
|
||||||
struct selector<true>
|
struct selector<true>
|
||||||
{
|
{
|
||||||
template<class t_type, class t_storage>
|
template<class t_type, class t_storage>
|
||||||
static bool serialize(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, bool doc_mode = false, const t_type& doc_substitute = t_type())
|
static bool serialize(const t_type& d, t_storage& stg, [[maybe_unused]] typename t_storage::hsection hparent_section, [[maybe_unused]] const char* pname)
|
||||||
{
|
{
|
||||||
return kv_serialize( (doc_mode ? doc_substitute:d), stg, hparent_section, pname);
|
//if constexpr (!t_storage::use_descriptions::value)
|
||||||
|
//{
|
||||||
|
return kv_serialize(d, stg, hparent_section, pname);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
// return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
//const t_type& doc_substitute = t_type(), const std::string& description = std::string()
|
||||||
|
template<class t_type, class t_storage>
|
||||||
|
static bool serialize_and_doc(t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, const std::string& description = std::string(), const t_type& doc_substitute = t_type())
|
||||||
|
{
|
||||||
|
if constexpr (t_storage::use_descriptions::value)
|
||||||
|
{
|
||||||
|
stg.set_entry_description(hparent_section, pname, description);
|
||||||
|
return kv_serialize(doc_substitute, stg, hparent_section, pname);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class t_type, class t_storage>
|
template<class t_type, class t_storage>
|
||||||
|
|
@ -340,8 +360,12 @@ namespace epee
|
||||||
template< class t_type_stored, class t_type, class t_storage, typename cb_serialize>
|
template< class t_type_stored, class t_type, class t_storage, typename cb_serialize>
|
||||||
static bool serialize_ephemeral(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, cb_serialize cb_s)
|
static bool serialize_ephemeral(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, cb_serialize cb_s)
|
||||||
{
|
{
|
||||||
t_type_stored a = cb_s(d);
|
t_type_stored a = AUTO_VAL_INIT(a);
|
||||||
return epee::serialization::selector<true>::serialize(a, stg, hparent_section, pname);
|
bool add_val = cb_s(d, a);
|
||||||
|
if (add_val)
|
||||||
|
return epee::serialization::selector<true>::serialize(a, stg, hparent_section, pname);
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -454,6 +478,29 @@ namespace epee
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
//-------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
|
//std::optional
|
||||||
|
template<class t_type, class t_storage>
|
||||||
|
bool kv_serialize(const std::optional<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||||
|
{
|
||||||
|
if(d.has_value())
|
||||||
|
{
|
||||||
|
return kv_serialize(*d, stg, hparent_section, pname);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class t_type, class t_storage>
|
||||||
|
bool kv_unserialize(std::optional<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||||
|
{
|
||||||
|
d = t_type{};
|
||||||
|
bool r = kv_unserialize(*d, stg, hparent_section, pname);
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
d = std::nullopt;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
//boost::shared_ptr
|
//boost::shared_ptr
|
||||||
template<class t_type, class t_storage>
|
template<class t_type, class t_storage>
|
||||||
bool kv_serialize(const boost::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
bool kv_serialize(const boost::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||||
|
|
@ -477,7 +524,30 @@ namespace epee
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
|
//std::shared_ptr
|
||||||
|
template<class t_type, class t_storage>
|
||||||
|
bool kv_serialize(const std::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||||
|
{
|
||||||
|
if (d.get())
|
||||||
|
{
|
||||||
|
return kv_serialize(*d, stg, hparent_section, pname);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class t_type, class t_storage>
|
||||||
|
bool kv_unserialize(std::shared_ptr<t_type>& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname)
|
||||||
|
{
|
||||||
|
d.reset();
|
||||||
|
t_type* ptr = new t_type();
|
||||||
|
bool r = kv_unserialize(*ptr, stg, hparent_section, pname);
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
d.reset(ptr);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,10 +23,8 @@
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -44,15 +44,20 @@ namespace epee
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
class portable_storage
|
template<typename t_section>
|
||||||
|
class portable_storage_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef epee::serialization::hsection hsection;
|
//typedef epee::serialization::hsection hsection;
|
||||||
|
using use_descriptions = std::false_type;
|
||||||
|
typedef t_section* hsection;
|
||||||
typedef epee::serialization::harray harray;
|
typedef epee::serialization::harray harray;
|
||||||
typedef storage_entry meta_entry;
|
typedef storage_entry meta_entry;
|
||||||
|
|
||||||
portable_storage(){}
|
portable_storage_base
|
||||||
virtual ~portable_storage(){}
|
(){}
|
||||||
|
virtual ~portable_storage_base
|
||||||
|
(){}
|
||||||
hsection open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist = false);
|
hsection open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist = false);
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
bool get_value(const std::string& value_name, t_value& val, hsection hparent_section);
|
bool get_value(const std::string& value_name, t_value& val, hsection hparent_section);
|
||||||
|
|
@ -83,12 +88,13 @@ namespace epee
|
||||||
bool load_from_binary(const binarybuffer& target);
|
bool load_from_binary(const binarybuffer& target);
|
||||||
template<class trace_policy>
|
template<class trace_policy>
|
||||||
bool dump_as_xml(std::string& targetObj, const std::string& root_name = "");
|
bool dump_as_xml(std::string& targetObj, const std::string& root_name = "");
|
||||||
bool dump_as_json(std::string& targetObj, size_t indent = 0, end_of_line_t eol = eol_crlf);
|
bool dump_as_json(std::string& targetObj, size_t indent = 0/*, end_of_line_t eol = eol_crlf*/);
|
||||||
bool load_from_json(const std::string& source);
|
bool load_from_json(const std::string& source);
|
||||||
|
void set_entry_description(hsection hparent_section, const std::string& name, const std::string& description) {}
|
||||||
|
|
||||||
template<typename cb_t>
|
template<typename cb_t>
|
||||||
bool enum_entries(hsection hparent_section, cb_t cb);
|
bool enum_entries(hsection hparent_section, cb_t cb);
|
||||||
private:
|
protected:
|
||||||
section m_root;
|
section m_root;
|
||||||
hsection get_root_section() {return &m_root;}
|
hsection get_root_section() {return &m_root;}
|
||||||
storage_entry* find_storage_entry(const std::string& pentry_name, hsection psection);
|
storage_entry* find_storage_entry(const std::string& pentry_name, hsection psection);
|
||||||
|
|
@ -107,32 +113,36 @@ namespace epee
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
};
|
};
|
||||||
inline
|
|
||||||
bool portable_storage::dump_as_json(std::string& buff, size_t indent /* = 0 */, end_of_line_t eol /* = eol_crlf */)
|
|
||||||
|
template<typename t_section>
|
||||||
|
bool portable_storage_base<t_section>::dump_as_json(std::string& buff, size_t indent /* = 0 *//*, end_of_line_t eol *//* = eol_crlf */)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
epee::serialization::dump_as_json(ss, m_root, indent, eol);
|
epee::serialization::recursive_visitor<strategy_json>::dump_as_(ss, m_root, indent/*, eol*/);
|
||||||
buff = ss.str();
|
buff = ss.str();
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::dump_as_json", false)
|
CATCH_ENTRY("portable_storage_base<t_section>::dump_as_json", false)
|
||||||
}
|
}
|
||||||
inline
|
|
||||||
bool portable_storage::load_from_json(const std::string& source)
|
template<typename t_section>
|
||||||
|
bool portable_storage_base<t_section>::load_from_json(const std::string& source)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
return json::load_from_json(source, *this);
|
return json::load_from_json(source, *this);
|
||||||
CATCH_ENTRY("portable_storage::load_from_json", false)
|
CATCH_ENTRY("portable_storage_base<t_section>::load_from_json", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename t_section>
|
||||||
template<class trace_policy>
|
template<class trace_policy>
|
||||||
bool portable_storage::dump_as_xml(std::string& targetObj, const std::string& root_name)
|
bool portable_storage_base<t_section>::dump_as_xml(std::string& targetObj, const std::string& root_name)
|
||||||
{
|
{
|
||||||
return false;//TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
return false;//TODO: don't think i ever again will use xml - ambiguous and "overtagged" format
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
template<typename t_section>
|
||||||
bool portable_storage::store_to_binary(binarybuffer& target)
|
bool portable_storage_base<t_section>::store_to_binary(binarybuffer& target)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
|
|
@ -144,10 +154,10 @@ namespace epee
|
||||||
pack_entry_to_buff(ss, m_root);
|
pack_entry_to_buff(ss, m_root);
|
||||||
target = ss.str();
|
target = ss.str();
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::store_to_binary", false)
|
CATCH_ENTRY("portable_storage_base<t_section>::store_to_binary", false)
|
||||||
}
|
}
|
||||||
inline
|
template<typename t_section>
|
||||||
bool portable_storage::load_from_binary(const binarybuffer& source)
|
bool portable_storage_base<t_section>::load_from_binary(const binarybuffer& source)
|
||||||
{
|
{
|
||||||
m_root.m_entries.clear();
|
m_root.m_entries.clear();
|
||||||
if(source.size() < sizeof(storage_block_header))
|
if(source.size() < sizeof(storage_block_header))
|
||||||
|
|
@ -172,11 +182,11 @@ namespace epee
|
||||||
throwable_buffer_reader buf_reader(source.data()+sizeof(storage_block_header), source.size()-sizeof(storage_block_header));
|
throwable_buffer_reader buf_reader(source.data()+sizeof(storage_block_header), source.size()-sizeof(storage_block_header));
|
||||||
buf_reader.read(m_root);
|
buf_reader.read(m_root);
|
||||||
return true;//TODO:
|
return true;//TODO:
|
||||||
CATCH_ENTRY("portable_storage::load_from_binary", false);
|
CATCH_ENTRY("portable_storage_base<t_section>::load_from_binary", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
hsection portable_storage::open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist)
|
typename portable_storage_base<t_section>::hsection portable_storage_base<t_section>::open_section(const std::string& section_name, hsection hparent_section, bool create_if_notexist)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
hparent_section = hparent_section ? hparent_section:&m_root;
|
hparent_section = hparent_section ? hparent_section:&m_root;
|
||||||
|
|
@ -197,7 +207,7 @@ namespace epee
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return &boost::get<section>(*pentry);
|
return &boost::get<section>(*pentry);
|
||||||
CATCH_ENTRY("portable_storage::open_section", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::open_section", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
template<class to_type>
|
template<class to_type>
|
||||||
|
|
@ -209,8 +219,9 @@ namespace epee
|
||||||
void operator()(const from_type& v){convert_t(v, m_target);}
|
void operator()(const from_type& v){convert_t(v, m_target);}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename t_section>
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
bool portable_storage::get_value(const std::string& value_name, t_value& val, hsection hparent_section)
|
bool portable_storage_base<t_section>::get_value(const std::string& value_name, t_value& val, hsection hparent_section)
|
||||||
{
|
{
|
||||||
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
||||||
//TRY_ENTRY();
|
//TRY_ENTRY();
|
||||||
|
|
@ -222,11 +233,11 @@ namespace epee
|
||||||
get_value_visitor<t_value> gvv(val);
|
get_value_visitor<t_value> gvv(val);
|
||||||
boost::apply_visitor(gvv, *pentry);
|
boost::apply_visitor(gvv, *pentry);
|
||||||
return true;
|
return true;
|
||||||
//CATCH_ENTRY("portable_storage::template<>get_value", false);
|
//CATCH_ENTRY("portable_storage_base<t_section>::template<>get_value", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
bool portable_storage::get_value(const std::string& value_name, storage_entry& val, hsection hparent_section)
|
bool portable_storage_base<t_section>::get_value(const std::string& value_name, storage_entry& val, hsection hparent_section)
|
||||||
{
|
{
|
||||||
//TRY_ENTRY();
|
//TRY_ENTRY();
|
||||||
if(!hparent_section) hparent_section = &m_root;
|
if(!hparent_section) hparent_section = &m_root;
|
||||||
|
|
@ -236,11 +247,12 @@ namespace epee
|
||||||
|
|
||||||
val = *pentry;
|
val = *pentry;
|
||||||
return true;
|
return true;
|
||||||
//CATCH_ENTRY("portable_storage::template<>get_value", false);
|
//CATCH_ENTRY("portable_storage_base<t_section>::template<>get_value", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
bool portable_storage::set_value(const std::string& value_name, const t_value& v, hsection hparent_section)
|
bool portable_storage_base<t_section>::set_value(const std::string& value_name, const t_value& v, hsection hparent_section)
|
||||||
{
|
{
|
||||||
BOOST_MPL_ASSERT(( boost::mpl::contains<boost::mpl::push_front<storage_entry::types, storage_entry>::type, t_value> ));
|
BOOST_MPL_ASSERT(( boost::mpl::contains<boost::mpl::push_front<storage_entry::types, storage_entry>::type, t_value> ));
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
|
|
@ -256,11 +268,11 @@ namespace epee
|
||||||
}
|
}
|
||||||
*pentry = storage_entry(v);
|
*pentry = storage_entry(v);
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::template<>set_value", false);
|
CATCH_ENTRY("portable_storage_base<t_section>::template<>set_value", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
storage_entry* portable_storage::find_storage_entry(const std::string& pentry_name, hsection psection)
|
storage_entry* portable_storage_base<t_section>::find_storage_entry(const std::string& pentry_name, hsection psection)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
CHECK_AND_ASSERT(psection, nullptr);
|
CHECK_AND_ASSERT(psection, nullptr);
|
||||||
|
|
@ -269,27 +281,28 @@ namespace epee
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return &it->second;
|
return &it->second;
|
||||||
CATCH_ENTRY("portable_storage::find_storage_entry", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::find_storage_entry", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<class entry_type>
|
template<class entry_type>
|
||||||
storage_entry* portable_storage::insert_new_entry_get_storage_entry(const std::string& pentry_name, hsection psection, const entry_type& entry)
|
storage_entry* portable_storage_base<t_section>::insert_new_entry_get_storage_entry(const std::string& pentry_name, hsection psection, const entry_type& entry)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
CHECK_AND_ASSERT(psection, nullptr);
|
CHECK_AND_ASSERT(psection, nullptr);
|
||||||
auto ins_res = psection->m_entries.insert(std::pair<std::string, storage_entry>(pentry_name, entry));
|
auto ins_res = psection->m_entries.insert(std::pair<std::string, storage_entry>(pentry_name, entry));
|
||||||
return &ins_res.first->second;
|
return &ins_res.first->second;
|
||||||
CATCH_ENTRY("portable_storage::insert_new_entry_get_storage_entry", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::insert_new_entry_get_storage_entry", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
hsection portable_storage::insert_new_section(const std::string& pentry_name, hsection psection)
|
typename portable_storage_base<t_section>::hsection portable_storage_base<t_section>::insert_new_section(const std::string& pentry_name, hsection psection)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
storage_entry* pse = insert_new_entry_get_storage_entry(pentry_name, psection, section());
|
storage_entry* pse = insert_new_entry_get_storage_entry(pentry_name, psection, section());
|
||||||
if(!pse) return nullptr;
|
if(!pse) return nullptr;
|
||||||
return &boost::get<section>(*pse);
|
return &boost::get<section>(*pse);
|
||||||
CATCH_ENTRY("portable_storage::insert_new_section", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::insert_new_section", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
template<class to_type>
|
template<class to_type>
|
||||||
|
|
@ -308,8 +321,9 @@ namespace epee
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
harray portable_storage::get_first_value(const std::string& value_name, t_value& target, hsection hparent_section)
|
harray portable_storage_base<t_section>::get_first_value(const std::string& value_name, t_value& target, hsection hparent_section)
|
||||||
{
|
{
|
||||||
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
||||||
//TRY_ENTRY();
|
//TRY_ENTRY();
|
||||||
|
|
@ -325,7 +339,7 @@ namespace epee
|
||||||
if(!boost::apply_visitor(gfv, ar_entry))
|
if(!boost::apply_visitor(gfv, ar_entry))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return &ar_entry;
|
return &ar_entry;
|
||||||
//CATCH_ENTRY("portable_storage::get_first_value", nullptr);
|
//CATCH_ENTRY("portable_storage_base<t_section>::get_first_value", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
template<class to_type>
|
template<class to_type>
|
||||||
|
|
@ -344,10 +358,10 @@ namespace epee
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
bool portable_storage::get_next_value(harray hval_array, t_value& target)
|
bool portable_storage_base<t_section>::get_next_value(harray hval_array, t_value& target)
|
||||||
{
|
{
|
||||||
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
|
||||||
//TRY_ENTRY();
|
//TRY_ENTRY();
|
||||||
|
|
@ -357,11 +371,12 @@ namespace epee
|
||||||
if(!boost::apply_visitor(gnv, ar_entry))
|
if(!boost::apply_visitor(gnv, ar_entry))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
//CATCH_ENTRY("portable_storage::get_next_value", false);
|
//CATCH_ENTRY("portable_storage_base<t_section>::get_next_value", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
harray portable_storage::insert_first_value(const std::string& value_name, const t_value& target, hsection hparent_section)
|
harray portable_storage_base<t_section>::insert_first_value(const std::string& value_name, const t_value& target, hsection hparent_section)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
if(!hparent_section) hparent_section = &m_root;
|
if(!hparent_section) hparent_section = &m_root;
|
||||||
|
|
@ -382,11 +397,12 @@ namespace epee
|
||||||
array_entry_t<t_value>& arr_typed = boost::get<array_entry_t<t_value> >(arr);
|
array_entry_t<t_value>& arr_typed = boost::get<array_entry_t<t_value> >(arr);
|
||||||
arr_typed.insert_first_val(target);
|
arr_typed.insert_first_val(target);
|
||||||
return &arr;
|
return &arr;
|
||||||
CATCH_ENTRY("portable_storage::insert_first_value", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::insert_first_value", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<typename cb_t>
|
template<typename cb_t>
|
||||||
bool portable_storage::enum_entries(hsection hparent_section, cb_t cb)
|
bool portable_storage_base<t_section>::enum_entries(hsection hparent_section, cb_t cb)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
if (!hparent_section) hparent_section = &m_root;
|
if (!hparent_section) hparent_section = &m_root;
|
||||||
|
|
@ -396,11 +412,12 @@ namespace epee
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::enum_entries", false);
|
CATCH_ENTRY("portable_storage_base<t_section>::enum_entries", false);
|
||||||
}
|
}
|
||||||
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
template<typename t_section>
|
||||||
template<class t_value>
|
template<class t_value>
|
||||||
bool portable_storage::insert_next_value(harray hval_array, const t_value& target)
|
bool portable_storage_base<t_section>::insert_next_value(harray hval_array, const t_value& target)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
CHECK_AND_ASSERT(hval_array, false);
|
CHECK_AND_ASSERT(hval_array, false);
|
||||||
|
|
@ -411,12 +428,12 @@ namespace epee
|
||||||
array_entry_t<t_value>& arr_typed = boost::get<array_entry_t<t_value> >(*hval_array);
|
array_entry_t<t_value>& arr_typed = boost::get<array_entry_t<t_value> >(*hval_array);
|
||||||
arr_typed.insert_next_value(target);
|
arr_typed.insert_next_value(target);
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::insert_next_value", false);
|
CATCH_ENTRY("portable_storage_base<t_section>::insert_next_value", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
//sections
|
//sections
|
||||||
inline
|
template<typename t_section>
|
||||||
harray portable_storage::get_first_section(const std::string& sec_name, hsection& h_child_section, hsection hparent_section)
|
harray portable_storage_base<t_section>::get_first_section(const std::string& sec_name, hsection& h_child_section, hsection hparent_section)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
if(!hparent_section) hparent_section = &m_root;
|
if(!hparent_section) hparent_section = &m_root;
|
||||||
|
|
@ -434,11 +451,11 @@ namespace epee
|
||||||
return nullptr;
|
return nullptr;
|
||||||
h_child_section = psec;
|
h_child_section = psec;
|
||||||
return &ar_entry;
|
return &ar_entry;
|
||||||
CATCH_ENTRY("portable_storage::get_first_section", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::get_first_section", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
bool portable_storage::get_next_section(harray hsec_array, hsection& h_child_section)
|
bool portable_storage_base<t_section>::get_next_section(harray hsec_array, hsection& h_child_section)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
CHECK_AND_ASSERT(hsec_array, false);
|
CHECK_AND_ASSERT(hsec_array, false);
|
||||||
|
|
@ -449,11 +466,11 @@ namespace epee
|
||||||
if(!h_child_section)
|
if(!h_child_section)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::get_next_section", false);
|
CATCH_ENTRY("portable_storage_base<t_section>::get_next_section", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
harray portable_storage::insert_first_section(const std::string& sec_name, hsection& hinserted_childsection, hsection hparent_section)
|
harray portable_storage_base<t_section>::insert_first_section(const std::string& sec_name, hsection& hinserted_childsection, hsection hparent_section)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
if(!hparent_section) hparent_section = &m_root;
|
if(!hparent_section) hparent_section = &m_root;
|
||||||
|
|
@ -474,11 +491,11 @@ namespace epee
|
||||||
array_entry_t<section>& sec_array = boost::get<array_entry_t<section>>(ar_entry);
|
array_entry_t<section>& sec_array = boost::get<array_entry_t<section>>(ar_entry);
|
||||||
hinserted_childsection = &sec_array.insert_first_val(section());
|
hinserted_childsection = &sec_array.insert_first_val(section());
|
||||||
return &ar_entry;
|
return &ar_entry;
|
||||||
CATCH_ENTRY("portable_storage::insert_first_section", nullptr);
|
CATCH_ENTRY("portable_storage_base<t_section>::insert_first_section", nullptr);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
inline
|
template<typename t_section>
|
||||||
bool portable_storage::insert_next_section(harray hsec_array, hsection& hinserted_childsection)
|
bool portable_storage_base<t_section>::insert_next_section(harray hsec_array, hsection& hinserted_childsection)
|
||||||
{
|
{
|
||||||
TRY_ENTRY();
|
TRY_ENTRY();
|
||||||
CHECK_AND_ASSERT(hsec_array, false);
|
CHECK_AND_ASSERT(hsec_array, false);
|
||||||
|
|
@ -488,8 +505,9 @@ namespace epee
|
||||||
array_entry_t<section>& sec_array = boost::get<array_entry_t<section>>(*hsec_array);
|
array_entry_t<section>& sec_array = boost::get<array_entry_t<section>>(*hsec_array);
|
||||||
hinserted_childsection = &sec_array.insert_next_value(section());
|
hinserted_childsection = &sec_array.insert_next_value(section());
|
||||||
return true;
|
return true;
|
||||||
CATCH_ENTRY("portable_storage::insert_next_section", false);
|
CATCH_ENTRY("portable_storage_base<t_section>::insert_next_section", false);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
typedef portable_storage_base<section> portable_storage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@ namespace epee
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
struct section
|
struct section
|
||||||
{
|
{
|
||||||
|
std::map<std::string, std::string> m_descriptions;
|
||||||
std::map<std::string, storage_entry> m_entries;
|
std::map<std::string, storage_entry> m_entries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||||
|
// names of its contributors may be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
|
||||||
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "portable_storage.h"
|
||||||
|
#include "portable_storage_to_description.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace epee
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
/************************************************************************/
|
||||||
|
/* */
|
||||||
|
/************************************************************************/
|
||||||
|
class portable_storage_extended_doc: public portable_storage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using use_descriptions = std::true_type;
|
||||||
|
|
||||||
|
void set_entry_description(hsection hparent_section, const std::string& name, const std::string& description)
|
||||||
|
{
|
||||||
|
if (!hparent_section)
|
||||||
|
hparent_section = &m_root;
|
||||||
|
hparent_section->m_descriptions[name] = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dump_as_decriptions(std::string& buff, size_t indent = 0 , end_of_line_t eol = eol_crlf)
|
||||||
|
{
|
||||||
|
TRY_ENTRY();
|
||||||
|
std::stringstream ss;
|
||||||
|
recursive_visitor<strategy_descriptin>::dump_as_(ss, m_root, indent);
|
||||||
|
buff = ss.str();
|
||||||
|
return true;
|
||||||
|
CATCH_ENTRY("portable_storage_base<t_section>::dump_as_json", false)
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
//---------------------------------------------------------------------------------------------------------------
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -59,6 +59,7 @@ namespace epee
|
||||||
storage_entry load_storage_entry();
|
storage_entry load_storage_entry();
|
||||||
void read(section& sec);
|
void read(section& sec);
|
||||||
void read(std::string& str);
|
void read(std::string& str);
|
||||||
|
void read(array_entry &ae);
|
||||||
private:
|
private:
|
||||||
struct recursuion_limitation_guard
|
struct recursuion_limitation_guard
|
||||||
{
|
{
|
||||||
|
|
@ -114,6 +115,7 @@ namespace epee
|
||||||
void throwable_buffer_reader::read(t_pod_type& pod_val)
|
void throwable_buffer_reader::read(t_pod_type& pod_val)
|
||||||
{
|
{
|
||||||
RECURSION_LIMITATION();
|
RECURSION_LIMITATION();
|
||||||
|
static_assert(std::is_pod<t_pod_type>::value, "POD type expected");
|
||||||
read(&pod_val, sizeof(pod_val));
|
read(&pod_val, sizeof(pod_val));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -277,5 +279,11 @@ namespace epee
|
||||||
m_ptr+=len;
|
m_ptr+=len;
|
||||||
m_count -= len;
|
m_count -= len;
|
||||||
}
|
}
|
||||||
|
inline
|
||||||
|
void throwable_buffer_reader::read(array_entry &ae)
|
||||||
|
{
|
||||||
|
RECURSION_LIMITATION();
|
||||||
|
CHECK_AND_ASSERT_THROW_MES(false, "Reading array entry is not supported");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,22 +28,38 @@
|
||||||
#include "parserse_base_utils.h"
|
#include "parserse_base_utils.h"
|
||||||
#include "file_io_utils.h"
|
#include "file_io_utils.h"
|
||||||
|
|
||||||
|
#define EPEE_JSON_RECURSION_LIMIT_INTERNAL 100
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
namespace serialization
|
namespace serialization
|
||||||
{
|
{
|
||||||
namespace json
|
namespace json
|
||||||
{
|
{
|
||||||
#define CHECK_ISSPACE() if(!isspace(*it)){ ASSERT_MES_AND_THROW("Wrong JSON character at: " << std::string(it, buf_end));}
|
|
||||||
|
namespace details
|
||||||
|
{
|
||||||
|
inline bool report_wrong_char_with_context(const std::string::const_iterator begin, const std::string::const_iterator it, const std::string::const_iterator end)
|
||||||
|
{
|
||||||
|
auto before_it = it - std::min(it - begin, static_cast<ptrdiff_t>(8));
|
||||||
|
auto after_it = it + std::min(end - it, static_cast<ptrdiff_t>(8));
|
||||||
|
std::string escaped_str(before_it, after_it);
|
||||||
|
std::replace_if(escaped_str.begin(), escaped_str.end(), [](int c){ return std::isprint(c); }, '?');
|
||||||
|
ASSERT_MES_AND_THROW("Wrong JSON character 0x" << std::hex << (int)*it << ", context: " << escaped_str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_ISSPACE() if (!isspace(*it)) details::report_wrong_char_with_context(sec_buf_begin, it, buf_end)
|
||||||
|
|
||||||
/*inline void parse_error()
|
/*inline void parse_error()
|
||||||
{
|
{
|
||||||
ASSERT_MES_AND_THROW("json parse error");
|
ASSERT_MES_AND_THROW("json parse error");
|
||||||
}*/
|
}*/
|
||||||
template<class t_storage>
|
template<class t_storage>
|
||||||
inline void run_handler(typename t_storage::hsection current_section, std::string::const_iterator& sec_buf_begin, std::string::const_iterator buf_end, t_storage& stg)
|
inline void run_handler(typename t_storage::hsection current_section, std::string::const_iterator& sec_buf_begin, std::string::const_iterator buf_end, t_storage& stg, unsigned int recursion)
|
||||||
{
|
{
|
||||||
|
CHECK_AND_ASSERT_THROW_MES(recursion < EPEE_JSON_RECURSION_LIMIT_INTERNAL,
|
||||||
|
"Wrong JSON data: recursion limitation (" << EPEE_JSON_RECURSION_LIMIT_INTERNAL << ") exceeded");
|
||||||
std::string::const_iterator sub_element_start;
|
std::string::const_iterator sub_element_start;
|
||||||
std::string name;
|
std::string name;
|
||||||
typename t_storage::harray h_array = nullptr;
|
typename t_storage::harray h_array = nullptr;
|
||||||
|
|
@ -154,7 +170,7 @@ namespace epee
|
||||||
//sub section here
|
//sub section here
|
||||||
typename t_storage::hsection new_sec = stg.open_section(name, current_section, true);
|
typename t_storage::hsection new_sec = stg.open_section(name, current_section, true);
|
||||||
CHECK_AND_ASSERT_THROW_MES(new_sec, "Failed to insert new section in json: " << std::string(it, buf_end));
|
CHECK_AND_ASSERT_THROW_MES(new_sec, "Failed to insert new section in json: " << std::string(it, buf_end));
|
||||||
run_handler(new_sec, it, buf_end, stg);
|
run_handler(new_sec, it, buf_end, stg, recursion + 1);
|
||||||
state = match_state_wonder_after_value;
|
state = match_state_wonder_after_value;
|
||||||
}else if(*it == '[')
|
}else if(*it == '[')
|
||||||
{//array of something
|
{//array of something
|
||||||
|
|
@ -183,7 +199,7 @@ namespace epee
|
||||||
typename t_storage::hsection new_sec = nullptr;
|
typename t_storage::hsection new_sec = nullptr;
|
||||||
h_array = stg.insert_first_section(name, new_sec, current_section);
|
h_array = stg.insert_first_section(name, new_sec, current_section);
|
||||||
CHECK_AND_ASSERT_THROW_MES(h_array&&new_sec, "failed to create new section");
|
CHECK_AND_ASSERT_THROW_MES(h_array&&new_sec, "failed to create new section");
|
||||||
run_handler(new_sec, it, buf_end, stg);
|
run_handler(new_sec, it, buf_end, stg, recursion + 1);
|
||||||
state = match_state_array_after_value;
|
state = match_state_array_after_value;
|
||||||
array_md = array_mode_sections;
|
array_md = array_mode_sections;
|
||||||
}else if(*it == '"')
|
}else if(*it == '"')
|
||||||
|
|
@ -257,7 +273,7 @@ namespace epee
|
||||||
typename t_storage::hsection new_sec = NULL;
|
typename t_storage::hsection new_sec = NULL;
|
||||||
bool res = stg.insert_next_section(h_array, new_sec);
|
bool res = stg.insert_next_section(h_array, new_sec);
|
||||||
CHECK_AND_ASSERT_THROW_MES(res&&new_sec, "failed to insert next section");
|
CHECK_AND_ASSERT_THROW_MES(res&&new_sec, "failed to insert next section");
|
||||||
run_handler(new_sec, it, buf_end, stg);
|
run_handler(new_sec, it, buf_end, stg, recursion + 1);
|
||||||
state = match_state_array_after_value;
|
state = match_state_array_after_value;
|
||||||
}else CHECK_ISSPACE();
|
}else CHECK_ISSPACE();
|
||||||
break;
|
break;
|
||||||
|
|
@ -359,7 +375,7 @@ namespace epee
|
||||||
std::string::const_iterator sec_buf_begin = buff_json.begin();
|
std::string::const_iterator sec_buf_begin = buff_json.begin();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
run_handler(nullptr, sec_buf_begin, buff_json.end(), stg);
|
run_handler(nullptr, sec_buf_begin, buff_json.end(), stg, 0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(const std::exception& ex)
|
catch(const std::exception& ex)
|
||||||
|
|
|
||||||
|
|
@ -56,16 +56,16 @@ namespace epee
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
template<class t_struct>
|
template<class t_struct>
|
||||||
bool store_t_to_json(const t_struct& str_in, std::string& json_buff, size_t indent = 0, end_of_line_t eol = eol_crlf)
|
bool store_t_to_json(const t_struct& str_in, std::string& json_buff, size_t indent = 0)
|
||||||
{
|
{
|
||||||
portable_storage ps;
|
portable_storage ps;
|
||||||
str_in.store(ps);
|
str_in.store(ps);
|
||||||
ps.dump_as_json(json_buff, indent, eol);
|
ps.dump_as_json(json_buff, indent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------------
|
||||||
template<class t_struct>
|
template<class t_struct>
|
||||||
std::string store_t_to_json(const t_struct& str_in, size_t indent = 0, end_of_line_t eol = eol_crlf)
|
std::string store_t_to_json(const t_struct& str_in, size_t indent = 0)
|
||||||
{
|
{
|
||||||
std::string json_buff;
|
std::string json_buff;
|
||||||
store_t_to_json(str_in, json_buff, indent);
|
store_t_to_json(str_in, json_buff, indent);
|
||||||
|
|
|
||||||
149
contrib/epee/include/storages/portable_storage_to_.h
Normal file
149
contrib/epee/include/storages/portable_storage_to_.h
Normal file
|
|
@ -0,0 +1,149 @@
|
||||||
|
// Copyright (c) 2006-2013, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||||
|
// names of its contributors may be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
|
||||||
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "misc_language.h"
|
||||||
|
#include "portable_storage_base.h"
|
||||||
|
|
||||||
|
namespace epee
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
template <typename t_strategy_layout_strategy>
|
||||||
|
class recursive_visitor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template<class t_stream>
|
||||||
|
struct array_entry_store_to_json_visitor : public boost::static_visitor<void>
|
||||||
|
{
|
||||||
|
t_stream& m_strm;
|
||||||
|
size_t m_indent;
|
||||||
|
|
||||||
|
array_entry_store_to_json_visitor(t_stream& strm, size_t indent)
|
||||||
|
: m_strm(strm)
|
||||||
|
, m_indent(indent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<class t_type>
|
||||||
|
void operator()(const array_entry_t<t_type>& a)
|
||||||
|
{
|
||||||
|
|
||||||
|
t_strategy_layout_strategy::handle_array_start(m_strm, m_indent);
|
||||||
|
if (a.m_array.size())
|
||||||
|
{
|
||||||
|
auto last_it = --a.m_array.end();
|
||||||
|
for (auto it = a.m_array.begin(); it != a.m_array.end(); it++)
|
||||||
|
{
|
||||||
|
dump_as_(m_strm, *it, m_indent);
|
||||||
|
if (it != last_it)
|
||||||
|
t_strategy_layout_strategy::handle_array_entry_separator(m_strm, m_indent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t_strategy_layout_strategy::handle_array_end(m_strm, m_indent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
struct storage_entry_store_to_json_visitor : public boost::static_visitor<void>
|
||||||
|
{
|
||||||
|
t_stream& m_strm;
|
||||||
|
size_t m_indent;
|
||||||
|
|
||||||
|
storage_entry_store_to_json_visitor(t_stream& strm, size_t indent)
|
||||||
|
: m_strm(strm)
|
||||||
|
, m_indent(indent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//section, array_entry
|
||||||
|
template<class visited_type>
|
||||||
|
void operator()(const visited_type& v)
|
||||||
|
{
|
||||||
|
dump_as_(m_strm, v, m_indent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
void static dump_as_(t_stream& strm, const array_entry& ae, size_t indent)
|
||||||
|
{
|
||||||
|
array_entry_store_to_json_visitor<t_stream> aesv(strm, indent);
|
||||||
|
boost::apply_visitor(aesv, ae);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
void static dump_as_(t_stream& strm, const storage_entry& se, size_t indent)
|
||||||
|
{
|
||||||
|
storage_entry_store_to_json_visitor<t_stream> sv(strm, indent);
|
||||||
|
boost::apply_visitor(sv, se);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream, class t_type>
|
||||||
|
void static dump_as_(t_stream& strm, const t_type& v, size_t indent)
|
||||||
|
{
|
||||||
|
t_strategy_layout_strategy::handle_value(strm, v, indent);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
void static dump_as_(t_stream& strm, const section& sec, size_t indent)
|
||||||
|
{
|
||||||
|
size_t local_indent = indent + 1;
|
||||||
|
t_strategy_layout_strategy::handle_obj_begin(strm, indent);
|
||||||
|
t_strategy_layout_strategy::handle_line_break(strm, indent);
|
||||||
|
|
||||||
|
if (sec.m_entries.size())
|
||||||
|
{
|
||||||
|
auto it_last = --sec.m_entries.end();
|
||||||
|
for (auto it = sec.m_entries.begin(); it != sec.m_entries.end(); it++)
|
||||||
|
{
|
||||||
|
if constexpr (t_strategy_layout_strategy::use_descriptions::value)
|
||||||
|
{
|
||||||
|
std::string descr;
|
||||||
|
auto it_descr = sec.m_descriptions.find(it->first);
|
||||||
|
if (it_descr != sec.m_descriptions.end())
|
||||||
|
descr = it_descr->second;
|
||||||
|
|
||||||
|
t_strategy_layout_strategy::handle_print_key(strm, it->first, descr, local_indent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t_strategy_layout_strategy::handle_print_key(strm, it->first, local_indent);
|
||||||
|
}
|
||||||
|
|
||||||
|
dump_as_(strm, it->second, local_indent);
|
||||||
|
if (it_last != it)
|
||||||
|
t_strategy_layout_strategy::handle_section_entry_separator(strm, indent);
|
||||||
|
|
||||||
|
t_strategy_layout_strategy::handle_line_break(strm, indent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t_strategy_layout_strategy::handle_obj_end(strm, indent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
107
contrib/epee/include/storages/portable_storage_to_description.h
Normal file
107
contrib/epee/include/storages/portable_storage_to_description.h
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
// Copyright (c) 2006-2024, Andrey N. Sabelnikov, www.sabelnikov.net
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are met:
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the Andrey N. Sabelnikov nor the
|
||||||
|
// names of its contributors may be used to endorse or promote products
|
||||||
|
// derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY
|
||||||
|
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "misc_language.h"
|
||||||
|
#include "portable_storage_base.h"
|
||||||
|
#include "portable_storage_to_.h"
|
||||||
|
|
||||||
|
namespace epee
|
||||||
|
{
|
||||||
|
namespace serialization
|
||||||
|
{
|
||||||
|
class strategy_descriptin
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using use_descriptions = std::true_type;
|
||||||
|
|
||||||
|
inline static const char* eol = get_endline(eol_crlf);
|
||||||
|
//static const end_of_line_t eol = eol_crlf;
|
||||||
|
|
||||||
|
template<class t_stream, class t_type>
|
||||||
|
static void handle_value(t_stream& strm, const t_type& v, size_t indent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_array_start(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
//strm << "[";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_array_end(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
//strm << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_obj_begin(t_stream& strm, size_t indent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_obj_end(t_stream& strm, size_t indent)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_print_key(t_stream& strm, const std::string& key, const std::string& description, size_t indent)
|
||||||
|
{
|
||||||
|
if (description.size())
|
||||||
|
{
|
||||||
|
const std::string indent_str = make_indent(indent);
|
||||||
|
strm << indent_str << "\"" << key << "\"" << ": " << description << eol;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_print_description(t_stream& strm, const std::string& description, size_t indent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_section_entry_separator(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
//strm << ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_array_entry_separator(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
//strm << ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_line_break(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
//strm << eol;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -30,174 +30,121 @@
|
||||||
|
|
||||||
#include "misc_language.h"
|
#include "misc_language.h"
|
||||||
#include "portable_storage_base.h"
|
#include "portable_storage_base.h"
|
||||||
|
#include "portable_storage_to_.h"
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
{
|
{
|
||||||
namespace serialization
|
namespace serialization
|
||||||
{
|
{
|
||||||
|
inline const char* get_endline(end_of_line_t eol)
|
||||||
template<class t_stream>
|
{
|
||||||
void dump_as_json(t_stream& strm, const array_entry& ae, size_t indent, end_of_line_t eol = eol_crlf);
|
switch (eol)
|
||||||
template<class t_stream>
|
{
|
||||||
void dump_as_json(t_stream& strm, const storage_entry& se, size_t indent, end_of_line_t eol = eol_crlf);
|
case eol_lf: return "\n";
|
||||||
template<class t_stream>
|
case eol_cr: return "\r";
|
||||||
void dump_as_json(t_stream& strm, const std::string& v, size_t indent, end_of_line_t eol = eol_crlf);
|
case eol_space: return " ";
|
||||||
template<class t_stream>
|
default: return "\r\n";
|
||||||
void dump_as_json(t_stream& strm, const int8_t& v, size_t indent, end_of_line_t eol = eol_crlf);
|
}
|
||||||
template<class t_stream>
|
}
|
||||||
void dump_as_json(t_stream& strm, const uint8_t& v, size_t indent, end_of_line_t eol = eol_crlf);
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const bool& v, size_t indent, end_of_line_t eol = eol_crlf);
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const double& v, size_t indent, end_of_line_t eol = eol_crlf);
|
|
||||||
template<class t_stream, class t_type>
|
|
||||||
void dump_as_json(t_stream& strm, const t_type& v, size_t indent, end_of_line_t eol = eol_crlf);
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const section& sec, size_t indent, end_of_line_t eol = eol_crlf);
|
|
||||||
|
|
||||||
|
|
||||||
inline std::string make_indent(size_t indent)
|
inline std::string make_indent(size_t indent)
|
||||||
{
|
{
|
||||||
return std::string(indent*2, ' ');
|
return std::string(indent * 2, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class t_stream>
|
class strategy_json
|
||||||
struct array_entry_store_to_json_visitor: public boost::static_visitor<void>
|
|
||||||
{
|
{
|
||||||
t_stream& m_strm;
|
public:
|
||||||
size_t m_indent;
|
using use_descriptions = std::false_type;
|
||||||
end_of_line_t m_eol;
|
|
||||||
|
|
||||||
array_entry_store_to_json_visitor(t_stream& strm, size_t indent, end_of_line_t eol)
|
inline static const char* eol = get_endline(eol_crlf);
|
||||||
: m_strm(strm)
|
//static const end_of_line_t eol = eol_crlf;
|
||||||
, m_indent(indent)
|
template<class t_stream>
|
||||||
, m_eol(eol)
|
static void handle_value(t_stream& strm, const std::string& v, size_t indent)
|
||||||
{}
|
|
||||||
|
|
||||||
template<class t_type>
|
|
||||||
void operator()(const array_entry_t<t_type>& a)
|
|
||||||
{
|
{
|
||||||
m_strm << "[";
|
strm << "\"" << misc_utils::parse::transform_to_json_escape_sequence(v) << "\"";
|
||||||
if(a.m_array.size())
|
}
|
||||||
{
|
template<class t_stream>
|
||||||
auto last_it = --a.m_array.end();
|
static void handle_value(t_stream& strm, const int8_t& v, size_t indent)
|
||||||
for(auto it = a.m_array.begin(); it != a.m_array.end(); it++)
|
{
|
||||||
{
|
strm << static_cast<int32_t>(v);
|
||||||
dump_as_json(m_strm, *it, m_indent, m_eol);
|
}
|
||||||
if(it != last_it)
|
template<class t_stream>
|
||||||
m_strm << ",";
|
static void handle_value(t_stream& strm, const uint8_t& v, size_t indent)
|
||||||
}
|
{
|
||||||
}
|
strm << static_cast<int32_t>(v);
|
||||||
m_strm << "]";
|
}
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_value(t_stream& strm, const bool& v, size_t indent)
|
||||||
|
{
|
||||||
|
if (v)
|
||||||
|
strm << "true";
|
||||||
|
else
|
||||||
|
strm << "false";
|
||||||
|
}
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_value(t_stream& strm, const double& v, size_t indent)
|
||||||
|
{
|
||||||
|
boost::io::ios_flags_saver ifs(strm);
|
||||||
|
strm.precision(8);
|
||||||
|
strm << std::fixed << v;
|
||||||
|
}
|
||||||
|
template<class t_stream, class t_type>
|
||||||
|
static void handle_value(t_stream& strm, const t_type& v, size_t indent)
|
||||||
|
{
|
||||||
|
strm << v;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_array_start(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << "[";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_array_end(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_obj_begin(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << "{";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_obj_end(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << make_indent(indent) << "}";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_print_key(t_stream& strm, const std::string& key, size_t indent)
|
||||||
|
{
|
||||||
|
const std::string indent_str = make_indent(indent);
|
||||||
|
strm << indent_str << "\"" << misc_utils::parse::transform_to_json_escape_sequence(key) << "\"" << ": ";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_section_entry_separator(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_array_entry_separator(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << ",";
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class t_stream>
|
||||||
|
static void handle_line_break(t_stream& strm, size_t indent)
|
||||||
|
{
|
||||||
|
strm << eol;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
struct storage_entry_store_to_json_visitor: public boost::static_visitor<void>
|
|
||||||
{
|
|
||||||
t_stream& m_strm;
|
|
||||||
size_t m_indent;
|
|
||||||
end_of_line_t m_eol;
|
|
||||||
|
|
||||||
storage_entry_store_to_json_visitor(t_stream& strm, size_t indent, end_of_line_t eol)
|
|
||||||
: m_strm(strm)
|
|
||||||
, m_indent(indent)
|
|
||||||
, m_eol(eol)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//section, array_entry
|
|
||||||
template<class visited_type>
|
|
||||||
void operator()(const visited_type& v)
|
|
||||||
{
|
|
||||||
dump_as_json(m_strm, v, m_indent, m_eol);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const array_entry& ae, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
array_entry_store_to_json_visitor<t_stream> aesv(strm, indent, eol);
|
|
||||||
boost::apply_visitor(aesv, ae);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const storage_entry& se, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
storage_entry_store_to_json_visitor<t_stream> sv(strm, indent, eol);
|
|
||||||
boost::apply_visitor(sv, se);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const std::string& v, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
strm << "\"" << misc_utils::parse::transform_to_json_escape_sequence(v) << "\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const int8_t& v, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
strm << static_cast<int32_t>(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const uint8_t& v, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
strm << static_cast<int32_t>(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const bool& v, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
if(v)
|
|
||||||
strm << "true";
|
|
||||||
else
|
|
||||||
strm << "false";
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const double& v, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
boost::io::ios_flags_saver ifs(strm);
|
|
||||||
strm.precision(8);
|
|
||||||
strm << std::fixed << v;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream, class t_type>
|
|
||||||
void dump_as_json(t_stream& strm, const t_type& v, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
strm << v;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class t_stream>
|
|
||||||
void dump_as_json(t_stream& strm, const section& sec, size_t indent, end_of_line_t eol)
|
|
||||||
{
|
|
||||||
auto put_eol = [&]() {
|
|
||||||
switch (eol)
|
|
||||||
{
|
|
||||||
case eol_lf: strm << "\n"; break;
|
|
||||||
case eol_cr: strm << "\r"; break;
|
|
||||||
case eol_space: strm << " "; break;
|
|
||||||
default: strm << "\r\n"; break;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
size_t local_indent = indent + 1;
|
|
||||||
strm << "{";
|
|
||||||
put_eol();
|
|
||||||
std::string indent_str = make_indent(local_indent);
|
|
||||||
if(sec.m_entries.size())
|
|
||||||
{
|
|
||||||
auto it_last = --sec.m_entries.end();
|
|
||||||
for(auto it = sec.m_entries.begin(); it!= sec.m_entries.end();it++)
|
|
||||||
{
|
|
||||||
strm << indent_str << "\"" << misc_utils::parse::transform_to_json_escape_sequence(it->first) << "\"" << ": ";
|
|
||||||
dump_as_json(strm, it->second, local_indent, eol);
|
|
||||||
if(it_last != it)
|
|
||||||
strm << ",";
|
|
||||||
put_eol();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
strm << make_indent(indent) << "}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <iomanip>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <boost/uuid/uuid.hpp>
|
#include <boost/uuid/uuid.hpp>
|
||||||
#include <boost/uuid/uuid_io.hpp>
|
#include <boost/uuid/uuid_io.hpp>
|
||||||
|
|
@ -444,7 +445,7 @@ POP_GCC_WARNINGS
|
||||||
inline bool string_to_num_fast(const std::string& buff, int& val)
|
inline bool string_to_num_fast(const std::string& buff, int& val)
|
||||||
{
|
{
|
||||||
val = atoi(buff.c_str());
|
val = atoi(buff.c_str());
|
||||||
if(buff != "0" && val == 0)
|
if (val == 0 && buff.find_first_not_of('0') != std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,7 @@ namespace epee
|
||||||
|
|
||||||
#define POTENTIAL_HANG_PREVENT_LIMIT 1000
|
#define POTENTIAL_HANG_PREVENT_LIMIT 1000
|
||||||
|
|
||||||
|
#define DEADLOCK_GUARD_JOURNAL_LIMIT 1000
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
|
@ -290,11 +290,11 @@ namespace epee
|
||||||
struct thread_info
|
struct thread_info
|
||||||
{
|
{
|
||||||
std::map<lock_reference_type, size_t> m_owned_objects;
|
std::map<lock_reference_type, size_t> m_owned_objects;
|
||||||
bool is_blocked;
|
bool is_blocked = false;
|
||||||
lock_reference_type blocker_lock;
|
lock_reference_type blocker_lock = nullptr;
|
||||||
const char* block_location;
|
const char* block_location = "unknown";
|
||||||
const char* func_name;
|
const char* func_name = "unknown";
|
||||||
const char* lock_name;
|
const char* lock_name = "unknown";
|
||||||
std::string thread_name;
|
std::string thread_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -307,6 +307,18 @@ namespace epee
|
||||||
std::map<lock_reference_type, thread_id_to_info_map::iterator> m_owned_locks_to_thread;
|
std::map<lock_reference_type, thread_id_to_info_map::iterator> m_owned_locks_to_thread;
|
||||||
// deadlock journal
|
// deadlock journal
|
||||||
std::list<std::string> m_deadlock_journal;
|
std::list<std::string> m_deadlock_journal;
|
||||||
|
//lock/unlock journal
|
||||||
|
struct journal_entry
|
||||||
|
{
|
||||||
|
std::thread::id tid;
|
||||||
|
lock_reference_type lock = nullptr;
|
||||||
|
bool is_lock_event = false;
|
||||||
|
const char* func_name = "unkonwn";
|
||||||
|
const char* lock_name = "unkonwn";
|
||||||
|
std::string thread_name;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::list<journal_entry> m_journal;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void on_before_lock(lock_reference_type lock, const char* func_name, const char* loction, const char* lock_name, const std::string& thread_name)
|
void on_before_lock(lock_reference_type lock, const char* func_name, const char* loction, const char* lock_name, const std::string& thread_name)
|
||||||
|
|
@ -363,6 +375,10 @@ namespace epee
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_journal.push_front(journal_entry{ this_id, lock, false, "", "", ""});
|
||||||
|
if (m_journal.size() > DEADLOCK_GUARD_JOURNAL_LIMIT)
|
||||||
|
m_journal.pop_back();
|
||||||
|
|
||||||
m_owned_locks_to_thread.erase(lock_to_thread_it);
|
m_owned_locks_to_thread.erase(lock_to_thread_it);
|
||||||
}
|
}
|
||||||
it->second.m_owned_objects.erase(ownership_it);
|
it->second.m_owned_objects.erase(ownership_it);
|
||||||
|
|
@ -400,6 +416,15 @@ namespace epee
|
||||||
ss << "-----------------------------------------------------------------------" << std::endl << err << std::endl;
|
ss << "-----------------------------------------------------------------------" << std::endl << err << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ss << "Ownership history history:" << std::endl;
|
||||||
|
size_t count = 0;
|
||||||
|
for (auto entry : m_journal)
|
||||||
|
{
|
||||||
|
ss << "tid(" << entry.thread_name << "): " << entry.tid << ", lock_addr: " << entry.lock << (entry.is_lock_event ? "-->":"<--") << ", func: " << (entry.func_name ? entry.func_name:"") << ", lock_name: " << (entry.lock_name ? entry.lock_name : "") << std::endl;
|
||||||
|
if (++count > 100)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -429,6 +454,10 @@ namespace epee
|
||||||
//need to add lock-to-thread reccord
|
//need to add lock-to-thread reccord
|
||||||
m_owned_locks_to_thread[lock] = it;
|
m_owned_locks_to_thread[lock] = it;
|
||||||
DO_DEBUG_COUT("[" << std::this_thread::get_id() << "][ADDED_OWNERSHIP]: " << lock << std::endl);
|
DO_DEBUG_COUT("[" << std::this_thread::get_id() << "][ADDED_OWNERSHIP]: " << lock << std::endl);
|
||||||
|
m_journal.push_front(journal_entry{ this_id, lock, true, it->second.func_name, it->second.lock_name, it->second.thread_name });
|
||||||
|
if (m_journal.size() > DEADLOCK_GUARD_JOURNAL_LIMIT)
|
||||||
|
m_journal.pop_back();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "zlib/zlib.h"
|
#include "zlib.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace epee
|
namespace epee
|
||||||
|
|
@ -98,6 +98,7 @@ namespace zlib_helper
|
||||||
if (ret != Z_OK)
|
if (ret != Z_OK)
|
||||||
{
|
{
|
||||||
LOCAL_ASSERT(0);
|
LOCAL_ASSERT(0);
|
||||||
|
inflateEnd(&zstream);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,6 +109,7 @@ namespace zlib_helper
|
||||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||||
{
|
{
|
||||||
LOCAL_ASSERT(0);
|
LOCAL_ASSERT(0);
|
||||||
|
inflateEnd(&zstream);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,6 +120,7 @@ namespace zlib_helper
|
||||||
if(ungzip_buff_size == zstream.avail_out)
|
if(ungzip_buff_size == zstream.avail_out)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Can't unpack buffer");
|
LOG_ERROR("Can't unpack buffer");
|
||||||
|
inflateEnd(&zstream);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit bd836936f7ed7e697f36dff709d00a907644172a
|
|
||||||
1
contrib/randomx
Submodule
1
contrib/randomx
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit cf15f4023ec8ddaa842f49111ba80ead1b5937f1
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit b589edb1906dccb387cfeded6ed12286c5f0405f
|
Subproject commit 1be2073ed3da5e9e6e94e8362548df26a22b1bd2
|
||||||
|
|
@ -1,248 +0,0 @@
|
||||||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
|
|
||||||
|
|
||||||
project(zlib C)
|
|
||||||
|
|
||||||
set(VERSION "1.2.11")
|
|
||||||
|
|
||||||
option(ASM686 "Enable building i686 assembly implementation")
|
|
||||||
option(AMD64 "Enable building amd64 assembly implementation")
|
|
||||||
|
|
||||||
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
|
|
||||||
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
|
|
||||||
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
|
|
||||||
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
|
|
||||||
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
|
|
||||||
|
|
||||||
include(CheckTypeSize)
|
|
||||||
include(CheckFunctionExists)
|
|
||||||
include(CheckIncludeFile)
|
|
||||||
include(CheckCSourceCompiles)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
|
||||||
check_include_file(stdint.h HAVE_STDINT_H)
|
|
||||||
check_include_file(stddef.h HAVE_STDDEF_H)
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check to see if we have large file support
|
|
||||||
#
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1)
|
|
||||||
# We add these other definitions here because CheckTypeSize.cmake
|
|
||||||
# in CMake 2.4.x does not automatically do so and we want
|
|
||||||
# compatibility with CMake 2.4.x.
|
|
||||||
if(HAVE_SYS_TYPES_H)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H)
|
|
||||||
endif()
|
|
||||||
if(HAVE_STDINT_H)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H)
|
|
||||||
endif()
|
|
||||||
if(HAVE_STDDEF_H)
|
|
||||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H)
|
|
||||||
endif()
|
|
||||||
check_type_size(off64_t OFF64_T)
|
|
||||||
if(HAVE_OFF64_T)
|
|
||||||
add_definitions(-D_LARGEFILE64_SOURCE=1)
|
|
||||||
endif()
|
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check for fseeko
|
|
||||||
#
|
|
||||||
check_function_exists(fseeko HAVE_FSEEKO)
|
|
||||||
if(NOT HAVE_FSEEKO)
|
|
||||||
add_definitions(-DNO_FSEEKO)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check for unistd.h
|
|
||||||
#
|
|
||||||
check_include_file(unistd.h Z_HAVE_UNISTD_H)
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
set(CMAKE_DEBUG_POSTFIX "d")
|
|
||||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
|
||||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
|
|
||||||
# If we're doing an out of source build and the user has a zconf.h
|
|
||||||
# in their source tree...
|
|
||||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h)
|
|
||||||
message(STATUS "Renaming")
|
|
||||||
message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h")
|
|
||||||
message(STATUS "to 'zconf.h.included' because this file is included with zlib")
|
|
||||||
message(STATUS "but CMake generates it automatically in the build directory.")
|
|
||||||
file(RENAME ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.included)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(ZLIB_PC ${CMAKE_CURRENT_BINARY_DIR}/zlib.pc)
|
|
||||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
|
|
||||||
${ZLIB_PC} @ONLY)
|
|
||||||
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY)
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
#============================================================================
|
|
||||||
# zlib
|
|
||||||
#============================================================================
|
|
||||||
|
|
||||||
set(ZLIB_PUBLIC_HDRS
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/zconf.h
|
|
||||||
zlib.h
|
|
||||||
)
|
|
||||||
set(ZLIB_PRIVATE_HDRS
|
|
||||||
crc32.h
|
|
||||||
deflate.h
|
|
||||||
gzguts.h
|
|
||||||
inffast.h
|
|
||||||
inffixed.h
|
|
||||||
inflate.h
|
|
||||||
inftrees.h
|
|
||||||
trees.h
|
|
||||||
zutil.h
|
|
||||||
)
|
|
||||||
set(ZLIB_SRCS
|
|
||||||
adler32.c
|
|
||||||
compress.c
|
|
||||||
crc32.c
|
|
||||||
deflate.c
|
|
||||||
gzclose.c
|
|
||||||
gzlib.c
|
|
||||||
gzread.c
|
|
||||||
gzwrite.c
|
|
||||||
inflate.c
|
|
||||||
infback.c
|
|
||||||
inftrees.c
|
|
||||||
inffast.c
|
|
||||||
trees.c
|
|
||||||
uncompr.c
|
|
||||||
zutil.c
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT MINGW)
|
|
||||||
set(ZLIB_DLL_SRCS
|
|
||||||
win32/zlib1.rc # If present will override custom build rule below.
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
if(ASM686)
|
|
||||||
set(ZLIB_ASMS contrib/asm686/match.S)
|
|
||||||
elseif (AMD64)
|
|
||||||
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if(ZLIB_ASMS)
|
|
||||||
add_definitions(-DASMV)
|
|
||||||
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
if(ASM686)
|
|
||||||
ENABLE_LANGUAGE(ASM_MASM)
|
|
||||||
set(ZLIB_ASMS
|
|
||||||
contrib/masmx86/inffas32.asm
|
|
||||||
contrib/masmx86/match686.asm
|
|
||||||
)
|
|
||||||
elseif (AMD64)
|
|
||||||
ENABLE_LANGUAGE(ASM_MASM)
|
|
||||||
set(ZLIB_ASMS
|
|
||||||
contrib/masmx64/gvmat64.asm
|
|
||||||
contrib/masmx64/inffasx64.asm
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ZLIB_ASMS)
|
|
||||||
add_definitions(-DASMV -DASMINF)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
|
|
||||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
|
|
||||||
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
|
|
||||||
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
|
|
||||||
|
|
||||||
if(MINGW)
|
|
||||||
# This gets us DLL resource information when compiling on MinGW.
|
|
||||||
if(NOT CMAKE_RC_COMPILER)
|
|
||||||
set(CMAKE_RC_COMPILER windres.exe)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
|
||||||
COMMAND ${CMAKE_RC_COMPILER}
|
|
||||||
-D GCC_WINDRES
|
|
||||||
-I ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
-I ${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
|
|
||||||
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
|
|
||||||
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
|
|
||||||
endif(MINGW)
|
|
||||||
|
|
||||||
#add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
|
||||||
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
|
|
||||||
# set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
|
|
||||||
# set_target_properties(zlib PROPERTIES SOVERSION 1)
|
|
||||||
|
|
||||||
if(NOT CYGWIN)
|
|
||||||
# This property causes shared libraries on Linux to have the full version
|
|
||||||
# encoded into their final filename. We disable this on Cygwin because
|
|
||||||
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
|
|
||||||
# seems to be the default.
|
|
||||||
#
|
|
||||||
# This has no effect with MSVC, on that platform the version info for
|
|
||||||
# the DLL comes from the resource file win32/zlib1.rc
|
|
||||||
# set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(UNIX)
|
|
||||||
# On unix-like platforms the library is almost always called libz
|
|
||||||
set_target_properties( zlibstatic PROPERTIES OUTPUT_NAME z)
|
|
||||||
if(NOT APPLE)
|
|
||||||
#set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
|
|
||||||
endif()
|
|
||||||
elseif(BUILD_SHARED_LIBS AND WIN32)
|
|
||||||
# Creates zlib1.dll when building shared library version
|
|
||||||
# set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(TARGETS zlibstatic
|
|
||||||
RUNTIME DESTINATION "${INSTALL_BIN_DIR}"
|
|
||||||
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}"
|
|
||||||
LIBRARY DESTINATION "${INSTALL_LIB_DIR}" )
|
|
||||||
endif()
|
|
||||||
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
|
|
||||||
endif()
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(FILES zlib.3 DESTINATION "${INSTALL_MAN_DIR}/man3")
|
|
||||||
endif()
|
|
||||||
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
|
|
||||||
install(FILES ${ZLIB_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
#============================================================================
|
|
||||||
# Example binaries
|
|
||||||
#============================================================================
|
|
||||||
|
|
||||||
#add_executable(example test/example.c)
|
|
||||||
#target_link_libraries(example zlib)
|
|
||||||
#add_test(example example)
|
|
||||||
|
|
||||||
#add_executable(minigzip test/minigzip.c)
|
|
||||||
#target_link_libraries(minigzip zlib)
|
|
||||||
|
|
||||||
if(HAVE_OFF64_T)
|
|
||||||
# add_executable(example64 test/example.c)
|
|
||||||
# target_link_libraries(example64 zlib)
|
|
||||||
# set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
|
||||||
# add_test(example64 example64)
|
|
||||||
|
|
||||||
# add_executable(minigzip64 test/minigzip.c)
|
|
||||||
# target_link_libraries(minigzip64 zlib)
|
|
||||||
# set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
|
||||||
endif()
|
|
||||||
File diff suppressed because it is too large
Load diff
368
contrib/zlib/FAQ
368
contrib/zlib/FAQ
|
|
@ -1,368 +0,0 @@
|
||||||
|
|
||||||
Frequently Asked Questions about zlib
|
|
||||||
|
|
||||||
|
|
||||||
If your question is not there, please check the zlib home page
|
|
||||||
http://zlib.net/ which may have more recent information.
|
|
||||||
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
|
|
||||||
|
|
||||||
|
|
||||||
1. Is zlib Y2K-compliant?
|
|
||||||
|
|
||||||
Yes. zlib doesn't handle dates.
|
|
||||||
|
|
||||||
2. Where can I get a Windows DLL version?
|
|
||||||
|
|
||||||
The zlib sources can be compiled without change to produce a DLL. See the
|
|
||||||
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
|
|
||||||
precompiled DLL are found in the zlib web site at http://zlib.net/ .
|
|
||||||
|
|
||||||
3. Where can I get a Visual Basic interface to zlib?
|
|
||||||
|
|
||||||
See
|
|
||||||
* http://marknelson.us/1997/01/01/zlib-engine/
|
|
||||||
* win32/DLL_FAQ.txt in the zlib distribution
|
|
||||||
|
|
||||||
4. compress() returns Z_BUF_ERROR.
|
|
||||||
|
|
||||||
Make sure that before the call of compress(), the length of the compressed
|
|
||||||
buffer is equal to the available size of the compressed buffer and not
|
|
||||||
zero. For Visual Basic, check that this parameter is passed by reference
|
|
||||||
("as any"), not by value ("as long").
|
|
||||||
|
|
||||||
5. deflate() or inflate() returns Z_BUF_ERROR.
|
|
||||||
|
|
||||||
Before making the call, make sure that avail_in and avail_out are not zero.
|
|
||||||
When setting the parameter flush equal to Z_FINISH, also make sure that
|
|
||||||
avail_out is big enough to allow processing all pending input. Note that a
|
|
||||||
Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
|
|
||||||
made with more input or output space. A Z_BUF_ERROR may in fact be
|
|
||||||
unavoidable depending on how the functions are used, since it is not
|
|
||||||
possible to tell whether or not there is more output pending when
|
|
||||||
strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
|
|
||||||
heavily annotated example.
|
|
||||||
|
|
||||||
6. Where's the zlib documentation (man pages, etc.)?
|
|
||||||
|
|
||||||
It's in zlib.h . Examples of zlib usage are in the files test/example.c
|
|
||||||
and test/minigzip.c, with more in examples/ .
|
|
||||||
|
|
||||||
7. Why don't you use GNU autoconf or libtool or ...?
|
|
||||||
|
|
||||||
Because we would like to keep zlib as a very small and simple package.
|
|
||||||
zlib is rather portable and doesn't need much configuration.
|
|
||||||
|
|
||||||
8. I found a bug in zlib.
|
|
||||||
|
|
||||||
Most of the time, such problems are due to an incorrect usage of zlib.
|
|
||||||
Please try to reproduce the problem with a small program and send the
|
|
||||||
corresponding source to us at zlib@gzip.org . Do not send multi-megabyte
|
|
||||||
data files without prior agreement.
|
|
||||||
|
|
||||||
9. Why do I get "undefined reference to gzputc"?
|
|
||||||
|
|
||||||
If "make test" produces something like
|
|
||||||
|
|
||||||
example.o(.text+0x154): undefined reference to `gzputc'
|
|
||||||
|
|
||||||
check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
|
|
||||||
/usr/X11R6/lib. Remove any old versions, then do "make install".
|
|
||||||
|
|
||||||
10. I need a Delphi interface to zlib.
|
|
||||||
|
|
||||||
See the contrib/delphi directory in the zlib distribution.
|
|
||||||
|
|
||||||
11. Can zlib handle .zip archives?
|
|
||||||
|
|
||||||
Not by itself, no. See the directory contrib/minizip in the zlib
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
12. Can zlib handle .Z files?
|
|
||||||
|
|
||||||
No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
|
|
||||||
the code of uncompress on your own.
|
|
||||||
|
|
||||||
13. How can I make a Unix shared library?
|
|
||||||
|
|
||||||
By default a shared (and a static) library is built for Unix. So:
|
|
||||||
|
|
||||||
make distclean
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
|
|
||||||
14. How do I install a shared zlib library on Unix?
|
|
||||||
|
|
||||||
After the above, then:
|
|
||||||
|
|
||||||
make install
|
|
||||||
|
|
||||||
However, many flavors of Unix come with a shared zlib already installed.
|
|
||||||
Before going to the trouble of compiling a shared version of zlib and
|
|
||||||
trying to install it, you may want to check if it's already there! If you
|
|
||||||
can #include <zlib.h>, it's there. The -lz option will probably link to
|
|
||||||
it. You can check the version at the top of zlib.h or with the
|
|
||||||
ZLIB_VERSION symbol defined in zlib.h .
|
|
||||||
|
|
||||||
15. I have a question about OttoPDF.
|
|
||||||
|
|
||||||
We are not the authors of OttoPDF. The real author is on the OttoPDF web
|
|
||||||
site: Joel Hainley, jhainley@myndkryme.com.
|
|
||||||
|
|
||||||
16. Can zlib decode Flate data in an Adobe PDF file?
|
|
||||||
|
|
||||||
Yes. See http://www.pdflib.com/ . To modify PDF forms, see
|
|
||||||
http://sourceforge.net/projects/acroformtool/ .
|
|
||||||
|
|
||||||
17. Why am I getting this "register_frame_info not found" error on Solaris?
|
|
||||||
|
|
||||||
After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
|
|
||||||
generates an error such as:
|
|
||||||
|
|
||||||
ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
|
|
||||||
symbol __register_frame_info: referenced symbol not found
|
|
||||||
|
|
||||||
The symbol __register_frame_info is not part of zlib, it is generated by
|
|
||||||
the C compiler (cc or gcc). You must recompile applications using zlib
|
|
||||||
which have this problem. This problem is specific to Solaris. See
|
|
||||||
http://www.sunfreeware.com for Solaris versions of zlib and applications
|
|
||||||
using zlib.
|
|
||||||
|
|
||||||
18. Why does gzip give an error on a file I make with compress/deflate?
|
|
||||||
|
|
||||||
The compress and deflate functions produce data in the zlib format, which
|
|
||||||
is different and incompatible with the gzip format. The gz* functions in
|
|
||||||
zlib on the other hand use the gzip format. Both the zlib and gzip formats
|
|
||||||
use the same compressed data format internally, but have different headers
|
|
||||||
and trailers around the compressed data.
|
|
||||||
|
|
||||||
19. Ok, so why are there two different formats?
|
|
||||||
|
|
||||||
The gzip format was designed to retain the directory information about a
|
|
||||||
single file, such as the name and last modification date. The zlib format
|
|
||||||
on the other hand was designed for in-memory and communication channel
|
|
||||||
applications, and has a much more compact header and trailer and uses a
|
|
||||||
faster integrity check than gzip.
|
|
||||||
|
|
||||||
20. Well that's nice, but how do I make a gzip file in memory?
|
|
||||||
|
|
||||||
You can request that deflate write the gzip format instead of the zlib
|
|
||||||
format using deflateInit2(). You can also request that inflate decode the
|
|
||||||
gzip format using inflateInit2(). Read zlib.h for more details.
|
|
||||||
|
|
||||||
21. Is zlib thread-safe?
|
|
||||||
|
|
||||||
Yes. However any library routines that zlib uses and any application-
|
|
||||||
provided memory allocation routines must also be thread-safe. zlib's gz*
|
|
||||||
functions use stdio library routines, and most of zlib's functions use the
|
|
||||||
library memory allocation routines by default. zlib's *Init* functions
|
|
||||||
allow for the application to provide custom memory allocation routines.
|
|
||||||
|
|
||||||
Of course, you should only operate on any given zlib or gzip stream from a
|
|
||||||
single thread at a time.
|
|
||||||
|
|
||||||
22. Can I use zlib in my commercial application?
|
|
||||||
|
|
||||||
Yes. Please read the license in zlib.h.
|
|
||||||
|
|
||||||
23. Is zlib under the GNU license?
|
|
||||||
|
|
||||||
No. Please read the license in zlib.h.
|
|
||||||
|
|
||||||
24. The license says that altered source versions must be "plainly marked". So
|
|
||||||
what exactly do I need to do to meet that requirement?
|
|
||||||
|
|
||||||
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
|
|
||||||
particular, the final version number needs to be changed to "f", and an
|
|
||||||
identification string should be appended to ZLIB_VERSION. Version numbers
|
|
||||||
x.x.x.f are reserved for modifications to zlib by others than the zlib
|
|
||||||
maintainers. For example, if the version of the base zlib you are altering
|
|
||||||
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
|
|
||||||
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
|
|
||||||
update the version strings in deflate.c and inftrees.c.
|
|
||||||
|
|
||||||
For altered source distributions, you should also note the origin and
|
|
||||||
nature of the changes in zlib.h, as well as in ChangeLog and README, along
|
|
||||||
with the dates of the alterations. The origin should include at least your
|
|
||||||
name (or your company's name), and an email address to contact for help or
|
|
||||||
issues with the library.
|
|
||||||
|
|
||||||
Note that distributing a compiled zlib library along with zlib.h and
|
|
||||||
zconf.h is also a source distribution, and so you should change
|
|
||||||
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
|
|
||||||
in zlib.h as you would for a full source distribution.
|
|
||||||
|
|
||||||
25. Will zlib work on a big-endian or little-endian architecture, and can I
|
|
||||||
exchange compressed data between them?
|
|
||||||
|
|
||||||
Yes and yes.
|
|
||||||
|
|
||||||
26. Will zlib work on a 64-bit machine?
|
|
||||||
|
|
||||||
Yes. It has been tested on 64-bit machines, and has no dependence on any
|
|
||||||
data types being limited to 32-bits in length. If you have any
|
|
||||||
difficulties, please provide a complete problem report to zlib@gzip.org
|
|
||||||
|
|
||||||
27. Will zlib decompress data from the PKWare Data Compression Library?
|
|
||||||
|
|
||||||
No. The PKWare DCL uses a completely different compressed data format than
|
|
||||||
does PKZIP and zlib. However, you can look in zlib's contrib/blast
|
|
||||||
directory for a possible solution to your problem.
|
|
||||||
|
|
||||||
28. Can I access data randomly in a compressed stream?
|
|
||||||
|
|
||||||
No, not without some preparation. If when compressing you periodically use
|
|
||||||
Z_FULL_FLUSH, carefully write all the pending data at those points, and
|
|
||||||
keep an index of those locations, then you can start decompression at those
|
|
||||||
points. You have to be careful to not use Z_FULL_FLUSH too often, since it
|
|
||||||
can significantly degrade compression. Alternatively, you can scan a
|
|
||||||
deflate stream once to generate an index, and then use that index for
|
|
||||||
random access. See examples/zran.c .
|
|
||||||
|
|
||||||
29. Does zlib work on MVS, OS/390, CICS, etc.?
|
|
||||||
|
|
||||||
It has in the past, but we have not heard of any recent evidence. There
|
|
||||||
were working ports of zlib 1.1.4 to MVS, but those links no longer work.
|
|
||||||
If you know of recent, successful applications of zlib on these operating
|
|
||||||
systems, please let us know. Thanks.
|
|
||||||
|
|
||||||
30. Is there some simpler, easier to read version of inflate I can look at to
|
|
||||||
understand the deflate format?
|
|
||||||
|
|
||||||
First off, you should read RFC 1951. Second, yes. Look in zlib's
|
|
||||||
contrib/puff directory.
|
|
||||||
|
|
||||||
31. Does zlib infringe on any patents?
|
|
||||||
|
|
||||||
As far as we know, no. In fact, that was originally the whole point behind
|
|
||||||
zlib. Look here for some more information:
|
|
||||||
|
|
||||||
http://www.gzip.org/#faq11
|
|
||||||
|
|
||||||
32. Can zlib work with greater than 4 GB of data?
|
|
||||||
|
|
||||||
Yes. inflate() and deflate() will process any amount of data correctly.
|
|
||||||
Each call of inflate() or deflate() is limited to input and output chunks
|
|
||||||
of the maximum value that can be stored in the compiler's "unsigned int"
|
|
||||||
type, but there is no limit to the number of chunks. Note however that the
|
|
||||||
strm.total_in and strm_total_out counters may be limited to 4 GB. These
|
|
||||||
counters are provided as a convenience and are not used internally by
|
|
||||||
inflate() or deflate(). The application can easily set up its own counters
|
|
||||||
updated after each call of inflate() or deflate() to count beyond 4 GB.
|
|
||||||
compress() and uncompress() may be limited to 4 GB, since they operate in a
|
|
||||||
single call. gzseek() and gztell() may be limited to 4 GB depending on how
|
|
||||||
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
|
|
||||||
|
|
||||||
The word "may" appears several times above since there is a 4 GB limit only
|
|
||||||
if the compiler's "long" type is 32 bits. If the compiler's "long" type is
|
|
||||||
64 bits, then the limit is 16 exabytes.
|
|
||||||
|
|
||||||
33. Does zlib have any security vulnerabilities?
|
|
||||||
|
|
||||||
The only one that we are aware of is potentially in gzprintf(). If zlib is
|
|
||||||
compiled to use sprintf() or vsprintf(), then there is no protection
|
|
||||||
against a buffer overflow of an 8K string space (or other value as set by
|
|
||||||
gzbuffer()), other than the caller of gzprintf() assuring that the output
|
|
||||||
will not exceed 8K. On the other hand, if zlib is compiled to use
|
|
||||||
snprintf() or vsnprintf(), which should normally be the case, then there is
|
|
||||||
no vulnerability. The ./configure script will display warnings if an
|
|
||||||
insecure variation of sprintf() will be used by gzprintf(). Also the
|
|
||||||
zlibCompileFlags() function will return information on what variant of
|
|
||||||
sprintf() is used by gzprintf().
|
|
||||||
|
|
||||||
If you don't have snprintf() or vsnprintf() and would like one, you can
|
|
||||||
find a portable implementation here:
|
|
||||||
|
|
||||||
http://www.ijs.si/software/snprintf/
|
|
||||||
|
|
||||||
Note that you should be using the most recent version of zlib. Versions
|
|
||||||
1.1.3 and before were subject to a double-free vulnerability, and versions
|
|
||||||
1.2.1 and 1.2.2 were subject to an access exception when decompressing
|
|
||||||
invalid compressed data.
|
|
||||||
|
|
||||||
34. Is there a Java version of zlib?
|
|
||||||
|
|
||||||
Probably what you want is to use zlib in Java. zlib is already included
|
|
||||||
as part of the Java SDK in the java.util.zip package. If you really want
|
|
||||||
a version of zlib written in the Java language, look on the zlib home
|
|
||||||
page for links: http://zlib.net/ .
|
|
||||||
|
|
||||||
35. I get this or that compiler or source-code scanner warning when I crank it
|
|
||||||
up to maximally-pedantic. Can't you guys write proper code?
|
|
||||||
|
|
||||||
Many years ago, we gave up attempting to avoid warnings on every compiler
|
|
||||||
in the universe. It just got to be a waste of time, and some compilers
|
|
||||||
were downright silly as well as contradicted each other. So now, we simply
|
|
||||||
make sure that the code always works.
|
|
||||||
|
|
||||||
36. Valgrind (or some similar memory access checker) says that deflate is
|
|
||||||
performing a conditional jump that depends on an uninitialized value.
|
|
||||||
Isn't that a bug?
|
|
||||||
|
|
||||||
No. That is intentional for performance reasons, and the output of deflate
|
|
||||||
is not affected. This only started showing up recently since zlib 1.2.x
|
|
||||||
uses malloc() by default for allocations, whereas earlier versions used
|
|
||||||
calloc(), which zeros out the allocated memory. Even though the code was
|
|
||||||
correct, versions 1.2.4 and later was changed to not stimulate these
|
|
||||||
checkers.
|
|
||||||
|
|
||||||
37. Will zlib read the (insert any ancient or arcane format here) compressed
|
|
||||||
data format?
|
|
||||||
|
|
||||||
Probably not. Look in the comp.compression FAQ for pointers to various
|
|
||||||
formats and associated software.
|
|
||||||
|
|
||||||
38. How can I encrypt/decrypt zip files with zlib?
|
|
||||||
|
|
||||||
zlib doesn't support encryption. The original PKZIP encryption is very
|
|
||||||
weak and can be broken with freely available programs. To get strong
|
|
||||||
encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
|
|
||||||
compression. For PKZIP compatible "encryption", look at
|
|
||||||
http://www.info-zip.org/
|
|
||||||
|
|
||||||
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
|
|
||||||
|
|
||||||
"gzip" is the gzip format, and "deflate" is the zlib format. They should
|
|
||||||
probably have called the second one "zlib" instead to avoid confusion with
|
|
||||||
the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
|
|
||||||
correctly points to the zlib specification in RFC 1950 for the "deflate"
|
|
||||||
transfer encoding, there have been reports of servers and browsers that
|
|
||||||
incorrectly produce or expect raw deflate data per the deflate
|
|
||||||
specification in RFC 1951, most notably Microsoft. So even though the
|
|
||||||
"deflate" transfer encoding using the zlib format would be the more
|
|
||||||
efficient approach (and in fact exactly what the zlib format was designed
|
|
||||||
for), using the "gzip" transfer encoding is probably more reliable due to
|
|
||||||
an unfortunate choice of name on the part of the HTTP 1.1 authors.
|
|
||||||
|
|
||||||
Bottom line: use the gzip format for HTTP 1.1 encoding.
|
|
||||||
|
|
||||||
40. Does zlib support the new "Deflate64" format introduced by PKWare?
|
|
||||||
|
|
||||||
No. PKWare has apparently decided to keep that format proprietary, since
|
|
||||||
they have not documented it as they have previous compression formats. In
|
|
||||||
any case, the compression improvements are so modest compared to other more
|
|
||||||
modern approaches, that it's not worth the effort to implement.
|
|
||||||
|
|
||||||
41. I'm having a problem with the zip functions in zlib, can you help?
|
|
||||||
|
|
||||||
There are no zip functions in zlib. You are probably using minizip by
|
|
||||||
Giles Vollant, which is found in the contrib directory of zlib. It is not
|
|
||||||
part of zlib. In fact none of the stuff in contrib is part of zlib. The
|
|
||||||
files in there are not supported by the zlib authors. You need to contact
|
|
||||||
the authors of the respective contribution for help.
|
|
||||||
|
|
||||||
42. The match.asm code in contrib is under the GNU General Public License.
|
|
||||||
Since it's part of zlib, doesn't that mean that all of zlib falls under the
|
|
||||||
GNU GPL?
|
|
||||||
|
|
||||||
No. The files in contrib are not part of zlib. They were contributed by
|
|
||||||
other authors and are provided as a convenience to the user within the zlib
|
|
||||||
distribution. Each item in contrib has its own license.
|
|
||||||
|
|
||||||
43. Is zlib subject to export controls? What is its ECCN?
|
|
||||||
|
|
||||||
zlib is not subject to export controls, and so is classified as EAR99.
|
|
||||||
|
|
||||||
44. Can you please sign these lengthy legal documents and fax them back to us
|
|
||||||
so that we can use your software in our product?
|
|
||||||
|
|
||||||
No. Go away. Shoo.
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
CMakeLists.txt cmake build file
|
|
||||||
ChangeLog history of changes
|
|
||||||
FAQ Frequently Asked Questions about zlib
|
|
||||||
INDEX this file
|
|
||||||
Makefile dummy Makefile that tells you to ./configure
|
|
||||||
Makefile.in template for Unix Makefile
|
|
||||||
README guess what
|
|
||||||
configure configure script for Unix
|
|
||||||
make_vms.com makefile for VMS
|
|
||||||
test/example.c zlib usages examples for build testing
|
|
||||||
test/minigzip.c minimal gzip-like functionality for build testing
|
|
||||||
test/infcover.c inf*.c code coverage for build coverage testing
|
|
||||||
treebuild.xml XML description of source file dependencies
|
|
||||||
zconf.h.cmakein zconf.h template for cmake
|
|
||||||
zconf.h.in zconf.h template for configure
|
|
||||||
zlib.3 Man page for zlib
|
|
||||||
zlib.3.pdf Man page in PDF format
|
|
||||||
zlib.map Linux symbol information
|
|
||||||
zlib.pc.in Template for pkg-config descriptor
|
|
||||||
zlib.pc.cmakein zlib.pc template for cmake
|
|
||||||
zlib2ansi perl script to convert source files for C++ compilation
|
|
||||||
|
|
||||||
amiga/ makefiles for Amiga SAS C
|
|
||||||
as400/ makefiles for AS/400
|
|
||||||
doc/ documentation for formats and algorithms
|
|
||||||
msdos/ makefiles for MSDOS
|
|
||||||
nintendods/ makefile for Nintendo DS
|
|
||||||
old/ makefiles for various architectures and zlib documentation
|
|
||||||
files that have not yet been updated for zlib 1.2.x
|
|
||||||
qnx/ makefiles for QNX
|
|
||||||
watcom/ makefiles for OpenWatcom
|
|
||||||
win32/ makefiles for Windows
|
|
||||||
|
|
||||||
zlib public header files (required for library use):
|
|
||||||
zconf.h
|
|
||||||
zlib.h
|
|
||||||
|
|
||||||
private source files used to build the zlib library:
|
|
||||||
adler32.c
|
|
||||||
compress.c
|
|
||||||
crc32.c
|
|
||||||
crc32.h
|
|
||||||
deflate.c
|
|
||||||
deflate.h
|
|
||||||
gzclose.c
|
|
||||||
gzguts.h
|
|
||||||
gzlib.c
|
|
||||||
gzread.c
|
|
||||||
gzwrite.c
|
|
||||||
infback.c
|
|
||||||
inffast.c
|
|
||||||
inffast.h
|
|
||||||
inffixed.h
|
|
||||||
inflate.c
|
|
||||||
inflate.h
|
|
||||||
inftrees.c
|
|
||||||
inftrees.h
|
|
||||||
trees.c
|
|
||||||
trees.h
|
|
||||||
uncompr.c
|
|
||||||
zutil.c
|
|
||||||
zutil.h
|
|
||||||
|
|
||||||
source files for sample programs
|
|
||||||
See examples/README.examples
|
|
||||||
|
|
||||||
unsupported contributions by third parties
|
|
||||||
See contrib/README.contrib
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
all:
|
|
||||||
-@echo "Please use ./configure first. Thank you."
|
|
||||||
|
|
||||||
distclean:
|
|
||||||
make -f Makefile.in distclean
|
|
||||||
|
|
@ -1,410 +0,0 @@
|
||||||
# Makefile for zlib
|
|
||||||
# Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
|
|
||||||
# For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
|
|
||||||
# To compile and test, type:
|
|
||||||
# ./configure; make test
|
|
||||||
# Normally configure builds both a static and a shared library.
|
|
||||||
# If you want to build just a static library, use: ./configure --static
|
|
||||||
|
|
||||||
# To use the asm code, type:
|
|
||||||
# cp contrib/asm?86/match.S ./match.S
|
|
||||||
# make LOC=-DASMV OBJA=match.o
|
|
||||||
|
|
||||||
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
|
|
||||||
# make install
|
|
||||||
# To install in $HOME instead of /usr/local, use:
|
|
||||||
# make install prefix=$HOME
|
|
||||||
|
|
||||||
CC=cc
|
|
||||||
|
|
||||||
CFLAGS=-O
|
|
||||||
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
|
|
||||||
#CFLAGS=-g -DZLIB_DEBUG
|
|
||||||
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
|
|
||||||
# -Wstrict-prototypes -Wmissing-prototypes
|
|
||||||
|
|
||||||
SFLAGS=-O
|
|
||||||
LDFLAGS=
|
|
||||||
TEST_LDFLAGS=-L. libz.a
|
|
||||||
LDSHARED=$(CC)
|
|
||||||
CPP=$(CC) -E
|
|
||||||
|
|
||||||
STATICLIB=libz.a
|
|
||||||
SHAREDLIB=libz.so
|
|
||||||
SHAREDLIBV=libz.so.1.2.11
|
|
||||||
SHAREDLIBM=libz.so.1
|
|
||||||
LIBS=$(STATICLIB) $(SHAREDLIBV)
|
|
||||||
|
|
||||||
AR=ar
|
|
||||||
ARFLAGS=rc
|
|
||||||
RANLIB=ranlib
|
|
||||||
LDCONFIG=ldconfig
|
|
||||||
LDSHAREDLIBC=-lc
|
|
||||||
TAR=tar
|
|
||||||
SHELL=/bin/sh
|
|
||||||
EXE=
|
|
||||||
|
|
||||||
prefix = /usr/local
|
|
||||||
exec_prefix = ${prefix}
|
|
||||||
libdir = ${exec_prefix}/lib
|
|
||||||
sharedlibdir = ${libdir}
|
|
||||||
includedir = ${prefix}/include
|
|
||||||
mandir = ${prefix}/share/man
|
|
||||||
man3dir = ${mandir}/man3
|
|
||||||
pkgconfigdir = ${libdir}/pkgconfig
|
|
||||||
SRCDIR=
|
|
||||||
ZINC=
|
|
||||||
ZINCOUT=-I.
|
|
||||||
|
|
||||||
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
|
|
||||||
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
|
|
||||||
OBJC = $(OBJZ) $(OBJG)
|
|
||||||
|
|
||||||
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
|
|
||||||
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
|
|
||||||
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
|
|
||||||
|
|
||||||
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
|
|
||||||
OBJA =
|
|
||||||
PIC_OBJA =
|
|
||||||
|
|
||||||
OBJS = $(OBJC) $(OBJA)
|
|
||||||
|
|
||||||
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
|
|
||||||
|
|
||||||
all: static shared
|
|
||||||
|
|
||||||
static: example$(EXE) minigzip$(EXE)
|
|
||||||
|
|
||||||
shared: examplesh$(EXE) minigzipsh$(EXE)
|
|
||||||
|
|
||||||
all64: example64$(EXE) minigzip64$(EXE)
|
|
||||||
|
|
||||||
check: test
|
|
||||||
|
|
||||||
test: all teststatic testshared
|
|
||||||
|
|
||||||
teststatic: static
|
|
||||||
@TMPST=tmpst_$$; \
|
|
||||||
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
|
|
||||||
echo ' *** zlib test OK ***'; \
|
|
||||||
else \
|
|
||||||
echo ' *** zlib test FAILED ***'; false; \
|
|
||||||
fi; \
|
|
||||||
rm -f $$TMPST
|
|
||||||
|
|
||||||
testshared: shared
|
|
||||||
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
|
|
||||||
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
|
|
||||||
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
|
|
||||||
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
|
|
||||||
TMPSH=tmpsh_$$; \
|
|
||||||
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
|
|
||||||
echo ' *** zlib shared test OK ***'; \
|
|
||||||
else \
|
|
||||||
echo ' *** zlib shared test FAILED ***'; false; \
|
|
||||||
fi; \
|
|
||||||
rm -f $$TMPSH
|
|
||||||
|
|
||||||
test64: all64
|
|
||||||
@TMP64=tmp64_$$; \
|
|
||||||
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
|
|
||||||
echo ' *** zlib 64-bit test OK ***'; \
|
|
||||||
else \
|
|
||||||
echo ' *** zlib 64-bit test FAILED ***'; false; \
|
|
||||||
fi; \
|
|
||||||
rm -f $$TMP64
|
|
||||||
|
|
||||||
infcover.o: $(SRCDIR)test/infcover.c $(SRCDIR)zlib.h zconf.h
|
|
||||||
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/infcover.c
|
|
||||||
|
|
||||||
infcover: infcover.o libz.a
|
|
||||||
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
|
|
||||||
|
|
||||||
cover: infcover
|
|
||||||
rm -f *.gcda
|
|
||||||
./infcover
|
|
||||||
gcov inf*.c
|
|
||||||
|
|
||||||
libz.a: $(OBJS)
|
|
||||||
$(AR) $(ARFLAGS) $@ $(OBJS)
|
|
||||||
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
|
||||||
|
|
||||||
match.o: match.S
|
|
||||||
$(CPP) match.S > _match.s
|
|
||||||
$(CC) -c _match.s
|
|
||||||
mv _match.o match.o
|
|
||||||
rm -f _match.s
|
|
||||||
|
|
||||||
match.lo: match.S
|
|
||||||
$(CPP) match.S > _match.s
|
|
||||||
$(CC) -c -fPIC _match.s
|
|
||||||
mv _match.o match.lo
|
|
||||||
rm -f _match.s
|
|
||||||
|
|
||||||
example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
|
|
||||||
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
|
|
||||||
|
|
||||||
minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
|
|
||||||
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
|
|
||||||
|
|
||||||
example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
|
|
||||||
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
|
|
||||||
|
|
||||||
minigzip64.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
|
|
||||||
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/minigzip.c
|
|
||||||
|
|
||||||
|
|
||||||
adler32.o: $(SRCDIR)adler32.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)adler32.c
|
|
||||||
|
|
||||||
crc32.o: $(SRCDIR)crc32.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c
|
|
||||||
|
|
||||||
deflate.o: $(SRCDIR)deflate.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
|
|
||||||
|
|
||||||
infback.o: $(SRCDIR)infback.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c
|
|
||||||
|
|
||||||
inffast.o: $(SRCDIR)inffast.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c
|
|
||||||
|
|
||||||
inflate.o: $(SRCDIR)inflate.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c
|
|
||||||
|
|
||||||
inftrees.o: $(SRCDIR)inftrees.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c
|
|
||||||
|
|
||||||
trees.o: $(SRCDIR)trees.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)trees.c
|
|
||||||
|
|
||||||
zutil.o: $(SRCDIR)zutil.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)zutil.c
|
|
||||||
|
|
||||||
compress.o: $(SRCDIR)compress.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)compress.c
|
|
||||||
|
|
||||||
uncompr.o: $(SRCDIR)uncompr.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)uncompr.c
|
|
||||||
|
|
||||||
gzclose.o: $(SRCDIR)gzclose.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzclose.c
|
|
||||||
|
|
||||||
gzlib.o: $(SRCDIR)gzlib.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzlib.c
|
|
||||||
|
|
||||||
gzread.o: $(SRCDIR)gzread.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzread.c
|
|
||||||
|
|
||||||
gzwrite.o: $(SRCDIR)gzwrite.c
|
|
||||||
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)gzwrite.c
|
|
||||||
|
|
||||||
|
|
||||||
adler32.lo: $(SRCDIR)adler32.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/adler32.o $(SRCDIR)adler32.c
|
|
||||||
-@mv objs/adler32.o $@
|
|
||||||
|
|
||||||
crc32.lo: $(SRCDIR)crc32.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
|
|
||||||
-@mv objs/crc32.o $@
|
|
||||||
|
|
||||||
deflate.lo: $(SRCDIR)deflate.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c
|
|
||||||
-@mv objs/deflate.o $@
|
|
||||||
|
|
||||||
infback.lo: $(SRCDIR)infback.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c
|
|
||||||
-@mv objs/infback.o $@
|
|
||||||
|
|
||||||
inffast.lo: $(SRCDIR)inffast.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c
|
|
||||||
-@mv objs/inffast.o $@
|
|
||||||
|
|
||||||
inflate.lo: $(SRCDIR)inflate.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c
|
|
||||||
-@mv objs/inflate.o $@
|
|
||||||
|
|
||||||
inftrees.lo: $(SRCDIR)inftrees.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c
|
|
||||||
-@mv objs/inftrees.o $@
|
|
||||||
|
|
||||||
trees.lo: $(SRCDIR)trees.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/trees.o $(SRCDIR)trees.c
|
|
||||||
-@mv objs/trees.o $@
|
|
||||||
|
|
||||||
zutil.lo: $(SRCDIR)zutil.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/zutil.o $(SRCDIR)zutil.c
|
|
||||||
-@mv objs/zutil.o $@
|
|
||||||
|
|
||||||
compress.lo: $(SRCDIR)compress.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/compress.o $(SRCDIR)compress.c
|
|
||||||
-@mv objs/compress.o $@
|
|
||||||
|
|
||||||
uncompr.lo: $(SRCDIR)uncompr.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/uncompr.o $(SRCDIR)uncompr.c
|
|
||||||
-@mv objs/uncompr.o $@
|
|
||||||
|
|
||||||
gzclose.lo: $(SRCDIR)gzclose.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzclose.o $(SRCDIR)gzclose.c
|
|
||||||
-@mv objs/gzclose.o $@
|
|
||||||
|
|
||||||
gzlib.lo: $(SRCDIR)gzlib.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzlib.o $(SRCDIR)gzlib.c
|
|
||||||
-@mv objs/gzlib.o $@
|
|
||||||
|
|
||||||
gzread.lo: $(SRCDIR)gzread.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzread.o $(SRCDIR)gzread.c
|
|
||||||
-@mv objs/gzread.o $@
|
|
||||||
|
|
||||||
gzwrite.lo: $(SRCDIR)gzwrite.c
|
|
||||||
-@mkdir objs 2>/dev/null || test -d objs
|
|
||||||
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/gzwrite.o $(SRCDIR)gzwrite.c
|
|
||||||
-@mv objs/gzwrite.o $@
|
|
||||||
|
|
||||||
|
|
||||||
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
|
|
||||||
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
|
|
||||||
rm -f $(SHAREDLIB) $(SHAREDLIBM)
|
|
||||||
ln -s $@ $(SHAREDLIB)
|
|
||||||
ln -s $@ $(SHAREDLIBM)
|
|
||||||
-@rmdir objs
|
|
||||||
|
|
||||||
example$(EXE): example.o $(STATICLIB)
|
|
||||||
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
|
|
||||||
|
|
||||||
minigzip$(EXE): minigzip.o $(STATICLIB)
|
|
||||||
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
|
|
||||||
|
|
||||||
examplesh$(EXE): example.o $(SHAREDLIBV)
|
|
||||||
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
|
|
||||||
|
|
||||||
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
|
|
||||||
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
|
|
||||||
|
|
||||||
example64$(EXE): example64.o $(STATICLIB)
|
|
||||||
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
|
|
||||||
|
|
||||||
minigzip64$(EXE): minigzip64.o $(STATICLIB)
|
|
||||||
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
|
|
||||||
|
|
||||||
install-libs: $(LIBS)
|
|
||||||
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
|
||||||
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
|
|
||||||
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
|
|
||||||
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
|
|
||||||
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
|
|
||||||
rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
|
|
||||||
cp $(STATICLIB) $(DESTDIR)$(libdir)
|
|
||||||
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
|
|
||||||
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
|
|
||||||
-@if test -n "$(SHAREDLIBV)"; then \
|
|
||||||
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
|
|
||||||
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
|
|
||||||
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
|
|
||||||
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
|
|
||||||
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
|
|
||||||
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
|
|
||||||
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
|
|
||||||
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
|
|
||||||
($(LDCONFIG) || true) >/dev/null 2>&1; \
|
|
||||||
fi
|
|
||||||
rm -f $(DESTDIR)$(man3dir)/zlib.3
|
|
||||||
cp $(SRCDIR)zlib.3 $(DESTDIR)$(man3dir)
|
|
||||||
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
|
|
||||||
rm -f $(DESTDIR)$(pkgconfigdir)/zlib.pc
|
|
||||||
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
|
|
||||||
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
|
|
||||||
# The ranlib in install is needed on NeXTSTEP which checks file times
|
|
||||||
# ldconfig is for Linux
|
|
||||||
|
|
||||||
install: install-libs
|
|
||||||
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
|
|
||||||
rm -f $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
|
|
||||||
cp $(SRCDIR)zlib.h zconf.h $(DESTDIR)$(includedir)
|
|
||||||
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
cd $(DESTDIR)$(includedir) && rm -f zlib.h zconf.h
|
|
||||||
cd $(DESTDIR)$(libdir) && rm -f libz.a; \
|
|
||||||
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
|
|
||||||
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
|
|
||||||
fi
|
|
||||||
cd $(DESTDIR)$(man3dir) && rm -f zlib.3
|
|
||||||
cd $(DESTDIR)$(pkgconfigdir) && rm -f zlib.pc
|
|
||||||
|
|
||||||
docs: zlib.3.pdf
|
|
||||||
|
|
||||||
zlib.3.pdf: $(SRCDIR)zlib.3
|
|
||||||
groff -mandoc -f H -T ps $(SRCDIR)zlib.3 | ps2pdf - $@
|
|
||||||
|
|
||||||
zconf.h.cmakein: $(SRCDIR)zconf.h.in
|
|
||||||
-@ TEMPFILE=zconfh_$$; \
|
|
||||||
echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
|
|
||||||
sed -f $$TEMPFILE $(SRCDIR)zconf.h.in > $@ &&\
|
|
||||||
touch -r $(SRCDIR)zconf.h.in $@ &&\
|
|
||||||
rm $$TEMPFILE
|
|
||||||
|
|
||||||
zconf: $(SRCDIR)zconf.h.in
|
|
||||||
cp -p $(SRCDIR)zconf.h.in zconf.h
|
|
||||||
|
|
||||||
mostlyclean: clean
|
|
||||||
clean:
|
|
||||||
rm -f *.o *.lo *~ \
|
|
||||||
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
|
||||||
example64$(EXE) minigzip64$(EXE) \
|
|
||||||
infcover \
|
|
||||||
libz.* foo.gz so_locations \
|
|
||||||
_match.s maketree contrib/infback9/*.o
|
|
||||||
rm -rf objs
|
|
||||||
rm -f *.gcda *.gcno *.gcov
|
|
||||||
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
|
|
||||||
|
|
||||||
maintainer-clean: distclean
|
|
||||||
distclean: clean zconf zconf.h.cmakein docs
|
|
||||||
rm -f Makefile zlib.pc configure.log
|
|
||||||
-@rm -f .DS_Store
|
|
||||||
@if [ -f Makefile.in ]; then \
|
|
||||||
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
|
|
||||||
printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile ; \
|
|
||||||
touch -r $(SRCDIR)Makefile.in Makefile ; fi
|
|
||||||
@if [ ! -f zconf.h.in ]; then rm -f zconf.h zconf.h.cmakein ; fi
|
|
||||||
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf ; fi
|
|
||||||
|
|
||||||
tags:
|
|
||||||
etags $(SRCDIR)*.[ch]
|
|
||||||
|
|
||||||
adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
|
|
||||||
gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
|
|
||||||
compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
|
|
||||||
crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
|
|
||||||
deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
|
|
||||||
infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
|
|
||||||
inffast.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
|
|
||||||
inftrees.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
|
|
||||||
trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
|
|
||||||
|
|
||||||
adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
|
|
||||||
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
|
|
||||||
compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
|
|
||||||
crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
|
|
||||||
deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
|
|
||||||
infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
|
|
||||||
inffast.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h
|
|
||||||
inftrees.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h
|
|
||||||
trees.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)trees.h
|
|
||||||
|
|
@ -1,115 +0,0 @@
|
||||||
ZLIB DATA COMPRESSION LIBRARY
|
|
||||||
|
|
||||||
zlib 1.2.11 is a general purpose data compression library. All the code is
|
|
||||||
thread safe. The data format used by the zlib library is described by RFCs
|
|
||||||
(Request for Comments) 1950 to 1952 in the files
|
|
||||||
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
|
|
||||||
rfc1952 (gzip format).
|
|
||||||
|
|
||||||
All functions of the compression library are documented in the file zlib.h
|
|
||||||
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
|
||||||
of the library is given in the file test/example.c which also tests that
|
|
||||||
the library is working correctly. Another example is given in the file
|
|
||||||
test/minigzip.c. The compression library itself is composed of all source
|
|
||||||
files in the root directory.
|
|
||||||
|
|
||||||
To compile all files and run the test program, follow the instructions given at
|
|
||||||
the top of Makefile.in. In short "./configure; make test", and if that goes
|
|
||||||
well, "make install" should work for most flavors of Unix. For Windows, use
|
|
||||||
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
|
|
||||||
make_vms.com.
|
|
||||||
|
|
||||||
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
|
||||||
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
|
||||||
http://zlib.net/ . Before reporting a problem, please check this site to
|
|
||||||
verify that you have the latest version of zlib; otherwise get the latest
|
|
||||||
version and check whether the problem still exists or not.
|
|
||||||
|
|
||||||
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
|
||||||
|
|
||||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
|
||||||
issue of Dr. Dobb's Journal; a copy of the article is available at
|
|
||||||
http://marknelson.us/1997/01/01/zlib-engine/ .
|
|
||||||
|
|
||||||
The changes made in version 1.2.11 are documented in the file ChangeLog.
|
|
||||||
|
|
||||||
Unsupported third party contributions are provided in directory contrib/ .
|
|
||||||
|
|
||||||
zlib is available in Java using the java.util.zip package, documented at
|
|
||||||
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
|
||||||
|
|
||||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
|
||||||
at CPAN (Comprehensive Perl Archive Network) sites, including
|
|
||||||
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
|
||||||
|
|
||||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
|
||||||
available in Python 1.5 and later versions, see
|
|
||||||
http://docs.python.org/library/zlib.html .
|
|
||||||
|
|
||||||
zlib is built into tcl: http://wiki.tcl.tk/4610 .
|
|
||||||
|
|
||||||
An experimental package to read and write files in .zip format, written on top
|
|
||||||
of zlib by Gilles Vollant <info@winimage.com>, is available in the
|
|
||||||
contrib/minizip directory of zlib.
|
|
||||||
|
|
||||||
|
|
||||||
Notes for some targets:
|
|
||||||
|
|
||||||
- For Windows DLL versions, please see win32/DLL_FAQ.txt
|
|
||||||
|
|
||||||
- For 64-bit Irix, deflate.c must be compiled without any optimization. With
|
|
||||||
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
|
|
||||||
compiler flag). The compiler bug has been reported to SGI.
|
|
||||||
|
|
||||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
|
|
||||||
when compiled with cc.
|
|
||||||
|
|
||||||
- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is
|
|
||||||
necessary to get gzprintf working correctly. This is done by configure.
|
|
||||||
|
|
||||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
|
||||||
other compilers. Use "make test" to check your compiler.
|
|
||||||
|
|
||||||
- gzdopen is not supported on RISCOS or BEOS.
|
|
||||||
|
|
||||||
- For PalmOs, see http://palmzlib.sourceforge.net/
|
|
||||||
|
|
||||||
|
|
||||||
Acknowledgments:
|
|
||||||
|
|
||||||
The deflate format used by zlib was defined by Phil Katz. The deflate and
|
|
||||||
zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
|
||||||
people who reported problems and suggested various improvements in zlib; they
|
|
||||||
are too numerous to cite here.
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
(C) 1995-2017 Jean-loup Gailly and Mark Adler
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
|
|
||||||
Jean-loup Gailly Mark Adler
|
|
||||||
jloup@gzip.org madler@alumni.caltech.edu
|
|
||||||
|
|
||||||
If you use the zlib library in a product, we would appreciate *not* receiving
|
|
||||||
lengthy legal documents to sign. The sources are provided for free but without
|
|
||||||
warranty of any kind. The library has been entirely written by Jean-loup
|
|
||||||
Gailly and Mark Adler; it does not include third-party code.
|
|
||||||
|
|
||||||
If you redistribute modified sources, we would appreciate that you include in
|
|
||||||
the file ChangeLog history information documenting your changes. Please read
|
|
||||||
the FAQ for more information on the distribution of modified source versions.
|
|
||||||
|
|
@ -1,186 +0,0 @@
|
||||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
|
||||||
* Copyright (C) 1995-2011, 2016 Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id$ */
|
|
||||||
|
|
||||||
#include "zutil.h"
|
|
||||||
|
|
||||||
local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
|
|
||||||
|
|
||||||
#define BASE 65521U /* largest prime smaller than 65536 */
|
|
||||||
#define NMAX 5552
|
|
||||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
|
||||||
|
|
||||||
#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;}
|
|
||||||
#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1);
|
|
||||||
#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2);
|
|
||||||
#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4);
|
|
||||||
#define DO16(buf) DO8(buf,0); DO8(buf,8);
|
|
||||||
|
|
||||||
/* use NO_DIVIDE if your processor does not do division in hardware --
|
|
||||||
try it both ways to see which is faster */
|
|
||||||
#ifdef NO_DIVIDE
|
|
||||||
/* note that this assumes BASE is 65521, where 65536 % 65521 == 15
|
|
||||||
(thank you to John Reiser for pointing this out) */
|
|
||||||
# define CHOP(a) \
|
|
||||||
do { \
|
|
||||||
unsigned long tmp = a >> 16; \
|
|
||||||
a &= 0xffffUL; \
|
|
||||||
a += (tmp << 4) - tmp; \
|
|
||||||
} while (0)
|
|
||||||
# define MOD28(a) \
|
|
||||||
do { \
|
|
||||||
CHOP(a); \
|
|
||||||
if (a >= BASE) a -= BASE; \
|
|
||||||
} while (0)
|
|
||||||
# define MOD(a) \
|
|
||||||
do { \
|
|
||||||
CHOP(a); \
|
|
||||||
MOD28(a); \
|
|
||||||
} while (0)
|
|
||||||
# define MOD63(a) \
|
|
||||||
do { /* this assumes a is not negative */ \
|
|
||||||
z_off64_t tmp = a >> 32; \
|
|
||||||
a &= 0xffffffffL; \
|
|
||||||
a += (tmp << 8) - (tmp << 5) + tmp; \
|
|
||||||
tmp = a >> 16; \
|
|
||||||
a &= 0xffffL; \
|
|
||||||
a += (tmp << 4) - tmp; \
|
|
||||||
tmp = a >> 16; \
|
|
||||||
a &= 0xffffL; \
|
|
||||||
a += (tmp << 4) - tmp; \
|
|
||||||
if (a >= BASE) a -= BASE; \
|
|
||||||
} while (0)
|
|
||||||
#else
|
|
||||||
# define MOD(a) a %= BASE
|
|
||||||
# define MOD28(a) a %= BASE
|
|
||||||
# define MOD63(a) a %= BASE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
uLong ZEXPORT adler32_z(adler, buf, len)
|
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
z_size_t len;
|
|
||||||
{
|
|
||||||
unsigned long sum2;
|
|
||||||
unsigned n;
|
|
||||||
|
|
||||||
/* split Adler-32 into component sums */
|
|
||||||
sum2 = (adler >> 16) & 0xffff;
|
|
||||||
adler &= 0xffff;
|
|
||||||
|
|
||||||
/* in case user likes doing a byte at a time, keep it fast */
|
|
||||||
if (len == 1) {
|
|
||||||
adler += buf[0];
|
|
||||||
if (adler >= BASE)
|
|
||||||
adler -= BASE;
|
|
||||||
sum2 += adler;
|
|
||||||
if (sum2 >= BASE)
|
|
||||||
sum2 -= BASE;
|
|
||||||
return adler | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initial Adler-32 value (deferred check for len == 1 speed) */
|
|
||||||
if (buf == Z_NULL)
|
|
||||||
return 1L;
|
|
||||||
|
|
||||||
/* in case short lengths are provided, keep it somewhat fast */
|
|
||||||
if (len < 16) {
|
|
||||||
while (len--) {
|
|
||||||
adler += *buf++;
|
|
||||||
sum2 += adler;
|
|
||||||
}
|
|
||||||
if (adler >= BASE)
|
|
||||||
adler -= BASE;
|
|
||||||
MOD28(sum2); /* only added so many BASE's */
|
|
||||||
return adler | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do length NMAX blocks -- requires just one modulo operation */
|
|
||||||
while (len >= NMAX) {
|
|
||||||
len -= NMAX;
|
|
||||||
n = NMAX / 16; /* NMAX is divisible by 16 */
|
|
||||||
do {
|
|
||||||
DO16(buf); /* 16 sums unrolled */
|
|
||||||
buf += 16;
|
|
||||||
} while (--n);
|
|
||||||
MOD(adler);
|
|
||||||
MOD(sum2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* do remaining bytes (less than NMAX, still just one modulo) */
|
|
||||||
if (len) { /* avoid modulos if none remaining */
|
|
||||||
while (len >= 16) {
|
|
||||||
len -= 16;
|
|
||||||
DO16(buf);
|
|
||||||
buf += 16;
|
|
||||||
}
|
|
||||||
while (len--) {
|
|
||||||
adler += *buf++;
|
|
||||||
sum2 += adler;
|
|
||||||
}
|
|
||||||
MOD(adler);
|
|
||||||
MOD(sum2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* return recombined sums */
|
|
||||||
return adler | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
uLong ZEXPORT adler32(adler, buf, len)
|
|
||||||
uLong adler;
|
|
||||||
const Bytef *buf;
|
|
||||||
uInt len;
|
|
||||||
{
|
|
||||||
return adler32_z(adler, buf, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
local uLong adler32_combine_(adler1, adler2, len2)
|
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
unsigned long sum1;
|
|
||||||
unsigned long sum2;
|
|
||||||
unsigned rem;
|
|
||||||
|
|
||||||
/* for negative len, return invalid adler32 as a clue for debugging */
|
|
||||||
if (len2 < 0)
|
|
||||||
return 0xffffffffUL;
|
|
||||||
|
|
||||||
/* the derivation of this formula is left as an exercise for the reader */
|
|
||||||
MOD63(len2); /* assumes len2 >= 0 */
|
|
||||||
rem = (unsigned)len2;
|
|
||||||
sum1 = adler1 & 0xffff;
|
|
||||||
sum2 = rem * sum1;
|
|
||||||
MOD(sum2);
|
|
||||||
sum1 += (adler2 & 0xffff) + BASE - 1;
|
|
||||||
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
|
||||||
if (sum1 >= BASE) sum1 -= BASE;
|
|
||||||
if (sum1 >= BASE) sum1 -= BASE;
|
|
||||||
if (sum2 >= ((unsigned long)BASE << 1)) sum2 -= ((unsigned long)BASE << 1);
|
|
||||||
if (sum2 >= BASE) sum2 -= BASE;
|
|
||||||
return sum1 | (sum2 << 16);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ========================================================================= */
|
|
||||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
|
||||||
}
|
|
||||||
|
|
||||||
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
|
||||||
uLong adler1;
|
|
||||||
uLong adler2;
|
|
||||||
z_off64_t len2;
|
|
||||||
{
|
|
||||||
return adler32_combine_(adler1, adler2, len2);
|
|
||||||
}
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
# Amiga powerUP (TM) Makefile
|
|
||||||
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
|
|
||||||
# Copyright (C) 1998 by Andreas R. Kleinert
|
|
||||||
|
|
||||||
LIBNAME = libzip.a
|
|
||||||
|
|
||||||
CC = scppc
|
|
||||||
CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \
|
|
||||||
OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER
|
|
||||||
AR = ppc-amigaos-ar cr
|
|
||||||
RANLIB = ppc-amigaos-ranlib
|
|
||||||
LD = ppc-amigaos-ld -r
|
|
||||||
LDFLAGS = -o
|
|
||||||
LDLIBS = LIB:scppc.a LIB:end.o
|
|
||||||
RM = delete quiet
|
|
||||||
|
|
||||||
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
|
|
||||||
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
|
|
||||||
|
|
||||||
TEST_OBJS = example.o minigzip.o
|
|
||||||
|
|
||||||
all: example minigzip
|
|
||||||
|
|
||||||
check: test
|
|
||||||
test: all
|
|
||||||
example
|
|
||||||
echo hello world | minigzip | minigzip -d
|
|
||||||
|
|
||||||
$(LIBNAME): $(OBJS)
|
|
||||||
$(AR) $@ $(OBJS)
|
|
||||||
-$(RANLIB) $@
|
|
||||||
|
|
||||||
example: example.o $(LIBNAME)
|
|
||||||
$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
|
|
||||||
|
|
||||||
minigzip: minigzip.o $(LIBNAME)
|
|
||||||
$(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS)
|
|
||||||
|
|
||||||
mostlyclean: clean
|
|
||||||
clean:
|
|
||||||
$(RM) *.o example minigzip $(LIBNAME) foo.gz
|
|
||||||
|
|
||||||
zip:
|
|
||||||
zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \
|
|
||||||
descrip.mms *.[ch]
|
|
||||||
|
|
||||||
tgz:
|
|
||||||
cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \
|
|
||||||
zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch]
|
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
|
||||||
|
|
||||||
adler32.o: zlib.h zconf.h
|
|
||||||
compress.o: zlib.h zconf.h
|
|
||||||
crc32.o: crc32.h zlib.h zconf.h
|
|
||||||
deflate.o: deflate.h zutil.h zlib.h zconf.h
|
|
||||||
example.o: zlib.h zconf.h
|
|
||||||
gzclose.o: zlib.h zconf.h gzguts.h
|
|
||||||
gzlib.o: zlib.h zconf.h gzguts.h
|
|
||||||
gzread.o: zlib.h zconf.h gzguts.h
|
|
||||||
gzwrite.o: zlib.h zconf.h gzguts.h
|
|
||||||
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
|
||||||
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
|
||||||
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
|
||||||
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
|
|
||||||
minigzip.o: zlib.h zconf.h
|
|
||||||
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
|
|
||||||
uncompr.o: zlib.h zconf.h
|
|
||||||
zutil.o: zutil.h zlib.h zconf.h
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
# SMakefile for zlib
|
|
||||||
# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly
|
|
||||||
# Osma Ahvenlampi <Osma.Ahvenlampi@hut.fi>
|
|
||||||
# Amiga, SAS/C 6.56 & Smake
|
|
||||||
|
|
||||||
CC=sc
|
|
||||||
CFLAGS=OPT
|
|
||||||
#CFLAGS=OPT CPU=68030
|
|
||||||
#CFLAGS=DEBUG=LINE
|
|
||||||
LDFLAGS=LIB z.lib
|
|
||||||
|
|
||||||
SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \
|
|
||||||
NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \
|
|
||||||
DEF=POSTINC
|
|
||||||
|
|
||||||
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
|
|
||||||
uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
|
|
||||||
|
|
||||||
TEST_OBJS = example.o minigzip.o
|
|
||||||
|
|
||||||
all: SCOPTIONS example minigzip
|
|
||||||
|
|
||||||
check: test
|
|
||||||
test: all
|
|
||||||
example
|
|
||||||
echo hello world | minigzip | minigzip -d
|
|
||||||
|
|
||||||
install: z.lib
|
|
||||||
copy clone zlib.h zconf.h INCLUDE:
|
|
||||||
copy clone z.lib LIB:
|
|
||||||
|
|
||||||
z.lib: $(OBJS)
|
|
||||||
oml z.lib r $(OBJS)
|
|
||||||
|
|
||||||
example: example.o z.lib
|
|
||||||
$(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS)
|
|
||||||
|
|
||||||
minigzip: minigzip.o z.lib
|
|
||||||
$(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS)
|
|
||||||
|
|
||||||
mostlyclean: clean
|
|
||||||
clean:
|
|
||||||
-delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS
|
|
||||||
|
|
||||||
SCOPTIONS: Makefile.sas
|
|
||||||
copy to $@ <from <
|
|
||||||
$(SCOPTIONS)
|
|
||||||
<
|
|
||||||
|
|
||||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
|
||||||
|
|
||||||
adler32.o: zlib.h zconf.h
|
|
||||||
compress.o: zlib.h zconf.h
|
|
||||||
crc32.o: crc32.h zlib.h zconf.h
|
|
||||||
deflate.o: deflate.h zutil.h zlib.h zconf.h
|
|
||||||
example.o: zlib.h zconf.h
|
|
||||||
gzclose.o: zlib.h zconf.h gzguts.h
|
|
||||||
gzlib.o: zlib.h zconf.h gzguts.h
|
|
||||||
gzread.o: zlib.h zconf.h gzguts.h
|
|
||||||
gzwrite.o: zlib.h zconf.h gzguts.h
|
|
||||||
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
|
||||||
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
|
||||||
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
|
|
||||||
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
|
|
||||||
minigzip.o: zlib.h zconf.h
|
|
||||||
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
|
|
||||||
uncompr.o: zlib.h zconf.h
|
|
||||||
zutil.o: zutil.h zlib.h zconf.h
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
/* compress.c -- compress a memory buffer
|
|
||||||
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id$ */
|
|
||||||
|
|
||||||
#define ZLIB_INTERNAL
|
|
||||||
#include "zlib.h"
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
Compresses the source buffer into the destination buffer. The level
|
|
||||||
parameter has the same meaning as in deflateInit. sourceLen is the byte
|
|
||||||
length of the source buffer. Upon entry, destLen is the total size of the
|
|
||||||
destination buffer, which must be at least 0.1% larger than sourceLen plus
|
|
||||||
12 bytes. Upon exit, destLen is the actual size of the compressed buffer.
|
|
||||||
|
|
||||||
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
|
|
||||||
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
|
|
||||||
Z_STREAM_ERROR if the level parameter is invalid.
|
|
||||||
*/
|
|
||||||
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
|
|
||||||
Bytef *dest;
|
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
int level;
|
|
||||||
{
|
|
||||||
z_stream stream;
|
|
||||||
int err;
|
|
||||||
const uInt max = (uInt)-1;
|
|
||||||
uLong left;
|
|
||||||
|
|
||||||
left = *destLen;
|
|
||||||
*destLen = 0;
|
|
||||||
|
|
||||||
stream.zalloc = (alloc_func)0;
|
|
||||||
stream.zfree = (free_func)0;
|
|
||||||
stream.opaque = (voidpf)0;
|
|
||||||
|
|
||||||
err = deflateInit(&stream, level);
|
|
||||||
if (err != Z_OK) return err;
|
|
||||||
|
|
||||||
stream.next_out = dest;
|
|
||||||
stream.avail_out = 0;
|
|
||||||
stream.next_in = (z_const Bytef *)source;
|
|
||||||
stream.avail_in = 0;
|
|
||||||
|
|
||||||
do {
|
|
||||||
if (stream.avail_out == 0) {
|
|
||||||
stream.avail_out = left > (uLong)max ? max : (uInt)left;
|
|
||||||
left -= stream.avail_out;
|
|
||||||
}
|
|
||||||
if (stream.avail_in == 0) {
|
|
||||||
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
|
|
||||||
sourceLen -= stream.avail_in;
|
|
||||||
}
|
|
||||||
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
|
|
||||||
} while (err == Z_OK);
|
|
||||||
|
|
||||||
*destLen = stream.total_out;
|
|
||||||
deflateEnd(&stream);
|
|
||||||
return err == Z_STREAM_END ? Z_OK : err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
*/
|
|
||||||
int ZEXPORT compress (dest, destLen, source, sourceLen)
|
|
||||||
Bytef *dest;
|
|
||||||
uLongf *destLen;
|
|
||||||
const Bytef *source;
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ===========================================================================
|
|
||||||
If the default memLevel or windowBits for deflateInit() is changed, then
|
|
||||||
this function needs to be updated.
|
|
||||||
*/
|
|
||||||
uLong ZEXPORT compressBound (sourceLen)
|
|
||||||
uLong sourceLen;
|
|
||||||
{
|
|
||||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
|
||||||
(sourceLen >> 25) + 13;
|
|
||||||
}
|
|
||||||
921
contrib/zlib/configure
vendored
921
contrib/zlib/configure
vendored
|
|
@ -1,921 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# configure script for zlib.
|
|
||||||
#
|
|
||||||
# Normally configure builds both a static and a shared library.
|
|
||||||
# If you want to build just a static library, use: ./configure --static
|
|
||||||
#
|
|
||||||
# To impose specific compiler or flags or install directory, use for example:
|
|
||||||
# prefix=$HOME CC=cc CFLAGS="-O4" ./configure
|
|
||||||
# or for csh/tcsh users:
|
|
||||||
# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure)
|
|
||||||
|
|
||||||
# Incorrect settings of CC or CFLAGS may prevent creating a shared library.
|
|
||||||
# If you have problems, try without defining CC and CFLAGS before reporting
|
|
||||||
# an error.
|
|
||||||
|
|
||||||
# start off configure.log
|
|
||||||
echo -------------------- >> configure.log
|
|
||||||
echo $0 $* >> configure.log
|
|
||||||
date >> configure.log
|
|
||||||
|
|
||||||
# get source directory
|
|
||||||
SRCDIR=`dirname $0`
|
|
||||||
if test $SRCDIR = "."; then
|
|
||||||
ZINC=""
|
|
||||||
ZINCOUT="-I."
|
|
||||||
SRCDIR=""
|
|
||||||
else
|
|
||||||
ZINC='-include zconf.h'
|
|
||||||
ZINCOUT='-I. -I$(SRCDIR)'
|
|
||||||
SRCDIR="$SRCDIR/"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set command prefix for cross-compilation
|
|
||||||
if [ -n "${CHOST}" ]; then
|
|
||||||
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
|
|
||||||
CROSS_PREFIX="${CHOST}-"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# destination name for static library
|
|
||||||
STATICLIB=libz.a
|
|
||||||
|
|
||||||
# extract zlib version numbers from zlib.h
|
|
||||||
VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}zlib.h`
|
|
||||||
VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < ${SRCDIR}zlib.h`
|
|
||||||
VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
|
|
||||||
VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < ${SRCDIR}zlib.h`
|
|
||||||
|
|
||||||
# establish commands for library building
|
|
||||||
if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
|
||||||
AR=${AR-"${CROSS_PREFIX}ar"}
|
|
||||||
test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
|
|
||||||
else
|
|
||||||
AR=${AR-"ar"}
|
|
||||||
test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
|
|
||||||
fi
|
|
||||||
ARFLAGS=${ARFLAGS-"rc"}
|
|
||||||
if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
|
||||||
RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
|
|
||||||
test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
|
|
||||||
else
|
|
||||||
RANLIB=${RANLIB-"ranlib"}
|
|
||||||
fi
|
|
||||||
if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
|
|
||||||
NM=${NM-"${CROSS_PREFIX}nm"}
|
|
||||||
test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
|
|
||||||
else
|
|
||||||
NM=${NM-"nm"}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# set defaults before processing command line options
|
|
||||||
LDCONFIG=${LDCONFIG-"ldconfig"}
|
|
||||||
LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
|
|
||||||
ARCHS=
|
|
||||||
prefix=${prefix-/usr/local}
|
|
||||||
exec_prefix=${exec_prefix-'${prefix}'}
|
|
||||||
libdir=${libdir-'${exec_prefix}/lib'}
|
|
||||||
sharedlibdir=${sharedlibdir-'${libdir}'}
|
|
||||||
includedir=${includedir-'${prefix}/include'}
|
|
||||||
mandir=${mandir-'${prefix}/share/man'}
|
|
||||||
shared_ext='.so'
|
|
||||||
shared=1
|
|
||||||
solo=0
|
|
||||||
cover=0
|
|
||||||
zprefix=0
|
|
||||||
zconst=0
|
|
||||||
build64=0
|
|
||||||
gcc=0
|
|
||||||
warn=0
|
|
||||||
debug=0
|
|
||||||
old_cc="$CC"
|
|
||||||
old_cflags="$CFLAGS"
|
|
||||||
OBJC='$(OBJZ) $(OBJG)'
|
|
||||||
PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
|
|
||||||
|
|
||||||
# leave this script, optionally in a bad way
|
|
||||||
leave()
|
|
||||||
{
|
|
||||||
if test "$*" != "0"; then
|
|
||||||
echo "** $0 aborting." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version
|
|
||||||
echo -------------------- >> configure.log
|
|
||||||
echo >> configure.log
|
|
||||||
echo >> configure.log
|
|
||||||
exit $1
|
|
||||||
}
|
|
||||||
|
|
||||||
# process command line options
|
|
||||||
while test $# -ge 1
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
-h* | --help)
|
|
||||||
echo 'usage:' | tee -a configure.log
|
|
||||||
echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
|
|
||||||
echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
|
|
||||||
echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
|
|
||||||
exit 0 ;;
|
|
||||||
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
|
||||||
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
|
|
||||||
-l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
|
||||||
--sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;;
|
|
||||||
-i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;;
|
|
||||||
-u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;;
|
|
||||||
-p* | --prefix) prefix="$2"; shift; shift ;;
|
|
||||||
-e* | --eprefix) exec_prefix="$2"; shift; shift ;;
|
|
||||||
-l* | --libdir) libdir="$2"; shift; shift ;;
|
|
||||||
-i* | --includedir) includedir="$2"; shift; shift ;;
|
|
||||||
-s* | --shared | --enable-shared) shared=1; shift ;;
|
|
||||||
-t | --static) shared=0; shift ;;
|
|
||||||
--solo) solo=1; shift ;;
|
|
||||||
--cover) cover=1; shift ;;
|
|
||||||
-z* | --zprefix) zprefix=1; shift ;;
|
|
||||||
-6* | --64) build64=1; shift ;;
|
|
||||||
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
|
|
||||||
--sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
|
|
||||||
--localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
|
|
||||||
-c* | --const) zconst=1; shift ;;
|
|
||||||
-w* | --warn) warn=1; shift ;;
|
|
||||||
-d* | --debug) debug=1; shift ;;
|
|
||||||
*)
|
|
||||||
echo "unknown option: $1" | tee -a configure.log
|
|
||||||
echo "$0 --help for help" | tee -a configure.log
|
|
||||||
leave 1;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# temporary file name
|
|
||||||
test=ztest$$
|
|
||||||
|
|
||||||
# put arguments in log, also put test file in log if used in arguments
|
|
||||||
show()
|
|
||||||
{
|
|
||||||
case "$*" in
|
|
||||||
*$test.c*)
|
|
||||||
echo === $test.c === >> configure.log
|
|
||||||
cat $test.c >> configure.log
|
|
||||||
echo === >> configure.log;;
|
|
||||||
esac
|
|
||||||
echo $* >> configure.log
|
|
||||||
}
|
|
||||||
|
|
||||||
# check for gcc vs. cc and set compile and link flags based on the system identified by uname
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
extern int getchar();
|
|
||||||
int hello() {return getchar();}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
|
|
||||||
cc=${CC-${CROSS_PREFIX}gcc}
|
|
||||||
cflags=${CFLAGS-"-O3"}
|
|
||||||
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
|
|
||||||
case "$cc" in
|
|
||||||
*gcc*) gcc=1 ;;
|
|
||||||
*clang*) gcc=1 ;;
|
|
||||||
esac
|
|
||||||
case `$cc -v 2>&1` in
|
|
||||||
*gcc*) gcc=1 ;;
|
|
||||||
*clang*) gcc=1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
show $cc -c $test.c
|
|
||||||
if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
|
|
||||||
echo ... using gcc >> configure.log
|
|
||||||
CC="$cc"
|
|
||||||
CFLAGS="${CFLAGS--O3}"
|
|
||||||
SFLAGS="${CFLAGS--O3} -fPIC"
|
|
||||||
if test "$ARCHS"; then
|
|
||||||
CFLAGS="${CFLAGS} ${ARCHS}"
|
|
||||||
LDFLAGS="${LDFLAGS} ${ARCHS}"
|
|
||||||
fi
|
|
||||||
if test $build64 -eq 1; then
|
|
||||||
CFLAGS="${CFLAGS} -m64"
|
|
||||||
SFLAGS="${SFLAGS} -m64"
|
|
||||||
fi
|
|
||||||
if test "$warn" -eq 1; then
|
|
||||||
if test "$zconst" -eq 1; then
|
|
||||||
CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST"
|
|
||||||
else
|
|
||||||
CFLAGS="${CFLAGS} -Wall -Wextra -pedantic"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test $debug -eq 1; then
|
|
||||||
CFLAGS="${CFLAGS} -DZLIB_DEBUG"
|
|
||||||
SFLAGS="${SFLAGS} -DZLIB_DEBUG"
|
|
||||||
fi
|
|
||||||
if test -z "$uname"; then
|
|
||||||
uname=`(uname -s || echo unknown) 2>/dev/null`
|
|
||||||
fi
|
|
||||||
case "$uname" in
|
|
||||||
Linux* | linux* | GNU | GNU/* | solaris*)
|
|
||||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
|
|
||||||
*BSD | *bsd* | DragonFly)
|
|
||||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
|
|
||||||
LDCONFIG="ldconfig -m" ;;
|
|
||||||
CYGWIN* | Cygwin* | cygwin* | OS/2*)
|
|
||||||
EXE='.exe' ;;
|
|
||||||
MINGW* | mingw*)
|
|
||||||
# temporary bypass
|
|
||||||
rm -f $test.[co] $test $test$shared_ext
|
|
||||||
echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
|
|
||||||
leave 1
|
|
||||||
LDSHARED=${LDSHARED-"$cc -shared"}
|
|
||||||
LDSHAREDLIBC=""
|
|
||||||
EXE='.exe' ;;
|
|
||||||
QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
|
|
||||||
# (alain.bonnefoy@icbt.com)
|
|
||||||
LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;;
|
|
||||||
HP-UX*)
|
|
||||||
LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"}
|
|
||||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
|
||||||
ia64)
|
|
||||||
shared_ext='.so'
|
|
||||||
SHAREDLIB='libz.so' ;;
|
|
||||||
*)
|
|
||||||
shared_ext='.sl'
|
|
||||||
SHAREDLIB='libz.sl' ;;
|
|
||||||
esac ;;
|
|
||||||
Darwin* | darwin*)
|
|
||||||
shared_ext='.dylib'
|
|
||||||
SHAREDLIB=libz$shared_ext
|
|
||||||
SHAREDLIBV=libz.$VER$shared_ext
|
|
||||||
SHAREDLIBM=libz.$VER1$shared_ext
|
|
||||||
LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
|
|
||||||
if libtool -V 2>&1 | grep Apple > /dev/null; then
|
|
||||||
AR="libtool"
|
|
||||||
else
|
|
||||||
AR="/usr/bin/libtool"
|
|
||||||
fi
|
|
||||||
ARFLAGS="-o" ;;
|
|
||||||
*) LDSHARED=${LDSHARED-"$cc -shared"} ;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
# find system name and corresponding cc options
|
|
||||||
CC=${CC-cc}
|
|
||||||
gcc=0
|
|
||||||
echo ... using $CC >> configure.log
|
|
||||||
if test -z "$uname"; then
|
|
||||||
uname=`(uname -sr || echo unknown) 2>/dev/null`
|
|
||||||
fi
|
|
||||||
case "$uname" in
|
|
||||||
HP-UX*) SFLAGS=${CFLAGS-"-O +z"}
|
|
||||||
CFLAGS=${CFLAGS-"-O"}
|
|
||||||
# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"}
|
|
||||||
LDSHARED=${LDSHARED-"ld -b"}
|
|
||||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
|
||||||
ia64)
|
|
||||||
shared_ext='.so'
|
|
||||||
SHAREDLIB='libz.so' ;;
|
|
||||||
*)
|
|
||||||
shared_ext='.sl'
|
|
||||||
SHAREDLIB='libz.sl' ;;
|
|
||||||
esac ;;
|
|
||||||
IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."}
|
|
||||||
CFLAGS=${CFLAGS-"-ansi -O2"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
|
|
||||||
OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
|
|
||||||
CFLAGS=${CFLAGS-"-O -std1"}
|
|
||||||
LDFLAGS="${LDFLAGS} -Wl,-rpath,."
|
|
||||||
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
|
|
||||||
OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
|
|
||||||
CFLAGS=${CFLAGS-"-O -std1"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
|
|
||||||
QNX*) SFLAGS=${CFLAGS-"-4 -O"}
|
|
||||||
CFLAGS=${CFLAGS-"-4 -O"}
|
|
||||||
LDSHARED=${LDSHARED-"cc"}
|
|
||||||
RANLIB=${RANLIB-"true"}
|
|
||||||
AR="cc"
|
|
||||||
ARFLAGS="-A" ;;
|
|
||||||
SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "}
|
|
||||||
CFLAGS=${CFLAGS-"-O3"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;;
|
|
||||||
SunOS\ 5* | solaris*)
|
|
||||||
LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"}
|
|
||||||
SFLAGS=${CFLAGS-"-fast -KPIC"}
|
|
||||||
CFLAGS=${CFLAGS-"-fast"}
|
|
||||||
if test $build64 -eq 1; then
|
|
||||||
# old versions of SunPRO/Workshop/Studio don't support -m64,
|
|
||||||
# but newer ones do. Check for it.
|
|
||||||
flag64=`$CC -flags | egrep -- '^-m64'`
|
|
||||||
if test x"$flag64" != x"" ; then
|
|
||||||
CFLAGS="${CFLAGS} -m64"
|
|
||||||
SFLAGS="${SFLAGS} -m64"
|
|
||||||
else
|
|
||||||
case `(uname -m || echo unknown) 2>/dev/null` in
|
|
||||||
i86*)
|
|
||||||
SFLAGS="$SFLAGS -xarch=amd64"
|
|
||||||
CFLAGS="$CFLAGS -xarch=amd64" ;;
|
|
||||||
*)
|
|
||||||
SFLAGS="$SFLAGS -xarch=v9"
|
|
||||||
CFLAGS="$CFLAGS -xarch=v9" ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test -n "$ZINC"; then
|
|
||||||
ZINC='-I- -I. -I$(SRCDIR)'
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
|
|
||||||
CFLAGS=${CFLAGS-"-O2"}
|
|
||||||
LDSHARED=${LDSHARED-"ld"} ;;
|
|
||||||
SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"}
|
|
||||||
CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;;
|
|
||||||
UNIX_System_V\ 4.2.0)
|
|
||||||
SFLAGS=${CFLAGS-"-KPIC -O"}
|
|
||||||
CFLAGS=${CFLAGS-"-O"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -G"} ;;
|
|
||||||
UNIX_SV\ 4.2MP)
|
|
||||||
SFLAGS=${CFLAGS-"-Kconform_pic -O"}
|
|
||||||
CFLAGS=${CFLAGS-"-O"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -G"} ;;
|
|
||||||
OpenUNIX\ 5)
|
|
||||||
SFLAGS=${CFLAGS-"-KPIC -O"}
|
|
||||||
CFLAGS=${CFLAGS-"-O"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -G"} ;;
|
|
||||||
AIX*) # Courtesy of dbakker@arrayasolutions.com
|
|
||||||
SFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
|
|
||||||
CFLAGS=${CFLAGS-"-O -qmaxmem=8192"}
|
|
||||||
LDSHARED=${LDSHARED-"xlc -G"} ;;
|
|
||||||
# send working options for other systems to zlib@gzip.org
|
|
||||||
*) SFLAGS=${CFLAGS-"-O"}
|
|
||||||
CFLAGS=${CFLAGS-"-O"}
|
|
||||||
LDSHARED=${LDSHARED-"cc -shared"} ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# destination names for shared library if not defined above
|
|
||||||
SHAREDLIB=${SHAREDLIB-"libz$shared_ext"}
|
|
||||||
SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
|
|
||||||
SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# define functions for testing compiler and library characteristics and logging the results
|
|
||||||
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#error error
|
|
||||||
EOF
|
|
||||||
if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
|
|
||||||
try()
|
|
||||||
{
|
|
||||||
show $*
|
|
||||||
test "`( $* ) 2>&1 | tee -a configure.log`" = ""
|
|
||||||
}
|
|
||||||
echo - using any output from compiler to indicate an error >> configure.log
|
|
||||||
else
|
|
||||||
try()
|
|
||||||
{
|
|
||||||
show $*
|
|
||||||
( $* ) >> configure.log 2>&1
|
|
||||||
ret=$?
|
|
||||||
if test $ret -ne 0; then
|
|
||||||
echo "(exit code "$ret")" >> configure.log
|
|
||||||
fi
|
|
||||||
return $ret
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
tryboth()
|
|
||||||
{
|
|
||||||
show $*
|
|
||||||
got=`( $* ) 2>&1`
|
|
||||||
ret=$?
|
|
||||||
printf %s "$got" >> configure.log
|
|
||||||
if test $ret -ne 0; then
|
|
||||||
return $ret
|
|
||||||
fi
|
|
||||||
test "$got" = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
cat > $test.c << EOF
|
|
||||||
int foo() { return 0; }
|
|
||||||
EOF
|
|
||||||
echo "Checking for obsessive-compulsive compiler options..." >> configure.log
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log
|
|
||||||
leave 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# see if shared library build supported
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
extern int getchar();
|
|
||||||
int hello() {return getchar();}
|
|
||||||
EOF
|
|
||||||
if test $shared -eq 1; then
|
|
||||||
echo Checking for shared library support... | tee -a configure.log
|
|
||||||
# we must test in two steps (cc then ld), required at least on SunOS 4.x
|
|
||||||
if try $CC -w -c $SFLAGS $test.c &&
|
|
||||||
try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
|
|
||||||
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
|
|
||||||
elif test -z "$old_cc" -a -z "$old_cflags"; then
|
|
||||||
echo No shared library support. | tee -a configure.log
|
|
||||||
shared=0;
|
|
||||||
else
|
|
||||||
echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
|
|
||||||
shared=0;
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test $shared -eq 0; then
|
|
||||||
LDSHARED="$CC"
|
|
||||||
ALL="static"
|
|
||||||
TEST="all teststatic"
|
|
||||||
SHAREDLIB=""
|
|
||||||
SHAREDLIBV=""
|
|
||||||
SHAREDLIBM=""
|
|
||||||
echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
|
|
||||||
else
|
|
||||||
ALL="static shared"
|
|
||||||
TEST="all teststatic testshared"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check for underscores in external names for use by assembler code
|
|
||||||
CPP=${CPP-"$CC -E"}
|
|
||||||
case $CFLAGS in
|
|
||||||
*ASMV*)
|
|
||||||
echo >> configure.log
|
|
||||||
show "$NM $test.o | grep _hello"
|
|
||||||
if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
|
|
||||||
CPP="$CPP -DNO_UNDERLINE"
|
|
||||||
echo Checking for underline in external names... No. | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo Checking for underline in external names... Yes. | tee -a configure.log
|
|
||||||
fi ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# check for size_t
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
size_t dummy = 0;
|
|
||||||
EOF
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking for size_t... Yes." | tee -a configure.log
|
|
||||||
need_sizet=0
|
|
||||||
else
|
|
||||||
echo "Checking for size_t... No." | tee -a configure.log
|
|
||||||
need_sizet=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# find the size_t integer type, if needed
|
|
||||||
if test $need_sizet -eq 1; then
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
long long dummy = 0;
|
|
||||||
EOF
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking for long long... Yes." | tee -a configure.log
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
int main(void) {
|
|
||||||
if (sizeof(void *) <= sizeof(int)) puts("int");
|
|
||||||
else if (sizeof(void *) <= sizeof(long)) puts("long");
|
|
||||||
else puts("z_longlong");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
else
|
|
||||||
echo "Checking for long long... No." | tee -a configure.log
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
int main(void) {
|
|
||||||
if (sizeof(void *) <= sizeof(int)) puts("int");
|
|
||||||
else puts("long");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
if try $CC $CFLAGS -o $test $test.c; then
|
|
||||||
sizet=`./$test`
|
|
||||||
echo "Checking for a pointer-size integer type..." $sizet"." | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo "Failed to find a pointer-size integer type." | tee -a configure.log
|
|
||||||
leave 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $need_sizet -eq 1; then
|
|
||||||
CFLAGS="${CFLAGS} -DNO_SIZE_T=${sizet}"
|
|
||||||
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# check for large file support, and if none, check for fseeko()
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <sys/types.h>
|
|
||||||
off64_t dummy = 0;
|
|
||||||
EOF
|
|
||||||
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
|
|
||||||
CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1"
|
|
||||||
SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
|
|
||||||
ALL="${ALL} all64"
|
|
||||||
TEST="${TEST} test64"
|
|
||||||
echo "Checking for off64_t... Yes." | tee -a configure.log
|
|
||||||
echo "Checking for fseeko... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo "Checking for off64_t... No." | tee -a configure.log
|
|
||||||
echo >> configure.log
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
int main(void) {
|
|
||||||
fseeko(NULL, 0, 0);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
if try $CC $CFLAGS -o $test $test.c; then
|
|
||||||
echo "Checking for fseeko... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
CFLAGS="${CFLAGS} -DNO_FSEEKO"
|
|
||||||
SFLAGS="${SFLAGS} -DNO_FSEEKO"
|
|
||||||
echo "Checking for fseeko... No." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# check for strerror() for use by gz* functions
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
int main() { return strlen(strerror(errno)); }
|
|
||||||
EOF
|
|
||||||
if try $CC $CFLAGS -o $test $test.c; then
|
|
||||||
echo "Checking for strerror... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
CFLAGS="${CFLAGS} -DNO_STRERROR"
|
|
||||||
SFLAGS="${SFLAGS} -DNO_STRERROR"
|
|
||||||
echo "Checking for strerror... No." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
# copy clean zconf.h for subsequent edits
|
|
||||||
cp -p ${SRCDIR}zconf.h.in zconf.h
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# check for unistd.h and save result in zconf.h
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <unistd.h>
|
|
||||||
int main() { return 0; }
|
|
||||||
EOF
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
|
||||||
mv zconf.temp.h zconf.h
|
|
||||||
echo "Checking for unistd.h... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo "Checking for unistd.h... No." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# check for stdarg.h and save result in zconf.h
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdarg.h>
|
|
||||||
int main() { return 0; }
|
|
||||||
EOF
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
|
||||||
mv zconf.temp.h zconf.h
|
|
||||||
echo "Checking for stdarg.h... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo "Checking for stdarg.h... No." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if the z_ prefix was requested, save that in zconf.h
|
|
||||||
if test $zprefix -eq 1; then
|
|
||||||
sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
|
|
||||||
mv zconf.temp.h zconf.h
|
|
||||||
echo >> configure.log
|
|
||||||
echo "Using z_ prefix on all symbols." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
|
|
||||||
if test $solo -eq 1; then
|
|
||||||
sed '/#define ZCONF_H/a\
|
|
||||||
#define Z_SOLO
|
|
||||||
|
|
||||||
' < zconf.h > zconf.temp.h
|
|
||||||
mv zconf.temp.h zconf.h
|
|
||||||
OBJC='$(OBJZ)'
|
|
||||||
PIC_OBJC='$(PIC_OBJZ)'
|
|
||||||
fi
|
|
||||||
|
|
||||||
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
|
|
||||||
if test $cover -eq 1; then
|
|
||||||
CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
|
|
||||||
if test -n "$GCC_CLASSIC"; then
|
|
||||||
CC=$GCC_CLASSIC
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
|
|
||||||
# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions
|
|
||||||
# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a
|
|
||||||
# return value. The most secure result is vsnprintf() with a return value. snprintf() with a
|
|
||||||
# return value is secure as well, but then gzprintf() will be limited to 20 arguments.
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include "zconf.h"
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
#ifndef STDC
|
|
||||||
choke me
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
int mytest(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
char buf[20];
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return (mytest("Hello%d\n", 1));
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
if try $CC $CFLAGS -o $test $test.c; then
|
|
||||||
echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
cat >$test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
int mytest(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
char buf[20];
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
n = vsnprintf(buf, sizeof(buf), fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return (mytest("Hello%d\n", 1));
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
|
|
||||||
SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
|
|
||||||
echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
|
|
||||||
echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
|
|
||||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
|
||||||
echo " vulnerabilities." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
CFLAGS="$CFLAGS -DNO_vsnprintf"
|
|
||||||
SFLAGS="$SFLAGS -DNO_vsnprintf"
|
|
||||||
echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
|
|
||||||
echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
|
|
||||||
echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
|
|
||||||
echo " vulnerabilities." | tee -a configure.log
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
cat >$test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
int mytest(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
char buf[20];
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, fmt);
|
|
||||||
n = vsprintf(buf, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return (mytest("Hello%d\n", 1));
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
CFLAGS="$CFLAGS -DHAS_vsprintf_void"
|
|
||||||
SFLAGS="$SFLAGS -DHAS_vsprintf_void"
|
|
||||||
echo "Checking for return value of vsprintf()... No." | tee -a configure.log
|
|
||||||
echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
|
|
||||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
|
||||||
echo " vulnerabilities." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
cat >$test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
int mytest()
|
|
||||||
{
|
|
||||||
char buf[20];
|
|
||||||
snprintf(buf, sizeof(buf), "%s", "foo");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return (mytest());
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if try $CC $CFLAGS -o $test $test.c; then
|
|
||||||
echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
cat >$test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
int mytest()
|
|
||||||
{
|
|
||||||
char buf[20];
|
|
||||||
return snprintf(buf, sizeof(buf), "%s", "foo");
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return (mytest());
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
CFLAGS="$CFLAGS -DHAS_snprintf_void"
|
|
||||||
SFLAGS="$SFLAGS -DHAS_snprintf_void"
|
|
||||||
echo "Checking for return value of snprintf()... No." | tee -a configure.log
|
|
||||||
echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
|
|
||||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
|
||||||
echo " vulnerabilities." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
CFLAGS="$CFLAGS -DNO_snprintf"
|
|
||||||
SFLAGS="$SFLAGS -DNO_snprintf"
|
|
||||||
echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
|
|
||||||
echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
|
|
||||||
echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
|
|
||||||
echo " vulnerabilities." | tee -a configure.log
|
|
||||||
|
|
||||||
echo >> configure.log
|
|
||||||
cat >$test.c <<EOF
|
|
||||||
#include <stdio.h>
|
|
||||||
int mytest()
|
|
||||||
{
|
|
||||||
char buf[20];
|
|
||||||
return sprintf(buf, "%s", "foo");
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return (mytest());
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if try $CC -c $CFLAGS $test.c; then
|
|
||||||
echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
CFLAGS="$CFLAGS -DHAS_sprintf_void"
|
|
||||||
SFLAGS="$SFLAGS -DHAS_sprintf_void"
|
|
||||||
echo "Checking for return value of sprintf()... No." | tee -a configure.log
|
|
||||||
echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
|
|
||||||
echo " can build but will be open to possible string-format security" | tee -a configure.log
|
|
||||||
echo " vulnerabilities." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# see if we can hide zlib internal symbols that are linked between separate source files
|
|
||||||
if test "$gcc" -eq 1; then
|
|
||||||
echo >> configure.log
|
|
||||||
cat > $test.c <<EOF
|
|
||||||
#define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
|
||||||
int ZLIB_INTERNAL foo;
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
if tryboth $CC -c $CFLAGS $test.c; then
|
|
||||||
CFLAGS="$CFLAGS -DHAVE_HIDDEN"
|
|
||||||
SFLAGS="$SFLAGS -DHAVE_HIDDEN"
|
|
||||||
echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
|
|
||||||
else
|
|
||||||
echo "Checking for attribute(visibility) support... No." | tee -a configure.log
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# show the results in the log
|
|
||||||
echo >> configure.log
|
|
||||||
echo ALL = $ALL >> configure.log
|
|
||||||
echo AR = $AR >> configure.log
|
|
||||||
echo ARFLAGS = $ARFLAGS >> configure.log
|
|
||||||
echo CC = $CC >> configure.log
|
|
||||||
echo CFLAGS = $CFLAGS >> configure.log
|
|
||||||
echo CPP = $CPP >> configure.log
|
|
||||||
echo EXE = $EXE >> configure.log
|
|
||||||
echo LDCONFIG = $LDCONFIG >> configure.log
|
|
||||||
echo LDFLAGS = $LDFLAGS >> configure.log
|
|
||||||
echo LDSHARED = $LDSHARED >> configure.log
|
|
||||||
echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
|
|
||||||
echo OBJC = $OBJC >> configure.log
|
|
||||||
echo PIC_OBJC = $PIC_OBJC >> configure.log
|
|
||||||
echo RANLIB = $RANLIB >> configure.log
|
|
||||||
echo SFLAGS = $SFLAGS >> configure.log
|
|
||||||
echo SHAREDLIB = $SHAREDLIB >> configure.log
|
|
||||||
echo SHAREDLIBM = $SHAREDLIBM >> configure.log
|
|
||||||
echo SHAREDLIBV = $SHAREDLIBV >> configure.log
|
|
||||||
echo STATICLIB = $STATICLIB >> configure.log
|
|
||||||
echo TEST = $TEST >> configure.log
|
|
||||||
echo VER = $VER >> configure.log
|
|
||||||
echo Z_U4 = $Z_U4 >> configure.log
|
|
||||||
echo SRCDIR = $SRCDIR >> configure.log
|
|
||||||
echo exec_prefix = $exec_prefix >> configure.log
|
|
||||||
echo includedir = $includedir >> configure.log
|
|
||||||
echo libdir = $libdir >> configure.log
|
|
||||||
echo mandir = $mandir >> configure.log
|
|
||||||
echo prefix = $prefix >> configure.log
|
|
||||||
echo sharedlibdir = $sharedlibdir >> configure.log
|
|
||||||
echo uname = $uname >> configure.log
|
|
||||||
|
|
||||||
# udpate Makefile with the configure results
|
|
||||||
sed < ${SRCDIR}Makefile.in "
|
|
||||||
/^CC *=/s#=.*#=$CC#
|
|
||||||
/^CFLAGS *=/s#=.*#=$CFLAGS#
|
|
||||||
/^SFLAGS *=/s#=.*#=$SFLAGS#
|
|
||||||
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
|
||||||
/^LDSHARED *=/s#=.*#=$LDSHARED#
|
|
||||||
/^CPP *=/s#=.*#=$CPP#
|
|
||||||
/^STATICLIB *=/s#=.*#=$STATICLIB#
|
|
||||||
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
|
||||||
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
|
||||||
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
|
||||||
/^AR *=/s#=.*#=$AR#
|
|
||||||
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
|
|
||||||
/^RANLIB *=/s#=.*#=$RANLIB#
|
|
||||||
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
|
|
||||||
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
|
|
||||||
/^EXE *=/s#=.*#=$EXE#
|
|
||||||
/^SRCDIR *=/s#=.*#=$SRCDIR#
|
|
||||||
/^ZINC *=/s#=.*#=$ZINC#
|
|
||||||
/^ZINCOUT *=/s#=.*#=$ZINCOUT#
|
|
||||||
/^prefix *=/s#=.*#=$prefix#
|
|
||||||
/^exec_prefix *=/s#=.*#=$exec_prefix#
|
|
||||||
/^libdir *=/s#=.*#=$libdir#
|
|
||||||
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
|
||||||
/^includedir *=/s#=.*#=$includedir#
|
|
||||||
/^mandir *=/s#=.*#=$mandir#
|
|
||||||
/^OBJC *=/s#=.*#= $OBJC#
|
|
||||||
/^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
|
|
||||||
/^all: */s#:.*#: $ALL#
|
|
||||||
/^test: */s#:.*#: $TEST#
|
|
||||||
" > Makefile
|
|
||||||
|
|
||||||
# create zlib.pc with the configure results
|
|
||||||
sed < ${SRCDIR}zlib.pc.in "
|
|
||||||
/^CC *=/s#=.*#=$CC#
|
|
||||||
/^CFLAGS *=/s#=.*#=$CFLAGS#
|
|
||||||
/^CPP *=/s#=.*#=$CPP#
|
|
||||||
/^LDSHARED *=/s#=.*#=$LDSHARED#
|
|
||||||
/^STATICLIB *=/s#=.*#=$STATICLIB#
|
|
||||||
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
|
|
||||||
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
|
|
||||||
/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM#
|
|
||||||
/^AR *=/s#=.*#=$AR#
|
|
||||||
/^ARFLAGS *=/s#=.*#=$ARFLAGS#
|
|
||||||
/^RANLIB *=/s#=.*#=$RANLIB#
|
|
||||||
/^EXE *=/s#=.*#=$EXE#
|
|
||||||
/^prefix *=/s#=.*#=$prefix#
|
|
||||||
/^exec_prefix *=/s#=.*#=$exec_prefix#
|
|
||||||
/^libdir *=/s#=.*#=$libdir#
|
|
||||||
/^sharedlibdir *=/s#=.*#=$sharedlibdir#
|
|
||||||
/^includedir *=/s#=.*#=$includedir#
|
|
||||||
/^mandir *=/s#=.*#=$mandir#
|
|
||||||
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
|
|
||||||
" | sed -e "
|
|
||||||
s/\@VERSION\@/$VER/g;
|
|
||||||
" > zlib.pc
|
|
||||||
|
|
||||||
# done
|
|
||||||
leave 0
|
|
||||||
|
|
@ -1,78 +0,0 @@
|
||||||
All files under this contrib directory are UNSUPPORTED. There were
|
|
||||||
provided by users of zlib and were not tested by the authors of zlib.
|
|
||||||
Use at your own risk. Please contact the authors of the contributions
|
|
||||||
for help about these, not the zlib authors. Thanks.
|
|
||||||
|
|
||||||
|
|
||||||
ada/ by Dmitriy Anisimkov <anisimkov@yahoo.com>
|
|
||||||
Support for Ada
|
|
||||||
See http://zlib-ada.sourceforge.net/
|
|
||||||
|
|
||||||
amd64/ by Mikhail Teterin <mi@ALDAN.algebra.com>
|
|
||||||
asm code for AMD64
|
|
||||||
See patch at http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/96393
|
|
||||||
|
|
||||||
asm686/ by Brian Raiter <breadbox@muppetlabs.com>
|
|
||||||
asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax
|
|
||||||
See http://www.muppetlabs.com/~breadbox/software/assembly.html
|
|
||||||
|
|
||||||
blast/ by Mark Adler <madler@alumni.caltech.edu>
|
|
||||||
Decompressor for output of PKWare Data Compression Library (DCL)
|
|
||||||
|
|
||||||
delphi/ by Cosmin Truta <cosmint@cs.ubbcluj.ro>
|
|
||||||
Support for Delphi and C++ Builder
|
|
||||||
|
|
||||||
dotzlib/ by Henrik Ravn <henrik@ravn.com>
|
|
||||||
Support for Microsoft .Net and Visual C++ .Net
|
|
||||||
|
|
||||||
gcc_gvmat64/by Gilles Vollant <info@winimage.com>
|
|
||||||
GCC Version of x86 64-bit (AMD64 and Intel EM64t) code for x64
|
|
||||||
assembler to replace longest_match() and inflate_fast()
|
|
||||||
|
|
||||||
infback9/ by Mark Adler <madler@alumni.caltech.edu>
|
|
||||||
Unsupported diffs to infback to decode the deflate64 format
|
|
||||||
|
|
||||||
inflate86/ by Chris Anderson <christop@charm.net>
|
|
||||||
Tuned x86 gcc asm code to replace inflate_fast()
|
|
||||||
|
|
||||||
iostream/ by Kevin Ruland <kevin@rodin.wustl.edu>
|
|
||||||
A C++ I/O streams interface to the zlib gz* functions
|
|
||||||
|
|
||||||
iostream2/ by Tyge Løvset <Tyge.Lovset@cmr.no>
|
|
||||||
Another C++ I/O streams interface
|
|
||||||
|
|
||||||
iostream3/ by Ludwig Schwardt <schwardt@sun.ac.za>
|
|
||||||
and Kevin Ruland <kevin@rodin.wustl.edu>
|
|
||||||
Yet another C++ I/O streams interface
|
|
||||||
|
|
||||||
masmx64/ by Gilles Vollant <info@winimage.com>
|
|
||||||
x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to
|
|
||||||
replace longest_match() and inflate_fast(), also masm x86
|
|
||||||
64-bits translation of Chris Anderson inflate_fast()
|
|
||||||
|
|
||||||
masmx86/ by Gilles Vollant <info@winimage.com>
|
|
||||||
x86 asm code to replace longest_match() and inflate_fast(),
|
|
||||||
for Visual C++ and MASM (32 bits).
|
|
||||||
Based on Brian Raiter (asm686) and Chris Anderson (inflate86)
|
|
||||||
|
|
||||||
minizip/ by Gilles Vollant <info@winimage.com>
|
|
||||||
Mini zip and unzip based on zlib
|
|
||||||
Includes Zip64 support by Mathias Svensson <mathias@result42.com>
|
|
||||||
See http://www.winimage.com/zLibDll/minizip.html
|
|
||||||
|
|
||||||
pascal/ by Bob Dellaca <bobdl@xtra.co.nz> et al.
|
|
||||||
Support for Pascal
|
|
||||||
|
|
||||||
puff/ by Mark Adler <madler@alumni.caltech.edu>
|
|
||||||
Small, low memory usage inflate. Also serves to provide an
|
|
||||||
unambiguous description of the deflate format.
|
|
||||||
|
|
||||||
testzlib/ by Gilles Vollant <info@winimage.com>
|
|
||||||
Example of the use of zlib
|
|
||||||
|
|
||||||
untgz/ by Pedro A. Aranda Gutierrez <paag@tid.es>
|
|
||||||
A very simple tar.gz file extractor using zlib
|
|
||||||
|
|
||||||
vstudio/ by Gilles Vollant <info@winimage.com>
|
|
||||||
Building a minizip-enhanced zlib with Microsoft Visual Studio
|
|
||||||
Includes vc11 from kreuzerkrieg and vc12 from davispuh
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
----------------------------------------------------------------
|
|
||||||
-- ZLib for Ada thick binding. --
|
|
||||||
-- --
|
|
||||||
-- Copyright (C) 2002-2004 Dmitriy Anisimkov --
|
|
||||||
-- --
|
|
||||||
-- Open source license information is in the zlib.ads file. --
|
|
||||||
----------------------------------------------------------------
|
|
||||||
--
|
|
||||||
-- $Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp $
|
|
||||||
|
|
||||||
-- This demo program provided by Dr Steve Sangwine <sjs@essex.ac.uk>
|
|
||||||
--
|
|
||||||
-- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer
|
|
||||||
-- of exactly the correct size is used for decompressed data, and the last
|
|
||||||
-- few bytes passed in to Zlib are checksum bytes.
|
|
||||||
|
|
||||||
-- This program compresses a string of text, and then decompresses the
|
|
||||||
-- compressed text into a buffer of the same size as the original text.
|
|
||||||
|
|
||||||
with Ada.Streams; use Ada.Streams;
|
|
||||||
with Ada.Text_IO;
|
|
||||||
|
|
||||||
with ZLib; use ZLib;
|
|
||||||
|
|
||||||
procedure Buffer_Demo is
|
|
||||||
EOL : Character renames ASCII.LF;
|
|
||||||
Text : constant String
|
|
||||||
:= "Four score and seven years ago our fathers brought forth," & EOL &
|
|
||||||
"upon this continent, a new nation, conceived in liberty," & EOL &
|
|
||||||
"and dedicated to the proposition that `all men are created equal'.";
|
|
||||||
|
|
||||||
Source : Stream_Element_Array (1 .. Text'Length);
|
|
||||||
for Source'Address use Text'Address;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Ada.Text_IO.Put (Text);
|
|
||||||
Ada.Text_IO.New_Line;
|
|
||||||
Ada.Text_IO.Put_Line
|
|
||||||
("Uncompressed size : " & Positive'Image (Text'Length) & " bytes");
|
|
||||||
|
|
||||||
declare
|
|
||||||
Compressed_Data : Stream_Element_Array (1 .. Text'Length);
|
|
||||||
L : Stream_Element_Offset;
|
|
||||||
begin
|
|
||||||
Compress : declare
|
|
||||||
Compressor : Filter_Type;
|
|
||||||
I : Stream_Element_Offset;
|
|
||||||
begin
|
|
||||||
Deflate_Init (Compressor);
|
|
||||||
|
|
||||||
-- Compress the whole of T at once.
|
|
||||||
|
|
||||||
Translate (Compressor, Source, I, Compressed_Data, L, Finish);
|
|
||||||
pragma Assert (I = Source'Last);
|
|
||||||
|
|
||||||
Close (Compressor);
|
|
||||||
|
|
||||||
Ada.Text_IO.Put_Line
|
|
||||||
("Compressed size : "
|
|
||||||
& Stream_Element_Offset'Image (L) & " bytes");
|
|
||||||
end Compress;
|
|
||||||
|
|
||||||
-- Now we decompress the data, passing short blocks of data to Zlib
|
|
||||||
-- (because this demonstrates the problem - the last block passed will
|
|
||||||
-- contain checksum information and there will be no output, only a
|
|
||||||
-- check inside Zlib that the checksum is correct).
|
|
||||||
|
|
||||||
Decompress : declare
|
|
||||||
Decompressor : Filter_Type;
|
|
||||||
|
|
||||||
Uncompressed_Data : Stream_Element_Array (1 .. Text'Length);
|
|
||||||
|
|
||||||
Block_Size : constant := 4;
|
|
||||||
-- This makes sure that the last block contains
|
|
||||||
-- only Adler checksum data.
|
|
||||||
|
|
||||||
P : Stream_Element_Offset := Compressed_Data'First - 1;
|
|
||||||
O : Stream_Element_Offset;
|
|
||||||
begin
|
|
||||||
Inflate_Init (Decompressor);
|
|
||||||
|
|
||||||
loop
|
|
||||||
Translate
|
|
||||||
(Decompressor,
|
|
||||||
Compressed_Data
|
|
||||||
(P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)),
|
|
||||||
P,
|
|
||||||
Uncompressed_Data
|
|
||||||
(Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last),
|
|
||||||
O,
|
|
||||||
No_Flush);
|
|
||||||
|
|
||||||
Ada.Text_IO.Put_Line
|
|
||||||
("Total in : " & Count'Image (Total_In (Decompressor)) &
|
|
||||||
", out : " & Count'Image (Total_Out (Decompressor)));
|
|
||||||
|
|
||||||
exit when P = L;
|
|
||||||
end loop;
|
|
||||||
|
|
||||||
Ada.Text_IO.New_Line;
|
|
||||||
Ada.Text_IO.Put_Line
|
|
||||||
("Decompressed text matches original text : "
|
|
||||||
& Boolean'Image (Uncompressed_Data = Source));
|
|
||||||
end Decompress;
|
|
||||||
end;
|
|
||||||
end Buffer_Demo;
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
----------------------------------------------------------------
|
|
||||||
-- ZLib for Ada thick binding. --
|
|
||||||
-- --
|
|
||||||
-- Copyright (C) 2002-2003 Dmitriy Anisimkov --
|
|
||||||
-- --
|
|
||||||
-- Open source license information is in the zlib.ads file. --
|
|
||||||
----------------------------------------------------------------
|
|
||||||
-- Continuous test for ZLib multithreading. If the test would fail
|
|
||||||
-- we should provide thread safe allocation routines for the Z_Stream.
|
|
||||||
--
|
|
||||||
-- $Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp $
|
|
||||||
|
|
||||||
with ZLib;
|
|
||||||
with Ada.Streams;
|
|
||||||
with Ada.Numerics.Discrete_Random;
|
|
||||||
with Ada.Text_IO;
|
|
||||||
with Ada.Exceptions;
|
|
||||||
with Ada.Task_Identification;
|
|
||||||
|
|
||||||
procedure MTest is
|
|
||||||
use Ada.Streams;
|
|
||||||
use ZLib;
|
|
||||||
|
|
||||||
Stop : Boolean := False;
|
|
||||||
|
|
||||||
pragma Atomic (Stop);
|
|
||||||
|
|
||||||
subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#;
|
|
||||||
|
|
||||||
package Random_Elements is
|
|
||||||
new Ada.Numerics.Discrete_Random (Visible_Symbols);
|
|
||||||
|
|
||||||
task type Test_Task;
|
|
||||||
|
|
||||||
task body Test_Task is
|
|
||||||
Buffer : Stream_Element_Array (1 .. 100_000);
|
|
||||||
Gen : Random_Elements.Generator;
|
|
||||||
|
|
||||||
Buffer_First : Stream_Element_Offset;
|
|
||||||
Compare_First : Stream_Element_Offset;
|
|
||||||
|
|
||||||
Deflate : Filter_Type;
|
|
||||||
Inflate : Filter_Type;
|
|
||||||
|
|
||||||
procedure Further (Item : in Stream_Element_Array);
|
|
||||||
|
|
||||||
procedure Read_Buffer
|
|
||||||
(Item : out Ada.Streams.Stream_Element_Array;
|
|
||||||
Last : out Ada.Streams.Stream_Element_Offset);
|
|
||||||
|
|
||||||
-------------
|
|
||||||
-- Further --
|
|
||||||
-------------
|
|
||||||
|
|
||||||
procedure Further (Item : in Stream_Element_Array) is
|
|
||||||
|
|
||||||
procedure Compare (Item : in Stream_Element_Array);
|
|
||||||
|
|
||||||
-------------
|
|
||||||
-- Compare --
|
|
||||||
-------------
|
|
||||||
|
|
||||||
procedure Compare (Item : in Stream_Element_Array) is
|
|
||||||
Next_First : Stream_Element_Offset := Compare_First + Item'Length;
|
|
||||||
begin
|
|
||||||
if Buffer (Compare_First .. Next_First - 1) /= Item then
|
|
||||||
raise Program_Error;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
Compare_First := Next_First;
|
|
||||||
end Compare;
|
|
||||||
|
|
||||||
procedure Compare_Write is new ZLib.Write (Write => Compare);
|
|
||||||
begin
|
|
||||||
Compare_Write (Inflate, Item, No_Flush);
|
|
||||||
end Further;
|
|
||||||
|
|
||||||
-----------------
|
|
||||||
-- Read_Buffer --
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
procedure Read_Buffer
|
|
||||||
(Item : out Ada.Streams.Stream_Element_Array;
|
|
||||||
Last : out Ada.Streams.Stream_Element_Offset)
|
|
||||||
is
|
|
||||||
Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First;
|
|
||||||
Next_First : Stream_Element_Offset;
|
|
||||||
begin
|
|
||||||
if Item'Length <= Buff_Diff then
|
|
||||||
Last := Item'Last;
|
|
||||||
|
|
||||||
Next_First := Buffer_First + Item'Length;
|
|
||||||
|
|
||||||
Item := Buffer (Buffer_First .. Next_First - 1);
|
|
||||||
|
|
||||||
Buffer_First := Next_First;
|
|
||||||
else
|
|
||||||
Last := Item'First + Buff_Diff;
|
|
||||||
Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last);
|
|
||||||
Buffer_First := Buffer'Last + 1;
|
|
||||||
end if;
|
|
||||||
end Read_Buffer;
|
|
||||||
|
|
||||||
procedure Translate is new Generic_Translate
|
|
||||||
(Data_In => Read_Buffer,
|
|
||||||
Data_Out => Further);
|
|
||||||
|
|
||||||
begin
|
|
||||||
Random_Elements.Reset (Gen);
|
|
||||||
|
|
||||||
Buffer := (others => 20);
|
|
||||||
|
|
||||||
Main : loop
|
|
||||||
for J in Buffer'Range loop
|
|
||||||
Buffer (J) := Random_Elements.Random (Gen);
|
|
||||||
|
|
||||||
Deflate_Init (Deflate);
|
|
||||||
Inflate_Init (Inflate);
|
|
||||||
|
|
||||||
Buffer_First := Buffer'First;
|
|
||||||
Compare_First := Buffer'First;
|
|
||||||
|
|
||||||
Translate (Deflate);
|
|
||||||
|
|
||||||
if Compare_First /= Buffer'Last + 1 then
|
|
||||||
raise Program_Error;
|
|
||||||
end if;
|
|
||||||
|
|
||||||
Ada.Text_IO.Put_Line
|
|
||||||
(Ada.Task_Identification.Image
|
|
||||||
(Ada.Task_Identification.Current_Task)
|
|
||||||
& Stream_Element_Offset'Image (J)
|
|
||||||
& ZLib.Count'Image (Total_Out (Deflate)));
|
|
||||||
|
|
||||||
Close (Deflate);
|
|
||||||
Close (Inflate);
|
|
||||||
|
|
||||||
exit Main when Stop;
|
|
||||||
end loop;
|
|
||||||
end loop Main;
|
|
||||||
exception
|
|
||||||
when E : others =>
|
|
||||||
Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E));
|
|
||||||
Stop := True;
|
|
||||||
end Test_Task;
|
|
||||||
|
|
||||||
Test : array (1 .. 4) of Test_Task;
|
|
||||||
|
|
||||||
pragma Unreferenced (Test);
|
|
||||||
|
|
||||||
Dummy : Character;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Ada.Text_IO.Get_Immediate (Dummy);
|
|
||||||
Stop := True;
|
|
||||||
end MTest;
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue