A file-based communications interface has been added to fitfuns to allow programs linked with this library to be driven from an external GUI program. An example, Clickfit, written in Tcl/Tk is presented below. The windows used within Clickfit are easy to modify, being configured in a separate file, which also has the basic system information required by the graphics library (PGplot).
The initial command line control options are retained, allowing rapid prototype development.
A job sequence number is added to the command line when the fortran program is launched. Subroutine PRELUDE, either called in the main program, (or in any case at the start of the fitfun routines) checks the command line for such a jobname eg job433 as the argument after the program name, and if found assumes it must expect commands via the communication files shown below. The first command is sent to the prelude routine and is a character string of data which, like subsequent commands, is copied into a FORTRAN common/comin/bufin where bufin is character*150. This allows a flexible method of furnishing data from commands for use in the fitting program, notably for reading data and data-linked parameters. The PRELUDE routine sets up the communication files. These are deleted on normalprogram termination A sequence number is included in each command, and the corresponding number is returned in the reply file. Further information is also returned in an information file as illustrated below:
for example program fitp, sequence number 433 GUI Fitfun program writes command m into fitp433.fcd ----> reads command | performs command usual terminal output to fitp433.log | writes status into fitp433.fif | writes reply to m in notes updated number m in reply | file showing command is complete <----- fitp433.frpPolling
Unexpected terminations
The primary cause should be signalled in the log file. In the case of communications being lost between the two programs it is possible that the calculation program continues to run, polling for a possible command until the 15 minute timeout is reached and the program terminates. Since the sequence number for the jobs is incremented each time a subsequent program launch will not interfere with the idling program, which may be terminated manually without prejudice.