@amxts/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +162 -0
- package/README.ru.md +162 -0
- package/amxmodx/base/include/amxconst.inc +594 -0
- package/amxmodx/base/include/amxmisc.inc +902 -0
- package/amxmodx/base/include/amxmodx.inc +3447 -0
- package/amxmodx/base/include/amxmodx_version.inc +20 -0
- package/amxmodx/base/include/cellarray.inc +525 -0
- package/amxmodx/base/include/cellstack.inc +166 -0
- package/amxmodx/base/include/celltrie.inc +412 -0
- package/amxmodx/base/include/core.inc +202 -0
- package/amxmodx/base/include/csstats.inc +298 -0
- package/amxmodx/base/include/csstats_const.inc +29 -0
- package/amxmodx/base/include/cstrike.inc +1287 -0
- package/amxmodx/base/include/cstrike_const.inc +521 -0
- package/amxmodx/base/include/csx.inc +259 -0
- package/amxmodx/base/include/cvars.inc +547 -0
- package/amxmodx/base/include/datapack.inc +161 -0
- package/amxmodx/base/include/dbi.inc +154 -0
- package/amxmodx/base/include/dodconst.inc +152 -0
- package/amxmodx/base/include/dodfun.inc +152 -0
- package/amxmodx/base/include/dodstats.inc +69 -0
- package/amxmodx/base/include/dodx.inc +161 -0
- package/amxmodx/base/include/engine.inc +1343 -0
- package/amxmodx/base/include/engine_const.inc +310 -0
- package/amxmodx/base/include/engine_stocks.inc +248 -0
- package/amxmodx/base/include/esf.inc +70 -0
- package/amxmodx/base/include/esf_const.inc +74 -0
- package/amxmodx/base/include/fakemeta.inc +1127 -0
- package/amxmodx/base/include/fakemeta_const.inc +793 -0
- package/amxmodx/base/include/fakemeta_stocks.inc +395 -0
- package/amxmodx/base/include/fakemeta_util.inc +882 -0
- package/amxmodx/base/include/file.inc +666 -0
- package/amxmodx/base/include/float.inc +422 -0
- package/amxmodx/base/include/fun.inc +333 -0
- package/amxmodx/base/include/gameconfig.inc +93 -0
- package/amxmodx/base/include/geoip.inc +264 -0
- package/amxmodx/base/include/ham_const.inc +4352 -0
- package/amxmodx/base/include/hamsandwich.inc +439 -0
- package/amxmodx/base/include/hlsdk_const.inc +808 -0
- package/amxmodx/base/include/json.inc +777 -0
- package/amxmodx/base/include/lang.inc +119 -0
- package/amxmodx/base/include/message_const.inc +1130 -0
- package/amxmodx/base/include/message_stocks.inc +161 -0
- package/amxmodx/base/include/messages.inc +604 -0
- package/amxmodx/base/include/newmenus.inc +387 -0
- package/amxmodx/base/include/ns.inc +754 -0
- package/amxmodx/base/include/ns_const.inc +196 -0
- package/amxmodx/base/include/nvault.inc +154 -0
- package/amxmodx/base/include/regex.inc +348 -0
- package/amxmodx/base/include/sockets.inc +183 -0
- package/amxmodx/base/include/sorting.inc +107 -0
- package/amxmodx/base/include/sqlx.inc +582 -0
- package/amxmodx/base/include/string.inc +786 -0
- package/amxmodx/base/include/string_const.inc +156 -0
- package/amxmodx/base/include/string_stocks.inc +325 -0
- package/amxmodx/base/include/textparse_ini.inc +214 -0
- package/amxmodx/base/include/textparse_smc.inc +261 -0
- package/amxmodx/base/include/tfcconst.inc +84 -0
- package/amxmodx/base/include/tfcstats.inc +62 -0
- package/amxmodx/base/include/tfcx.inc +148 -0
- package/amxmodx/base/include/time.inc +118 -0
- package/amxmodx/base/include/tsconst.inc +154 -0
- package/amxmodx/base/include/tsfun.inc +198 -0
- package/amxmodx/base/include/tsstats.inc +65 -0
- package/amxmodx/base/include/tsx.inc +88 -0
- package/amxmodx/base/include/vault.inc +60 -0
- package/amxmodx/base/include/vector.inc +131 -0
- package/amxmodx/base/include/xs.inc +1570 -0
- package/as/amxts.d.ts +153 -0
- package/as/constants.ts +4730 -0
- package/as/effects.ts +1449 -0
- package/as/entities.ts +5482 -0
- package/as/events.ts +3054 -0
- package/as/facade.ts +4639 -0
- package/as/flags.ts +299 -0
- package/as/fs.ts +287 -0
- package/as/hooks.ts +18536 -0
- package/as/kit.ts +25 -0
- package/as/lib/check.ts +86 -0
- package/as/modules/http.ts +184 -0
- package/as/natives.ts +11845 -0
- package/as/os.ts +30 -0
- package/as/promise.ts +1392 -0
- package/as/promise.types.d.ts +82 -0
- package/as/remote.ts +288 -0
- package/as/tsconfig.json +22 -0
- package/as/vector.ts +65 -0
- package/bin/amxts.mjs +10 -0
- package/includes/menu_core.inc +355 -0
- package/includes/order.txt +54 -0
- package/includes/sources.json +27 -0
- package/includes/universal_config.inc +355 -0
- package/lint/oxlint-plugin.mjs +77 -0
- package/node_modules/assemblyscript/LICENSE +201 -0
- package/node_modules/assemblyscript/NOTICE +93 -0
- package/node_modules/assemblyscript/package.json +63 -0
- package/node_modules/assemblyscript/std/README.md +6 -0
- package/node_modules/assemblyscript/std/assembly/array.ts +526 -0
- package/node_modules/assemblyscript/std/assembly/arraybuffer.ts +77 -0
- package/node_modules/assemblyscript/std/assembly/atomics.ts +127 -0
- package/node_modules/assemblyscript/std/assembly/bindings/asyncify.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/bindings/dom.ts +291 -0
- package/node_modules/assemblyscript/std/assembly/bindings/node.ts +6 -0
- package/node_modules/assemblyscript/std/assembly/builtins.ts +2631 -0
- package/node_modules/assemblyscript/std/assembly/compat.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/console.ts +42 -0
- package/node_modules/assemblyscript/std/assembly/crypto.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/dataview.ts +181 -0
- package/node_modules/assemblyscript/std/assembly/date.ts +373 -0
- package/node_modules/assemblyscript/std/assembly/diagnostics.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/error.ts +44 -0
- package/node_modules/assemblyscript/std/assembly/function.ts +38 -0
- package/node_modules/assemblyscript/std/assembly/index.d.ts +2822 -0
- package/node_modules/assemblyscript/std/assembly/iterator.ts +35 -0
- package/node_modules/assemblyscript/std/assembly/map.ts +260 -0
- package/node_modules/assemblyscript/std/assembly/math.ts +3289 -0
- package/node_modules/assemblyscript/std/assembly/memory.ts +123 -0
- package/node_modules/assemblyscript/std/assembly/number.ts +388 -0
- package/node_modules/assemblyscript/std/assembly/object.ts +36 -0
- package/node_modules/assemblyscript/std/assembly/performance.ts +9 -0
- package/node_modules/assemblyscript/std/assembly/polyfills.ts +27 -0
- package/node_modules/assemblyscript/std/assembly/process.ts +50 -0
- package/node_modules/assemblyscript/std/assembly/reference.ts +48 -0
- package/node_modules/assemblyscript/std/assembly/regexp.ts +12 -0
- package/node_modules/assemblyscript/std/assembly/rt/README.md +83 -0
- package/node_modules/assemblyscript/std/assembly/rt/common.ts +81 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-incremental.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-minimal.ts +2 -0
- package/node_modules/assemblyscript/std/assembly/rt/index-stub.ts +1 -0
- package/node_modules/assemblyscript/std/assembly/rt/index.d.ts +37 -0
- package/node_modules/assemblyscript/std/assembly/rt/itcms.ts +419 -0
- package/node_modules/assemblyscript/std/assembly/rt/rtrace.ts +15 -0
- package/node_modules/assemblyscript/std/assembly/rt/stub.ts +133 -0
- package/node_modules/assemblyscript/std/assembly/rt/tcms.ts +254 -0
- package/node_modules/assemblyscript/std/assembly/rt/tlsf.ts +592 -0
- package/node_modules/assemblyscript/std/assembly/rt.ts +87 -0
- package/node_modules/assemblyscript/std/assembly/set.ts +220 -0
- package/node_modules/assemblyscript/std/assembly/shared/feature.ts +65 -0
- package/node_modules/assemblyscript/std/assembly/shared/runtime.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/target.ts +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/tsconfig.json +11 -0
- package/node_modules/assemblyscript/std/assembly/shared/typeinfo.ts +72 -0
- package/node_modules/assemblyscript/std/assembly/staticarray.ts +401 -0
- package/node_modules/assemblyscript/std/assembly/string.ts +847 -0
- package/node_modules/assemblyscript/std/assembly/symbol.ts +114 -0
- package/node_modules/assemblyscript/std/assembly/table.ts +16 -0
- package/node_modules/assemblyscript/std/assembly/tsconfig.json +6 -0
- package/node_modules/assemblyscript/std/assembly/typedarray.ts +1945 -0
- package/node_modules/assemblyscript/std/assembly/uri.ts +17 -0
- package/node_modules/assemblyscript/std/assembly/util/bytes.ts +107 -0
- package/node_modules/assemblyscript/std/assembly/util/casemap.ts +497 -0
- package/node_modules/assemblyscript/std/assembly/util/error.ts +54 -0
- package/node_modules/assemblyscript/std/assembly/util/hash.ts +117 -0
- package/node_modules/assemblyscript/std/assembly/util/math.ts +1922 -0
- package/node_modules/assemblyscript/std/assembly/util/memory.ts +290 -0
- package/node_modules/assemblyscript/std/assembly/util/number.ts +873 -0
- package/node_modules/assemblyscript/std/assembly/util/sort.ts +313 -0
- package/node_modules/assemblyscript/std/assembly/util/string.ts +1202 -0
- package/node_modules/assemblyscript/std/assembly/util/uri.ts +275 -0
- package/node_modules/assemblyscript/std/assembly/vector.ts +4 -0
- package/node_modules/assemblyscript/std/assembly.json +16 -0
- package/node_modules/assemblyscript/std/portable/index.d.ts +462 -0
- package/node_modules/assemblyscript/std/portable/index.js +416 -0
- package/node_modules/assemblyscript/std/portable.json +11 -0
- package/node_modules/assemblyscript/std/types/assembly/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/assembly/package.json +3 -0
- package/node_modules/assemblyscript/std/types/portable/index.d.ts +1 -0
- package/node_modules/assemblyscript/std/types/portable/package.json +3 -0
- package/node_modules/assemblyscript/tsconfig-base.json +13 -0
- package/package.json +112 -0
- package/runtime/deps/assemblyscript/LICENSE +201 -0
- package/runtime/deps/assemblyscript/NOTICE +93 -0
- package/runtime/deps/assemblyscript/bin/asc.js +35 -0
- package/runtime/deps/assemblyscript/dist/asc.js +25035 -0
- package/runtime/deps/assemblyscript/dist/assemblyscript.js +337 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/LICENSE +201 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/index.js +28905 -0
- package/runtime/deps/assemblyscript/node_modules/binaryen/package.json +50 -0
- package/runtime/deps/assemblyscript/node_modules/long/LICENSE +202 -0
- package/runtime/deps/assemblyscript/node_modules/long/index.js +1581 -0
- package/runtime/deps/assemblyscript/node_modules/long/package.json +58 -0
- package/runtime/deps/assemblyscript/package.json +114 -0
- package/runtime/host/amxts.inc +85 -0
- package/runtime/licenses/AMXX-LICENSE.txt +34 -0
- package/runtime/licenses/AssemblyScript-LICENSE +201 -0
- package/runtime/licenses/AssemblyScript-NOTICE +93 -0
- package/runtime/licenses/Binaryen-LICENSE +201 -0
- package/runtime/licenses/Bun-LICENSE.md +84 -0
- package/runtime/licenses/GPL-3.0.txt +674 -0
- package/runtime/licenses/LLVM-LICENSE.TXT +279 -0
- package/runtime/licenses/README.md +25 -0
- package/runtime/licenses/WAMR-LICENSE +219 -0
- package/runtime/natives.txt +1095 -0
- package/runtime/patches/README.md +59 -0
- package/runtime/patches/assemblyscript-0.28.20-amxts.patch +14174 -0
- package/runtime/patches/wamr-2.4.5-amxts.patch +364 -0
- package/scripts/apply-docs.ts +508 -0
- package/scripts/asc.ts +27 -0
- package/scripts/auto-imports.ts +258 -0
- package/scripts/build-wasm.ts +595 -0
- package/scripts/check.ts +93 -0
- package/scripts/compile-cache.ts +179 -0
- package/scripts/compile.ts +401 -0
- package/scripts/docker-server.ts +73 -0
- package/scripts/docs/as/amxts.ts +210 -0
- package/scripts/docs/as/effects.ts +1684 -0
- package/scripts/docs/as/facade.ts +3302 -0
- package/scripts/docs/as/fs.ts +173 -0
- package/scripts/docs/as/lib/check.ts +68 -0
- package/scripts/docs/as/modules/http.ts +66 -0
- package/scripts/docs/as/os.ts +16 -0
- package/scripts/docs/as/promise.ts +132 -0
- package/scripts/docs/as/promise.types.ts +63 -0
- package/scripts/docs/as/vector.ts +48 -0
- package/scripts/docs/entities.ts +2338 -0
- package/scripts/docs/events.ts +245 -0
- package/scripts/docs/game.ts +497 -0
- package/scripts/docs/messages.ts +148 -0
- package/scripts/file-contents.ts +74 -0
- package/scripts/includes.ts +134 -0
- package/scripts/player-fields.ts +866 -0
- package/scripts/plugin-cache.ts +92 -0
- package/scripts/plugin-natives.ts +1157 -0
- package/scripts/prebuilt.ts +268 -0
- package/scripts/prepare.ts +134 -0
- package/scripts/project.ts +973 -0
- package/scripts/run.ts +28 -0
- package/scripts/shared-modules.ts +906 -0
- package/scripts/system.ts +33 -0
- package/scripts/tracked-fs.ts +115 -0
- package/scripts/typed-configs.ts +788 -0
- package/scripts/ui.ts +77 -0
- package/src/cli-api.mjs +175 -0
- package/src/parser/include-parser.ts +506 -0
- package/src/system.mjs +155 -0
- package/src/testing/compile-cache.ts +31 -0
- package/src/testing/compile.ts +222 -0
- package/src/testing/coroutines.ts +191 -0
- package/src/testing/index.ts +39 -0
- package/src/testing/kits.ts +55 -0
- package/src/testing/memory.ts +125 -0
- package/src/testing/natives.ts +925 -0
- package/src/testing/server.ts +1874 -0
- package/src/testing/setup.ts +63 -0
- package/src/testing/tables.ts +139 -0
- package/src/types.ts +51 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// String Manipulation Constants
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined _string_const_included
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define _string_const_included
|
|
18
|
+
|
|
19
|
+
#define charsmax(%1) (sizeof(%1)-1)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @global Unless otherwise noted, all string functions which take in a
|
|
23
|
+
* writable buffer and maximum length should NOT have the null terminator INCLUDED
|
|
24
|
+
* in the length. This means that this is valid:
|
|
25
|
+
* copy(string, charsmax(string), ...)
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Buffer size used by fmt().
|
|
30
|
+
*/
|
|
31
|
+
#define MAX_FMT_LENGTH 256
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Below are the trim flags for strtok2
|
|
35
|
+
*
|
|
36
|
+
* You can specify how the left and right buffers will
|
|
37
|
+
* be trimmed by strtok2. LTRIM trims spaces from the
|
|
38
|
+
* left side. RTRIM trims from the right side.
|
|
39
|
+
*
|
|
40
|
+
* The defines TRIM_INNER, TRIM_OUTER and TRIM_FULL are
|
|
41
|
+
* shorthands for commonly used flag combinations.
|
|
42
|
+
*
|
|
43
|
+
* When the initial string is trimmed, using TRIM_INNER
|
|
44
|
+
* for all subsequent strtok2 calls will ensure that left
|
|
45
|
+
* and right are always trimmed from both sides.
|
|
46
|
+
*
|
|
47
|
+
* Examples:
|
|
48
|
+
* str1[] = " This is * some text "
|
|
49
|
+
* strtok2(str1, left, 24, right, 24, '*', TRIM_FULL)
|
|
50
|
+
* left will be "This is", right will be "some text"
|
|
51
|
+
*
|
|
52
|
+
* str2[] = " Here is | an | example "
|
|
53
|
+
* trim(str2)
|
|
54
|
+
* strtok2(str2, left, 24, right, 24, '|', TRIM_INNER)
|
|
55
|
+
* left will be "Here is", right will be "an | example"
|
|
56
|
+
* strtok2(right, left, 24, right, 24, '|', TRIM_INNER)
|
|
57
|
+
* left will be "an", right will be "example"
|
|
58
|
+
*
|
|
59
|
+
* str3[] = " One - more "
|
|
60
|
+
* strtok2(str3, left, 24, right, 24, '-', TRIM_OUTER)
|
|
61
|
+
* left will be "One ", right will be " more"
|
|
62
|
+
*
|
|
63
|
+
* str4[] = " Final . example "
|
|
64
|
+
* strtok2(str4, left, 24, right, 24, '.', LTRIM_LEFT|LTRIM_RIGHT)
|
|
65
|
+
* left will be "Final ", right will be "example "
|
|
66
|
+
*/
|
|
67
|
+
#define LTRIM_LEFT (1<<0)
|
|
68
|
+
#define RTRIM_LEFT (1<<1)
|
|
69
|
+
#define LTRIM_RIGHT (1<<2)
|
|
70
|
+
#define RTRIM_RIGHT (1<<3)
|
|
71
|
+
|
|
72
|
+
#define TRIM_INNER RTRIM_LEFT|LTRIM_RIGHT
|
|
73
|
+
#define TRIM_OUTER LTRIM_LEFT|RTRIM_RIGHT
|
|
74
|
+
#define TRIM_FULL TRIM_OUTER|TRIM_INNER
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Category flags to be used with is_string_category(), to check whether code points in a
|
|
78
|
+
* string are part of that category.
|
|
79
|
+
*/
|
|
80
|
+
#define UTF8C_LETTER_UPPERCASE 0x00000001 // Uppercase letter code points, Lu in the Unicode database.
|
|
81
|
+
#define UTF8C_LETTER_LOWERCASE 0x00000002 // Lowercase letter code points, Ll in the Unicode database.
|
|
82
|
+
#define UTF8C_LETTER_TITLECASE 0x00000004 // Titlecase letter code points, Lt in the Unicode database.
|
|
83
|
+
#define UTF8C_LETTER_MODIFIER 0x00000008 // Modifier letter code points, Lm in the Unicode database.
|
|
84
|
+
#define UTF8C_LETTER_OTHER 0x00000010 // Other letter code points, Lo in the Unicode database.
|
|
85
|
+
|
|
86
|
+
// Combined flag for all letter categories with case mapping
|
|
87
|
+
// Combined flag for all letter categories
|
|
88
|
+
const UTF8C_LETTER = (UTF8C_LETTER_UPPERCASE | UTF8C_LETTER_LOWERCASE | UTF8C_LETTER_TITLECASE | UTF8C_LETTER_MODIFIER | UTF8C_LETTER_OTHER);
|
|
89
|
+
const UTF8C_CASE_MAPPED = (UTF8C_LETTER_UPPERCASE | UTF8C_LETTER_LOWERCASE | UTF8C_LETTER_TITLECASE);
|
|
90
|
+
|
|
91
|
+
#define UTF8C_MARK_NON_SPACING 0x00000020 // Non-spacing mark code points, Mn in the Unicode database.
|
|
92
|
+
#define UTF8C_MARK_SPACING 0x00000040 // Spacing mark code points, Mc in the Unicode database.
|
|
93
|
+
#define UTF8C_MARK_ENCLOSING 0x00000080 // Enclosing mark code points, Me in the Unicode database.
|
|
94
|
+
|
|
95
|
+
// Combined flag for all mark categories.
|
|
96
|
+
const UTF8C_MARK = (UTF8C_MARK_NON_SPACING | UTF8C_MARK_SPACING | UTF8C_MARK_ENCLOSING);
|
|
97
|
+
|
|
98
|
+
#define UTF8C_NUMBER_DECIMAL 0x00000100 // Decimal number code points, Nd in the Unicode database.
|
|
99
|
+
#define UTF8C_NUMBER_LETTER 0x00000200 // Letter number code points, Nl in the Unicode database.
|
|
100
|
+
#define UTF8C_NUMBER_OTHER 0x00000400 // Other number code points, No in the Unicode database.
|
|
101
|
+
|
|
102
|
+
// Combined flag for all number categories.
|
|
103
|
+
const UTF8C_NUMBER = (UTF8C_NUMBER_DECIMAL | UTF8C_NUMBER_LETTER | UTF8C_NUMBER_OTHER);
|
|
104
|
+
|
|
105
|
+
#define UTF8C_PUNCTUATION_CONNECTOR 0x00000800 // Connector punctuation category, Pc in the Unicode database.
|
|
106
|
+
#define UTF8C_PUNCTUATION_DASH 0x00001000 // Dash punctuation category, Pd in the Unicode database.
|
|
107
|
+
#define UTF8C_PUNCTUATION_OPEN 0x00002000 // Open punctuation category, Ps in the Unicode database.
|
|
108
|
+
#define UTF8C_PUNCTUATION_CLOSE 0x00004000 // Close punctuation category, Pe in the Unicode database.
|
|
109
|
+
#define UTF8C_PUNCTUATION_INITIAL 0x00008000 // Initial punctuation category, Pi in the Unicode database.
|
|
110
|
+
#define UTF8C_PUNCTUATION_FINAL 0x00010000 // Final punctuation category, Pf in the Unicode database.
|
|
111
|
+
#define UTF8C_PUNCTUATION_OTHER 0x00020000 // Other punctuation category, Po in the Unicode database.
|
|
112
|
+
|
|
113
|
+
// Combined flag for all punctuation categories.
|
|
114
|
+
const UTF8C_PUNCTUATION = (UTF8C_PUNCTUATION_CONNECTOR | UTF8C_PUNCTUATION_DASH | UTF8C_PUNCTUATION_OPEN | \
|
|
115
|
+
UTF8C_PUNCTUATION_CLOSE | UTF8C_PUNCTUATION_INITIAL | UTF8C_PUNCTUATION_FINAL | \
|
|
116
|
+
UTF8C_PUNCTUATION_OTHER);
|
|
117
|
+
|
|
118
|
+
#define UTF8C_SYMBOL_MATH 0x00040000 // Math symbol category, Sm in the Unicode database.
|
|
119
|
+
#define UTF8C_SYMBOL_CURRENCY 0x00080000 // Currency symbol category, Sc in the Unicode database.
|
|
120
|
+
#define UTF8C_SYMBOL_MODIFIER 0x00100000 // Modifier symbol category, Sk in the Unicode database.
|
|
121
|
+
#define UTF8C_SYMBOL_OTHER 0x00200000 // Other symbol category, So in the Unicode database.
|
|
122
|
+
|
|
123
|
+
// Combined flag for all symbol categories.
|
|
124
|
+
const UTF8C_SYMBOL = (UTF8C_SYMBOL_MATH | UTF8C_SYMBOL_CURRENCY | UTF8C_SYMBOL_MODIFIER | UTF8C_SYMBOL_OTHER);
|
|
125
|
+
|
|
126
|
+
#define UTF8C_SEPARATOR_SPACE 0x00400000 // Space separator category, Zs in the Unicode database.
|
|
127
|
+
#define UTF8C_SEPARATOR_LINE 0x00800000 // Line separator category, Zl in the Unicode database.
|
|
128
|
+
#define UTF8C_SEPARATOR_PARAGRAPH 0x01000000 // Paragraph separator category, Zp in the Unicode database.
|
|
129
|
+
|
|
130
|
+
// Combined flag for all separator categories.
|
|
131
|
+
const UTF8C_SEPARATOR = (UTF8C_SEPARATOR_SPACE | UTF8C_SEPARATOR_LINE | UTF8C_SEPARATOR_PARAGRAPH);
|
|
132
|
+
|
|
133
|
+
#define UTF8C_CONTROL 0x02000000 // Control category, Cc in the Unicode database.
|
|
134
|
+
#define UTF8C_FORMAT 0x04000000 // Format category, Cf in the Unicode database.
|
|
135
|
+
#define UTF8C_SURROGATE 0x08000000 // Surrogate category, Cs in the Unicode database.
|
|
136
|
+
#define UTF8C_PRIVATE_USE 0x10000000 // Private use category, Co in the Unicode database.
|
|
137
|
+
#define UTF8C_UNASSIGNED 0x20000000 // Unassigned category, Cn in the Unicode database.
|
|
138
|
+
#define UTF8C_COMPATIBILITY 0x40000000 // Flag used for maintaining backwards compatibility with POSIX
|
|
139
|
+
#define UTF8C_IGNORE_GRAPHEME_CLUSTER 0x80000000 // Flag used for checking only the general category of code points at the start of a grapheme cluster.
|
|
140
|
+
|
|
141
|
+
// Flag used for maintaining backwards compatibility with POSIX function
|
|
142
|
+
const UTF8C_ISCNTRL = (UTF8C_COMPATIBILITY | UTF8C_CONTROL);
|
|
143
|
+
const UTF8C_ISPRINT = (UTF8C_COMPATIBILITY | UTF8C_LETTER | UTF8C_NUMBER | UTF8C_PUNCTUATION | UTF8C_SYMBOL | UTF8C_SEPARATOR);
|
|
144
|
+
const UTF8C_ISSPACE = (UTF8C_COMPATIBILITY | UTF8C_SEPARATOR_SPACE);
|
|
145
|
+
const UTF8C_ISBLANK = (UTF8C_COMPATIBILITY | UTF8C_SEPARATOR_SPACE | UTF8C_PRIVATE_USE);
|
|
146
|
+
const UTF8C_ISGRAPH = (UTF8C_COMPATIBILITY | UTF8C_LETTER | UTF8C_NUMBER | UTF8C_PUNCTUATION | UTF8C_SYMBOL);
|
|
147
|
+
const UTF8C_ISPUNCT = (UTF8C_COMPATIBILITY | UTF8C_PUNCTUATION | UTF8C_SYMBOL);
|
|
148
|
+
const UTF8C_ISALNUM = (UTF8C_COMPATIBILITY | UTF8C_LETTER | UTF8C_NUMBER);
|
|
149
|
+
const UTF8C_ISALPHA = (UTF8C_COMPATIBILITY | UTF8C_LETTER);
|
|
150
|
+
const UTF8C_ISUPPER = (UTF8C_COMPATIBILITY | UTF8C_LETTER_UPPERCASE);
|
|
151
|
+
const UTF8C_ISLOWER = (UTF8C_COMPATIBILITY | UTF8C_LETTER_LOWERCASE);
|
|
152
|
+
const UTF8C_ISDIGIT = (UTF8C_COMPATIBILITY | UTF8C_NUMBER);
|
|
153
|
+
const UTF8C_ISXDIGIT = (UTF8C_COMPATIBILITY | UTF8C_NUMBER | UTF8C_PRIVATE_USE);
|
|
154
|
+
|
|
155
|
+
// All flags.
|
|
156
|
+
const UTF8C_ALL = 0xFFFFFFFF & (~UTF8C_COMPATIBILITY);
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// String Manipulation Stocks
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined _string_stocks_included
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define _string_stocks_included
|
|
18
|
+
|
|
19
|
+
#if !defined _string_included
|
|
20
|
+
#include <string>
|
|
21
|
+
#endif
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @global Unless otherwise noted, all string functions which take in a
|
|
25
|
+
* writable buffer and maximum length should NOT have the null terminator INCLUDED
|
|
26
|
+
* in the length. This means that this is valid:
|
|
27
|
+
* copy(string, charsmax(string), ...)
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns whether a given string contains only digits.
|
|
32
|
+
* This returns false for zero-length strings.
|
|
33
|
+
*
|
|
34
|
+
* @param sString Character to test.
|
|
35
|
+
* @return True if string contains only digit, otherwise false.
|
|
36
|
+
*/
|
|
37
|
+
stock bool:is_str_num(const sString[])
|
|
38
|
+
{
|
|
39
|
+
new i = 0;
|
|
40
|
+
|
|
41
|
+
while (sString[i] && isdigit(sString[i]))
|
|
42
|
+
{
|
|
43
|
+
++i;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return sString[i] == 0 && i != 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Returns an uppercase character to a lowercase character.
|
|
51
|
+
*
|
|
52
|
+
* @note Only available in 1.8.3 and above.
|
|
53
|
+
*
|
|
54
|
+
* @param chr Characer to convert.
|
|
55
|
+
* @return Lowercase character on success,
|
|
56
|
+
* no change on failure.
|
|
57
|
+
*/
|
|
58
|
+
stock char_to_upper(chr)
|
|
59
|
+
{
|
|
60
|
+
if (is_char_lower(chr))
|
|
61
|
+
{
|
|
62
|
+
return (chr & ~(1<<5));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return chr;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Returns a lowercase character to an uppercase character.
|
|
70
|
+
*
|
|
71
|
+
* @note Only available in 1.8.3 and above.
|
|
72
|
+
*
|
|
73
|
+
* @param chr Characer to convert.
|
|
74
|
+
* @return Uppercase character on success,
|
|
75
|
+
* no change on failure.
|
|
76
|
+
*/
|
|
77
|
+
stock char_to_lower(chr)
|
|
78
|
+
{
|
|
79
|
+
if (is_char_upper(chr))
|
|
80
|
+
{
|
|
81
|
+
return (chr | (1<<5));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return chr;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Backwards compatibility stock - use argbreak or argparse.
|
|
89
|
+
* @deprecated this function does not work properly.
|
|
90
|
+
*/
|
|
91
|
+
#pragma deprecated Use argbreak() instead
|
|
92
|
+
stock strbreak(const text[], Left[], leftLen, Right[], rightLen)
|
|
93
|
+
{
|
|
94
|
+
return argbreak(text, Left, leftLen, Right, rightLen);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Emulates strbreak() using argparse().
|
|
99
|
+
*
|
|
100
|
+
* @param text Source input string.
|
|
101
|
+
* @param left Buffer to store string left part.
|
|
102
|
+
* @param leftlen Maximum length of the string part buffer.
|
|
103
|
+
* @param right Buffer to store string right part.
|
|
104
|
+
* @param rightlen Maximum length of the string part buffer.
|
|
105
|
+
*
|
|
106
|
+
* @return -1 if no match was found; otherwise, an index into source
|
|
107
|
+
* marking the first index after the searched text. The
|
|
108
|
+
* index is always relative to the start of the input string.
|
|
109
|
+
*/
|
|
110
|
+
stock argbreak(const text[], left[], leftlen, right[], rightlen)
|
|
111
|
+
{
|
|
112
|
+
new pos = argparse(text, 0, left, leftlen);
|
|
113
|
+
|
|
114
|
+
if (pos == -1)
|
|
115
|
+
{
|
|
116
|
+
return -1;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
new textlen = strlen(text);
|
|
120
|
+
|
|
121
|
+
while (pos < textlen && isspace(text[pos]))
|
|
122
|
+
{
|
|
123
|
+
pos++;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
copy(right, rightlen, text[pos]);
|
|
127
|
+
|
|
128
|
+
return pos;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* It is basically strbreak but you have a delimiter that is more than one character in length. By Suicid3.
|
|
133
|
+
*
|
|
134
|
+
* @param szInput Source input string.
|
|
135
|
+
* @param szLeft Buffer to store left string part.
|
|
136
|
+
* @param pL_Max Maximum length of the string part buffer.
|
|
137
|
+
* @param szRight Buffer to store right string part.
|
|
138
|
+
* @param pR_Max Maximum length of the string part buffer.
|
|
139
|
+
* @param szDelim A string which specifies a search point to break at.
|
|
140
|
+
*
|
|
141
|
+
* @noreturn
|
|
142
|
+
*/
|
|
143
|
+
stock split(const szInput[], szLeft[], pL_Max, szRight[], pR_Max, const szDelim[])
|
|
144
|
+
{
|
|
145
|
+
new iEnd = contain(szInput, szDelim);
|
|
146
|
+
new iStart = iEnd + strlen(szDelim);
|
|
147
|
+
|
|
148
|
+
// If delimiter isnt in Input just split the string at max lengths
|
|
149
|
+
if (iEnd == -1)
|
|
150
|
+
{
|
|
151
|
+
iStart = copy(szLeft, pL_Max, szInput);
|
|
152
|
+
copy(szRight, pR_Max, szInput[iStart]);
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// If delimter is in Input then split at input for max lengths
|
|
157
|
+
if (pL_Max >= iEnd)
|
|
158
|
+
copy(szLeft, iEnd, szInput);
|
|
159
|
+
else
|
|
160
|
+
copy(szLeft, pL_Max, szInput);
|
|
161
|
+
|
|
162
|
+
copy(szRight, pR_Max, szInput[iStart]);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Removes a path from szFilePath leaving the name of the file in szFile for a pMax length.
|
|
167
|
+
*
|
|
168
|
+
* @param szFilePath String to perform search and replacements on.
|
|
169
|
+
* @param szFile Buffer to store file name.
|
|
170
|
+
* @param pMax Maximum length of the string buffer.
|
|
171
|
+
*
|
|
172
|
+
* @noreturn
|
|
173
|
+
*/
|
|
174
|
+
stock remove_filepath(const szFilePath[], szFile[], pMax)
|
|
175
|
+
{
|
|
176
|
+
new len = strlen(szFilePath);
|
|
177
|
+
|
|
178
|
+
while ((--len >= 0) && (szFilePath[len] != '/') && (szFilePath[len] != '\')) { }
|
|
179
|
+
|
|
180
|
+
copy(szFile, pMax, szFilePath[len + 1]);
|
|
181
|
+
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Replaces a contained string iteratively.
|
|
187
|
+
*
|
|
188
|
+
* @note Consider using replace_string() instead.
|
|
189
|
+
*
|
|
190
|
+
* @note This ensures that no infinite replacements will take place by
|
|
191
|
+
* intelligently moving to the next string position each iteration.
|
|
192
|
+
*
|
|
193
|
+
* @param string String to perform search and replacements on.
|
|
194
|
+
* @param len Maximum length of the string buffer.
|
|
195
|
+
* @param what String to search for.
|
|
196
|
+
* @param with String to replace the search string with.
|
|
197
|
+
*
|
|
198
|
+
* @return Number of replacements on success, otherwise 0.
|
|
199
|
+
*/
|
|
200
|
+
stock replace_all(string[], len, const what[], const with[])
|
|
201
|
+
{
|
|
202
|
+
new pos = 0;
|
|
203
|
+
|
|
204
|
+
if ((pos = contain(string, what)) == -1)
|
|
205
|
+
{
|
|
206
|
+
return 0;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
new total = 0;
|
|
210
|
+
new with_len = strlen(with);
|
|
211
|
+
new diff = strlen(what) - with_len;
|
|
212
|
+
new total_len = strlen(string);
|
|
213
|
+
new temp_pos = 0;
|
|
214
|
+
|
|
215
|
+
while (replace(string[pos], len - pos, what, with) != 0)
|
|
216
|
+
{
|
|
217
|
+
total++;
|
|
218
|
+
|
|
219
|
+
/* jump to position after replacement */
|
|
220
|
+
pos += with_len;
|
|
221
|
+
|
|
222
|
+
/* update cached length of string */
|
|
223
|
+
total_len -= diff;
|
|
224
|
+
|
|
225
|
+
/* will the next call be operating on the last character? */
|
|
226
|
+
if (pos >= total_len)
|
|
227
|
+
{
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* find the next position from our offset */
|
|
232
|
+
temp_pos = contain(string[pos], what);
|
|
233
|
+
|
|
234
|
+
/* if it's invalid, we're done */
|
|
235
|
+
if (temp_pos == -1)
|
|
236
|
+
{
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* otherwise, reposition and update counters */
|
|
241
|
+
pos += temp_pos;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return total;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Breaks a string into pieces and stores each piece into an array of buffers.
|
|
249
|
+
*
|
|
250
|
+
* @param text The string to split.
|
|
251
|
+
* @param split The string to use as a split delimiter.
|
|
252
|
+
* @param buffers An array of string buffers (2D array).
|
|
253
|
+
* @param maxStrings Number of string buffers (first dimension size).
|
|
254
|
+
* @param maxStringLength Maximum length of each string buffer.
|
|
255
|
+
* @param copyRemainder False (default) discard excess pieces, true to ignore
|
|
256
|
+
* delimiters after last piece.
|
|
257
|
+
* @return Number of strings retrieved.
|
|
258
|
+
*/
|
|
259
|
+
stock explode_string(const text[], const split[], buffers[][], maxStrings, maxStringLength, bool:copyRemainder = false)
|
|
260
|
+
{
|
|
261
|
+
new reloc_idx, idx, total;
|
|
262
|
+
|
|
263
|
+
if (maxStrings < 1 || !split[0])
|
|
264
|
+
{
|
|
265
|
+
return 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
while ((idx = split_string(text[reloc_idx], split, buffers[total], maxStringLength)) != -1)
|
|
269
|
+
{
|
|
270
|
+
reloc_idx += idx;
|
|
271
|
+
if (++total == maxStrings)
|
|
272
|
+
{
|
|
273
|
+
if (copyRemainder)
|
|
274
|
+
{
|
|
275
|
+
copy(buffers[total-1], maxStringLength, text[reloc_idx-idx]);
|
|
276
|
+
}
|
|
277
|
+
return total;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
copy(buffers[total++], maxStringLength, text[reloc_idx]);
|
|
282
|
+
|
|
283
|
+
return total;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Joins an array of strings into one string, with a "join" string inserted in
|
|
288
|
+
* between each given string. This function complements ExplodeString.
|
|
289
|
+
*
|
|
290
|
+
* @param strings An array of strings.
|
|
291
|
+
* @param numStrings Number of strings in the array.
|
|
292
|
+
* @param join The join string to insert between each string.
|
|
293
|
+
* @param buffer Output buffer to write the joined string to.
|
|
294
|
+
* @param maxLength Maximum length of the output buffer.
|
|
295
|
+
* @return Number of bytes written to the output buffer.
|
|
296
|
+
*/
|
|
297
|
+
stock implode_strings(const strings[][], numStrings, const join[], buffer[], maxLength)
|
|
298
|
+
{
|
|
299
|
+
new total, length, part_length;
|
|
300
|
+
new join_length = strlen(join);
|
|
301
|
+
|
|
302
|
+
for (new i=0; i<numStrings; i++)
|
|
303
|
+
{
|
|
304
|
+
length = copy(buffer[total], maxLength-total, strings[i]);
|
|
305
|
+
total += length;
|
|
306
|
+
|
|
307
|
+
if (length < part_length)
|
|
308
|
+
{
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (i != numStrings - 1)
|
|
313
|
+
{
|
|
314
|
+
length = copy(buffer[total], maxLength-total, join);
|
|
315
|
+
total += length;
|
|
316
|
+
|
|
317
|
+
if (length < join_length)
|
|
318
|
+
{
|
|
319
|
+
break;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
return total;
|
|
325
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// vim: set ts=4 sw=4 tw=99 noet:
|
|
2
|
+
//
|
|
3
|
+
// AMX Mod X, based on AMX Mod by Aleksander Naszko ("OLO").
|
|
4
|
+
// Copyright (C) The AMX Mod X Development Team.
|
|
5
|
+
//
|
|
6
|
+
// This software is licensed under the GNU General Public License, version 3 or higher.
|
|
7
|
+
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
|
8
|
+
// https://alliedmods.net/amxmodx-license
|
|
9
|
+
|
|
10
|
+
//
|
|
11
|
+
// INI Parser Functions
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
#if defined _textparse_ini_included
|
|
15
|
+
#endinput
|
|
16
|
+
#endif
|
|
17
|
+
#define _textparse_ini_included
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This parser API is entirely event based.
|
|
21
|
+
* You must hook events to receive data.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The INI file format is defined as:
|
|
26
|
+
* WHITESPACE: 0x20, \n, \t, \r
|
|
27
|
+
* IDENTIFIER: A-Z a-z 0-9 _ - , + . $ ? /
|
|
28
|
+
* STRING : Any set of symbols
|
|
29
|
+
*
|
|
30
|
+
* Basic syntax is comprised of SECTIONs.
|
|
31
|
+
* A SECTION is defined as:
|
|
32
|
+
* [SECTIONNAME]
|
|
33
|
+
* OPTION
|
|
34
|
+
* OPTION
|
|
35
|
+
* OPTION...
|
|
36
|
+
*
|
|
37
|
+
* SECTIONNAME is an IDENTIFIER.
|
|
38
|
+
* OPTION can be repeated any number of times, once per line.
|
|
39
|
+
* OPTION is defined as one of:
|
|
40
|
+
* KEY = "VALUE"
|
|
41
|
+
* KEY = VALUE
|
|
42
|
+
* KEY
|
|
43
|
+
* Where KEY is an IDENTIFIER and VALUE is a STRING.
|
|
44
|
+
*
|
|
45
|
+
* WHITESPACE should always be omitted.
|
|
46
|
+
* COMMENTS should be stripped, and are defined as text occurring in:
|
|
47
|
+
* ;<TEXT>
|
|
48
|
+
*
|
|
49
|
+
* Example file below. Note that the second line is technically invalid.
|
|
50
|
+
* The event handler must decide whether this should be allowed.
|
|
51
|
+
* --FILE BELOW--
|
|
52
|
+
* [gaben]
|
|
53
|
+
* hi = clams
|
|
54
|
+
* bye = "NO CLAMS"
|
|
55
|
+
*
|
|
56
|
+
* [valve]
|
|
57
|
+
* cannot
|
|
58
|
+
* maintain
|
|
59
|
+
* products
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Parser invalid code.
|
|
64
|
+
*/
|
|
65
|
+
enum INIParser
|
|
66
|
+
{
|
|
67
|
+
Invalid_INIParser = 0
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Creates a new INI parser.
|
|
72
|
+
* This is used to set parse hooks.
|
|
73
|
+
*
|
|
74
|
+
* @return A new handle to an INI Parse structure.
|
|
75
|
+
*/
|
|
76
|
+
native INIParser:INI_CreateParser();
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Disposes of an INI parser.
|
|
80
|
+
*
|
|
81
|
+
* @param handle Handle to an INI Parse structure.
|
|
82
|
+
*
|
|
83
|
+
* @return True if disposed, false otherwise.
|
|
84
|
+
*/
|
|
85
|
+
native INI_DestroyParser(&INIParser:handle);
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Parses an INI config file.
|
|
89
|
+
*
|
|
90
|
+
* @param handle A handle to an INI Parse structure.
|
|
91
|
+
* @param file A string containing the file path.
|
|
92
|
+
* @param line An optional by reference cell to store the last line number read.
|
|
93
|
+
* @param col An optional by reference cell to store the last column number read.
|
|
94
|
+
* @param data An optional handle or value to pass through to callback functions
|
|
95
|
+
*
|
|
96
|
+
* @return An SMCParseError result.
|
|
97
|
+
* @error Invalid or corrupt handle.
|
|
98
|
+
*/
|
|
99
|
+
native bool:INI_ParseFile(INIParser:handle, const file[], &line = 0, &col = 0, any:data = 0);
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Sets the INI_ParseStart function of a parse handle.
|
|
103
|
+
*
|
|
104
|
+
* @note Below is the prototype of callback:
|
|
105
|
+
* -
|
|
106
|
+
* Called when parsing is started.
|
|
107
|
+
*
|
|
108
|
+
* @param handle A handle to an INI Parse structure.
|
|
109
|
+
* @param data Handle or value passed in INI_ParseFile
|
|
110
|
+
*
|
|
111
|
+
* @noreturn
|
|
112
|
+
*
|
|
113
|
+
* public OnParseStart(INIParser:handle, any:data)
|
|
114
|
+
* -
|
|
115
|
+
* @param handle Handle to an INI Parse structure.
|
|
116
|
+
* @param func A ParseStart callback.
|
|
117
|
+
*
|
|
118
|
+
* @noreturn
|
|
119
|
+
* @error Invalid or corrupt handle.
|
|
120
|
+
*/
|
|
121
|
+
native INI_SetParseStart(INIParser:handle, const func[]);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Sets the INI_ParseEnd function of a parse handle.
|
|
125
|
+
*
|
|
126
|
+
* @note Below is the prototype of callback:
|
|
127
|
+
* -
|
|
128
|
+
* Called when parsing is halted.
|
|
129
|
+
*
|
|
130
|
+
* @param handle A handle to an INI Parse structure.
|
|
131
|
+
* @param halted True if abnormally halted, false otherwise.
|
|
132
|
+
* @param data Handle or value passed in INI_ParseFile
|
|
133
|
+
*
|
|
134
|
+
* @noreturn
|
|
135
|
+
*
|
|
136
|
+
* public OnParseEnd(INIParser:handle, bool:halted, any:data)
|
|
137
|
+
* -
|
|
138
|
+
* @param handle Handle to an INI Parse structure.
|
|
139
|
+
* @param func A ParseEnd callback.
|
|
140
|
+
*
|
|
141
|
+
* @noreturn
|
|
142
|
+
* @error Invalid or corrupt handle.
|
|
143
|
+
*/
|
|
144
|
+
native INI_SetParseEnd(INIParser:handle, const func[]);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Sets the two main reader functions.
|
|
148
|
+
*
|
|
149
|
+
* @note Below is the prototype of callback:
|
|
150
|
+
* -
|
|
151
|
+
* NewSection:
|
|
152
|
+
* Called when the parser finds a new section.
|
|
153
|
+
*
|
|
154
|
+
* @param handle Handle to an INI Parse structure.
|
|
155
|
+
* @param section Name of section in between the [ and ] characters.
|
|
156
|
+
* @param invalid_tokens True if invalid tokens were detected in the name.
|
|
157
|
+
* @param close_bracket True if a closing bracket was detected, false otherwise.
|
|
158
|
+
* @param extra_tokens True if extra tokens were detected on the line.
|
|
159
|
+
* @param curtok Contains current token in the line where the section name starts.
|
|
160
|
+
* You can add to this offset when failing to point to a token.
|
|
161
|
+
* @param data Handle or value passed in INI_ParseFile
|
|
162
|
+
*
|
|
163
|
+
* @return True to keep parsing, false otherwise.
|
|
164
|
+
*
|
|
165
|
+
* public bool:OnNewSection(INIParser:handle, const section[], bool:invalid_tokens, bool:close_bracket, bool:extra_tokens, curtok, any:data)
|
|
166
|
+
*
|
|
167
|
+
* KeyValue:
|
|
168
|
+
* Called when the parser finds a new key/value pair.
|
|
169
|
+
*
|
|
170
|
+
* @param handle Handle to an INI Parse structure.
|
|
171
|
+
* @param key Name of key.
|
|
172
|
+
* @param value String containing value (with quotes stripped, if any).
|
|
173
|
+
* @param invalid_tokens Whether or not the key contained invalid tokens.
|
|
174
|
+
* @param equal_token There was an '=' sign present (in case the value is missing).
|
|
175
|
+
* @param quotes Whether value was enclosed in quotes.
|
|
176
|
+
* @param curtok Contains the token index of the start of the value string.
|
|
177
|
+
* This can be changed when returning false.
|
|
178
|
+
* @param data Handle or value passed in INI_ParseFile
|
|
179
|
+
*
|
|
180
|
+
* @return True to keep parsing, false otherwise.
|
|
181
|
+
*
|
|
182
|
+
* public bool:OnKeyValue(INIParser:handle, const key[], const value[], bool:invalid_tokens, bool:equal_token, bool:quotes, curtok, any:data)
|
|
183
|
+
* -
|
|
184
|
+
* @param handle Handle to an INI Parse structure.
|
|
185
|
+
* @param kv A KeyValue callback.
|
|
186
|
+
* @param ns An optional NewSection callback.
|
|
187
|
+
*
|
|
188
|
+
* @noreturn
|
|
189
|
+
*/
|
|
190
|
+
native INI_SetReaders(INIParser:smc, const kvFunc[], const nsFunc[] = "" );
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Sets a raw line reader on an INI parser handle.
|
|
194
|
+
*
|
|
195
|
+
* @note Below is the prototype of callback:
|
|
196
|
+
* -
|
|
197
|
+
* Called whenever a raw line is read.
|
|
198
|
+
*
|
|
199
|
+
* @param handle The INI Parse handle.
|
|
200
|
+
* @param line Contents of line.
|
|
201
|
+
* @param lineno The line number it occurs on.
|
|
202
|
+
* @param curtok Pointer to optionally store failed position in string.
|
|
203
|
+
* @param data Handle or value passed in INI_ParseFile
|
|
204
|
+
*
|
|
205
|
+
* @return True to keep parsing, false otherwise.
|
|
206
|
+
*
|
|
207
|
+
* public bool:OnRawLine(INIParser:smc, const line[], lineno, curtok, any:data)
|
|
208
|
+
*
|
|
209
|
+
* @param handle Handle to an INI Parse structure.
|
|
210
|
+
* @param func A RawLine callback.
|
|
211
|
+
*
|
|
212
|
+
* @noreturn
|
|
213
|
+
*/
|
|
214
|
+
native INI_SetRawLine(INIParser:handle, const func[]);
|