Skip to content

Releases: IS4Code/PawnPlus

PawnPlus v1.5.1

10 Nov 11:32
Compare
Choose a tag to compare

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

09 Aug 13:44
Compare
Choose a tag to compare

Locales

Locales and locale-based operations now play a much 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 like str_count_chars or str_collation_key. In practice, this means that different locale-based rules could be applied to individual calls, without using pp_locale to 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_convert function 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_format and 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 automatic str_convert for strings, etc.
  • New format selectors were added: %m (monetary value) and %t (time), both using locale-based output format. In addition, x now 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_percents can be used, switching from \ to % as the escape character for any pattern or replacement string.
  • The regex_lex options 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, unless regex_percents is 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_vars to obtain the number of Var: 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_name on Windows no longer returns empty string after pp_locale("") and instead obtains the actual name of the system locale.

PawnPlus v1.4.3

29 Dec 16:40
Compare
Choose a tag to compare
  • Added str_capacity and str_reserve to 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 via amx_SetString. For example, amx_buffer_string_auto_fit allows resizing the string to fit any number of characters inside. Note that not all SA-MP functions use amx_SetString, so this will only improve interop with those that do.
  • Added support for reading two special environment variables, PAWNPLUS_NO_AMX_HOOKS and PAWNPLUS_NO_FILE_HOOKS. This allows circumventing Zeex/samp-plugin-crashdetect#127 if the server is launched via PAWNPLUS_NO_FILE_HOOKS=1 ./samp03svr or
    export PAWNPLUS_NO_FILE_HOOKS=1
    ./samp03svr
  • Fixed pawn_try_call_native_msg and similar functions to correctly load their arguments.

PawnPlus v1.4.2

30 Dec 22:32
Compare
Choose a tag to compare
  • Unifies the result of str_addr and str_buf_addr (and var_addr and var_buf_addr) so that both functions can be used interchangeably. AmxStringBuffer: (and str_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 of str_addr in all situations.

    Please note that the address returned from str_addr and str_buf_addr is 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_recursion now returns the old value.

  • pp_toggle_exec_hook can 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

09 Oct 11:57
Compare
Choose a tag to compare

Additions

  • (task_)await_str(_s) (#49 from @Se8870).
  • handler_inverted_return for compatibility with y_hooks (#52 from @AGraber).
  • math_random_generator (and the random_generator enum) to set the concrete generator for random functions.

Changes

  • pawn_on_init and pawn_on_exit use 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 be generator_minstd_rand0 on 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 tagof and sizeof in parameters for older compilers with YSI (see #48).
  • regex_cached_addr verifies that the memory location was not destroyed.
  • str_set_format allows using the target string during the formatting before it is replaced.
  • Fixed the amx_FindPublic hook to hide new callbacks from amx_NumPublics called inside the original function.
  • Fixed custom callbacks calls when amx_Exec has null retval. (#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

10 Oct 11:21
Compare
Choose a tag to compare

Additions

  • Added the possibility to register and handle a custom format selector, including the str_register_format and str_get_format_tag functions and the tag_op_format tag operation. More here.
  • str_val_* functions have a new format string parameter to use the format operation instead of string conversion. The value corresponds to a format specifier in str_format.
  • An expression (in {, }) in str_format may be followed by a format specifier like an argument substitution.
  • Added tag_set_op_expr to allow handling a tag operation with an expression.
  • Added regex_start_at_pos to treat the pos argument as an absolute start of the string (for ^).
  • All families of functions that accept variant parameters now also accept dynamic strings natively.
  • Added pp_daytime to obtain the time of day in milliseconds.

Changes

  • The d format selector does not necessarily imply signed integer conversion when applied on tagged values, only "decimal", meaning it can be used on Float: and unsigned:.
  • str_format and 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 via str_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_error raises an error when used with a non-error code.
  • var_delete raises an error when used on an invalid variant reference.
  • The debug module on Windows now also hooks CreateFileW in addition to CreateFileA to accomodate for different host environments. It is now also restricted to .amx files. This could affect plugins that use CreateFileA to open a file, then close the file and expect the file to be immediately available with CreateFileW again, or that use CreateFileW to 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 of StringTag: 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_addr is used on a dynamic string.
  • Added missing tag_uid_amx_guard to the include.
  • tag_call_op now also supports tag_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

14 Nov 15:22
Compare
Choose a tag to compare
  • 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

22 Jun 13:42
Compare
Choose a tag to compare
  • expr_parse supports hex escape sequences for producing any character cell via its numeric value. The syntax is \xXX or \uXXXXXXXX.
  • Removing a callback handler from a callback handler no longer stops other handlers from executing or causes crashes when false is returned.
  • pp_module_name fixed for Linux.
  • subhook has been updated to the latest version, hopefully solving crashes on some platforms.

PawnPlus v1.3

26 Apr 18:55
Compare
Choose a tag to compare

Additions:

  • map_new and pool_new allow specifying the ordered state at creation.
  • bool:stay parameter for iter_erase specifying the iterator shouldn't move to the next element. Usable in loops. New iter_empty function, also usable via operator!.
  • var_iter accepts count like in iter_repeat. handle_iter added.
  • 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.

PawnPlus v1.2.1

21 Dec 22:09
Compare
Choose a tag to compare
  • math_try_round, math_try_floor, math_try_ceiling, and math_try_truncate for when the result might not fit in a 32-bit integer.
  • Missing tags added to PP_ALL_TAGS.
  • start parameter in str_get is actually used.
  • Fixed a potential crash when *_delete_deep is called on an ordered pool.