mirror of
https://github.com/ccxvii/mujs.git
synced 2026-02-05 17:29:43 +08:00
Add JS_VERSION_MAJOR/MINOR/PATCH defines to mujs.h
A macro JS_CHECKVERSION(major, minor, patch) can be used to test the
version if your code depends on API features added in a given version.
#if JS_CHECKVERSION(1, 2, 0)
... use new API ...
#else
... don't use new API ...
#endif
This commit is contained in:
2
main.c
2
main.c
@@ -356,6 +356,8 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (interactive) {
|
||||
printf("Welcome to MuJS %d.%d.%d.\n",
|
||||
JS_VERSION_MAJOR, JS_VERSION_MINOR, JS_VERSION_PATCH);
|
||||
if (isatty(0)) {
|
||||
using_history();
|
||||
rl_bind_key('\t', rl_insert);
|
||||
|
||||
7
mujs.h
7
mujs.h
@@ -7,6 +7,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define JS_VERSION_MAJOR 1
|
||||
#define JS_VERSION_MINOR 2
|
||||
#define JS_VERSION_PATCH 0
|
||||
|
||||
#define JS_VERSION (JS_VERSION_MAJOR * 10000 + JS_VERSION_MINOR * 100 + JS_VERSION_PATCH)
|
||||
#define JS_CHECKVERSION(x,y,z) (JS_VERSION >= ((x) * 10000 + (y) * 100 + (z)))
|
||||
|
||||
/* noreturn is a GCC extension */
|
||||
#ifdef __GNUC__
|
||||
#define JS_NORETURN __attribute__((noreturn))
|
||||
|
||||
Reference in New Issue
Block a user