Releases: IS4Code/PawnPlus
PawnPlus v1.5.2
PawnPlus v1.5.1
Fixes
- The expression parser (
expr_parse) now correctly interprets&&and||(used to parse&&as& &). - After using
pp_hook_check_ref_args(true),AmxString:values are now interpreted correctly (#59).
PawnPlus v1.5
Locales
Locales and locale-based operations now play a much more integral role in the plugin. See here for a more comprehensive guide of how locales are configured and used. Main changes:
- A custom format of the locale name is now used, allowing to specify the encoding and other parameters in addition to the locale name. This allows using Unicode-based locales as well as tweak details of how other operations behave, such as the interpretation of characters outside the ANSI range, the fallback character used when no mapping is available, and so on.
- In addition, the format supports
|-separated alternatives, to form a single locale name that could be used on multiple platforms (e.g. both Windows and Linux) to select the appropriate supported locale. - This form of locale name can now be used in existing functions such as
str_to_lower/str_to_upper, as well as new functions likestr_count_charsorstr_collation_key. In practice, this means that different locale-based rules could be applied to individual calls, without usingpp_localeto modify the global locale.
String formatting and conversions
Thanks to the new locale features, additional enhancements for string formatting and conversions were possible:
- The
str_convertfunction can be used to convert from one encoding into another. This can be used to convert an ANSI-encoded string into Unicode, or vice versa. str_formatand other formatting functions now support changing the locale mid-string, in the form of{$enc:identifier}, applying to the format specifiers that follow it. This can be used to set the default number formatting rules, to perform automaticstr_convertfor strings, etc.- New format selectors were added:
%m(monetary value) and%t(time), both using locale-based output format. In addition,xnow supports floats and produces a hex-float when used on a known float value.
Regular expressions
Existing regular expression capabilities were also enhanced with locale support, as well as as a new pattern-matching engine: Lex, inspired by Lua.
- The locale can be specified at the beginning of any pattern by using the syntax
($identifier). This affects how the pattern is parsed, as well as what rules are used for matching the pattern. - Support for classes and collations has been improved, taking use of locale-defined ones when possible.
- A new option
regex_percentscan be used, switching from\to%as the escape character for any pattern or replacement string. - The
regex_lexoptions can be used, setting the alternative Lex engine and pattern syntax. This has several differences (from both usual patterns and Lua):\is still used as the primary escape character, unlessregex_percentsis used.- Character classes must be used as
\a,\g,\c,\p,\l,\u, and\x. No other locale-defined classes are possible. - Collation-based and case-insensitive matching is possible through the usual flags, unlike in Lua.
Other
- The project was updated to C++14 and will likely remain at that version for a long time.
- Added
pp_num_amx_varsto obtain the number ofVar:instances. - Dynamically calling native functions on the main thread protects against non-critical system errors/signals raised in them.
- Added a few missing functions to the C API, mainly for memory and containers.
- Using
pp_locale_nameon Windows no longer returns empty string afterpp_locale("")and instead obtains the actual name of the system locale.
PawnPlus v1.4.3
- Added
str_capacityandstr_reserveto control the internal string's buffer capacity. str_addr,var_addr, and co. now have a second parameter specifying the particular behaviour of strings copied into the dynamic string viaamx_SetString. For example,amx_buffer_string_auto_fitallows resizing the string to fit any number of characters inside. Note that not all SA-MP functions useamx_SetString, so this will only improve interop with those that do.- Added support for reading two special environment variables,
PAWNPLUS_NO_AMX_HOOKSandPAWNPLUS_NO_FILE_HOOKS. This allows circumventing Zeex/samp-plugin-crashdetect#127 if the server is launched viaPAWNPLUS_NO_FILE_HOOKS=1 ./samp03svrorexport PAWNPLUS_NO_FILE_HOOKS=1 ./samp03svr - Fixed
pawn_try_call_native_msgand similar functions to correctly load their arguments.
PawnPlus v1.4.2
-
Unifies the result of
str_addrandstr_buf_addr(andvar_addrandvar_buf_addr) so that both functions can be used interchangeably.AmxStringBuffer:(andstr_buf_addr) should still be used in situations where the implementation of the native is known to rely on the value being an actual address of the character data, but it is valid to be used instead ofstr_addrin all situations.Please note that the address returned from
str_addrandstr_buf_addris meant to be temporary, only to be used for the native for which it was created for, and might become unusable sooner than in the previous versions. -
pp_max_recursionnow returns the old value. -
pp_toggle_exec_hookcan be used to disable modifications to the AMX execution, at the cost of making certain advanced features (like async, threading, custom callbacks etc.) unavailable.
PawnPlus v1.4.1
Additions
- (
task_)await_str(_s) (#49 from @Se8870). handler_inverted_returnfor compatibility with y_hooks (#52 from @AGraber).math_random_generator(and therandom_generatorenum) to set the concrete generator for random functions.
Changes
pawn_on_initandpawn_on_exituse shorter names internally, allowing 7 characters longer identifiers. Scripts do not have to be recompiled.- Random generation was changed to guarantee consistency on both Windows and Linux. The default generator is now
generator_mt19937(used to begenerator_minstd_rand0on Linux). See this article for more details on how random number generation works between compilers. Consistency of generated numbers with previous versions is not guaranteed!
Fixes
- Fixed the use of
tagofandsizeofin parameters for older compilers with YSI (see #48). regex_cached_addrverifies that the memory location was not destroyed.str_set_formatallows using the target string during the formatting before it is replaced.- Fixed the
amx_FindPublichook to hide new callbacks fromamx_NumPublicscalled inside the original function. - Fixed custom callbacks calls when
amx_Exechas nullretval. (#53 from @AGraber).
Note: Starting from this release, the "-static" binary is compiled on a different machine than before and may not work on old systems.
PawnPlus v1.4
Additions
- Added the possibility to register and handle a custom format selector, including the
str_register_formatandstr_get_format_tagfunctions and thetag_op_formattag operation. More here. str_val_*functions have a newformatstring parameter to use the format operation instead of string conversion. The value corresponds to a format specifier instr_format.- An expression (in
{,}) instr_formatmay be followed by a format specifier like an argument substitution. - Added
tag_set_op_exprto allow handling a tag operation with an expression. - Added
regex_start_at_posto treat theposargument as an absolute start of the string (for^). - All families of functions that accept variant parameters now also accept dynamic strings natively.
- Added
pp_daytimeto obtain the time of day in milliseconds.
Changes
- The
dformat selector does not necessarily imply signed integer conversion when applied on tagged values, only "decimal", meaning it can be used onFloat:andunsigned:. str_formatand similar functions treat a sole"%s"format string specially and do not use a tag operation, primarily to speed-up the case of appending a single string viastr_append_format.- Functions that do not return a meaningful value are marked with
unit:in the include. This does not denote an actual tag, only that the function always returns 1 (or raises an error on failure). task_set_errorraises an error when used with a non-error code.var_deleteraises an error when used on an invalid variant reference.- The debug module on Windows now also hooks
CreateFileWin addition toCreateFileAto accomodate for different host environments. It is now also restricted to.amxfiles. This could affect plugins that useCreateFileAto open a file, then close the file and expect the file to be immediately available withCreateFileWagain, or that useCreateFileWto open a file, close it and then try to open it in another thread. The lifetime of all prolonged handles still ends with the next tick, and now also when an AMX is fully loaded.
Fixes
ConstStringTag:is used instead ofStringTag:in a couple of places.- Fixed assertion error on an invalid format specifier.
- Clearing containers properly invalidates their iterators.
- Fixed a crash on exit related to unsetting the locale.
- Fixed assertion error when
regex_cached_addris used on a dynamic string. - Added missing
tag_uid_amx_guardto the include. tag_call_opnow also supportstag_op_handle.iter_set_*is now regarded as cell-returning in metadata.- Fixed a potential memory leak on
amx_commit(thanks @GermanAizek).
PawnPlus v1.3.2
- Newly added callback handlers are not called from the same callback handler for the current callback.
- Do not extend the lifetime of the last opened file (used by the debug module) indefinitely, preventing locking files for external access.
- Added fallback for trampoline creation for
CreateFileA/fopen, fixing crashes on some platforms.
PawnPlus v1.3.1
expr_parsesupports hex escape sequences for producing any character cell via its numeric value. The syntax is\xXXor\uXXXXXXXX.- Removing a callback handler from a callback handler no longer stops other handlers from executing or causes crashes when
falseis returned. pp_module_namefixed for Linux.- subhook has been updated to the latest version, hopefully solving crashes on some platforms.
PawnPlus v1.3
Additions:
map_newandpool_newallow specifying the ordered state at creation.bool:stayparameter foriter_erasespecifying the iterator shouldn't move to the next element. Usable in loops. Newiter_emptyfunction, also usable viaoperator!.var_iteraccepts count like initer_repeat.handle_iteradded.- Task-related optimizations.
Fixes:
- Cloning a pool doesn't reassign the indices.
- Cloning a map or a pool preserves its ordered state.
- Deep clear of some containers doesn't delete them anymore.