Highlights for spec release 6.06

May 8, 2017 - RELEASE 6.06.01


Better Hardware Polling While Waiting For Keyboard Input

While waiting for keyboard input, spec checks the busy status of active motors, timers, etc. spec also checks for events from a spec server (if using), messages from clients if running as a spec server and EPICS event callbacks (if using EPICS), Previously, spec used a select() system call with a short polling time that only responded to keyboard activity. spec now uses the select() call to also monitor server/client related and EPICS activity. If no other I/O, such as with PC board controllers, serial devices, etc., is active, spec is idle, waiting in the select() call. If there is other I/O, spec polls the devices no faster than ten times per second. The new code should provide faster response times to server/client and EPICS events.

The new code also includes a fix for an issue related to pasting text at the prompt. Previously, there was a noticeable delay between display of each character of the pasted text. That delay is gone.

Finally, the spec_par() "fast_hdw_checks" option is no longer relevant. For backward compatibility, it can still be set, but its value is ignored.

Hardware Polling While Running unix() Commands

spec will now use the keyboard-input hardware polling loop while waiting for a child process created with unix() to finish. The same applies to spec's gethelp() function which also creates child processes to format and display help files. This change means that when in server mode, the spec server will now respond to clients even when, for example, the server itself is being used to display a help file.

spec will give the child process up to one second to complete before starting the hardware polling. That avoids any delays when running quick unix() commands.

A known issue occurs if a client sends a command to a spec server to create an interactive subshell while the server itself is in a subshell. The work around is not to do that. If the situation occurs, upon exiting the subshell on the server, one may need to type ^Z to suspend spec, then fg to bring spec to the foreground.

Parser Now Reentrant

The byacc utility is used to compile the spec parser. CSS has modified the version it uses so that the parser is reentrant. That means that as of this spec release, multi-line commands being typed at a spec server will not be corrupted by the arrival of commands from a client, as was previously the case. In addition, nested eval() calls should now work flawlessly.

Initialization Implemented For 2D Associative Arrays

Two dimensional associative array initialization is now available. Each element is initialized with three colon-separated items. The first two items are the array indices and the third is the element value. Syntax is as follows:

testarray = [ 1:2:"item", 2:3:"item2" ]

which results in:

testarray["1"]["2"] = "item"
testarray["2"]["3"] = "item2"

Initialization lists can include a mix of 2D, 1D or index-implicit 1D sequences.

Multi-Line Commands Now Saved As One Entry In History List

Commands or statement blocks entered at the main prompt that extend over multiple lines are now saved as just one item in the command line history. This history mode, which is enabled by default, can be disabled by setting the new spec_par() "history_join" option to zero.

Escaped History Character Now Kept In History Item

In order to use the negation operator ! in an expression entered at the keyboard, the character needs to be preceded by backslash, as in \!, as a bare exclamation mark is interpreted as the history recall character by the command line editing library. Previously, when the line containing \! was saved as a history item, the backslash was removed, meaning if the line was recalled, the line would have to be edited to add back in the backslash. This spec release ensures the backslash remains in the history item. However, it is now not allowed to combine \! and exclamation-mark recalled history items on the same line.

History Restored Even If State File Is Unusable

When not starting fresh, but with a state file that is missing, corrupted or otherwise unusable, spec will still try to restore command-line history, which is stored in a separate file since spec release 6.05.01.

Input Line Length Now Unlimited

The length of an input line is now unlimited. Previously, the maximum number of characters was 4,096. This change is important to accommodate the new "history_join" feature which, for example, will save a statement making a macro definition that includes a long string as a single history item.

New "unusable" Argument for mca_spar() and image_par()

A new "unusable" option for mca_spar() and image_par() will return a nonzero value if the associated device is unusable, either because it didn't pass the presence test, because it was marked "OFF" in the config file or because there is no configured device at the given unit number. No error messages will appear if the arguments refer to unconfigured devices.

New Options and Fixes To strdef()

The strdef() functions returns the macro definition of its argument as a string. A problem where escaped string delimiters were not properly coded in the return strings has been fixed. In addition, strdef() now takes an optional associative array argument. If the macro is a macro function, the associative array elements will be assigned the string names of the arguments in order started at zero. Also, an element of the array indexed by the string "file" will contain the pathname of the file where the macro definition came from or the strings "tty" if the macro was defined at the keyboard.

"Server Hardware" Functionality Improved

The new "server hardware" feature introduced in spec release 6.04.01 now support MCA-type (1D) and image-type (2D) devices. In addition, spec now supports automatic start up of the server process, whether on a local or remote host. spec will also attempt to restart a server that stops responding. The servers can now be daemonized to run in the background unassociated with a terminal. The servers also use lock files to prevent more than one instance from running. See the server_hdw help file for details.

Image Functions Now Set HDW_ERR

The image_get(), image_put() and image_par() functions now set the built-in HDW_ERR global variable with appropriate values on failed calls. See the HDW_ERR help file for details.

splot Updates

The Python splot utility has improvements in functionality, performance and stability. One notable new capability is 2D contour-plotting for mesh scans. Also, print dialogs and functionality are improved.


New Reciprocal Space and Delta vscan Macros

The vscan family of macros do variable step size scans. The scan arguments include a start, focus and end position for each scanned variable, with point spacing being closest together at the specified focus, which can be anywhere within the scan range, including the end points. New vhscan, vkscan, vlscan and vhklscan macros provide for scanning in reciprocal space. Additional v3scan and v4scan macros have been added to support additional motors. Delta versions dvscan through dv4scan are also now included. See the vscan help file for details.

New disable and enable Macros For Setting Hardware

The standard spec macros now include macros to easily disable or enable hardware devices. The macros are based on similar macros from the ESRF and should be fully compatible with those. See the disable help file for details.

Broken Multiple Motor Continuous Scans Are Fixed

A bug in the internal _cscan_prep macro prevented c2scan through c4scan from working correctly, along with the delta versions. That bug is fixed. See the cscan help file for more information about the scans.


Fix For Restoring History When Starting With -u and -t

An issue with the revamped history facility introduced in spec release 6.05.01, where if spec was invoked with the -u and/or -t flags to start with an initial state file from another user or tty, spec would not also import the associated command history, has been fixed.

Fix For Reading Miscellaneous State File Parameters with -u and -t

An old issue, where the spec_par() options and certain persistant hardware parameters saved in the user state file as "miscellaneous parameters" were not obtained from the alternate initial state file specified with the -u and/or -t command line options, has been fixed.

Fix For Slow Pasting With libreadline

spec now includes a work around for a problem with slow pasting of text when spec is linked with libreadline (but not libedit) in certain environments.

Fix For the "move_done" Property On spec Servers For Pseudomotors

A problem where a request to a spec server for a calculational pseudomotor's "move_done" property would return a value of 0, even when the associated real motors were busy, has been fixed.


New motor_par() "dump" option for Newport SMC100 Motor Controller

A new "dump" option to motor_par() for the Newport SMC100CC/PP motor controllers will display all the controller parameter settings as obtained using the controller's ZT command. In addition, the command motor_par(mne, "read", "ZT") will return a multi-line string that contains the complete ZT response. See the SMC100 manual for more information.