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
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
MSVC doesn't support C99 VLA (variable-length array).
Use fixed size arrays in API examples and use JERRY_VLA macro
in unit tests to make these tests buildable on Windows too.
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
MSVC doen't support __attribute__((unused)),
we should use JERRY_UNUSED macro instead.
Additionally removed the internal jrt.h include from
tests/unit-core/test-common.h which was layering violation.
It made JERRY_ASSERT unavailable, we should use TEST_ASSERT.
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
Added a unit test for the jerryx_arg_js_iterator_restore function.
Added the specification to the documentation.
JerryScript-DCO-1.0-Signed-off-by: Timothy Harvey t-harvey@ti.com
Their length (size) is known at compile time. Therefore `sizeof`
is more efficient for them.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Remove jerry_parse_named_resource, merge its arguments to jerry_parse
and change is_strict argument to an option list for possible future extensions.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Add a function in jerryx/arg.
jerryx_arg_transform_object_properties, it will validate the properties of a JS object, and convert those properties into native type.
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
In case of some compilers (e.g. gcc-4.9, gcc-5.4) the `TEST_ASSERT (arg3[4] == '\0')`
fails in test_validator1_handler() due to uninitialized memory fields.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
It provides some APIs for binding developers, so that
they can validate the type of the js argument and convert/assign them
to the native argument.
Related Issue: #1716
JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com