-
Notifications
You must be signed in to change notification settings - Fork 688
Implement IO port API #1201
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
LaszloLango
merged 1 commit into
jerryscript-project:master
from
LaszloLango:jerry-port-io
Jul 14, 2016
Merged
Implement IO port API #1201
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, this check should not happen here but in the port implementation (if that impl cares about it). Likewise,
jerry_debug_levelshouldn't even be defined in jerry.c. EverythingJERRY_LOGshould do is just pass things on tojerry_port_logimplemented in the port for it to decide what to do with it (aslvlis passed on as well).In some sense, it should work similarly to the "fatal" logic. As far ar jerry-core is concerned, there is only a single
jerry_port_fatalfunction to be called. However, the default port implementation adds some extras to it, namely the "abort_on_fail" functionality. However, that's a port-specific thing. Therefore, thestatic bool abort_on_failvariable is defined in jerry-port-default-fatal.c, and accessor methodsjerry_port_default_set_abort_on_failandjerry_port_default_is_abort_on_failin jerry-port-default.h.I can imagine a similar scenario with the logs. There could be default port-specific accessors, e.g.,
jerry_port_default_set_log_levelandjerry_port_default_get_log_levelin jerry-port-default.h and their implementation (along with any variables needed for that logic, saydebug_levelorlog_level) in jerry-port-default-io.c. And then the line(void) level; /* default port implementation ignores the log level */will go away (actually, the presence of this line already signals the problem that log levels are not checked at the right place, IMHO).Additonal notes:
JERRY_D[D[D]]LOGmacros callJERRY_LOGwith 1, 2, and 3 as level parameters. This does not seem right in the light of the new log level enum.printfs in the code (e.g., jrt-fatals.c, js-parser.c, js-parser-util.c, ecma-builtin-global.c, jmem-poolman.c, jmem-heap.c, js-parser-statm.c), even if mostly macro-guarded. When will these be rewritten to call the_logand_consolefunctions?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Sorry, missed the "Note: after this PR," part. Cancel my last Q.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with the first part.
JERRY_D[D[D]]LOGmacros are all on debug level. There where no multiple debug levels in the proposed (and accepted) IO port API proposal (see: #964).I think moving the debug level to the port is might be a good idea. I'll try to do it in a followup work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is current status.
JERRY_D[D[D]]LOGmacros expand toJERRY_LOG (]0-3], ...)depending onJERRY_ENABLE_LOGsettings. The first parameter should be the debug level you just mentioned, not integers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@akosthekiss, as I said. I'll do it in a follow up work. Don't worry. It's on my list to clean this up.