-
Notifications
You must be signed in to change notification settings - Fork 684
Move version numbers to public headers #2556
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
Conversation
docs/02.API-REFERENCE.md
Outdated
|
||
Enum that contains the following elements: | ||
|
||
- JERRY_VERSION_API_MAJOR - signals the major API version |
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.
comment: returns the...
Please also modify the others.
docs/02.API-REFERENCE.md
Outdated
|
||
```c | ||
uint32_t | ||
jerry_get_api_major_version(void); |
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.
These functions are redundant, aren't they?
docs/02.API-REFERENCE.md
Outdated
|
||
Enum that contains the following elements: | ||
|
||
- JERRY_VERSION_API_MAJOR - signals the major API version |
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.
What if we would change the "signals" word, to "represents" / "describes"?
docs/02.API-REFERENCE.md
Outdated
- JERRY_VERSION_API_MAJOR - signals the major API version | ||
- JERRY_VERSION_API_MINOR - signals the minor API version | ||
- JERRY_VERSION_DEBUGGER - signals the debugger version | ||
- JERRY_VERSION_SNAPSHOT - signals the snapshot version |
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.
As these values are only used for one method we should add a "see also" block to refer the method which uses this.
docs/02.API-REFERENCE.md
Outdated
- return value | ||
- API minor version | ||
|
||
## jerry_get_component_version |
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.
If we have this method, why do we need the previous two? (get_api_minor & get_api_major)?
docs/02.API-REFERENCE.md
Outdated
**Summary** | ||
|
||
Get the component version described in parameter. If the defined components | ||
asked is not available, then it returns 0, as well as a default value. |
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.
What do you mean by: ..it returns 0, as well as a default value.
? This will return a zero and another value?
docs/02.API-REFERENCE.md
Outdated
``` | ||
- `component` - A jerry_versions_t signaling desired component. | ||
- return value | ||
- API major version |
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.
AFAIK: this is a typo here: the return value is the version of the requested component.
docs/02.API-REFERENCE.md
Outdated
|
||
```c | ||
uint32_t api_version; | ||
api_version = jerry_get_component_version(API_MAJOR_VERSION); |
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.
There is no API_MAJOR_VERSION
described in the jerry_version_t
enum.
docs/02.API-REFERENCE.md
Outdated
@@ -5558,6 +5623,7 @@ jerry_get_arraybuffer_byte_length (const jerry_value_t value); | |||
``` | |||
|
|||
**See also** | |||
|
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.
Is this empty line needed here?
jerry-core/api/jerry.c
Outdated
* Get the component version described in parameter. | ||
* | ||
* Note: | ||
* * Debugger and snapshot versions are set to undefined, unless they are turned on. |
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.
The comment states that the "debugger/snapshot version are set to undefined" if they are turned off. But in the code the return value will be 0. That looks pretty defined for me....
jerry-core/api/jerry.c
Outdated
* * Debugger and snapshot versions are set to undefined, unless they are turned on. | ||
* | ||
* @return a uint32_t containing: | ||
* API major, API minor, debugger and snapshot version. |
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.
So.. this will return all of these values? in one uint32_t?
jerry-core/api/jerry.c
Outdated
* API major, API minor, debugger and snapshot version. | ||
*/ | ||
uint32_t | ||
jerry_get_component_version (jerry_version_t component) /**< the component, the version of which we want */ |
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 comment reads a bit awkward.
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.
Please, convince me that we need functions to achieve this. include/jerryscript-core.h
already has JERRY_API_MAJOR_VERSION
and JERRY_API_MINOR_VERSION
as macro-defined constants. api/jerry-snapshot.h
already has JERRY_SNAPSHOT_VERSION
, which could be moved to include/jerryscript-snapshot.h
. And debugger/debugger.h
already has JERRY_DEBUGGER_VERSION
, which could be moved to include/jerryscript-debugger.h
. I see no point in hiding these behind functions nor introducing a new enum to programmatically choose from different version numbers. All that's needed is to publish two already existing macros in public headers. IMO.
It could help, if we only have an binary file, to confirm, which version of jerry is it exactly, to avoid confusion. |
I don't really understand this use case. If "binary file" means a library (most probably, a static library) then it MUST be accompanied by the appropriate public header files to be useful. But then the macros in the public header file(s) specify the versions. (Using a libxxx.a without an xxx.h is certainly possible at the technical level but that's called reverse engineering and is not a use case library developers (== us) have to support.) If "binary file" means an executable application then it's the task of the application to identify itself or the components it contains. In this case, the application source code can contain |
He is probably talking about dynamic modules, where you load a module and try to confirm the module is what you expected. |
Dynamic libraries are also a tricky thing. If one knows the API version of the library (the major version at least) then one may know what functions can be expected to exist (at least the minimum subset). But that means that one already has to know the value of Moreover, although using jerry-core as a dynamic library is certainly possible, the device class where that's possible is pretty much not the main application area of the engine. |
The moving of |
I have no strong opinion about this, so whatever is good for me. |
JERRY_SNAPSHOT_VERSION and JERRY_DEBUGGER_VERSION were moved into public headers, to grant access to them. JerryScript-DCO-1.0-Signed-off-by: Bela Toth [email protected]
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.
LGTM
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.
LGTM
JERRY_SNAPSHOT_VERSION and JERRY_DEBUGGER_VERSION were moved into public headers, to grant access to them.
JerryScript-DCO-1.0-Signed-off-by: Bela Toth [email protected]