Skip to content

Introduce the Termination Port API #1015

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

akosthekiss
Copy link
Member

  • Moved the error codes to jerry-port.h and declared port function
    jerry_port_fatal.
  • Moved "exit or abort on fail" functionality to the newly added
    jerry-port-default-fatal.c.
  • This implied that a default port-specific API had to be introduced:
    functions jerry_port_default_set_abort_on_fail and
    jerry_port_default_is_abort_on_fail declared in jerry-port-default.h
    control the fatal exit behaviour.
  • For the sake of clarity, renamed jerry-port.c to
    jerry-port-default-io.c.
  • Adapted CMakeLists to deal with port implementations consisting of
    more then one source file and exposing headers. This also required
    the renaming of EXTERNAL_PORT_FILE cmake option to
    EXTERNAL_PORT_DIR.
  • Adapted main sources to use the default port header for the
    abort-on-fail functionality, as that is not part of the core jerry
    API anymore.
  • Added default port implementation to the static source code checker
    tools.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

@akosthekiss akosthekiss added enhancement An improvement jerry-port Related to the port API or the default port implementation labels Apr 18, 2016
@akosthekiss
Copy link
Member Author

Related to #964 . Not a full implementation of the ideas suggested there, of course, but a first step towards it. In addition to introducing the Termination API (which seemed to be the one that everyone agreed on), the PR already exemplifies how a port implementation can have its own extension(s) to the core Jerry API.

@akosthekiss
Copy link
Member Author

Note: also related to #957

/*
* Termination Port API
*
* Note: It is questionable whether a library should be able to terminate an
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor style issue. The common style for note comments are that using newline and indent to colon.

/*
 * Note:
 *      It is questionable whether...

#ifdef __cplusplus
extern "C"
{
#endif /* !__cplusplus */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#endif /* __cplusplus */

@LaszloLango
Copy link
Contributor

I like the PR, but I'd like to hear the opinion of everyone who is involved in #964 before we merge. Let's give some time for everyone to check it. :)

@akosthekiss akosthekiss force-pushed the port-termination branch 2 times, most recently from 0b83ee5 to 2bf0b94 Compare April 18, 2016 17:47
@akosthekiss
Copy link
Member Author

Should anyone be interested, a draft of the Date Port API is prototyped as some patches on top of this PR here: https://github.com/akiss77/jerryscript/tree/port-date (no PR, yet)

Acknowledgement: it does have some overlap with #969 by @franc0is

@zherczeg
Copy link
Member

LGTM

@LaszloLango
Copy link
Contributor

@akiss77, Date Port API patch also looks good for first sight.

@LaszloLango
Copy link
Contributor

LGTM

* Moved the error codes to jerry-port.h and declared port function
  `jerry_port_fatal`.

* Moved "exit or abort on fail" functionality to the newly added
  jerry-port-default-fatal.c.

* This implied that a default port-specific API had to be introduced:
  functions `jerry_port_default_set_abort_on_fail` and
  `jerry_port_default_is_abort_on_fail` declared in jerry-port-default.h
  control the fatal exit behaviour.

* For the sake of clarity, renamed jerry-port.c to
  jerry-port-default-io.c.

* Adapted CMakeLists to deal with port implementations consisting of
  more then one source file and exposing headers. This also required
  the renaming of `EXTERNAL_PORT_FILE` cmake option to
  `EXTERNAL_PORT_DIR`.

* Adapted main sources to use the default port header for the
  abort-on-fail functionality, as that is not part of the core jerry
  API anymore.

* Added default port implementation to the static source code checker
  tools.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
@akosthekiss akosthekiss merged commit 02ba19f into jerryscript-project:master Apr 19, 2016
@akosthekiss akosthekiss deleted the port-termination branch April 19, 2016 12:42
@franc0is
Copy link
Contributor

I'm just now catching up with these PRs, they are terrific! I'm thrilled to see the port model moving forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement jerry-port Related to the port API or the default port implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants