dmh_wish Tcl Tk Shell

NAME

dmh_wish - Distributed programming/windowing shell

dmh85, dmh86 - Version specific names of dmh_wish

libdmh86.so, libdmh86.sl, dmh86.dll, etc. - version specific shared libraries for dynamic loading


SYNOPSIS

dmh_wish ?options? ?arg arg ...?

dmh86 ?options? ?arg arg ...?

OPTIONS

-colormap new
For X-windows platforms, specifies that the window should have a new private colormap instead of using the default colormap for the screen.

-console
Enable using console input with an input file. Without this option, console input is disabled when an input file is specified.  Prior to September 2014, on Unix systems, this flag simply caused console IO in the terminal window to be enabled.  Post September 2014 on Unix systems, this argument causes a Tk based console window to be created that replaces using the terminal window as a console.  This behavior is now similar to Windows where a Tk based console window is always created and available.  The Tk based console window on Windows and Unix is shown if there is no file input or if the command console show is executed.  The Tk based console window has the advantages of properly handling command history editing with cursor movements and providing readily accessible handling of both console input and output.

-display display
For X-windows platforms, the display (and screen) on which to display window. Ignored if -notk is specified.

-encoding name
Specifies the encoding of the text stored in fileName.

-file fileName
Read commands from fileName rather than standard input. The last element in fileName will be used as the title for the application and name of its interpreter for send commands (unless overridden by the -name option).

When the -file option is used without the -console option, console input is disabled on POSIX systems, and the console is hidden on NT systems.

-geometry geometry
Initial geometry to use for window. Ignored if -notk is specified. If this option is specified, its value is stored in the geometry global variable of the application's Tcl interpreter.

-help
Print a summary of the command-line options and exit.

-msgargs
Execute the command line arguments that are not options as SEMATECH Generic Server message commands. When used with the -file option, if the -msgargs option is first on the command line, the commands are executed first, before the file is sourced. Similarly, if the -file option appears first, the file is sourced first. This feature is used by Tcl application scripts such as the Datahub to provide command line usage which is compatible with legacy SEMATECH applications.

-name name
Use name as the title to be displayed in the window, and as the name of the interpreter for send commands. Ignored if -notk is specified.

-notk
Do not connect to the X server. This mode is useful for daemon/server processes. On Windows, the Tk windowing software is still loaded and initialized, but the windows are hidden. A Windows developer can achieve results closer to a true background process by running as a service.

-sync
On X-Windows platforms, execute all display server commands synchronously, so that errors are reported immediately. This will result in much slower execution, but it is useful for debugging. Ignored if -notk is specified.

-tclargs
Evalute the command line arguments that are not options as Tcl statements. When used with the -file option, if the -tclargs option preceeds the -file option on the command line, the statements are evaluated before the file is sourced. Similarly, if the -file option appears first, the file is sourced first.

-use id
Specifies that the main window for the application is to be embedded in the window whose identifier is id, instead of being created as an independent toplevel window. Id must be specified in the same way as the value for the -use option for toplevel widgets (i.e. it has a form like that returned by the winfo id command). Note that on some platforms this will only work correctly if id refers to a Tk frame or toplevel that has its -container option enabled.
-visual visual
On X-Windows platforms, specifies the visual to use for the window. Visual may have any of the forms supported by the Tk_GetVisual library function.

DESCRIPTION

The Hume Integration Datahub SDK installs an extended Tcl/Tk program having a version specific name such as dmh85 as well as installing the same program under the version independent name dmh_wish. Dmh_wish is a single program consisting of the Tcl command language, the Tk toolkit, DMH mailbox messaging extensions, Hume Datahub extensions, and logic that reads commands from standard input or from a file. By default, it creates a main window and then processes Tcl commands. If dmh_wish is invoked with no -f option then it reads Tcl commands interactively from standard input. It will continue processing commands until all windows have been deleted or until end-of-file is reached on standard input.

When used interactively, if there exists a file .dmhrc in the home directory of the user, dmh_wish evaluates the file as a Tcl script just before reading the first command from standard input. On Windows NT, the home directory is established by creating the environment variable HOME, with a value of a Unix style slash delimited pathname such as c:/users/joe. Use the Control Panel application System or the Tcl command regset to do this.

If the -file option is used, then dmh_wish reads Tcl commands from the file named in the -file option. These commands will normally create an interactive interface consisting of one or more widgets. When the end of the command file is reached, dmh_wish will continue to respond to window events until all windows have been deleted. There is no automatic evaluation of .dmhrc in this case, but the script file can always source it if desired.

Automatic Loading of Packages

The dmh_wish executable has the ability to automatically load a package of your choosing without requiring the user to provide any command line arguments.  If the dmh_wish executable is renamed so that the name no longer starts with dmh, and there is no -file filename option specified on the command line, then the startup logic will evaluate package require exename where exename is equivalent to file rootname [file tail executable_name].  For example, the executable name, inspect.exe causes the package inspect to be loaded.  Other arguments on the command line are processed normally and available to the application logic in the global variable argv as is the usual case. When the package loading feature is triggered, it is an alternative to running with a script file, so by default a console is not provided.  The -console command line option may be used to force having a console. 

This feature has the following advantages for deploying your applications:

Dynamic Loading of the DMH Package

The features provided by the Hume Integration SDK can also be dynamically loaded into a stock or custom Tcl/Tk executable. Depending on your system, one of the following shared library files is built and installed for this purpose: dmh85.dll, libdmh85.so, libdmh85.so.1.0 or libdmh85.sl. In practice, the entire directory, dmh85, which is usually installed in /usr/local/lib, is copied into the lib directory of the Tcl/Tk installation. The Hume provided features become available after executing the Tcl command package require dmh.

ENVIRONMENT

Recent versions of Tcl/Tk are built with shared libraries on all platforms. On Windows, the shared library DLL files are found by the operating system in the same directory as the executable. On POSIX systems, the shared libraries are found by the operating system if they are installed in the system directories, /lib, /usr/lib, or /usr/local/lib. If the libraries are installed elsewhere, an environment variable must be set. The proper environment variable differs for the specific operating system:

AIX
LIBPATH

# example
LIBPATH=$LIBPATH:$pwd/usr/local/lib:/lib:/usr/lib; export LIBPATH
HP-UX
SHLIB_PATH

# example
SHLIB_PATH=$SHLIB_PATH:$pwd/usr/local/lib; export SHLIB_PATH
Linux
LD_RUN_PATH

# example
LD_RUN_PATH=$LD_RUN_PATH:$pwd/usr/local/lib; export LD_RUN_PATH
SunOS/Solaris
LD_LIBRARY_PATH

# example
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$pwd/usr/local/lib; export LD_LIBRARY_PATH

 

The following environment variables affect various aspects of using Tcl/Tk and the DMH package. For convenience, this list includes items that are more closely related to other programs and application scripts than to dmh_wish.

DMH_BIN
This variable gives the path where the DMH executable programs and application scripts are found. The path defaults to /usr/local/bin. If the DMH_BIN variable value is not correct, the invocation of certain script applications such as the datahub will fail.
DMH_LIBRARY
Ordinarily the directory containing the DMH runtime library is found relative to the executable program, as in "../lib/dmh85/". In unusual circumstances such as when using DMH in an application that is not in the DMH_BIN directory, the environment variable DMH_LIBRARY can be defined to override the usual search, or to indicate a specific runtime library directory. Once the DMH software is successfully initialized, the variable ::dmh::dmh_library shows the directory that is being used.
HUB_MAX_FIELD
In order to prevent excessive memory usage, the hub table display logic limits the requested initial display width in characters for each column to 200.  The user can override this value by setting the environment variable HUB_MAX_FIELD.
HUB_MAX_WIDTH
The hub table display logic computes an initial window width based on the table data and the available screen width.  On very large screens, large tables can be inconveniently wide.   A user can set the maximum width in pixels by setting the environment variable HUB_MAX_WIDTH.
HUB_ROW_MAX
In order to prevent excessive memory usage, the hub table display logic ordinarily shows only the first 5000 rows of a table's data. To show more rows than this default, the environment variable HUB_ROW_MAX can be set. This environment variable is used for both display of in-memory tables, and display of persistent database tables using dmh_SQLsrv.
NO_DDE_IMPORT
Prior to Tcl version 8.4, the DMH software always created the mh_eval command in the global namespace.  The presence of this command is relied upon by the mbx_RPC command which is used to support the inspect application.  In order to have compatibilty of Tcl 8.5 applications with inspect, the mh_eval command is imported into the global namespace from the ::dmh namespace during initialization on all platforms unless the NO_DDE_IMPORT environment variable is defined.  On Windows platforms, the send and dde_execute commands are also imported into the global namespace for the same purpose during initialization unless this environment variable is defined.
NO_DDE_QUERY
When the DMH software is run on the Windows platforms, it ordinarily uses the Microsoft DDE query call to determine which DMH processes already exist, so it can choose a unique name for its send command identity. Defining the NO_DDE_QUERY environment variable prevents this query from happening. This is needed if a dmh_wish process execs a child dmh_wish process without requesting background execution using &.. The child process and parent deadlock since the parent will not answer the child's query until after the child exits. The usual situation is to exec dmh_wish processes in background, so the problem does not occur. The NO_DDE_QUERY variable should also be set when software that does not respond properly to a DDE query, such as IBM's Visual Age Smalltalk, or IBM's Automation Connection. In this situation it appears that the dmh_wish program cannot be started, but in reality, the dmh_wish process is blocked by the rogue application, and is not able to finish its initialization.
NO_SQL_ROW_COUNT
The User Interface of the dmh_SQLsrv application ordinarily lists the tables that exist in a persistent database, and the number of data rows in each table. If the tables are very large, obtaining the number of rows can be time-consuming. Therefore, counting the rows can be disabled by setting the environment variable NO_SQL_ROW_COUNT to the value 1. This value can be overridden by the dmh_SQLsrv menu, so the environment variable is actually an initialization preference.
TCL_LIBRARY
Ordinarily the directory containing the Tcl runtime library including the file init.tcl is found relative to the executable program, as in "../lib/tcl8.6/". In unusual circumstances such as when using Tcl in an embedded application, the environment variable TCL_LIBRARY can be defined to override the usual search, and indicate a specific runtime library directory.
TCLLIBPATH
A colon separated list of directories to supply the initial value to the Tcl auto_path variable which is used to find Tcl procedures that are sourced when first used.
TK_BITMAP_SCALE
Hume customized versions of Tk use the value of tk scaling to determine whether 1X, 2X, or 3X scaled-up bitmaps are used for built-in bitmaps, checkbuttons, and checkboxes.  This works well for Windows, but not reliably on Linux.  The user can set this environment variable value to 1, 2 or 3 to override the default use the tk scaling value.
TK_LIBRARY
Ordinarily the directory containing the Tk runtime library including the file tk.tcl is found relative to the Tcl library path, as in "../tk8.6/". In unusual circumstances such as when using Tk in an uninstalled application, the environment variable TK_LIBRARY can be defined to override the usual search, and indicate a specific runtime library directory. library directory.

VARIABLES

Dmh_wish sets the following Tcl variables:
argc
Contains a count of the number of arg arguments (0 if none), not including the options described above.
argv
Contains a Tcl list whose elements are the arg arguments (not including the options described above), in order, or an empty string if there are no arg arguments.
argv0
Contains fileName if it was specified. Otherwise, contains the name by which dmh_wish was invoked.
::dmh::dmh_library
Set to the path where the program finds the DMH Tcl library.
::dmh::notk
Set to 1 if the -notk command line option was used to indicate background operation without windows is desired. On Unix systems, -notk causes the executable not use X-windows, and Tk variables such as tk_library are not defined. On Windows when using -notk, all of the usual Tk commands and variables still exist, so this flag is set to indicate that windows are not wanted. Dmh_wish.exe can also be run in the background as an NT service.
::dmh::dmh_version
Set to 1.4. This version interoperates with all previous releases, but some earlier releases did not define this variable.
tcl_interactive
Contains 1 if dmh_wish is reading commands interactively (no -file option was specified and standard input is a terminal-like device), 0 otherwise.
tcl_library
Set to the path where the program has found the Tcl runtime library.
tcl_version
Set to 8.6 for Tcl 8.6.
tcl_patchLevel
Set to a value such as 8.6.9 to show the patch level of the version.
tk_library
Set to the path where the program has found the Tk runtime library.
tk_version
Set to 8.6 for Tk 8.6. Releases prior to 4.0 set variable tkVersion.

SCRIPT FILES

On Unix systems, if you create a Tcl script in a file whose first line is

#!/usr/local/bin/dmh_wish -f
then you can invoke the script file directly from your shell if you mark it as executable. This assumes that dmh_wish has been installed in the default location in /usr/local/bin; if it's installed somewhere else then you'll have to modify the above line to match.

A better alternative on Unix systems is to start your script programs with:

#!/bin/sh
# restart using first dmh_wish on PATH \ 
exec dmh_wish -f "$0" "$@"

See wish(1) for an explanation.

On Windows NT, you can create batch files with the filename extension of .bat or .cmd to have the command interpreter recognize them as executable. The contents of a batch file might be:

  start /b dmh_wish -f /users/joe/myscript.tcl
Another trick on Windows NT is to have a .bat file that contains Tcl code, and can start itself. For example, you might create a file, myscript.bat, that starts out with:
  start dmh_wish -tclargs "proc start args {} ; proc goto args {} ; source myscript.bat"
  goto EndOfTcl
  #
  # Insert Tcl code HERE

  #
  # \
  :EndOfTcl

As a rule of thumb, you use Unix style slash pathnames for any pathname that is processed by the Tcl/Tk logic, and DOS style backslashes for Windows programs. Windows NT 3.51 needs the "start" command to run a program independent of the current shell process, but Windows NT 4.0 does not. Another example is:

  start /b d:\usr\local\bin\dmh_wish -f /users/joe/myscript.tcl

PROMPTS

When dmh_wish is invoked interactively it normally prompts for each command with ``% ''. You can change the prompt by setting the variables tcl_prompt1 and tcl_prompt2. If variable tcl_prompt1 exists then it must consist of a Tcl script to output a prompt; instead of outputting a prompt dmh_wish will evaluate the script in tcl_prompt1. The variable tcl_prompt2 is used in a similar way when a newline is typed but the current command isn't yet complete; if tcl_prompt2 isn't set then no prompt is output for incomplete commands.

RESOURCES

On Unix, you can set X-Windows resources in your .Xdefaults file in your home directory. The options(n) man page describes the Name and Class of window system widget attributes that you can set. You need to refer to your X-Windows documentation to fully understand use of resources. For example, to change the default foreground and background colors, of the "ui" Tcl/Tk application, you could use the following lines in your .Xdefaults file:

  Ui*Background: Grey
  Ui*Foreground: Black

Note that the application name, ui, was mapped to the resource name, Ui, by folding the first letter to uppercase. On Unix, you can use the X-windows applications xfontsel and xcolors to see the available font and color choices.

On Windows NT and the Macintosh there is no .Xdefaults or xrdb application. You can change your window system attributes using the option command inside of your Tcl source code as in:

  option add *Background Grey
  option add *Canvas*Background LightGray
  option add *Scrollbar.foreground SlateGrey
  option add *activeBackground SlateGrey
  option add *disabledForeground SlateGrey
  option add *Text*Background LightGray
  option add *selectBackground LightBlue2
  option add *selectForeground Black
  #option add *font -adobe-helvetica-bold-r-normal-*-12-120-*-*-*-*-*-*
  #option add *font -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso8859-1
  # font "Ansi" is for Windows only
  option add *font Ansi
  # on the Macintosh:
  option add *font {monaco 9 normal}
  option add Reporthighlight*font {monaco 9 {bold italic}}

These lines of code can be added to your .dmhrc file for interactive usage of dmh_wish, or put in a file and source'd into a non-interactive Tcl/Tk application.

On Windows NT, you specify colors just as you do in Unix, using X-windows colornames or RGB numeric values (see colors).

In addition, the following names are also supported on Windows NT for the system colors:

    System3dDarkShadow
    System3dLight
    SystemActiveBorder
    SystemActiveCaption
    SystemAppWorkspace
    SystemBackground
    SystemButtonFace
    SystemButtonHighlight
    SystemButtonShadow
    SystemButtonText
    SystemCaptionText
    SystemDisabledText
    SystemGrayText
    SystemHighlight
    SystemHighlightText
    SystemInactiveBorder
    SystemInactiveCaption
    SystemInactiveCaptionText
    SystemInfoBackground
    SystemInfoText
    SystemMenu
    SystemMenuText
    SystemScrollbar
    SystemWindow
    SystemWindowFrame
    SystemWindowText

SEE ALSO

Tcl variables, Tk variables, wish

KEYWORDS

shell, toolkit, DMH, color, font, resource