Skip to content
Snippets Groups Projects
Commit 0d222f31 authored by rswindell's avatar rswindell
Browse files

New properties: system.version_num and system.version_hex, initialized with

the values of the newly defined macros of the same names. These allow easy
comparison for scripts. Example:
    if(system.version_num < 31301) /* v3.13b */
        print("version 3.13b or later required");
system.version_hex allows easy major/minor version number checking, parsing
or printing using right-shift operations instead of division/rounding. Example:
    31301/100 == 313.01
    0x31301>>8 == 0x313
parent b85e1b93
No related branches found
No related tags found
No related merge requests found
......@@ -484,6 +484,8 @@ static char* sys_prop_desc[] = {
,"Synchronet alpha/beta designation (e.g. ' beta')"
,"Synchronet full version information (e.g. '3.10k Beta Debug')"
,"Synchronet version notice (includes version and platform)"
,"Synchronet version number in decimal (e.g. 31301 for v3.13b)"
,"Synchronet version number in hexadecimal (e.g. 0x31301 for v3.13b)"
,"platform description (e.g. 'Win32', 'Linux', 'FreeBSD')"
,"socket library version information"
,"message base library version information"
......@@ -1676,6 +1678,17 @@ JSObject* DLLCALL js_CreateSystemObject(JSContext* cx, JSObject* parent
if(!JS_SetProperty(cx, sysobj, "version_notice", &val))
return(NULL);
/* Numeric version properties */
if(!JS_NewNumberValue(cx, VERSION_NUM, &val))
return(NULL);
if(!JS_SetProperty(cx, sysobj, "version_num", &val))
return(NULL);
if(!JS_NewNumberValue(cx, VERSION_HEX, &val))
return(NULL);
if(!JS_SetProperty(cx, sysobj, "version_hex", &val))
return(NULL);
if((js_str=JS_NewStringCopyZ(cx, PLATFORM_DESC))==NULL)
return(NULL);
val = STRING_TO_JSVAL(js_str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment