10 Commits

Author SHA1 Message Date
Máté Tokodi
3b876f7392
Update clang-format (#5112)
Bump minimum clang-format version to 15 (the previously used 10 is not
in the ubuntu-22.04 repo)

Reformat several files

Re-enable format and strings CI checkers

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2023-12-11 23:21:52 +01:00
Yonggang Luo
d5f048e961
Add FEATURE_INIT_FINI support on Windows. (#4859)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-12-10 13:01:24 +01:00
Robert Fancsik
badfdf4dba
Replace vera++ with clang-format (#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-05 14:15:47 +01:00
Csaba Osztrogonác
dc44b8b933 Disable INIT_FINI unittest on Windows (#3132)
MSVC doesn't support library constructor/destructor, let's disable
the related unittest and clarify the documentation and error messages.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-20 10:04:55 +02:00
Gabriel "_|Nix|_" Schulhof
6dc2764a94 modules: add ability to clear cache (#2300)
This adds the ability to remove a single module from the cache, or to
clear the entire module cache.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2018-05-04 10:12:17 +09:00
Greg Miell
10f777689f Add extern "C" to module.h (#2150)
JerryScript-DCO-1.0-Signed-off-by: Greg Miell greg@gothack.ninja
2017-12-18 21:08:45 +01:00
Gabriel "_|Nix|_" Schulhof
6d53931055 module extension: add support for canonical name resolution (#2013)
Before attempting to load a module, each provided resolver must be given an
opportunity to examine the name of the requested module without actually
loading it so as to canonicalize it, in case a module can be referred to by
multiple names.

Then, modules are loaded and cached by their canonical name.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-09-29 12:02:34 +02:00
Gabriel "_|Nix|_" Schulhof
81952f3cd0 module: Re-implement using library constructors/destructors (#2018)
By using constructors/destructors we unify the case of static linking with
that of dynamic linking, and we reuse the build flag FEATURE_INIT_FINI. Using
constructors/destructors also allows us to cover the case where library
constructor/destructor functionality is unavailable, because we can expose the
module registration/unregistration functions as global symbols, to be called
explicitly from within the application.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1952

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-09-22 12:35:38 +02:00
Martijn Thé
66b072d5ae Fix: make jerryx_module_resolve resolvers argument const (#1942)
The resolvers argument that is passed to jerryx_module_resolve() is
not mutated by the function. Therefore the argument should be const.
In the docs, a static const array is passed, but this currently does not
work w/o a cast. This patch fixes this.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2017-08-01 15:39:21 +02:00
Gabriel "_|Nix|_" Schulhof
66b2a7670f New extension: module (#1863)
This extension provides the following facilities:
  - registering modules,
  - module resolvers, and
  - an API for retrieving a module instance given its name.

A module is defined as a global static structure containing a pointer
to a string which is the name of the module, and a pointer to a function
which will be called when an instance of the module is needed.

A module resolver is a function that accepts a string holding the name
of the module and returns a `jerry_value_t` in an out-parameter and
`true` if the module was found, or `false` if it was not. If it returns
`true` and the out-parameter has the error flag set then the API will
pass it through without caching.

This extension provides a built-in module resolver which attempts to
load modules that follow the above module definition.

The API provided by this extension invokes all module resolvers it
receives in sequence to attempt to resolve the name of a single module.
After one resolver returns `true` and a `jerry_value_t` that represents
the module the API stops iterating over the remaining resolvers and
caches the value if its error flag is not set. It then returns the
`jerry_value_t`. The API will return a `jerry_value_t` containing an
error indicating that the module was not found if it reaches the end of
the list of resolvers. The error it returns has an extra property
`"moduleName"` the value of which is a string containing the name of the
module that the API was asked to resolve.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-07-18 15:54:24 +02:00