diff options
author | Steve Bennett <steveb@workware.net.au> | 2011-04-21 11:37:46 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2011-04-21 11:37:46 +1000 |
commit | 1d7380ccd226e9dc9e55b85635ba7da25848cca3 (patch) | |
tree | 99e7164c2967c23d3cb9abe87a1e80ef80f69c1e /jim.c | |
parent | e6bf60412c25c48b07159610da2b338b6fd87ca1 (diff) | |
download | jimtcl-1d7380ccd226e9dc9e55b85635ba7da25848cca3.zip jimtcl-1d7380ccd226e9dc9e55b85635ba7da25848cca3.tar.gz jimtcl-1d7380ccd226e9dc9e55b85635ba7da25848cca3.tar.bz2 |
Add additional tcl_platform() settings
For better Tcl compatibility, add byteOrder, threaded, pointerSize, wordSize
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim.c')
-rw-r--r-- | jim.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -4510,6 +4510,16 @@ void Jim_CollectIfNeeded(Jim_Interp *interp) } #endif +static int JimIsBigEndian(void) +{ + union { + unsigned short s; + unsigned char c[2]; + } uval = {0x0102}; + + return uval.c[0] == 1; +} + /* ----------------------------------------------------------------------------- * Interpreter related functions * ---------------------------------------------------------------------------*/ @@ -4575,6 +4585,10 @@ Jim_Interp *Jim_CreateInterp(void) Jim_SetVariableStrWithStr(i, "tcl_platform(os)", TCL_PLATFORM_OS); Jim_SetVariableStrWithStr(i, "tcl_platform(platform)", TCL_PLATFORM_PLATFORM); + Jim_SetVariableStrWithStr(i, "tcl_platform(byteOrder)", JimIsBigEndian() ? "bigEndian" : "littleEndian"); + Jim_SetVariableStrWithStr(i, "tcl_platform(threaded)", "0"); + Jim_SetVariableStr(i, "tcl_platform(pointerSize)", Jim_NewIntObj(i, sizeof(void *))); + Jim_SetVariableStr(i, "tcl_platform(wordSize)", Jim_NewIntObj(i, sizeof(jim_wide))); return i; } |