Version 2.0.0 (06/25/13): Changed all references to motor.dat to mxmotor.dat for compatibility with MX 2.0.0. A variety of small changes to match changes in MX. Version 1.5.4 (05/10/11): Updated Solaris makefiles for compatibility with SunStudio 12.1 and Solaris 10 10/09. Version 1.5.2 (03/30/10): Changed mx_process_exists() to mx_process_id_exists() to mirror the same change in libMx. Version 1.5.1 (10/04/09): Added the Mx::user_requested_interrupt_or_pause() function. Version 1.5.0 (11/12/08): Updated Tcl package version to 1.5. Added new Mx::SCA class to control MX single channel analyzers. Version 1.4.0 (01/15/07): Updated Tcl package version to 1.4. Modified make_LibMxTcl_index so that it no longer uses the Bash 'x$PATH = x' trick for Cygwin and Win32 to determine whether or not the PATH variable already exists. The trick fails if the PATH variable contains space characters, which are a common occurrence on Cygwin and Win32 systems. Version 1.3.0 (08/08/06): Updated Tcl package version to 1.3. Version 1.2.0 (03/17/06): Minor tweaks to accomodate changes in the MX API for MX 1.2.0. Version 1.1.1 (01/11/06): MxTcl now uses the new mx_initialize_runtime() function to setup the correct runtime environment for MX. Replaced calls to strcpy(), strncpy(), and sprintf() with calls to strlcpy() and snprintf(). Makefile updates for newer operating system versions and for minor changes to the build system. Version 1.1.0 (07/13/05): Added support for an Mx::MCA class to MxTcl. This class supports all of the same methods that are supported by Python-based MP. Added new methods to the Mx::Motor class called get_status and get_extended_status. Scanning in 'mxgui' now supports creating, editing and running MX quick scans and list scans. Added support for scan pause request handlers. These handlers allow the user to pause a scan in progress and then optionally resume the scan. Version 1.0.2 (08/27/04): Support for MX amplifier, analog input, and analog output classes has been added to MxTcl. Version 1.0.0 (04/26/04): No changes were made in this release other than bumping the version number of the package to 1.0 Version 0.66.1 (08/24/03): The MX architecture 'freebsd' has been renamed to 'bsd' to reflect the fact that it builds equally well on FreeBSD, NetBSD, and OpenBSD. Version 0.66.0 (08/15/03): Two new functions Mx::get_datafile_type and Mx::get_plot_type have been added. Datafile and plot descriptions in MX scan records are now composite objects that contain both the type followed by optional arguments. Thus, it was necessary to add the above functions so that MxTcl can split off just the datafile and plot types from the datafile and plot descriptions. Version 0.65.0 (04/01/03): The MxTcl makefiles have renamed the old ARCH and INSTALL_DIR variables to MX_ARCH and MX_INSTALL_DIR. A new method for Mx::RecordList objects called set_program_name has been added that allows MxTcl client scripts to identify themselves to remote MX servers. Although this feature is optional, MxTcl scripts are encouraged to make use of this feature, since it makes the MX server's list of clients more useful. MxTcl has added support for FreeBSD. Version 0.62.0 (12/03/02): This release is a major revision of MxTcl that changes it from a statically linked Tcl extension to a dynamically loaded extension. Recent versions of [incr tcl] no longer provide a statically linked library with which to build a statically linked 'mxtclsh' or 'mxwish'. Instead, a stubs library with a name like 'libitclstub3.1.a' is provided. Since MxTcl depends on [incr tcl] for its functionality, this means that MxTcl had to be changed to a dynamically loaded extension to work with recent versions of [incr tcl] and Tcl/Tk. So what does this mean? First of all, it means that the old binaries 'mxtclsh' and 'mxwish' no longer exist. Instead, you now run MxTcl scripts via the standard binaries 'tclsh' or 'wish' and then dynamically load both [incr tcl] and then MxTcl. Second, the stubs interface that MxTcl now uses was only introduced in Tcl/Tk 8.1, so MxTcl is no longer supported for Tcl/Tk 8.0 and before. MxTcl has only been tested with Tcl/Tk 8.3 and 8.4 and with [incr tcl] 3.1 and 3.2. MxTcl may work with Tcl/Tk 8.1 or 8.2, but this is completely untested. So unless you have a compelling reason to run Tcl/Tk 8.1 or 8.2, I would recommend that you stick with 8.3 or above. If, for now, you need to stick with the old version of MxTcl, MxTcl 0.60.0 should still build and work with MX 0.62.0. However, this will not likely be the case for versions of MX beyond 0.62.x, so you should change over soon. Contact me if you have any problems with getting this to work. The following is an abbreviated working example of what the script startup needs to look like for MxTcl 0.62.0 and above: if { [ info exists env(MXDIR) ] == 0 } { set env(MXDIR) [ file join "/" "opt" "mx" ] } set mxtcl_package_dir [ file join $env(MXDIR) "lib" "mxtcl" ] set auto_path [ concat $mxtcl_package_dir $auto_path ] package require Itcl 3.1 # If your script is to be a GUI you also need to load Itk # and Iwidgets. The example below attempts to load Iwidgets # version 4.0 and falls back to 3.0 if 4.0 is not found. package require Itk 3.1 if [ catch { package require Iwidgets 4.0 } ] { package require Iwidgets 3.0 } # Now you can load and initialize MxTcl. package require Mx ::Mx::init # At this point MxTcl is correctly initialized so you can # load databases and proceed onward. set mx_database [ file join $env(MXDIR) "etc" "motor.dat" ] set record_list [ Mx::setup_database $mx_database ] # Here you may start to use the database. For example, set energy_motor [ $record_list get_record "energy" ] set energy [ $energy_motor get_position ] puts "Current X-ray energy = $energy eV" # And so forth... Another important change is that informational output and user interrupt handling has been modified so that individual MxTcl scripts can provide their own custom handlers. Thus, if you had some code that looked like Mx::install_user_interrupt_handler Mx::install_output_handlers $window Mx::install_dialog_handler then you need to change this to look like Mx::set_user_interrupt_function my_user_interrupt_function Mx::set_all_output_functions my_output_function Mx::set_info_dialog_function my_info_dialog_function where the user provided functions should look something like proc my_user_interrupt_function {} { update set interrupt_occurred $Example::user_interrupt_flag set Example::user_interrupt_flag 0 return $interrupt_occurred } proc my_output_function { message } { my_puts $message update } proc my_info_dialog_function { text_prompt \ gui_prompt button_label } { bell tk_dialog .my_info_dialog "MX Info" \ $gui_prompt info 0 $button_label } Another change is that all occurrences of the [incr tcl] commands 'class', 'body', and 'code' must be replaced by 'itcl::class', 'itcl::body', and 'itcl::code' respectively. In practice, the 'class' and 'body' commands are only used internally by the MxTcl package, so application code should only have to change instances of 'code' to 'itcl::code'. This change occurred since [incr tcl] no longer exports these commands to the calling scripts namespace. Theoretically, the calling script could import these names itself, but, in practice, I have found that going that route does not work as well as one might expect. Contact me if you need more help with the new version of MxTcl. There were some other less important changes: A new MX build platform 'irix-gcc' has been added. The addition of 'irix-gcc' was motivated by the fact that I was unsuccessful at building a working version of Tcl/Tk 8.3 or 8.4 with the vendor provided C compiler on the SGI Irix machines I have access to. However, versions of Tcl/Tk 8.4 compiled with GCC under Irix seem to work fine. Thus, I have decided, for now, that the simplest solution is to build MX and its extensions for Irix with GCC. However, if someone can show me how to get a working version of Tcl/Tk 8.4 with the SGI provided C compiler, I would be interested in knowing how they did that. MxTcl 0.62.0 currently cannot be built for Cygwin. The version of Tcl/Tk provided for Cygwin is still stuck at version 8.0 which does not support the new stubs interface. Once the Cygwin versions of Tcl/Tk and [incr tcl ] have been upgraded to Tcl/Tk 8.1 or above, I will go back and make the MxTcl 'cygwin' build target work again. However, if you need a scripting interface for Cygwin, the MX Python interface, MP, does work with current versions of Cygwin. Alternately, you can use the MxTcl 'win32' build target to build MxTcl with Visual C++. New script front ends 'mxtclsh_script' and 'mxwish_script' have been added. These are invoked from a Unix shell or DOS window prompt as mxtclsh_script user_script argument1 argument2 argument3 ... for non-GUI scripts and as mxwish_script user_script argument1 argument2 argument3 ... for GUI scripts. These two scripts handle all of the MX and MxTcl initialization and then invoke a 'main' procedure with the supplied arguments that is expected to be provided by the supplied 'user_script' Here is a complete working example: -------------------------- cut here ----------------------- #! /bin/sh # # This script reports the position of the requested motor. # # \ exec mxtclsh_script "$0" ${1+"$@"} proc main { record_list argv } { if { [ llength $argv ] != 1 } { puts stderr "" puts stderr "Usage: mt_get_position motorname" puts stderr "" exit } set motor_name [ lindex $argv 0 ] set motor [ $record_list get_record $motor_name ] set position [ $motor get_position ] set units [ $motor get_field "units" ] puts "Motor '$motor_name' position = $position $units" } -------------------------- cut here ----------------------- A set of usage examples for 'mxtclsh_script' and 'mxwish_script' are provided in the 'mxtcl/examples' directory. These two scripts were inspired by 'mpscript' from the MX Python module, MP. Thus, the examples provided with MxTcl are equivalent to the examples provided with MP in the 'mp/examples' directory except for the differences in syntax between Tcl/Tk and Python. A new Mx::process_exists function has been added so that Imcagui can check to see if the external Chooch process is still running without spawning another external program to do the job. A new Mx::error_message function has been added to replace the use of tk_dialog in most instances. The old Tcl script 'mxgui.tcl' has been renamed to 'mxgui', while the old shell script front end 'mxgui' has been eliminated. Version 0.60.0 (08/13/02): A new 'get_previous_record' method has been added to MxTcl records. In addition, 'get_multiple_records' now has an extra argument to specify the order in which the records should be returned. This is done to support returning a list of records in reverse order. 'mxgui' uses this to report its list of scans in reverse order in the scan selection dialog. The 'is_at_home_switch' method for motors has been renamed to 'home_search_succeeded'. A new 'read_raw' method for scalers has been added. This is to allow clients to read a scaler without dark current subtraction being performed. Version 0.56.1 (04/04/02): Support for digital input and output devices has been added to the MxTcl package. The code that parses MX string variables was not correctly initializing the value of the max_string_token_length variable. This has been fixed. Version 0.56.0 (03/04/02): The makefiles have been modified to replace the MX_TCL_INSTALL... variables with a more traditional system of makefile targets. Updated Mx_set_field_cmd() to reflect the change to the prototypes of token_parser routines made in the base MX package. Version 0.55.0 (12/18/01): Added support for MX relay records to MxTcl. They have methods called 'relay_command' and 'get_relay_status'. Version 0.50.1 (10/25/01): Created two new scripts named 'mxtclsh_script' and 'mxwish_script'. 'mxtclsh_script' is an 'mxtclsh' script that encapsulates all of the generic setup steps for MxTcl and then invokes a user-supplied 'main' procedure. The idea is to eliminate the necessity to do a lot of the same setup steps in each new script by putting those setup steps in a common script. 'mxwish_script' does the same thing, but using 'mxwish' as the interpreter. An example that uses this new support is the 'testrs232' and associated 'testrs232.tcl' scripts in the 'test' directory. Added support for the Mx::RS232 class, which allows MxTcl scripts to send and receive strings via RS-232 ports. Modified the initialize_hardware method for the Mx::Record class to add an 'inithw_flags' argument. This was done to match the corresponding change made to mx_initialize_hardware in the primary MX package. Version 0.50.0 (08/19/01): Implemented MxTcl's part of the great renaming. See the changelog for MX for more details. Version 0.27.3 (07/19/01): Added support for MacOS X when using the Tenon port of Tcl/Tk and an in-house port of [incr Tcl]. At present, the port has some glitches and misbehavior such as mishandling of drop-down menus and problems with executing external programs. It is thought that this may be due to errors in the in-house port of Tcl/Tk. Hopefully, a better port of [incr Tcl] may appear soon. Currently, this port has not yet been tested with the XFree86 port to MacOS X. Added partial support for the Cygwin version of Tcl/Tk. At present, 'mxtclsh' is fully functional, but 'mxwish' hangs while trying to draw its first window. This will be addressed in later releases. It should be noted that MxTcl does not yet work with the most recent versions of Tcl/Tk and [incr Tcl] that require 'stubs' support, since MxTcl has not yet been modified to support 'stubs'. Version 0.27.2 (02/07/01): Made minor changes to the Makefiles to support using Tcl/Tk 8.2 or 8.3 in combination with [incr Tcl] 3.1 or 3.2. No changes to the actual source code were required. So far these changes have only been fully tested with Linux, but should work with Tcl/Tk 8.0 at least on other platforms. Version 0.27.1 (12/21/00): Made a minor bug fix to Mx_init_cmd() that added a previously missing call to mx_initialize_clock_ticks(). This is for compatibility with recent changes to the 'soft_motor' record. Version 0.27.0 (09/05/00): Added support for motor object methods to get and set motor base speeds, default speeds, maximum speeds, accelerations, and home switch detection. Modified the handling of MX errors so that the text of the error message is assigned to the object result of the Tcl procedure that encounters the error. This allows the standard 'bgerror' procedure to find and display MX error messages in the error dialog box. Version 0.26.5 (06/26/00): Added support for the 'solgcc' target which uses GCC 2.8.1 on Solaris 2.6. Version 0.26.4 (05/05/00): Updated Mx::install_output_handlers to redirect the output of the new mx_warning() function to the the same place as error and informational messages. Version 0.26.3 (03/28/00): Found and fixed a bug in 'make install' for SGI that was causing the libMxTk library to be deleted. Version 0.26.2 (03/16/00): Modified the MX Tcl package to split out the Tk and Itk dependent parts into a libMxTk library. Also split 'mxtclwish' into two different programs, namely, 'mxtclsh' and 'mxwish'. 'mxwish' is essentially equivalent to the old 'mxtclwish', while 'mxtclsh' makes no use of windowing systems like X11. The intention is that 'mxtclsh' play the same role for MX as 'tclsh' does for Tcl/Tk as a non-graphical MX Tcl interpreter. On Win32, 'mxwish' now uses a WinMain() style of startup rather than using main() like the old 'mxtclwish' did. This means that 'mxwish' is no longer a console mode application and can be started up from another graphical program without creating an extraneous console window. Version 0.25.1 (11/12/99): Made minor changes to mxAppInit.c to allow it to be compiled with the SGI Irix 6.5 compiler. Version 0.25.0 (09/20/99): Updated the MX Tcl/Tk package to work with version 0.25.0 of the core MX package. As part of this, the "Edit Scans" display of "mxgui" has been modified to allow the user to select between "Preset Time" and "Preset Count" measurements. Please note that there was no 0.24.x version of the MX Tcl/Tk package. Version 0.23.2 (05/10/99): Permission has been granted by IIT to make the source code freely available on the Internet. Added IIT copyright messages to all the source code files. Version 0.23.1 (02/12/99): Fixed some minor bugs in the Win32 batch files used with mxgui. Version 0.23.0 (01/27/99): Added a "make install" target to the Makefiles to allow for more automatic installation of the software. Added support for the Mx::Scaler and Mx::Timer classes with a corresponding "Show Scalers" menu in the mxgui program. Constructed an include file 'mxAppInit.h' which contains the 5 function prototypes for internal Tcl/Tk routines that mxtclwish uses. This removes the need to include 'tclInt.h' in the file 'mxAppInit.c'. Standardized textBackground colors in the various windows so that they should all be white. The various attempts I made to choose something like 'ivory' looked good on some platforms and bad on others. But white looks essentially the same on all the platforms. There is now a motor polling interval dialog that allows one to modify the polling interval for mxgui motor control windows. mxgui now prompts for scan header changes. It didn't before. Made a variety of other small tweaks to mxgui. Version 0.22.7 (11/04/98): Revised the makefiles to make it easier to support multiple platforms. Also created some DIR macros to more easily specify the locations of packages that 'mxtcl' depends on. Version 0.22.6 (10/29/98): The MX Tcl library build process now creates a statically linked library libMxTcl.a in addition to the regular shared library version. Also, the build now creates an mxtclwish binary that is statically linked to libMxTcl.a and libMx.a. This binary will be the interpreter that is used for now, since the use of static libraries will help in the interpretation of core dumps. Changed the "show motors" window in mxgui so that the list of motors now appears in a scrolling window. Made other minor tweaks to the user interface. The message log window in mxgui now displays the MX version number when it starts up. Version 0.22.5 (10/21/98): This version implements most of the features intended for the first version of the MX GUI, namely, motor control, scan setup and execution, and editing of variable values. Most everything works, but the GUI is still somewhat buggy and dumps core every so often. Thus, there is still some more work to do before I have a "stable" version of the Tcl/Tk GUI interface. Version 0.22.4 (09/11/98): This is the first version tested with users. The GUI is very incomplete at this point, but has enough stuff implemented to be of actual use to beamline staff at least.