aboutsummaryrefslogtreecommitdiff
path: root/jim.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2011-04-21 11:37:46 +1000
committerSteve Bennett <steveb@workware.net.au>2011-04-21 11:37:46 +1000
commit1d7380ccd226e9dc9e55b85635ba7da25848cca3 (patch)
tree99e7164c2967c23d3cb9abe87a1e80ef80f69c1e /jim.c
parente6bf60412c25c48b07159610da2b338b6fd87ca1 (diff)
downloadjimtcl-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.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/jim.c b/jim.c
index 78b4db2..f1d2605 100644
--- a/jim.c
+++ b/jim.c
@@ -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;
}