Skip to content

Releases: IS4Code/PawnPlus

PawnPlus v0.11.1

31 Dec 13:27
Compare
Choose a tag to compare
PawnPlus v0.11.1 Pre-release
Pre-release

Error handling

  • By default, any error caused by a native function will be reported via a raised AMX native error, in addition to a message to the log. This happens when a function is expected to produce a result based on its description, but fails to do so (because of invalid arguments, invalid state of the object etc.), and the error can be prevented. Do not expect that native functions return 0 or some other error code; instead, make sure the errorneous call never happens in the first place.
  • pp_error_level can set a script-wide error level that is sufficient for raising an AMX error. Usable values are error_logic, error_formal, and error_none. The first level is set by default, the last can be used to disable AMX errors altogether. Logic errors occur when you work with invalid data in your code (references to nonexistent objects, invalid indices etc.); these can be fixed by making sure you properly initialise your variables or check for exceptional values. Formal errors occurs when you call a function in a certain form that is not expected, like a mismatch in the number of arguments for pawn_call_public or an invalid function name (these errors were already reported prior to this version); these errors are usually fixed by fixing the native call itself.
  • When an error occurs in the script, public pp_on_error can be used to handle it before an AMX error is raised. The source, message, and level is provided to the callback, which can specify the value returned from the erroring function. Returning true from the callback will suppress the error.

Containers

  • Maps can be switched to ordered mode via map_set_ordered. When this is used, all pairings in the map will be ordered based on the key, and all newly added values will conform to this ordering. All iterators to the map are also invalidated.
  • Instead of the hash operation, ordered maps use the lt operation (less than) to compare keys. Therefore, values with different tags are always comparable (although the result is only determined by their tags, not by their values), and arrays are compared lexicographically via their cells. Thus string keys can are also comparable.
  • var_get_arr will, when the offsets are specified, copy the whole range of cells starting at the offsets instead of just the first cell.

Tasks

  • task_set_result will return the value returned (or yielded) from the last handler that was executed in response to the task.

AMX

  • amx_end_fork renamed to amx_fork_end.
  • amx_parallel_begin and amx_parallel_end (used in the macro amx_parallel). This function sets the debug handler for the AMX that, when called (via the BREAK instruction), pauses the execution of the AMX and schedules it to be resumed on the next tick. The number of BREAK instructions that must be used to pause the machine can be also specified. With the sufficient debug level, they will be emitted after every statement (or you can use #emit break). This makes long loops appear to run in parallel with the server and the script (but they will be less efficient than true threaded code).

PawnPlus v0.11.0

17 Nov 00:15
Compare
Choose a tag to compare
PawnPlus v0.11.0 Pre-release
Pre-release

Collections

  • List iterators return the index via iter_get_key. New iterator functions: iter_sizeof, iter_tagof, iter_sizeof_key, iter_tagof_key.
  • Movement functions take optional parameter to specify the number of steps.
  • list_find for searching in lists (uses variant comparison).
  • Other functions for maps and lists to create iterators at specific positions.

Memory management

  • It is no longer possible to directly move GC-objects between the local and global pool. Instead, acquire and release operations are used to increase or decrease the reference count stored in the object. Only objects having the count set to 0 will be in the local pool (and thus collectible). (#11)
  • As a consequence, GlobalString, GlobalVariant, and GlobalIter tags are removed, as well as the corresponding tag conversions. acquire and release should be used explicitly to control the movement. You also shouldn't need to delete these objects directly, if you use these operations correctly.
  • Guards use acquire and release to control the lifetime of the guarded object. For objects controlled by the garbage collector, this manipulates the reference count. For other objects, it calls delete_deep on them.
  • Generic functions pawn_ref and pawn_unref to create Ref<T> without explicit retagging.
  • Added handles to manage standard objects (like lists and maps) using garbage collection. Handles are garbage-collected, and delete the object when they are collected.
  • Handles and guards do not call the destructor if the object was already destroyed via some other way (only works for containers and tasks).

Tasks

  • Tasks can store variants (i.e. values of any type and tag). Generic tasks are possible now as well.
  • task_continue_with and task_continue_with_bound to specify a function which should be called when the task is completed (and which might be used for a new task).

Tags

  • Tags derived from generic tags cannot have their operations redefined.
  • tag_element to obtain the element tag from a generic tag.
  • Generic tags no longer have to be explicitly defined. Instead, all generic functions are represented as separate macros.

PawnPlus v0.10.1

29 Oct 18:15
Compare
Choose a tag to compare
PawnPlus v0.10.1 Pre-release
Pre-release

v0.10.1

  • pp_max_recursion to prevent crashes related to native recursion.
  • task_bind returns the immediate result if it is available.
  • A task scheduled to be completed after 0-length time interval will be still executed in the current tick, but postponed after all other code.
  • task_config to control which sections of the memory should be stored.
  • Finishing a task after a time interval: task_set_result_ms, task_set_result_ticks, task_set_error_ms, task_set_error_ticks.

v0.10.0

  • Tags ConstString and ConstVariant have been introduced to better distinguish functions which shall not modify the input object. Their use in code is optional. (Note about tag inheritance: String inherits from ConstString.)
  • Added task_bind to create a task from a public function.
  • All native functions now check for the correct argument count.
  • PP_ALL_TAGS may be defined for compilers which support tag wildcard.
  • Tag instances store their operations with them, so indexing a map is no longer needed when calling operations dynamically. The unknown tag (now with the internal representation of {...}) is the base of all other tags.
  • var_inc and var_dec are finally implemented, together with the operator overloads. Dynamically defining or calling these operations now also works.
  • Dynamically defined tag operations (tag_set_op) cache the public function index, making them a lot faster.
  • Fixed calling pawn_call_public and pawn_call_native with no arguments.
  • Fixed argument offset in pawn_register_callback and pawn_add_filter.

PawnPlus v0.9

13 Oct 17:10
Compare
Choose a tag to compare
PawnPlus v0.9 Pre-release
Pre-release

Hooking

  • Proper native hooks (pawn_add_hook). The original function can be directly called by calling the native again inside the hook, modifying freely the arguments or return value.
  • Filters reimplemented using the new system.
  • Maximum amount of hooks increased to 1024 (was 256).

Callbacks

  • Changed how dynamic callbacks work, resulting in higher compatibility with other plugins. Hooking amx_FindPublic is no longer necessary.
  • New options for callbacks, specifying the presence of return value or allowing modification of input arguments.
  • The base public function must be provided now in order to register dynamic callbacks (for providing the index and default return value).

Collections

  • Added linked lists. Created by linked_list_new, a linked list is similar to the standard list, but its elements are kept as separate objects in the memory, linked together via references to neighboring links. Iterators to linked lists remain valid even when the list is modified.

Other

  • Task which is currently being completed will not be fully deleted.
  • Caching of callback and hook handler names, resulting in speed increase.
  • pawn_get_args for obtaining all arguments provided to the function.
  • Fixed signed characters conversion in strings.
  • Partial implementation of GCA. Optional arguments are checked at runtime and several cached values are accompanied by validity checks.
  • Generic syntax is now optional (define PP_SYNTAX_GENERIC).
  • amx_public_var fixed.

PawnPlus v0.8.1

09 Aug 12:25
Compare
Choose a tag to compare
PawnPlus v0.8.1 Pre-release
Pre-release
  • Fixed a compatibility issue with SAMPGDK related to events.

PawnPlus v0.8

07 Aug 22:00
Compare
Choose a tag to compare
PawnPlus v0.8 Pre-release
Pre-release
  • Tasks can store an error/exception state, can be used to signal cancellation or other exceptional events. Waiting for any result or error is performed via task_wait (now used together with task_get_result in task_await).
  • Iterators completely reworked, now are much safer and more powerful, allow for inserting or erasing values, and keep track of their collection's lifetime and modifications.
  • Tag system enhanced with dynamically defined tags and tag operations which can be called on values or variants. Properly defined tag operations can automatically collect unused objects or isolate their data. Tag operations can be invoked dynamically.
  • Minor additions to string and AMX functions.
  • AMX is fully cleaned after saving the sleep state, the stack no longer leaks.
  • String coercion operators fixed and definable with PP_SYNTAX_STRING_OP.

PawnPlus v0.7.2

24 Jul 17:16
Compare
Choose a tag to compare
PawnPlus v0.7.2 Pre-release
Pre-release
  • map_remove fixed.
  • Added map_has_key to determine if a certain key in a map exists.

PawnPlus v0.7.1

07 Jul 10:00
Compare
Choose a tag to compare
PawnPlus v0.7.1 Pre-release
Pre-release
  • Fixed a bug regarding using array variant functions.

PawnPlus v0.7

05 Jul 18:24
Compare
Choose a tag to compare
PawnPlus v0.7 Pre-release
Pre-release
  • Variants can store 2D and 3D arrays now. Many variant functions were updated to work with a variable number of indices.
  • amx_fork can specify 3 levels of forking (exec, data, script).
  • Native hooks are called filters now, both functions merged to pawn_native_filter.
  • Obtaining the tag of a variant can be done via var_tag_uid, removing the need to use tagof.
  • Optional syntax features are now disabled by default. Define PP_SYNTAX to restore them.
  • Compatible with YSI by default.

PawnPlus v0.6

04 Jun 16:38
Compare
Choose a tag to compare
PawnPlus v0.6 Pre-release
Pre-release
  • Added various *_clone functions for deep-cloning objects.
  • Memory leak fixes related to objects and threads.
  • Massive infrastructure change in the various components of the plugin, leading to more manageable and safe code.
  • Changes to the tasks API, its garbage collection and adding task_delete, task_valid, task_completed, task_keep, task_reset, task_any, and task_all.
  • Time-based tasks are stored in a list ordered by the time, making the server more efficient in case of a larger number of active timers.
  • Numerous functions related to AMX machines like forking, remote access to variables etc. Usable in other systems like tasks and threading.