aboutsummaryrefslogtreecommitdiff
path: root/jerry-ext/handler/handler-assert.c
AgeCommit message (Collapse)Author
2022-01-20Update jerry-port and jerry-ext (#4907)Dániel Bátyai
Notable changes: - Updated and the port API interface, new functions have been added and some have been changed. The port library is now cleaned up to not have any dependency on jerry-core, as it should be. The port library is now strictly a collection of functions that implement embedding/platform specific behavior. - The default port implementation has been split for windows and unix. Implemented port functions have been categorized and reorganized, and marked with attribute((weak)) for better reusability. - External context allocation has been moved to the port API instead of a core API callback. The iterface has also been extended with a function to free the allocated context. When external context is enabled, jerry_init now automatically calls the port implementation to allocate the context and jerry_cleanup automatically calls the port to free the context. - jerry_port_log has been changed to no longer require formatting to be implemented by the port. The reason beind this is that it was vague what format specifiers were used by the engine, and in what manner. The port function now takes a zero-terminated string, and should only implement how the string should be logged. - Logging and log message formatting is now handled by the core jerry library where it can be implemented as necessary. Logging can be done through a new core API function, which uses the port to output the final log message. - Log level has been moved into jerry-core, and an API function has been added to set the log level. It should be the library that filters log messages based on the requested log level, instead of logging everything and requiring the user to do so. - Module resolving logic has been moved into jerry-core. There's no reason to have it in the port library and requiring embedders to duplicate the code. It also added an unnecessary dependency on jerry-core to the port. Platform specific behavior is still used through the port API, like resolving module specifiers, and reading source file contents. If necessary, the resolving logic can still be overridden as previously. - The jerry-ext library has also been cleaned up, and many utility functions have been added that previously were implemented in jerry-main. This allows easier reusability for some common operations, like printing unhandled exceptions or providing a repl console. - Debugger interaction with logged/printed messages has been fixed, so that it's no longer the port implementations responsibility to send the output to the debugger, as the port should have no notion of what a debugger is. The printing and logging functions will now pass the result message to the debugger, if connected. - Cleaned up TZA handling in the date port implementation, and simplified the API function prototype. - Moved property access helper functions that use ASCII strings as keys from jerry-ext to the core API. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-12-06Rework the public API (#4829)Dániel Bátyai
Related to #4186. Some notable changes: - The term 'Error' now strictly refers to native Error objects defined in the ECMA standard, which are ordinary objects. All other uses of 'error' or 'error reference' where the term refers to a thrown value is now called 'exception'. - Simplified the naming scheme of many String API functions. These functions will now also take an 'encoding' argument to specify the desired encoding in which to operate. - Removed the substring-copy-to-buffer functions. These functions behaved awkwardly, as they use character index to specify the start/end positions, and were mostly used incorrectly with byte offsets instead. The functionality can still be replicated with other functions if necessary. - String-to-buffer functions will no longer fail if the buffer is not sufficiently large, the string will instead be cropped. - Fixed the usage of the '_sz' prefix in many API functions. The term 'sz' means zero-terminated string in hungarian notation, this was used incorrectly in many cases. - Renamed most of the public API functions to have shorter, more on-point names, rather than the often too long descriptive names. Functions are now also grouped by the type of value they operate on, where this makes sense. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-11-05Replace vera++ with clang-format (#4518)Robert Fancsik
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-06-24Remove jerry_get_boolean_value (#4685)Gergo Csizi
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-02-17Rework external function handlers (#4599)Zoltan Herczeg
Instead of a fixed number of arguments, a call info structure is passed to the handlers, which can be extended in the future without breaknig the API. This structure holds new.target value, so its getter function is removed. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-05Add backtrace print when the 'assert' js method fails (#3051)Péter Gál
In the jerry-ext there is a native 'assert' handler implemented. This change adds extra backtrace information if an 'assert' call fails. To print out the backtrace the library should be built with `JERRY_LINE_INFO` enabled. JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-09-18Add soft assert handler to jerry-ext (#2516)Akos Kiss
Allow developers to choose whether they want a hard or a soft implementation behind `assert`, i.e., whether they want to kill the whole engine in case of an assertion failure in the executed script or just throw a JS error. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09Implement common external function handlers in `jerry-ext` (#1787)Akos Kiss
Added `handler` module to `jerry-ext` to contain implementation of commonly used external function handlers: `assert`, `gc`, and `print`. Also adapted jerry-main to use jerry-ext/handler JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu