Cross-Platform Support

Tcl is designed so that you can write scripts that run unchanged on UNIX, Macintosh, and Windows platforms. In practice, you may need a small amount of code that is specific to a particular platform. You can find out information about the platform via the tcl_platform variable. This is an array with these elements defined:

  • tcl_platform(platform) is one of unix, macintosh, or windows.

  • tcl_platform(os) identifies the operating system. Examples include MacOS, Solaris, Linux, Win32s (Windows 3.1 with the Win32 subsystem), Windows 95, Windows NT, and SunOS.

  • tcl_platform(osVersion) gives the version number of the operating system.

  • tcl_platform(machine) identifies the hardware. Examples include ppc (Power PC), 68k (68000 family), sparc, intel, mips, and alpha.

  • tcl_platform(isWrapped) indicates that the application has been wrapped up into a single executable with TclPro Wrapper. This is not defined in normal circumstances.

  • tcl_platform(user) gives the login name of the current user.

  • tcl_platform(debug) indicates that Tcl was compiled with debugging symbols.

  • tcl_platform(thread) indicates that Tcl was compiled with thread support enabled.

On some platforms a hostname is defined. If available, it is returned with the info hostname command. This command may return an empty string.

One of the most significant areas affected by cross-platform portability is the file system and the way files are named. This topic is discussed on page 103.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.235.227