# Subroutines

- Subroutines: Descriptions in numerical order
- Subroutines: Descriptions in subject order
- Subroutines: Descriptions in alphabetical order
- Menu

# Subroutines: Descriptions in numerical order

    Help and definitions
    HELP_SIMDEM ... provide help
    IMAGES      ... display gallery of images
    PALETT      ... definition of colours
    GKS001      ... definition of line and symbol types
    GKSVF3      ... definition of arrows/lines/boxes
    PCPLOT      ... definition of fill styles
    NAGSUB      ... NAG library substitute routines
    Programs
    SIMDEM01
    PUTADV ... advice
    PUTCAU ... caution
    PUTFAT ... fatal
    PUTMES ... multi-line text display
    PUTWAR ... warning
    PUTTXT ... text
    SIMDEM02
    GETD01 ... get 1 unrestricted value  (must be initialised)
    GETD02 ... get 2 unrestricted values (must be initialised)
    GETD03 ... get 3 unrestricted values (must be initialised)
    GETDGE ... get X where X >= A        (must be initialised)
    GETDLE ... get X where X =< A        (must be initialised)
    GETDG2 ... get X =< Y                (must be initialised)
    GETDG3 ... get X =< Y =< Z           (must be initialised)
    GETDM1 ... get x where A =< X =< B   (must be initialised)
    GETR01 ... get 1 unrestricted value
    GETR02 ... get 2 unrestricted values
    GETR03 ... get 3 unrestricted values
    GETRM1 ... get X where A =< x =< B
    SIMDEM03
    GETI01 ... get 1 integer i
    GETIGT ... get 1 integer i > A
    GETILT ... get 1 integer i < B
    GETIM1 ... get 1 integer A =< i =< B
    GETJ01 ... get 1 integer i           (must be initialised)
    GETJGE ... get 1 integer i >= A      (must be initialised)
    GETJLE ... get 1 integer i =< A      (must be initialised)
    GETJM1 ... get 1 integer A =< i =< B (must be initialised)
    SIMDEM04
    GETSTR ... get a text string from the user (default supplied)
    GETTXT ... get a text string from the user (default = ?)
    SIMDEM05
    GETL01 ... get a logical variable
    SIMDEM06
    LISTBX ... select from a simple list box
    SIMDEM07
    LIST01 ... scrolling table with reverse communication
    LIST02 ... scrolling table
    SLEEP1 ... impose a delay
    SIMDEM08
    TABLE1 ... scrolling table with coloured lines
    SIMDEM09
    GKS001 ... plot 1 function
    SIMDEM10
    GKS004 ... plot 4 functions
    SIMDEM11
    EDITD1 ... editing a double precision array
    SIMDEM12
    EDITI1 ... editing an integer array
    SIMDEM13
    EDITTX ... editing a text array
    SIMDEM14
    VIEWIT ... matrix as a numerical table
    SIMDEM15
    CLOSER ... close a Simdem file
    DELEET ... delete a file
    GETTMP ... get a temporary file name
    OPENER ... open a Simdem file
    REVPRO ... review progress
    WRITER ... write to a Simdem file
    SIMDEM16
    VIEWER ... view a file
    SIMDEM17
    PATCH1 ... view text (comprehensive)
    PATCH2 ... view text (simplified)
    SIMDEM18
    TITLE1 ... select from a title page and menu
    SIMDEM19
    ANSWER ... select from a question and answer window
    SIMDEM20
    TBOX01 ... select from a tabbing list box
    SIMDEM21
    GKST04 ... plot 4 (x,y) transforms
    SIMDEM22
    SURD2S ... plot surfaces and contours
    SIMDEM23
    SPACE0 ... plot curves in space
    SIMDEM24
    GKSVF1 ... plot a vector field
    SIMDEM25
    GKSEB4 ... plot error bars
    SIMDEM26
    DSPLAY ... display or file a matrix
    SIMDEM27
    TABLE2 ... display a coloured table
    SIMDEM28
    WINDOW ... display a background window
    SIMDEM29
    LINEIN ... get a text string
    SIMDEM30
    TITLES ... display a title with menu
    TUTOR1 ... display a tutorial
    SIMDEM31
    GETI0N ... get n integers
    SIMDEM32
    GETR0N ... get n double precison values
    FORM25 ... return a variable as CHARACTER (LEN = 25)
    SIMDEM33
    GETS0N ... get n character strings
    SIMDEM34
    GETL0N ... get n logicals
    SIMDEM35
    GET00N ... get n arbitrary values
    SIMDEM36
    BBOX01 ... select from normal buttons
    HBOX01 ... select from horizontal buttons
    VBOX01 ... select from vertical buttons
    SIMDEM37
    RBOX01 ... select from ganged radio/tick boxes
    SIMDEM38
    TABLE4 ... display interactive calculations
    SIMDEM39
    WAITER ... display Wait ... Calculations in progress
    SIMDEM40
    CONFIG ... configure the Simfit DLLs
    SIMDEM41
    TRIM80 ... trim a long filename
    VEC1IN ... get a vector
    SIMDEM42
    MATTIN ... get a matrix
    SIMDEM43
    ATTRIB ... get file attributes
    GETNOU ... get an unopened Simdem unit
    SIMDEM44
    GETFIL ... select using the Windows file-selection control
    OFILES ... select using the Simfit file-selection control
    FSERCH ... search for a file
    INFOFL ... display the status of a file
    SIMDEM45
    FPRINT ... print a text file
    SIMDEM46
    DELTMP ... delete temporary files
    SMPLOT ... plot n data sets
    SIMDEM47
    SIMDEM48
    BCPLOT ... plot a bar chart
    PCPLOT ... plot a pie chart
    SIMDEM49
    BWPLOT ... plot as boxes and whiskers
    SIMDEM50
    EBPLOT ... plot as bars/symbols plus error bars
    SIMDEM51
    DLLCLR ... get signatures for w_clearwin.dll
    DLLGRA ... get signatures for w_graphics.dll
    DLLMEN ... get signatures for w_menus.dll
    SCCLIB ... get signatures for salflibc.dll
    SIMDEM52
    PALETT ... get a colour from the palette
    SIMDEM53
    LBPLOT ... plot a 2D scatter plus labels
    SIMDEM54
    CDPLOT ... plot sample cumulative plus best-fit cdf
    SIMDEM55
    PDPLOT ... plot sample histogram plus best-fit pdf
    SIMDEM56
    HIST01 ... plot a histogram with error bars
    SIMDEM57
    DGPLOT ... plot a dendrogram with threshold
    SIMDEM58
    CHKBOX ... select from 1-dimensional scrolling check boxes
    RBOXES ... select from 2-dimensional scrolling check boxes
    SIMDEM59
    MFILES ... select one or multiple files
    TRIM60 ... trim a long filename
    SIMDEM60
    LSTBOX ... select from a comprehensive list box
    SIMDEM61
    HNPLOT ... plot half-normal and normal scores
    SIMDEM62
    ELIPS1 ... plot bivariate normal confidence ellipses
    NAGSUB ... NAG library substitute routines
    SIMDEM63
    MTPLOT ... plot rows and columns from a matrix
    SIMDEM64
    RTPLOT ... plot a parametric curve r = r(theta)
    SIMDEM65
    AUX256 ... full path to a Simdem auxiliary file
    VUOPEN ... select a file to view/open/copy/paste
    SIMDEM66
    ISITMF ... check if a file is a Simfit matrix file
    MAT2IN ... read a data matrix from a file
    MATOUT ... write a data matrix to a file
    SIMDEM67
    MATTRN ... matrix editing and transforming
    SIMDEM68
    MAT3IN ... comprehensive control to read-in data matrices
    MAT4IN ... comprehensive control to use/edit data matrices
    CHOP80 ... truncates titles to first 80 characters
    SIMDEM69
    GKSVF3 ... plot a vector field with labels
    SIMDEM70
    CLOCK1 ... return the current clock time in seconds
    DBPLOT ... plot with LHS and RHS axes (a double plot)
    DEFKEY ... define/retrieve character configuration keys
    DEFLAB ... define/retrieve arrays of labels or character keys
    EDITPS ... edit PostScript files and make collages
    GKS012 ... plot up to 12 data sets
    GKSCB4 ... plot error bars (no advanced options)
    GKSHB4 ... plot horizontal error bars
    GKSLGL ... define/retrieve plot configuration parameters (simple)
    GKST12 ... plot up to 12 transformed data sets
    GRFLGL ... define/retrieve plot configuration parameters (advanced)
    GSTYLE ... define/retrieve plot configuration parameters (all)
    LABCFG ... define/retrieve plot labels, fill styles, colours
    MFPLOT ... replay a metafile to resume editing
    NSTEPS ... define/retrieve groups of data points to be omitted
    RESDEF ... restore Simfit plotting defaults
    SBPLOT ... plot a stacked bar chart
    SPACE6 ... plot 3D space curves
    SYMCFG ... define/retrieve plot symbols, lines, colours
    TSIZES ... define/retrieve font sizes
    TSPLOT ... plot time series data
    XFONTS ... plot the Simfit font substitution maps

Back to Menu or Subroutines

# Subroutines: Descriptions in subject order

    Help and definitions
    HELP_SIMDEM ... provide help
    IMAGES      ... display gallery of images
    PALETT      ... definition of colours
    GKS001      ... definition of line and symbol types
    GKSVF3      ... definition of arrows/lines/boxes
    PCPLOT      ... definition of fill styles
    NAGSUB      ... NAG library substitute routines
    Programs
    SIMDEM01
    PUTADV ... advice
    PUTCAU ... caution
    PUTFAT ... fatal
    PUTMES ... multi-line text display
    PUTWAR ... warning
    PUTTXT ... text
    SIMDEM07
    LIST01 ... scrolling table with reverse communication
    LIST02 ... scrolling table
    SLEEP1 ... impose a delay
    SIMDEM08
    TABLE1 ... scrolling table with coloured lines
    SIMDEM14
    VIEWIT ... matrix as a numerical table
    SIMDEM15
    CLOSER ... close a Simdem file
    DELEET ... delete a file
    GETTMP ... get a temporary file name
    OPENER ... open a Simdem file
    REVPRO ... review progress
    WRITER ... write to a Simdem file
    SIMDEM16
    VIEWER ... view a file
    SIMDEM17
    PATCH1 ... view text (comprehensive)
    PATCH2 ... view text (simplified)
    SIMDEM26
    DSPLAY ... display or file a matrix
    SIMDEM27
    TABLE2 ... display a coloured table
    SIMDEM28
    WINDOW ... display a background window
    SIMDEM30
    TITLES ... display a title with menu
    TUTOR1 ... display a tutorial
    SIMDEM38
    TABLE4 ... display interactive calculations
    SIMDEM39
    WAITER ... display Wait ... Calculations in progress
    SIMDEM29
    LINEIN ... get a text string
    SIMDEM31
    GETI0N ... get n integers
    SIMDEM32
    GETR0N ... get n double precison values
    FORM25 ... return a variable as CHARACTER (LEN = 25)
    SIMDEM33
    GETS0N ... get n character strings
    SIMDEM34
    GETL0N ... get n logicals
    SIMDEM35
    GET00N ... get n arbitrary values
    SIMDEM02
    GETD01 ... get 1 unrestricted value  (must be initialised)
    GETD02 ... get 2 unrestricted values (must be initialised)
    GETD03 ... get 3 unrestricted values (must be initialised)
    GETDGE ... get X where X >= A        (must be initialised)
    GETDLE ... get X where X =< A        (must be initialised)
    GETDG2 ... get X =< Y                (must be initialised)
    GETDG3 ... get X =< Y =< Z           (must be initialised)
    GETDM1 ... get x where A =< X =< B   (must be initialised)
    GETR01 ... get 1 unrestricted value
    GETR02 ... get 2 unrestricted values
    GETR03 ... get 3 unrestricted values
    GETRM1 ... get X where A =< x =< B
    SIMDEM03
    GETI01 ... get 1 integer i
    GETIGT ... get 1 integer i > A
    GETILT ... get 1 integer i < B
    GETIM1 ... get 1 integer A =< i =< B
    GETJ01 ... get 1 integer i           (must be initialised)
    GETJGE ... get 1 integer i >= A      (must be initialised)
    GETJLE ... get 1 integer i =< A      (must be initialised)
    GETJM1 ... get 1 integer A =< i =< B (must be initialised)
    SIMDEM04
    GETSTR ... get a text string from the user (default supplied)
    GETTXT ... get a text string from the user (default = ?)
    SIMDEM05
    GETL01 ... get a logical variable
    SIMDEM41
    TRIM80 ... trim a long filename
    VEC1IN ... get a vector
    SIMDEM42
    MATTIN ... get a matrix
    SIMDEM43
    ATTRIB ... get file attributes
    GETNOU ... get an unopened Simdem unit
    SIMDEM51
    DLLCLR ... get signatures for w_clearwin.dll
    DLLGRA ... get signatures for w_graphics.dll
    DLLMEN ... get signatures for w_menus.dll
    SCCLIB ... get signatures for salflibc.dll
    SIMDEM52
    PALETT ... get a colour from the palette
    SIMDEM06
    LISTBX ... select from a simple list box
    SIMDEM18
    TITLE1 ... select from a title page and menu
    SIMDEM19
    ANSWER ... select from a question and answer window
    SIMDEM20
    TBOX01 ... select from a tabbing list box
    SIMDEM36
    BBOX01 ... select from normal buttons
    HBOX01 ... select from horizontal buttons
    VBOX01 ... select from vertical buttons
    SIMDEM37
    RBOX01 ... select from ganged radio/tick boxes
    SIMDEM58
    CHKBOX ... select from 1-dimensional scrolling check boxes
    RBOXES ... select from 2-dimensional scrolling check boxes
    SIMDEM59
    MFILES ... select one or multiple files
    TRIM60 ... trim a long filename
    SIMDEM60
    LSTBOX ... select from a comprehensive list box
    SIMDEM65
    AUX256 ... full path to a Simdem auxiliary file
    VUOPEN ... select a file to view/open/copy/paste
    SIMDEM44
    GETFIL ... select using the Windows file-selection control
    OFILES ... select using the Simfit file-selection control
    FSERCH ... search for a file
    INFOFL ... display the status of a file
    SIMDEM11
    EDITD1 ... editing a double precision array
    SIMDEM12
    EDITI1 ... editing an integer array
    SIMDEM13
    EDITTX ... editing a text array
    SIMDEM09
    GKS001 ... plot 1 function
    SIMDEM10
    GKS004 ... plot 4 functions
    SIMDEM21
    GKST04 ... plot 4 (x,y) transforms
    SIMDEM22
    SURD2S ... plot surfaces and contours
    SIMDEM23
    SPACE0 ... plot curves in space
    SIMDEM24
    GKSVF1 ... plot a vector field
    SIMDEM25
    GKSEB4 ... plot error bars
    SIMDEM46
    DELTMP ... delete temporary files
    SMPLOT ... plot n data sets
    SIMDEM47
    SIMDEM48
    BCPLOT ... plot a bar chart
    PCPLOT ... plot a pie chart
    SIMDEM49
    BWPLOT ... plot as boxes and whiskers
    SIMDEM50
    EBPLOT ... plot as bars/symbols plus error bars
    SIMDEM53
    LBPLOT ... plot a 2D scatter plus labels
    SIMDEM54
    CDPLOT ... plot sample cumulative plus best-fit cdf
    SIMDEM55
    PDPLOT ... plot sample histogram plus best-fit pdf
    SIMDEM56
    HIST01 ... plot a histogram with error bars
    SIMDEM57
    DGPLOT ... plot a dendrogram with threshold
    SIMDEM61
    HNPLOT ... plot half-normal and normal scores
    SIMDEM62
    ELIPS1 ... plot bivariate normal confidence ellipses
    NAGSUB ... NAG library substitute routines
    SIMDEM63
    MTPLOT ... plot rows and columns from a matrix
    SIMDEM64
    RTPLOT ... plot a parametric curve r = r(theta)
    SIMDEM69
    GKSVF3 ... plot a vector field with labels
    SIMDEM70
    CLOCK1 ... return the current clock time in seconds
    DBPLOT ... plot with LHS and RHS axes (a double plot)
    DEFKEY ... define/retrieve character configuration keys
    DEFLAB ... define/retrieve arrays of labels or character keys
    EDITPS ... edit PostScript files and make collages
    GKS012 ... plot up to 12 data sets
    GKSCB4 ... plot error bars (no advanced options)
    GKSHB4 ... plot horizontal error bars
    GKSLGL ... define/retrieve plot configuration parameters (simple)
    GKST12 ... plot up to 12 transformed data sets
    GRFLGL ... define/retrieve plot configuration parameters (advanced)
    GSTYLE ... define/retrieve plot configuration parameters (all)
    LABCFG ... define/retrieve plot labels, fill styles, colours
    MFPLOT ... replay a metafile to resume editing
    NSTEPS ... define/retrieve groups of data points to be omitted
    RESDEF ... restore Simfit plotting defaults
    SBPLOT ... plot a stacked bar chart
    SPACE6 ... plot 3D space curves
    SYMCFG ... define/retrieve plot symbols, lines, colours
    TSIZES ... define/retrieve font sizes
    TSPLOT ... plot time series data
    XFONTS ... plot the Simfit font substitution maps
    SIMDEM40
    CONFIG ... configure the Simfit DLLs
    SIMDEM45
    FPRINT ... print a text file
    SIMDEM66
    ISITMF ... check if a file is a Simfit matrix file
    MAT2IN ... read a data matrix from a file
    MATOUT ... write a data matrix to a file
    SIMDEM67
    MATTRN ... matrix editing and transforming
    SIMDEM68
    MAT3IN ... comprehensive control to read-in data matrices
    MAT4IN ... comprehensive control to use/edit data matrices
    CHOP80 ... truncates titles to first 80 characters

Back to Menu or Subroutines

# Subroutines: Descriptions in alphabetical order

    Help and definitions
    HELP_SIMDEM ... provide help
    IMAGES      ... display gallery of images
    PALETT      ... definition of colours
    GKS001      ... definition of line and symbol types
    GKSVF3      ... definition of arrows/lines/boxes
    PCPLOT      ... definition of fill styles
    NAGSUB      ... NAG library substitute routines
    Subroutines
    ANSWER ... select from a question and answer window
    ATTRIB ... get file attributes
    AUX256 ... full path to a Simdem auxiliary file
    BBOX01 ... select from normal buttons
    BCPLOT ... plot a bar chart
    BWPLOT ... plot as boxes and whiskers
    CDPLOT ... plot sample cumulative plus best-fit cdf
    CHKBOX ... select from 1-dimensional scrolling check boxes
    CHOP80 ... truncates titles to the first 80 characters
    CLOCK1 ... returns the current clock time in seconds
    CLOSER ... close a Simdem file
    CONFIG ... configure the Simfit DLLs
    DBPLOT ... plot with LHS and RHS axes (a double plot)
    DEFKEY ... define/retrieve character configuration keys
    DEFLAB ... define/retrieve arrays of labels or character keys
    DELEET ... delete a file
    DELTMP ... delete temporary files
    DGPLOT ... plot a dendrogram with threshold
    DLLCLR ... get signatures for w_clearwin.dll
    DLLGRA ... get signatures for w_graphics.dll
    DLLMEN ... get signatures for w_menus.dll
    DSPLAY ... display or file a matrix
    EBPLOT ... plot as bars/symbols plus error bars
    EDITD1 ... editing a double precision array
    EDITI1 ... editing an integer array
    EDITPS ... edit PostScript files and make collages
    EDITTX ... editing a text array
    ELIPS1 ... plot bivariate normal confidence ellipses
    FORM25 ... return a variable as CHARACTER (LEN = 25)
    FPRINT ... print a text file
    FSERCH ... search for a file
    GET00N ... get n arbitrary values
    GETD01 ... get 1 unrestricted value  (must be initialised)
    GETD02 ... get 2 unrestricted values (must be initialised)
    GETD03 ... get 3 unrestricted values (must be initialised)
    GETDGE ... get X where X >= A        (must be initialised)
    GETDLE ... get X where X =< A        (must be initialised)
    GETDG2 ... get X =< Y                (must be initialised)
    GETDG3 ... get X =< Y =< Z           (must be initialised)
    GETDM1 ... get x where A =< X =< B   (must be initialised)
    GETI01 ... get 1 integer i
    GETI0N ... get n integers
    GETIGT ... get 1 integer i > A
    GETILT ... get 1 integer i < B
    GETIM1 ... get 1 integer A =< i =< B
    GETJ01 ... get 1 integer i           (must be initialised)
    GETJGE ... get 1 integer i >= A      (must be initialised)
    GETJLE ... get 1 integer i =< A      (must be initialised)
    GETJM1 ... get 1 integer A =< i =< B (must be initialised)
    GETFIL ... select using the Windows file-selection control
    GETL01 ... get a logical variable
    GETL0N ... get n logicals
    GETNOU ... get an unopened Simdem unit
    GETR01 ... get 1 unrestricted value
    GETR02 ... get 2 unrestricted values
    GETR03 ... get 3 unrestricted values
    GETR0N ... get n double precison values
    GETRM1 ... get X where A =< x =< B
    GETS0N ... get n character strings
    GETSTR ... get a text string from the user (default supplied)
    GETTMP ... get a temporary file name
    GETTXT ... get a text string from the user (default = ?)
    GKS001 ... plot 1 function
    GKS004 ... plot 4 functions
    GKS012 ... plot up to 12 data sets
    GKSEB4 ... plot error bars
    GKSCB4 ... plot error bars (no advanced options)
    GKSHB4 ... plot horizontal error bars
    GKSLGL ... define/retrieve plot configuration parameters (simple)
    GKST04 ... plot 4 (x,y) transforms
    GKST12 ... plot up to 12 transformed data sets
    GKSVF1 ... plot a vector field
    GKSVF3 ... plot a vector field with labels
    GRFLGL ... define/retrieve plot configuration parameters (advanced)
    GSTYLE ... define/retrieve plot configuration parameters (all)
    HBOX01 ... select from horizontal buttons
    HIST01 ... plot a histogram with error bars
    HNPLOT ... plot half-normal and normal scores
    INFOFL ... display the status of a file
    ISFCON ... is a file connected
    ISITMF ... check if a file is a Simfit matrix file
    ISUCON ... is a unit connected
    LABCFG ... define/retrieve plot labels, fill styles, colours
    LBPLOT ... plot a 2D scatter plus labels
    LINEIN ... get a text string
    LISTBX ... select from a simple list box
    LIST01 ... scrolling table with reverse communication
    LIST02 ... scrolling table
    LSTBOX ... select from a comprehensive list box
    MAT2IN ... read a data matrix from a file
    MAT3IN ... comprehensive control to read-in data matrices
    MAT4IN ... comprehensive control to use/edit data matrices
    MATOUT ... write a matrix to file
    MATTIN ... get a matrix
    MATTRN ... matrix editing and transforming
    MFILES ... select one or multiple files
    MFPLOT ... replay a metafile to resume editing
    MTPLOT ... plot rows and columns from a matrix
    NAGSUB ... NAG library substitute routines
    NSTEPS ... define/retrieve groups of data points to be omitted
    OFILES ... select using the Simfit file-selection control
    OPENER ... open a Simdem file
    PATCH1 ... view text (comprehensive)
    PATCH2 ... view text (simplified)
    PALETT ... get a colour from the palette
    PCPLOT ... plot a pie chart
    PDPLOT ... plot sample histogram plus best-fit pdf
    PUTADV ... advice
    PUTCAU ... caution
    PUTFAT ... fatal
    PUTMES ... multi-line text display
    PUTWAR ... warning
    PUTTXT ... text
    RBOX01 ... select from ganged radio/tick boxes
    RBOXES ... select from 2-dimensional scrolling check boxes
    RESDEF ... restore Simfit plotting defaults
    REVPRO ... review progress
    RTPLOT ... plot a parametric curve r = r(theta)
    SBPLOT ... plot a stacked bar chart
    SCCLIB ... get signatures for salflibc.dll
    SLEEP1 ... impose a delay
    SMPLOT ... plot n data sets
    SPACE0 ... plot curves in space (simple)
    SPACE6 ... plot curves in space (advanced)
    SURD2S ... plot surfaces and contours
    SYMCFG ... define/retrieve plot symbols, lines, colours
    TABLE1 ... scrolling table with coloured lines
    TABLE2 ... display a coloured table
    TABLE4 ... display interactive calculations
    TBOX01 ... select from a tabbing list box
    TITLE1 ... select from a title page and menu
    TITLES ... display a title with menu
    TRIM60 ... trim a long filename
    TRIM80 ... trim a long filename
    TSIZES ... define/retrieve font sizes
    TSPLOT ... plot time series data
    TUTOR1 ... display a tutorial
    VBOX01 ... select from vertical buttons
    VEC1IN ... get a vector
    VIEWIT ... matrix as a numerical table
    VIEWER ... view a file
    VUOPEN ... select a file to view/open/copy/paste
    WAITER ... display Wait ... Calculations in progress
    WINDOW ... display a background window
    WRITER ... write to a Simdem file
    XFONTS ... plot the Simfit font substitution maps

Back to Menu or Subroutines

## Summary

    subroutines: HELP_SIMDEM, IMAGES
        program: SIMDEM01

The Simdem library contains a set of routines that users can call from anywhere in a Fortran program. Because of this restriction, most of the windows created by Simdem controls are in the form of dialogue windows that must be closed before program operation can continue. There are no nested windows or child windows and very few places where users can minimise down to the taskbar. This is intentional, and is to allow users the freedom to call routines in any sequence. There are no undo options to navigate backwards.

The routines are all in standard Fortran, and none of the arguments require any knowledge about the Windows API. All that is taken care of behind the scenes, which spares users the necessity of having to learn anything about the intricacies of traditional Windows programming.

It is important to stress that the library uses a very strict form for subroutine arguments; they are in order of integer, double precision, character, then logical, and within each type they are in alphabetical order. Also, the declarations start each sub-argument list on a new line for clarity.

The convention to be used is to give the subroutine or function with calling sequence followed by a brief description of the arguments and the associated intents. Simdem users should note that this document will only describe the routines that are actually demonstrated by program simdem.exe, and programs simdem01 to simdem70, and there are many more routines that users can call if they care to scan the Simdem source codes.

As introductory examples consider the Simdem help and image display subroutines.

          SUBROUTINE HELP_SIMDEM (REQUEST)
          CHARACTER (LEN = *), INTENT (IN) :: REQUEST

    REQUEST: Character string dictating which subsection of the help
             program to run. For instance REQUEST = 'simdem' gives access
             to the full help program, while other arguments display the
             corresponding sections, e.g. 'simdem01' to 'simdem70' show
             the source codes for program simdem01 through to simdem70.

          SUBROUTINE IMAGES (ISEND)
          INTEGER, INTENT (IN): ISEND

    ISEND: Dictates which of the nine or so pages of the gallery to display, while
           ISEND = 0 displays the whole gallery of plotting styles.

Back to Menu or Subroutines

## Display messages

    subroutines: PUTADV, PUTCAU, PUTFAT, PUTMES, PUTWAR, PUTTXT
        program: SIMDEM01

Note that the simple messaging routines PUTADV, PUTCAU, PUTFAT, and PUTWAR can on rare occasions cause problems if users try to construct multi-window displays, particularly involving graphics. In such circumstances it is advisable to manage without the distinctive colour schemes used for these messages, and simply call the Windows message box function by adding an X_ prefix, as in X_PUTADV, X_PUTCAU, X_PUTFAT, AND X_PUTWAR.

          SUBROUTINE PUTADV (MESSAGE)
          CHARACTER (LEN = *), INTENT (IN) :: MESSAGE

    MESSAGE: Character string giving general advice on a grey background.

          SUBROUTINE PUTCAU (MESSAGE)
          CHARACTER (LEN = *), INTENT (IN) :: MESSAGE

    MESSAGE: Character string giving cautionary advice on a blue background.

          SUBROUTINE PUTFAT (MESSAGE)
          CHARACTER (LEN = *), INTENT (IN) :: MESSAGE

    MESSAGE: Character string giving a fatal error message on a black background.

          SUBROUTINE PUTMES (N, &
                             TEXT)
          INTEGER,             INTENT (IN) :: N
          CHARACTER (LEN = *), INTENT (IN) :: TEXT(N)

       N: Number of lines of text.
    TEXT: Character array with message.
          Note that if N is greater than 1, the first line will be in bold text so,
          for longer messages, it is best to make the second line a blank line.

          SUBROUTINE PUTWAR (MESSAGE)
          CHARACTER (LEN = *), INTENT (IN) :: MESSAGE

    MESSAGE: Character string giving a non-fatal warning message on a red background.

          SUBROUTINE PUTTXT (MESSAGE)
          CHARACTER (LEN = *), INTENT (IN) :: MESSAGE

    MESSAGE: Character string displaying an arbitrary line of text.

Back to Menu or Subroutines

## Display Sequential calculations

    subroutines: LIST01, LIST02, SLEEP1
        program: SIMDEM07

It should be noted that the critical INPUT arguments for LINE are not case sensitive and there is another routine, LIST02, that does not involve reverse communication, and where LINE is an INPUT (IN) argument.

LIST01 should be used where the reverse communication is valuable, as in monitoring iterative procedures like fitting differential equations, otherwise LIST02 should be used.

          SUBROUTINE LIST01 (LINE)
          CHARACTER (LEN = *), INTENT (INOUT) :: LINE

    LINE: If LINE = 'OPEN' on entry then open a window for output.
          If LINE = 'CLOSE' on entry then close down the window.
          If LINE = 'STATUS' on entry LINE is returned as 'OPEN' or 'CLOSE'.
          If LINE = 'NOPEN' on entry LINE is returned as 0 if not connected
                    or 1 if connected for writing.
          Otherwise LINE is used as the next line in a scrolling table,
          unless the user stops the table before output is completed
          when LINE is returned as 'CLOSE'.

          SUBROUTINE SLEEP1 (DELAY)
          INTEGER, INTENT (IN) :: DELAY

    DELAY: Number of seconds to stop operation and free-up the CPU

Back to Menu or Subroutines

## Display a simple table

    subroutine: TABLE1
       program: SIMDEM08

It should be noted that the critical INPUT arguments 'OPEN' and 'CLOSE' are not case sensitive.

          SUBROUTINE TABLE1 (ICOLOR, &
                             LINE)
          INTEGER,             INTENT (IN) :: ICOLOR
          CHARACTER (LEN = *), INTENT (IN) :: LINE

    ICOLOR: When called the first time ICOLOR sets the background colour.
            When called subsequently ICOLOR sets the colour of the line.
            ICOLOR = 15 ... white
            ICOLOR = 0  ... black
            ICOLOR = 1  ... blue
            ICOLOR = 4  ... red
      LINE: if LINE = 'OPEN' on entry then open a window for output.
            if LINE = 'CLOSE' on entry then close down the window.
            Otherwise LINE is used as the next line in a scrolling table.

Back to Menu or Subroutines

## Display data values

    subroutine: VIEWIT
       program: SIMDEM14

          SUBROUTINE VIEWIT (NCOLS, NRMAX, NROWS, NTYPE, &
                             A, &
                             TITLE)
          INTEGER,             INTENT (IN) :: NCOLS, NRMAX, NROWS, NTYPE
          DOUBLE PRECISION,    INTENT (IN) :: A(NRMAX,NCOLS)
          CHARACTER (LEN = *), INTENT (IN) :: TITLE

    NCOLS: Number of columns.
    NRMAX: Leading dimension of array.
    NROWS: Number of rows.
    NTYPE: NTYPE = 1 ... I format (integers, using NINT)
           NTYPE = 2 ... F format (floats)
           NTYPE = 3 ... E format (large/small)
        A: Data matrix (no missing values)
    TITLE: Title.

Back to Menu or Subroutines

## Display progress of calculations

    subroutines: REVPRO, GETTMP, DELEET, OPENER, CLOSER, WRITER
        program: SIMDEM15

OPENER, CLOSER, and WRITER avoid cross-compiler issues by ensuring that the file and unit are defined within w_menus.dll even if the executable has not been compiled by the compiler used to compile w_menus.dll. Users of the NAG NAGfor compiler and Silverfrost FTN95 do not need these routines.

          SUBROUTINE REVPRO (NOUT)
          INTEGER, INTENT (IN) :: NOUT

    NOUT: Unit connected for writing, appending, rewinding, etc. to
          review data written to NOUT, e.g. to record data analyis,
          curve fitting, etc.
          NOUT must be opened before the first call to REVPRO and
          closed after the last call to REVPRO.
          OPENER and CLOSER must be used if necessary (see below).

          SUBROUTINE GETTMP (IFAIL, &
                             FNAME)
          INTEGER,            INTENT (OUT) :: IFAIL
          CHARACTER (LEN = *) INTENT (OUT) :: FNAME

    IFAIL: Returned as follows:  0 if successful
                                -1 LEN(FNAME) < 12
                                -2 could not locate %TEMP% folder
                                -3 LEN(FNAME) too short to create temporary
                                   filename in %TEMP% folder
                                -4 failed to find an unused filename after
                                   1000 attempts with random filenames
    FNAME: If LEN(FNAME) < 12 returned undefined with an error message
           If LEN(FNAME) < LEN(%TEMP%) + 13 returned with f$123456.tmp as
                                            a local file name
           If LEN(FNAME) >= LEN(%TEMP%) + 13 returned with f$123456.tmp as
                                             a file name in the %TEMP% folder
           FNAME is the name of a file that does not exist, but the file
           is not opened.
           It is recommended to have LEN(FNAME) >= 260, say 1024.

          SUBROUTINE DELEET (FNAME, &
                             ASKIF, THERE)
          CHARACTER (LEN = *), INTENT (IN)  :: FNAME
          LOGICAL,             INTENT (IN)  :: ASKIF
          LOGICAL,             INTENT (OUT) :: THERE

    FNAME: Arbitrary file name.
    ASKIF: if .TRUE. inquire if the file should be deleted.
           if .FALSE. delete without prompting.
    THERE: returned as .TRUE. if the file still exists, otherwise as .FALSE.

          SUBROUTINE OPENER (IOS, NOUT, &
                             FNAME)
          INTEGER,             INTENT (OUT) :: IOS
          INTEGER,             INTENT (IN)  :: NOUT
          CHARACTER (LEN = *), INTENT (IN)  :: FNAME

      IOS: IOSTAT value from file openening in w_menus.dll.
     NOUT: Unit for connecting in w_menus.dll.
    FNAME: Arbitrary file name.

          SUBROUTINE CLOSER (NOUT)
          INTEGER, INTENT (IN) :: NOUT

     NOUT: Unit for closing in w_menus.dll.

          SUBROUTINE WRITER (IOS, NLINES, NOUT, &
                             LINES)
          INTEGER,             INTENT (OUT) :: IOS
          INTEGER,             INTENT (IN)  :: NLINES, NOUT
          CHARACTER (LEN = *), INTENT (IN)  :: LINES(NLINES)

       IOS: IOSTAT value from writing to NOUT.
    NLINES: Number of lines to be written to NOUT.
      NOUT: Unit for writing opened by OPENER.
     LINES: Text array for writing.

Back to Menu or Subroutines

## Display ASCII text files

    subroutine: VIEWER
       program: SIMDEM16

          SUBROUTINE VIEWER (ISEND &
                             FNAME, PATH, PATTERN)
          INTEGER,             INTENT (IN) :: ISEND
          CHARACTER (LEN = *), INTENT (IN) :: FNAME, PATH, PATTERN

      ISEND: as follows:
             ISEND = 1: view just the named file (if located) then return.
             ISEND = 2: view wild card pattern repeatedly until user quits.
             Otherwise return with no action.
      FNAME: as follows:
             ISEND = 1: FNAME must be the full path/file-name.
             ISEND = 2: not referenced.
             FNAME would usually be the name of a text file but, if Simdem
             is configured correctly, it could be a .pdf, .eps, or .ps file.
       PATH: as follows:
             ISEND = 1: not referenced.
             ISEND = 2: path to be searched.
    PATTERN: as follows:
             ISEND = 1: not referenced.
             ISEND = 2: wild card pattern for search, e.g. "*.txt".

Back to Menu or Subroutines

## Display text pages

    subroutines: PATCH1, PATCH2
        program: SIMDEM17

Note that PATCH2 is a cut-down version of PATCH1 with default arguments.

          SUBROUTINE PATCH1 (ICOLOR, IX, IY, LSHADE, NUMBLD, NUMTXT, &
                             TEXT, &
                             FIXED)
          INTEGER,             INTENT (IN) :: NUMTXT
          INTEGER,             INTENT (IN) :: ICOLOR, IX, IY, LSHADE, NUMBLD(NUMTXT)
          CHARACTER (LEN = *), INTENT (IN) :: TEXT(NUMTXT)
          LOGICAL,             INTENT (IN) :: FIXED

    ICOLOR: Background colour.
            ICOLOR = 1: blue
            ICOLOR = 4: red
            ICOLOR = 9: white
            Otherwise grey
    IX, IY: Position down from top left hand in average characters.
            May be disabled in some versions and is always disabled
            when IX or IY is less than or equal to zero.
    LSHADE: May be disabled in some versions.
            LSHADE = 0: no shading
            LSHADE = 1: shading
    NUMBLD: Determines the font type and colour.
            NUMBLD(i) = 1 or 2: Normal
            NUMBLD(i) = 3 or 4: Italic
            NUMBLD(i) = 4 or 5: Bold
            NUMBLD(i) = 6 or 7: Bold Italic
            Odd numbers : normal
            Even numbers: highlighted
    NUMTXT: Dimension.
      TEXT: Text array.
            Note that a grave accent can be used for tabbing.
     FIXED: FIXED = .TRUE.  Courier New
            FIXED = .FALSE. Arial or Tahoma

          SUBROUTINE PATCH2 (NUMBLD, NUMTXT, &
                             TEXT)
          INTEGER,             INTENT (IN) :: NUMTXT
          INTEGER,             INTENT (IN) :: NUMBLD(NUMTXT)
          CHARACTER (LEN = *), INTENT (IN) :: TEXT(NUMTXT)

    NUMBLD: Determines the font type and colour.
            NUMBLD(i) = 1 or 2: Normal
            NUMBLD(i) = 3 or 4: Italic
            NUMBLD(i) = 4 or 5: Bold
            NUMBLD(i) = 6 or 7: Bold Italic
            Odd numbers : normal
            Even numbers: highlighted
    NUMTXT: Dimension.
      TEXT: Text array.
            Note that a grave accent can be used for tabbing.

Back to Menu or Subroutines

## Display or file a matrix

    subroutine: DSPLAY
       program: SIMDEM26

This subroutine is intended to be used as part of a data analysis package where it may be required to write the matrix A to a pre-connected unit. If the matrix A is very large a starting row/column is requested. If FILEIT = .TRUE. then the matrix will be written to a pre-connected UNIT = NOUT, but only if it is not too large, as determined by internal parameters NCTOP and NRTOP.

          SUBROUTINE DSPLAY (NCMAX, NCOL, NOUT, NRMAX, NROW, NTYPE, &
                             A, &
                             TITLE, &
                             FILEIT)
          INTEGER,             INTENT (IN) :: NCMAX, NCOL, NF, NRMAX, NROW, &
                                              NTYPE
          DOUBLE PRECISION,    INTENT (IN) :: A(NRMAX,NCMAX)
          CHARACTER (LEN = *), INTENT (IN) :: TITLE
          LOGICAL,             INTENT (IN) :: FILEIT

     NCMAX: Maximum column dimension.
      NCOL: Column dimension.
      NOUT: If FILEIT = .FALSE. NOUT is not referenced.
            If FILEIT = .TRUE. NOUT must be a pre-connected unit.
     NRMAX: Leading dimension of matrix A.
      NROW: Row dimension.
     NTYPE: Data type.
            NTYPE = 1: Integers               ... I format
            NTYPE = 2: Real of order unity    ... F format
            NTYPE = 3: Floating point numbers ... E format
         A: Data matrix.
     TITLE: Title.
    FILEIT: If FILEIT = .TRUE. A will be written to unit NOUT.
            If FILEIT = .FALSE. NOUT will not be referenced.

Back to Menu or Subroutines

## Display a coloured table

    subroutine: TABLE2
       program: SIMDEM27

The only difference between this and TABLE1 is that the colour of any individual letters can be set using the array ICOLOR. This makes TABLE2 slower and more complicated to use, but it can be very useful to set the colour of individual letters.

          SUBROUTINE TABLE2 (ICOLOR, &
                             LINE)
          INTEGER,             INTENT (IN) :: ICOLOR(*)
          CHARACTER (LEN = *), INTENT (IN) :: LINE

    ICOLOR: VGA type colour for individual characters in LINE.
            ICOLOR(i) =  0 black
            ICOLOR(i) =  1 blue
            ICOLOR(i) =  4 red
            ICOLOR(i) = 14 yellow
            ICOLOR(i) = 15 white
      LINE: Case insensitive string as follows
            LINE = 'OPEN' then open a window
                   ICOLOR(1) sets the background colour
            LINE = 'CLOSE' close the window
            Otherwise LINE is displayed in the window.

Back to Menu or Subroutines

## Display a background window

    subroutine: WINDOW
       program: SIMDEM28

This routine creates a background window over which other Simdem controls can be displayed. Some versions allow several windows to be opened but this is not recommended and may be disabled.

          SUBROUTINE WINDOW (ISEND, &
                             TITLE, &
                             ACTION)
          INTEGER,             INTENT (IN) :: ISEND
          CHARACTER (LEN = *), INTENT (IN) :: TITLE
          LOGICAL,             INTENT (IN) :: ACTION

     ISEND: Window number (must be set to 1 in this version).
     TITLE: Title of window.
    ACTION: Controls operation required.
            ACTION = .TRUE. open a window
            ACTION = .FALSE. close the window

There are two further issues concerning this routine.

1. Inside the Simfit package TITLE has a special meaning.
   If TITLE = 'Simfit program'//PNAME then details are written to f$simfit.tmp indicating the special actions required for program PNAME.
2. Background windows can be switched off using the speedup options.
   So, if suppress background windows is selected on w_simfit.cfg, this subroutine will be disabled.

Back to Menu or Subroutines

## Display a title page and tutorial

    subroutines: TITLES, TUTOR1
        program: SIMDEM30

TITLES is similar to PATCH1 for colours and fonts.

          SUBROUTINE TITLES (ICOLOR, NUMBLD, NUMDEC, NUMHDR, NUMOPT, &
                             NUMPOS, &
                             HEADER, OPTION)
          INTEGER,             INTENT (IN)    :: ICOLOR, NUMHDR, NUMOPT
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMHDR), &
                                                 NUMPOS(NUMOPT)
          INTEGER,             INTENT (INOUT) :: NUMDEC
          CHARACTER (LEN = *), INTENT (IN)    :: HEADER(NUMHDR), &
                                                 OPTION(NUMOPT)

    ICOLOR: Colour.
    NUMBLD: Font type.
    NUMDEC: Default menu choice on entry then returns the choice.
    NUMHDR: Dimension of header.
    NUMOPT: Number of options.
    NUMPOS: Hot key positions for menu.
    HEADER: Text before menu.
    OPTION: The menu.

TUTOR1 is similar to PATCH1, TUTORS and TITLES for colours and fonts, except that NEXT and UPDOWN control the allowed movement forwards and backwards through the tutorial pages.
Note about parameters NEXT and UPDOWN.
Actually only one logical control variable is needed but both are kept to remain consistent with subroutine TUTORS and to allow for future developments. The scheme in this version is as follows
If both UPOWN and NEXT are .TRUE. the stores are filled up.
If either are .FALSE. the stores are displayed.

          SUBROUTINE TUTOR1 (ICOLOR, NUMBLD, NUMHDR, &
                             HEADER, FRAME, &
                             NEXT, UPDOWN)
          INTEGER,             INTENT (IN) :: ICOLOR, NUMHDR
          INTEGER,             INTENT (IN) :: NUMBLD(NUMHDR)
          CHARACTER (LEN = *), INTENT (IN) :: HEADER(NUMHDR)
          LOGICAL,             INTENT (IN) :: FRAME, NEXT, UPDOWN

    ICOLOR: Colour.
    NUMBLD: Font type.
    NUMHDR: Header dimensions.
    HEADER: Header.
     FRAME: If .TRUE., uses Courier New, otherwise Sans Serif.
      NEXT: If .TRUE. move to next item (see below)
    UPDOWN: If .TRUE. allow up/down scrolling (see below)
            The effect of NEXT and UPDOWN depends on the version. Usually
            NEXT = UPDOWN = .TRUE. causes the buffer to fill and either
            of them .FALSE. causes display. It is probably best to keep
            UPDOWN fixed and control the tutorial using NEXT.

Back to Menu or Subroutines

## Display interactive calculations

    subroutine: TABLE4
       program: SIMDEM38

TABLE4 opens a window to display the results of calculations using Simfit scalar functions for input together with user-defined code, as demonstrated in simdem38.
The idea is to specify a function that can be used interactively and the results of the calculation can be displayed in real time.
The variables N and X can be simple values for editing or they can be limits required for the editing process, depending on the active subroutine being called.

          SUBROUTINE TABLE4 (ICOLOR, N, &
                             X, &
                             STRNG_OLD)
          INTEGER,             INTENT (IN)    :: ICOLOR
          INTEGER,             INTENT (INOUT) :: N(*)
          DOUBLE PRECISION,    INTENT (INOUT) :: X(*)
          CHARACTER (LEN = *), INTENT (IN)    :: STRNG

    ICOLOR: Colour (not used in this version).
         N: Defaults then results ... integers.
         X: Defaults then results ... double precisions.
     STRNG: Message/control string.

    Use N and X for input/output functions as follows:
    GETI01: N(1) = IMID                                     ! get one arbitrary integer
    GETIL1: N(1) = IBOT, N(2) = IMID, N(3) = ITOP           ! get one limited integer
    GETIM1: N(1) = IBOT, N(2) = IMID, N(3) = ITOP           ! get one integer in a range
    GETRG3: X(1) = X, X(2) = Y, X(3) = Z, Z >= Y >= X ! get three values x =< y =< z
    GETRL1: X(1) = XBOT, X(2) = XMID, X(3) = XTOP           ! get one limited value
    GETRM1: X(1) = XBOT, X(2) = XMID, X(3) = XTOP           ! get one value in a range
    GETR01: X(1) = X                                        ! get one arbitrary value

    Open/Close using
       STRNG = 'OPEN': start table, N and X are not referenced
       STRNG = 'CLOSE: close table, N and X are not referenced
       STRNG = 'CLOSE (NO PROMPT)': close table with no prompt
       STRNG = '****': output STRING

    Defining the function
       This version must be called twice in succession to use
       one of the input/output functions. The first time READY
       is set .TRUE. and the function is identified. The second
       time the function is called.
       1) STRNG = SRNAME
       2) STRNG = argument to primitive

    SRNAME = name of an allowed subroutine sets up that subroutine call
             so the next line is the declaration for the call when N and X
             are then used by the subroutine called.

Back to Menu or Subroutines

## Display Wait ... Calculations in progress

    subroutine: WAITER
       program: SIMDEM39

Inform users when a slow process is taking place.

          SUBROUTINE WAITER (SHOW)
          LOGICAL, INTENT (IN) :: SHOW

    SHOW: SHOW = .TRUE. then display the waiting message.
          SHOW = .FALSE. then switch the message off.

Back to Menu or Subroutines

## Get a text string

    subroutine: LINEIN
       program: SIMDEM29

Show a window with explanatory text and an edit box to receive then edit a text string.

          SUBROUTINE LINEIN (ICOLOR, IX, IY, NCHAR, NUMBLD, NUMTXT, &
                             LINE, TEXT, &
                             FIXED)
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, NCHAR, &
                                                 NUMTXT
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMTXT)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NUMTXT)
          CHARACTER (LEN = *), INTENT (INOUT) :: LINE
          LOGICAL,             INTENT (IN)    :: FIXED

    ICOLOR: Value     Background   Text     Highlight-text
            9 or 15   white        black    red
            otherwise grey         black    blue
    IX, IY: Window position from top left
            This may be disabled and will be if IX and IY =< 0
     NCHAR: Width (in characters) of the edit box to hold LINE
    NUMBLD: Value     Font
            0, 1      standard
            2, 3      italic
            4, 5      bold
            6, 7      bold italic
    NUMTXT: Number of text lines
      LINE: String to be supplied then edited
      TEXT: Header text
     FIXED: If .TRUE.  use Courier New
            If .FALSE. use sans serif

Back to Menu or Subroutines

## Get n integers

    subroutine: GETI0N
       program: SIMDEM31

Show a list of supplied integers to be edited, each with a corresponding line of text.

          SUBROUTINE GETI0N (N, NVALUE, &
                             TEXT)
          INTEGER,             INTENT (IN)    :: N
          INTEGER,             INTENT (INOUT) :: NVALUE(N)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(N)

         N: Number of integers required
    NVALUE: The N integers
      TEXT: One line adjacent to each integer edit box

Back to Menu or Subroutines

## Get n double precision values

    subroutine: GETR0N
       program: SIMDEM32

Show a list of supplied values to be edited, each with a corresponding line of text.

          SUBROUTINE GETR0N (N, &
                             XVALUE, &
                             TEXT)
          INTEGER,             INTENT (IN)    :: N
          DOUBLE PRECISION,    INTENT (INOUT) :: XVALUE(N)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(N)

         N: Number of values required
    XVALUE: The N values
      TEXT: One line adjacent to each double precision edit box

    The values of X supplied are displayed using the following function FORM25.

          CHARACTER (LEN = 25) FUNCTION FORM25(X)
          DOUBLE PRECISION, INTENT (IN) :: X

          This returns the character representation of X using 15 significant digits
          in an appropriate I, F, or E left justified format with no trailing zeros.
          There are also functions FORM20(X) and FORM15(X) for 20 and 15 character
          representations, and function FORM12(I) for 12 character integer display.

Back to Menu or Subroutines

## Get n character strings

    subroutine: GETS0N
       program: SIMDEM33

Show a list of supplied strings to be edited, each with a corresponding line of text.

          SUBROUTINE GETS0N (N, &
                             SVALUE, TEXT)
          INTEGER,             INTENT (IN)    :: N
          CHARACTER (LEN = *), INTENT (INOUT) :: SVALUE(N)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(N)

         N: Number of character strings required
    SVALUE: The N character strings
      TEXT: One line adjacent to each character edit box

Back to Menu or Subroutines

## Get n logicals

    subroutine: GETL0N
       program: SIMDEM34

Show a list of check boxes to be ticked/un-ticked, each with a corresponding line of text.

          SUBROUTINE GETL0N (N, &
                             TEXT, &
                             LVALUE)
          INTEGER,             INTENT (IN)    :: N
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(N)
          LOGICAL,             INTENT (INOUT) :: LVALUE(N)

         N: Number of logical variables required
    LVALUE: The N logical variables
      TEXT: One line adjacent to each tick box

Back to Menu or Subroutines

## Get n arbitrary values

    subroutine: GET00N
       program: SIMDEM35

Display a control with a list of integers, doubles, character, or logicals for editing, each with a corresponding line of text. Users must supply arrays of dimension NUMOPT for integers, double precisions, and character strings, but the value of NUMPOS(i) dictates the type of variable to be edited. Integer KVALUE returns 0 (.FALSE.) or 1 (.TRUE.) for logical variables.

          SUBROUTINE GET00N (ICOLOR, IX, IY, KVALUE, LSHADE, NUMBLD, &
                             NUMOPT, NUMPOS, NSTART, NUMTXT, &
                             XVALUE, &
                             SVALUE, TEXT, &
                             FIXED, FULL, HIGH)
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, LSHADE, &
                                                 NUMOPT, NSTART, NUMTXT
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMTXT), &
                                                 NUMPOS(NUMOPT)
          INTEGER,             INTENT (INOUT) :: KVALUE(NUMOPT)
          DOUBLE PRECISION,    INTENT (INOUT) :: XVALUE(NUMOPT)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NUMTXT)
          CHARACTER (LEN = *), INTENT (INOUT) :: SVALUE(NUMOPT)
          LOGICAL,             INTENT (IN)    :: FIXED, FULL, HIGH

    ICOLOR: Not used in this version
        IX: X coordinate of top left hand corner
        IY: Y coordinate of top left hand corner
    KVALUE: Integer values returned by this routine
            Also logical values 0 = .FALSE., 1 = .TRUE.
            from check box item
    LSHADE: Not used in this version
    NUMBLD: Font scheme line by line
            Value  font (sans serif or Courier New if FIXED = .TRUE.)
            0, 1   standard
            2, 3   italic
            4, 5   bold
            6, 7   bold Italic
    NUMOPT: Number of options available
    NUMPOS: Type of edit box which can be of these types
            NUMPOS(i) = 1: integers
            NUMPOS(i) = 2: doubles
            NUMPOS(i) = 3: characters
            NUMPOS(i) = 4: logicals
    NUMSTA: Number of the line of text where menu items start
    NUMTXT: Number of lines of text NUMTXT >= NUMOPT
    XVALUE: Double precision values returned by this routine
    SVALUE: Character strings returned by this routine
      TEXT: Text array (text plus menus)
     FIXED: Mono spaced font if .TRUE.
      FULL: Not used in this version
      HIGH: Not used in this version

Back to Menu or Subroutines

## Get double precision values

    subroutines: GETR01, GETR02, GETR03, GETRM1,
                 GETD01, GETD02, GETD03, GETDGE, GETDLE,
                 GETDG2, GETDG3, GETDM1
       program: SIMDEM02

These routines divide into one of two types. The GETR?? routines do not require initialised values, but the GETD?? routines must be supplied with initialised values. Values supplied for initialisation are stored to full double precision, but only the signficant digits are displayed in the edit boxes.

    SUBROUTINE GETR01 (X, text)       ... get 1 unrestricted value
    SUBROUTINE GETR02 (X, Y, text)    ... get 2 unrestricted values
    SUBROUTINE GETR03 (X, Y, Z, text) ... get 3 unrestricted values
    SUBROUTINE GETRM1 (A, X, B, text) ... get X where A =< x =< B
    SUBROUTINE GETD01 (X, text)       ... get 1 unrestricted value  (must be initialised)
    SUBROUTINE GETD02 (X, Y, text)    ... get 2 unrestricted values (must be initialised)
    SUBROUTINE GETD03 (X, Y, Z, text  ... get 3 unrestricted values (must be initialised)
    SUBROUTINE GETDGE (X, A, text)    ... get X where X >= A        (must be initialised)
    SUBROUTINE GETDLE (X, B, text)    ... get X where X =< B        (must be initialised)
    SUBROUTINE GETDG2 (X, Y, text)    ... get X =< Y                (must be initialised)
    SUBROUTINE GETDG3 (X, Y, Z, text) ... get X =< Y =< Z           (must be initialised)
    SUBROUTINE GETDM1 (A, X, B, text) ... get x where A =< X =< B   (must be initialised)

    DOUBLE PRECISION,    INTENT (IN)    :: A, B
    DOUBLE PRECISION,    INTENT (INOUT) :: X, Y, Z
    CHARACTER (LEN = *), INTENT (IN)    :: TEXT

Back to Menu or Subroutines

## Get an integer

    subroutines: GETI01, GETIGT, GETILT, GETIM1,
                 GETJ01, GETJGT, GETJLT, GETJM1
        program: SIMDEM03

These routines divide into one of two types. The GETI?? routines do not require initialised values, but the GETJ?? routines must be supplied with initialised values.

    SUBROUTINE GETI01 (I, LINE)       ... get 1 integer i
    SUBROUTINE GETIGT (I, A, LINE)    ... get 1 integer i > A
    SUBROUTINE GETILT (I, B, LINE)    ... get 1 integer i < A
    SUBROUTINE GETIM1 (A, I, B, LINE) ... get 1 integer A =< i =< B
    SUBROUTINE GETJ01 (I, LINE)       ... get 1 integer i           (must be initialised)
    SUBROUTINE GETJGE (I, A, LINE)    ... get 1 integer i >= A      (must be initialised)
    SUBROUTINE GETJLE (I, B, LINE)    ... get 1 integer i =< B      (must be initialised)
    SUBROUTINE GETJM1 (A, I, B, LINE) ... get 1 integer A =< i =< B (must be initialised)

    INTEGER,             INTENT (IN)    :: A, B
    INTEGER,             INTENT (INOUT) :: I
    CHARACTER (LEN = *), INTENT (IN)    :: LINE

Back to Menu or Subroutines

## Get text strings

    subroutines: GETSTR, GETTXT
        program: SIMDEM04

The only difference between subroutines GETSTR and GETTXT is that GETSTR must be called with a valid RESPONSE character string, while GETTXT displays a question mark for a default RESPONSE.

    SUBROUTINE GETSTR (QUERY, RESPONSE) ... get a text string from the user (default supplied)
    SUBROUTINE GETTXT (QUERY, RESPONSE) ... get a text string from the user (default = ?)

    CHARACTER (LEN = *), INTENT (IN)    :: QUERY
    CHARACTER (LEN = *), INTENT (INOUT) :: RESPONSE

Back to Menu or Subroutines

## Get a logical variable

    subroutine: GETL01
       program: SIMDEM05

          SUBROUTINE GETL01 (QUERY, &
                             YESNO)
          CHARACTER (LEN = *), INTENT (IN)    :: QUERY
          LOGICAL,             INTENT (INOUT) :: YESNO

    QUERY: Text string in the form of a question
    YESNO: On input this determines the default response.
           On exit this contains the user response.

Back to Menu or Subroutines

## Get a vector from the user

    subroutines: VEC1IN, TRIM80
        program: SIMDEM41

          SUBROUTINE VEC1IN (ISEND, NIN, NMAX, NPTS, &
                             X, &
                             FNAME, TITLE, &
                             ABORT, FIXNPT, LABEL)
          INTEGER,             INTENT (IN)    :: NIN, NMAX
          INTEGER,             INTENT (INOUT) :: ISEND, NPTS
          DOUBLE PRECISION,    INTENT (OUT)   :: X(NMAX)
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAME, TITLE
          LOGICAL,             INTENT (IN)    :: FIXNPT, LABEL
          LOGICAL,             INTENT (OUT)   :: ABORT

     ISEND: (input/output) as follows
             ISEND = 1: user inputs TITLE etc. and ISEND is unchanged
             ISEND = 2: TITLE etc. from file and ISEND is unchanged
             OTHERWISE: user chooses mode and ISEND is returned as 1 or 2
       NIN: (input/unchanged) unconnected unit for data input
             Note: if an existing file is successfully opened, then NIN is
             returned connected for further reading. Otherwise NIN is
             closed on exit
      NMAX: (input/unchanged) maximum dimension
      NPTS: (input/output) size of X as follows
             FIXNPT = .TRUE. then NPTS is unchanged
             FIXNPT = .FALSE. then NPTS is arbitrary
     FNAME: (output) as follows
             ISEND = 1: file supplied by user (unchanged)
             OTHERWISE: temporary file name like vector_k.tmp
     TITLE: (output) as follows
             ISEND = 1: read off file
             OTHERWISE: returned depending on LABEL
     ABORT: (output) error indicator
    FIXNPT: (input/unchanged)
             FIXNPT = .TRUE. return exactly NPTS data points
             FIXNPT = .FALSE. then return arbitrary NPTS data points
     LABEL: (input/unchanged) as follows if data are to be typed in
             LABEL = .TRUE. then the user supplies a title
             LABEL = .FALSE. a temporary title is supplied

          SUBROUTINE TRIM80 (LINE)
          CHARACTER (LEN = *), INTENT (INOUT) :: LINE

    LINE: This is typically a long filename that is trimmed so that the
          right-most 80 characters are the last characters of the filename,
          in order to avoid overflow when writing character strings to output
          devices and files. There are also routines TRIM40, TRIM60, and TRIM100.

Back to Menu or Subroutines

## Get a matrix from the user

    subroutine: MATTIN
       program: SIMDEM42

          SUBROUTINE MATTIN (ISEND, NCMAX, NCOL, NIN, NRMAX, NROW, &
                             A, B, &
                             FNAME, TITLE, &
                             ABORT, FIXCOL, FIXROW, LABEL)
          INTEGER,             INTENT (IN)    :: ISEND, NCMAX, NIN, NRMAX
          INTEGER,             INTENT (INOUT) :: NCOL, NROW
          DOUBLE PRECISION,    INTENT (OUT)   :: A(NRMAX,NCMAX), B(*)
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAME, TITLE
          LOGICAL,             INTENT (IN)    :: FIXCOL, FIXROW, LABEL
          LOGICAL,             INTENT (OUT)   :: ABORT

     ISEND: (input/unchanged) as follows
             ISEND = 1: User inputs TITLE etc.
             ISEND = 2: TITLE etc. from file prepared by MAKMAT
             OTHERWISE : User chooses input mode
     NCMAX: (input/unchanged) maximum column dimension
      NCOL: (input/output) actual column dimension depending on FIXCOL
       NIN: (input/unchanged) unconnected unit number for file opening
             If a file is selected NIN is returned connected in case
             it is necessary to read the trailer o/w it is closed
     NRMAX: (input/unchanged) leading dimension
      NROW: (input/output) actual row dimension depending on FIXROW
         A: (output)
         B: workspace (not used in this version)
     FNAME: (input/output) as follows
             ISEND = 1: unchanged
             ISEND = 2: returned as temporary file name
     TITLE: (input/output) depending on ISEND and LABEL as follows
             ISEND = 1: data title from file
             Otherwise, LABEL = .TRUE. user chooses
                        LABEL = .FALSE. default
     ABORT: (output) error indicator
    FIXCOL: (input/unchanged) if .TRUE. column size fixed as NCOL
    FIXROW: (input/unchanged) if .TRUE. row size fixed as NROW
     LABEL: (input/unchanged) if .TRUE. user inputs title

Back to Menu or Subroutines

## Get a matrix from the clipboard

    subroutines: ATTRIB, GETNOU, ISFCON, ISUCON, MATTIN
        program: SIMDEM43

Simdem43 demonstrates how to use subroutine MATTIN to get a matrix from the clipboard. It also uses subroutines ATTRIB and GETNOU.

          SUBROUTINE ATTRIB (FNAME, &
                             EXIST, READ_ONLY)
          CHARACTER (LEN = *), INTENT (IN)  :: FNAME
          LOGICAL,             INTENT (OUT) :: EXIST, READ_ONLY

        FNAME: A filename
        EXIST: .TRUE. if the file exists
    READ_ONLY: .TRUE. if the file has the read-only attribute

          SUBROUTINE GETNOU (NOUT)
          INTEGER, INTENT (OUT) :: NOUT

    NOUT: This is the first unit counting upwards from 12 that is
          not opened in the Simdem GUI. The unit is not then connected
          by subroutine GETNOU.
    It is provided for cross-compiler use.

          LOGICAL FUNCTION ISFCON (FNAME)
          CHARACTER (LEN = *), INTENT (IN) :: FNAME

    Returns .TRUE. only if FNAME exists and is connected
    It is provided for cross-compiler use.

          LOGICAL FUNCTION ISUCON (NUNIT)
          INTEGER, INTENT (IN) :: NUNIT

    Returns .TRUE. only if NUNIT is connected
    It is provided for cross-compiler use.

Back to Menu or Subroutines

## Get DLL signatures

    subroutines: SCCLIB, DLLCLR, DLLGRA, DLLMEN
        program: SIMDEM51

These routines can be called to make sure that the DLLs linked into Simdem are consistent, i.e. with the same version and release number. Simdem will use local DLLs if there are any, then it will search the path, so these routines are most useful when there is ambiguity about the DLLs, e.g. more than one copy on the path, or some local but others on the path.

          SUBROUTINE SCCLIB (NSALF)
          INTEGER, INTENT (OUT) :: NSALF

          SUBROUTINE DLLCLR (XVER, YVER, &
                             DVER)
          SUBROUTINE DLLGRA (XVER, YVER, &
                             DVER)
          SUBROUTINE DLLMEN (XVER, YVER, &
                             DVER)
          DOUBLE PRECISION,     INTENT (OUT) :: XVER, YVER
          CHARACTER (LEN = 30), INTENT (OUT) :: DVER

    NSALF: Sequence number for salflibc.dll    (32-bit version), or
          -Sequence number for clearwin64.dll  (64-bit version)
     XVER: Version number
     YVER: Release number
     DVER: Description

Back to Menu or Subroutines

## Get a colour from the palette

    subroutine: PALETT
       program: SIMDEM52

Subroutine PALETT allows users to select colours for graphical objects from an array of colours currently defined in w_ps.cfg, but also to edit user-defined colours.

          SUBROUTINE PALETT (ICOLOR, MODE)
          INTEGER, INTENT (INOUT) :: ICOLOR
          INTEGER, INTENT (IN)    :: MODE

    ICOLOR: Current colour on input, selected colour on exit.
            Must be in range 0 to 71 for 72-colour version.
            The following 16 standard colours are always defined.
            0  Black
            1  Blue
            2  Green
            3  Cyan
            4  Red
            5  Magenta
            6  Brown
            7  White
            8  Dark Gray
            9  Light Blue
            10 Light Green
            11 Light Cyan
            12 Light Red
            13 Light Magenta
            14 Yellow
            15 Intense White
      MODE: Must be set to 0 to display the palette.
            Other values depend on the version and
            are not allowed in the 72-colour version.

Back to Menu or Subroutines

## Select from a simple list box

    subroutine: LISTBX
       program: SIMDEM06

          SUBROUTINE LISTBX (NUMDEC, NUMOPT, &
                             OPTS)
          INTEGER,             INTENT (IN)    :: NUMOPT
          INTEGER,             INTENT (INOUT) :: NUMDEC
          CHARACTER (LEN = *), INTENT (IN)    :: OPTS(NUMOPT)

    NUMDEC: On input defines the default option number.
            On exit holds the number of the option selected.
    NUMOPT: Number of options.
      OPTS: List of options.

Back to Menu or Subroutines

## Select from a title page and menu

    subroutine: TITLE1
       program: SIMDEM18

          SUBROUTINE TITLE1 (ICOLOR, NUMBLD, NUMDEC, NUMHDR, NUMOPT, &
                             NUMPOS, &
                             HEADER, OPTION)
          INTEGER,             INTENT (IN)    :: ICOLOR, NUMHDR, NUMOPT
          INTEGER,             INTENT (INOUT) :: NUMDEC
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMHDR), &
                                                 NUMPOS(NUMOPT)
          CHARACTER (LEN = *), INTENT (IN)    :: HEADER(NUMHDR), &
                                                 OPTION(NUMOPT)

    ICOLOR: Colour scheme (see PATCH1).
    NUMBLD: Font style (see PATCH1).
    NUMDEC: Sets choice on input then returned as the decision.
    NUMHDR: Number of header lines.
    NUMOPT: Number of options.
    NUMPOS: Hot key positions (must be unique).
    HEADER: Header text.
    OPTION: Menu options.

Back to Menu or Subroutines

## Select from a question and answer window

    subroutine: ANSWER
       program: SIMDEM19

          SUBROUTINE ANSWER (ICOLOR, NUMBLD, NUMHDR, &
                             HEADER, OPTION, &
                             YES)
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMHDR)
          CHARACTER (LEN = *), INTENT (IN)    :: HEADER(NUMHDR), OPTION
          LOGICAL,             INTENT (INOUT) :: YES

    ICOLOR: Colour style (see PATCH1).
    NUMBLD: Text style (see PATCH1).
    NUMHDR: Number of header lines.
    HEADER: Header text.
    OPTION: The 1-line option.
       YES: Sets the default button on input
            then returns the option selected.

Back to Menu or Subroutines

## Select from a tabbing list box

    subroutine: TBOX01
       program: SIMDEM20

          SUBROUTINE TBOX01 (ICOLOR, IX, IY, LSHADE, NUMBLD, NUMDEC, &
                             NUMOPT, NUMPOS, NSTART, NTEXT, &
                             TEXT, &
                             TAB_BOT, TAB_MID, TAB_TOP)
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, LSHADE, &
                                                 NUMOPT, NSTART, NTEXT
          INTEGER,             INTENT (INOUT) :: NUMDEC
          INTEGER,             INTENT (IN)    :: NUMBLD(NTEXT), &
                                                 NUMPOS(NUMOPT)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NTEXT)
          LOGICAL,             INTENT (IN)    :: TAB_BOT, TAB_MID, TAB_TOP

     ICOLOR: May be disabled (see PATCH1).
     IX, IY: Position down from top left hand in average characters.
             May be disabled and always is for ix or iy =< 0.
     LSHADE: May be disabled (0 = no shading, 1 = shading).
     NUMBLD: 1, 2 = Normal; 3,4 = Italic; 4,5 = Bold; 6,7 = Bold Italic
             Odd number = normal, Even number = highlighted.
     NUMDEC: Decision (must be pre-set to default before entry).
     NUMOPT: Number of options.
     NUMPOS: Not used in this version but must be set.
     NSTART: Starting line for list box in text array.
     NUMTXT: Text dimension.
       TEXT: Text array.
    TAB_TOP: Tab header (at grave characters).
    TAB_MID: Tab list box items (at grave characters).
    TAB_BOT: Tab trailer (at grave characters).

Back to Menu or Subroutines

## Select from button boxes

    subroutines: BBOX01, HBOX01, VBOX01
        program: SIMDEM36

Subroutines BBOX01, HBOX01, and VBOX01 are only useful for relatively small numbers of options. The only difference is the button position. The hot key, as set by NUMPOS, must be unique and consistent across buttons.

          SUBROUTINE BBOX01 (ICOLOR, IX, IY, LSHADE, NUMBLD, NUMDEC, &
                             NUMOPT, NUMPOS, NSTART, NTEXT, &
                             TEXT, &
                             BORDER, FLASH, HIGH)
          INTEGER,             INTENT (INOUT) :: NUMDEC
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, LSHADE, &
                                                 NUMOPT, NSTART, NTEXT
          INTEGER,             INTENT (IN)    :: NUMBLD(NTEXT), &
                                                 NUMPOS(NUMOPT)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NTEXT)
          LOGICAL,             INTENT (IN)    :: BORDER, FLASH, HIGH

          SUBROUTINE HBOX01 (ICOLOR, IX, IY, LSHADE, NUMBLD, NUMDEC, &
                             NUMOPT, NUMPOS, NSTART, NTEXT, &
                             TEXT, &
                             BORDER, FLASH, HIGH)
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, LSHADE, &
                                                 NUMOPT, NSTART, NTEXT
          INTEGER,             INTENT (IN)    :: NUMBLD(NTEXT), &
                                                 NUMPOS(NUMOPT)
          INTEGER,             INTENT (INOUT) :: NUMDEC
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NTEXT)
          LOGICAL,             INTENT (IN)    :: BORDER, FLASH, HIGH

          SUBROUTINE VBOX01 (ICOLOR, IX, IY, LSHADE, NUMBLD, NUMDEC, &
                             NUMOPT, NUMPOS, NUMSTA, NUMTXT, TEXT, &
                             BORDER, FLASH, HIGH)
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, LSHADE, &
                                                 NUMOPT, NUMSTA, NUMTXT
          INTEGER,             INTENT (INOUT) :: NUMDEC
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMTXT), &
                                                 NUMPOS(NUMOPT)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NUMTXT)
          LOGICAL,             INTENT (IN)    :: BORDER, FLASH, HIGH

    ICOLOR: Colour (see PATCH1)
    IX, IY: Window position (may be disabled)
    LSHADE: 0 = no shading, 1 = shading (may be disabled))
    NUMBLD: 1, 2 = Normal; 3,4 = Italic; 4,5 = Bold; 6,7 = Bold Italic
            Odd number = normal, Even number = highlighted
    NUMDEC: Decision (must be pre-set to default before entry)
    NUMOPT: Number of options >= 1
    NUMPOS: Position of hot key in button text
    NSTART: Starting line for buttons in text array
    NUMTXT: Text dimension
      TEXT: Text array
     FIXED: Use Courier New if .true. otherwise sans serif
     FLASH: Not used
      HIGH: Not used

Back to Menu or Subroutines

## Select from ganged radio/tick boxes

    subroutine: RBOX01
       program: SIMDEM37

          SUBROUTINE RBOX01 (ICOLOR, IX, IY, LSHADE, NUMBLD, NUMDEC, &
                             NUMOPT, NUMPOS, NUMSTA, NUMTXT, &
                             TEXT, &
                             BORDER, FLASH, HIGH)
          INTEGER,             INTENT (IN)    :: ICOLOR, IX, IY, LSHADE, &
                                                 NUMDEC, NUMOPT, NUMSTA, &
                                                 NUMTXT
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMTXT)
          INTEGER,             INTENT (INOUT) :: NUMPOS(NUMOPT)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NUMTXT)
          LOGICAL,             INTENT (IN)    :: BORDER, FLASH, HIGH

    ICOLOR: Not used in this version.
        IX: X-coordinate.
        IY: Y-coordinate.
    LSHADE: Shading ... not used in this version.
    NUMBLD: Has special meaning within a menu sub-group.
    NUMDEC: Is <= 0 for radio o/w check boxes.
    NUMOPT: Number of options.
    NUMPOS: Is 0,1 for false/true.
    NUMSTA: Starting line for menu items.
    NUMTXT: Number of text lines.
      TEXT: Header plus embedded menu items.
     FIXED: Use fixed or proportional fonts.
      FULL: Not used in this version.
      HIGH: Not used in this version.

    Note how ganging is achieved as follows:-

    The idea is that positive hundreds for numbld form ganged
    groups where at least one must be switched on, but negative
    hundreds form ganged groups where they can all be switched
    off. At most one can be switched on in any ganged group.
    For example-
    set corresponding numbld = 100 leads to a 100-type group
    set corresponding numbld = - 100 leads to a -100-type group
    set corresponding numbld = 200 leads to a 200-type group
    set corresponding numbld =  -200 leads to a -200-type group
    set corresponding numbld = 300 leads to a 300-type group
    set corresponding numbld =  -300 leads to a -300-type group
    the significance of this is as follows:

    if numbld(i) < 0 then the controls in a group can be all off
    if numbld(i) > 0 then one control in a group must be switched on
    only one of the numpos can be switched on (i.e. 1) in any group
    it is necessary to edit if large groups > 10 are required

Back to Menu or Subroutines

## Select from scrolling check boxes

    subroutines: CHKBOX, RBOXES
        program: SIMDEM58

With subroutine CHKBOX a window with scrolling check boxes is displayed, where the check boxes are ticked or un-ticked depending on the value of USEIT on entry. Adjacent to each check box is a line of explanatory text. After checking and un-checking as required, the user can cancel or accept the editing.

          SUBROUTINE CHKBOX (N, &
                             TEXT, TITLE, &
                             USEIT)
          INTEGER,             INTENT (IN)    :: N
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(N), TITLE
          LOGICAL,             INTENT (INOUT) :: USEIT(N)

        N: Number of check boxes required.
     TEXT: Labels, one for each logical variable.
    TITLE: Title for check boxes.
    USEIT: Supplied as defaults.
           Changed only if {Apply} is pressed.

Subroutine RBOXES is similar to subroutine CHKBOX except that there is a N_DOWN by N_ACROSS matrix of check boxes. Also there is an initial header section intended to describe the meaning of the N_ACROSS columns of check boxes. For each of the N_DOWN rows of check boxes one check box will be selected, depending on the value of IRB supplied for that row. Users can alter the box checked so that, on exit, the value of IRB(i) will be the number of the check box ticked in row i.

          SUBROUTINE RBOXES (IRB, N_ACROSS, N_DOWN, N_HEADER, &
                             HEADER, TEXT)
          INTEGER,             INTENT (IN)    :: N_ACROSS, N_DOWN, N_HEADER
          INTEGER,             INTENT (INOUT) :: IRB(N_DOWN)
          CHARACTER (LEN = *), INTENT (IN)    :: HEADER(N_HEADER), &
                                                 TEXT(N_DOWN)

         IRB: Number of check box selected at each row.
              Note that 1 =< IRB(i) =< N_ACROSS.
    N_ACROSS: Number of ganged check boxes across.
      N_DOWN: Number of rows of ganged check boxes.
    N_HEADER: Number of lines of header information.
      HEADER: Lines of header information.
        TEXT: Captions for rows of check boxes (width =< 20).

Back to Menu or Subroutines

## Select one or multiple files

    subroutines: MFILES, TRIM60
        program: SIMDEM59

          SUBROUTINE MFILES (NFILES, NMAX, &
                             FILES)

          INTEGER,             INTENT (IN)    :: NMAX
          INTEGER,             INTENT (OUT)   :: NFILES
          CHARACTER (LEN = *), INTENT (INOUT) :: FILES(NMAX)

    NFILES: On entry NFILES is set to zero.
            On exit NFILES is the number of files selected.
      NMAX: Maximum number of files that can be selected.
     FILES: Files selected.

          SUBROUTINE TRIM60 (LINE)
          CHARACTER (LEN = *), INTENT (INOUT) :: LINE

    LINE: This is typically a long filename that is trimmed so that the
          right-most 60 characters are the last characters of the filename,
          in order to avoid overflow when writing character strings to output
          devices and files. There are also routines TRIM40, TRIM80, and TRIM100.

Back to Menu or Subroutines

## Select from a comprehensive list box

    subroutine: LSTBOX
       program: SIMDEM60

          SUBROUTINE LSTBOX (NUMBLD, NUMDEC, NUMOPT, NUMSTA, NUMTXT, &
                             TEXT)
          INTEGER,             INTENT (IN)    :: NUMTXT, NUMOPT, NUMSTA
          INTEGER,             INTENT (IN)    :: NUMBLD(NUMTXT)
          INTEGER,             INTENT (INOUT) :: NUMDEC
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NUMTXT)

    NUMBLD: 0 = black, 1 = red, etc.
    NUMDEC: On entry sets the pre-selected item.
            On exit returns the item selected or
            the default Cancel or Quit item if
            the closure cross is used.
    NUMOPT: Number of options.
    NUMSTA: Number of starting line for menu items.
    NUMTXT: Number of lines in array TEXT.
      TEXT: Options with extra text if required.

    Advice
    1) The subroutine will only work if all arguments
       are initalised correctly.
    2) Grave accents (like `) create tabbing when in the
       header or trailer text lines.
    3) Grave accents (like `) in the menu items invoke a
       different tabbing procedure which may suppress
       colours set by numbld.
    4) If a menu item contains words like Cancel, Exit,
       or Quit, a default closure cross option is made
       available which will select the option containing
       the words Cancel, Exit, or Quit.

Back to Menu or Subroutines

## Select a file to view/open/copy/paste

    subroutines: VUOPEN, AUX256
        program: SIMDEM65

Subroutine VUOPEN can be used to view/open/copy/paste from a file identified from list of files supplied in the array TEXT.

          SUBROUTINE VUOPEN (NUMDEC, NUMTXT, &
                             TEXT, &
                             VIEW)
          INTEGER,             INTENT (IN)    :: NUMTXT
          INTEGER,             INTENT (INOUT) :: NUMDEC
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NUMTXT)
          LOGICAL,             INTENT (INOUT) :: VIEW

    NUMTXT: Number of text lines.
    NUMDEC: On entry defines the default item.
            On exit defines the line chosen.
      TEXT: Each line should be the name of a file. However,
            a grave accent (`) can be used to separate filenames
            from comments, but they must all be at the same
            position in every line of text.
      VIEW: Returned as .TRUE. if users selects to VIEW.
            Returned as .FALSE. if users selects to OPEN.

The function AUX256 must be supplied with a filename PNAME. If this filename can be identified as a Simdem auxiliary file then AUX256 will be returned as the fully qualified path-filename to PNAME. Otherwise AUX256 will be returned as the filename supplied. It is advisable to define AUX256 as at least (LEN = 1024) in the calling program.

          CHARACTER (LEN = *) FUNCTION AUX256 (PNAME)
          CHARACTER (LEN = *), INTENT (IN) :: PNAME

Back to Menu or Subroutines

## Select from the Simfit file-selection control

    subroutines: OFILES, GETFIL, FSERCH, INFOFL
        program: SIMDEM44

The advanced simfit file selection control is very versatile. You can type in file names or use the Windows Browse function. Alternatively you can toggle backwards or forwards through the lists of recently created/analysed files which allows keystroke editing or you can select directly from the file lists. You can also set filters interactively. There are many powerful built in functions, e.g. try opening an exe or dll file. You cannot set demonstration filenames from the SIMDEM44 example, so the [Demo] button will not work.

          SUBROUTINE OFILES (ISEND, NOUT, &
                             FNAME, &
                             ABORT)
          INTEGER,             INTENT (IN)    :: ISEND, NOUT
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAME
          LOGICAL,             INTENT (OUT)   :: ABORT

    ADVICE: UNITS 1, 2, 5 and 6 cannot be opened in this version.
            This version takes the search pattern from w_filter.cfg
            each time it is called and allows FILTERS etc. to be changed
            interactively. It uses w_input.cfg and w_output.cfg to
            remember filenames i.e. for history.
     ISEND: ISEND = 1, User supplies FILENAME at terminal, then SAVE new file
                       i.e. Save as ...
            ISEND = 2, FILENAME as argument to subroutine, then SAVE new file
                      (re-try with JSEND = 1 if failure with JSEND = 2)
            ISEND = 3, User supplies FILENAME at terminal/from panel, then OPEN old file
                       Search pattern = FNAME set on initial entry in this version
                       i.e. Open ...
            ISEND = 4, FILENAME as argument to subroutine, then OPEN old file
                       (re-try with JSEND = 3 if failure with JSEND = 4)
      NOUT: Unconnected UNIT number.
     FNAME: FILENAME.
     ABORT: Returned as .TRUE. for success, .FALSE. if failure.

The simple file control is just an interface to the usual Windows file selection control with no special Simfit features. It is initialised by the arguments ext and type1.

          SUBROUTINE GETFIL (ISEND, &
                             EXT, FNAME, TYPE1, &
                             ABORT)
          INTEGER,             INTENT (IN)  :: ISEND
          CHARACTER (LEN = *), INTENT (IN)  :: EXT, TYPE1
          CHARACTER (LEN = *), INTENT (OUT) :: FNAME
          LOGICAL,             INTENT (OUT) :: ABORT

    ISEND: ISEND = 1: Open ... an existing file
           Otherwise Save As ... a new file
      EXT: File extension, e.g. txt, bmp, eps
    FNAME: File name selected or blank if no file selected
    TYPE1: File type or description, e.g. Encapsulated Postscript file
    ABORT: Error indicator
     Note: this routine does not open any files, it just returns file names. So a new
           filename will only lead to a new file if the file is subsequently opened.

The file searching routine allows user to specify a fully qualified filename, or a simple filename (FNAME) and a directory (DIR) to start a search which includes sub-folders. The search can be stopped if it proves too long, otherwise THERE is returned as .TRUE. if FULL_PATH is the fully qualified filename. for FNAME.

          SUBROUTINE FSERCH (DIR, FNAME, FULL_PATH, &
                             THERE)
          CHARACTER (LEN = *), INTENT (IN)  :: DIR, FNAME
          CHARACTER (LEN = *), INTENT (OUT) :: FULL_PATH
          LOGICAL,             INTENT (OUT) :: THERE

The filename displaying routine conveniently displays a message, depending on ISEND, and the filename supplied.

          SUBROUTINE INFOFL (ISEND, &
                             FNAME)
          INTEGER,             INTENT (IN) :: ISEND
          CHARACTER (LEN = *), INTENT (IN) :: FNAME

          ISEND = 1: file missing
          ISEND = 2: file created
          ISEND = 3: file deleted
          ISEND = 4: file incorrectly formatted
          ISEND = 5: file cannot be viewed/edited/printed
          ISEND = 6: file is read only
          ISEND = 7: file cannot be opened
          ISEND = 8: file is empty
          ISEND = 9: file has been located

Back to Menu or Subroutines

## Editing double precision variables

    subroutine: EDITD1
       program: SIMDEM11

          SUBROUTINE EDITD1 (ISEND, NCOLS, NRMAX, NROWS, &
                             X, &
                             TEXT)
          INTEGER,             INTENT (IN)    :: ISEND, NCOLS, NRMAX, NROWS
          DOUBLE PRECISION,    INTENT (INOUT) :: X(NRMAX,*)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT

    ISEND: ISEND = 1: view only    ... X unchanged.
           ISEND = 2: edit only    ... X changed.
           ISEND = 3: fill in/edit ... X initialised.
    NCOLS: Column dimension.
    NRMAX: Leading dimension.
    NROWS: Row dimension.
        X: Depending on ISEND.
     TEXT: Title.

Back to Menu or Subroutines

## Editing integers

    subroutine: EDITI1
       program: SIMDEM12

Subroutine EDITI1 actually edits a double precision matrix X, but internally it is integer converted using NINT. Hence, to realise integer editing it is necessary to transform an integer input matrix into double precision using DBLE before input, and transform the resulting edited double precision matrix into an integer matrix using NINT after exit.

          SUBROUTINE EDITI1 (ISEND, NCOLS, NRMAX, NROWS, &
                             X, &
                             TEXT)
          INTEGER,             INTENT (IN)    :: ISEND, NCOLS, NRMAX, NROWS
          DOUBLE PRECISION,    INTENT (INOUT) :: X(NRMAX,*)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT

    ISEND: ISEND = 1: view X     ... X unchanged.
           ISEND = 2: edit X     ... X changed.
           ISEND = 3: initialise ... X initialised/edited.
    NCOLS: Column dimension.
    NRMAX: Leading dimension.
    NROWS: Row dimension.
        X: Depending on ISEND.
     TEXT: Title.

Back to Menu or Subroutines

    subroutine: EDITTX
       program: SIMDEM13

## Editing text

Subroutine EDITTX is supplied with a text array of maximum dimensions NHIGH by NWIDE, then returns a text array of dimensions NLINES by NWIDE after editing, where NLINES allows for line deletion and adding new lines.

          SUBROUTINE EDITTX (NHIGH, NLINES, NWIDE, &
                             TEXT)
          INTEGER,             INTENT (IN)    :: NHIGH, NWIDE
          INTEGER,             INTENT (OUT)   :: NLINES
          CHARACTER (LEN = *), INTENT (INOUT) :: TEXT(NHIGH)

     NHIGH: Maximum number of lines in text buffer.
    NLINES: Number of lines of edited buffer on exit.
     NWIDE: Maximum width of edited buffer.
      TEXT: Buffer.

Back to Menu or Subroutines

## Plot 1 function

    subroutine: GKS001
       program: SIMDEM09

Note that the scheme for line types (L) and symbol types (M) in subroutine GKS001 is used everywhere else in Simdem graphics.

          SUBROUTINE GKS001 (L, M, N, &
                             X, Y, &
                             PTITLE, XTITLE, YTITLE)
          INTEGER,             INTENT (IN) :: L, M, N
          DOUBLE PRECISION,    INTENT (IN) :: X(N), Y(N)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE

         L: Line type. L = 1 Solid
                       L = 2 Dashed
                       L = 3 Dotted
                       L = 4 Dashed-Dotted
                       L = 5 Vector >>>
                       L = 6 Vector <<<
                       L = 7 Step-cdf
                       L = 8 Step-survival
                       L = 9 Filled polygon
                       Otherwise None
         M: Symbol type. M = 1 Dot
                         M = 2 Plus
                         M = 3 Cross
                         M = 4 Asterisk
                         M = 5 Circle
                         M = 6 Circle-half
                         M = 7 Circle-full
                         M = 8 Triangle
                         M = 9 Triangle-half
                         M = 10 Triangle-full
                         M = 11 Square
                         M = 12 Square-half
                         M = 13 Square-full
                         M = 14 Diamond
                         M = 15 Diamond-half
                         M = 16 Diamond-full
                         M = 17 Minus
                         M = 18 Male
                         M = 19 Female
                         M = 20 Bar-outline
                         M = 21 Bar-filled
                         M = 22 Bar-diagonal-up
                         M = 23 Bar-diagonal-down
                         M = 24 Bar-criss-cross
                         M = 25 Bar-horizontal
                         M = 26 Bar-vertical
                         M = 27 Bar-dashed
                         M = 28 Bar-dotted
                         M = 29 Bar-dash-dotted
                         M = 30 Circle-outline
                         M = 31 Triangle-outline
                         M = 32 Square-outline
                         M = 33 Diamond-outline
                         M = 34 Inverted-triangle
                         M = 35 Inverted-triangle-half
                         M = 36 Inverted-triangle-full
                         Otherwise none
         N: Dimension.
         X: Data for X-axis.
         Y: Data for Y-axis.
    PTITLE: Plot title.
    XTITLE: Legend for X-axis.
    YTITLE: Legend for Y-axis.

Back to Menu or Subroutines

## Plot 4 functions

    subroutine: GKS004
       program: SIMDEM10

         SUBROUTINE GKS004 (  L1,  L2,  L3,  L4, &
                              M1,  M2,  M3,  M4, &
                             N1D, N2D, N3D, N4D, &
                             X1D, X2D, X3D, X4D, &
                             Y1D, Y2D, Y3D, Y4D, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, GSAVE)
          INTEGER,             INTENT (IN) :: L1, L2, L3, L4, &
                                              M1, M2, M3, M4, &
                                              N1D, N2D, N3D, N4D
          DOUBLE PRECISION,    INTENT (IN) :: X1D(*), X2D(*), &
                                              X3D(*), X4D(*), &
                                              Y1D(*), Y2D(*), &
                                              Y3D(*), Y4D(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL,             INTENT (IN) :: AXES, GSAVE

      L1 to L4: Line types   (see GKS001).
      M1 to M4: Symbol types (see GKS001).
    N1D to N4D: Dimensions.
    X1D to X4D: Data for X-axis.
    Y1D to Y4D: Data for Y-axis.
        PTITLE: Plot title.
        XTITLE: Legend for X-axis.
        YTITLE: Legend for Y-axis.
          AXES: May not be used ... Set to .TRUE.
         GSAVE: May not be used ... Set to .TRUE.

Back to Menu or Subroutines

## Plot 4 (x,y) transforms

    subroutine: GKST04
       program: SIMDEM21

          SUBROUTINE GKST04 ( L1,  L2,  L3,  L4, &
                              M1,  M2,  M3,  M4, &
                             N1D, N2D, N3D, N4D, &
                             A, X1D, X2D, X3D, X4D, &
                                Y1D, Y2D, Y3D, Y4D, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, SAVEIT)
          INTEGER,             INTENT (IN) :: L1, L2, L3, L4, &
                                              M1, M2, M3, M4, &
                                              N1D, N2D, N3D, N4D
          DOUBLE PRECISION,    INTENT (IN) :: A
          DOUBLE PRECISION,    INTENT (IN) :: X1D(*), X2D(*), X3D(*), X4D(*)
          DOUBLE PRECISION,    INTENT (IN) :: Y1D(*), Y2D(*), Y3D(*), Y4D(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL,             INTENT (IN) :: AXES, SAVEIT

    Arguments as for GKS004 except that A is provided in case a Hill transform
    for (x,y) to (log[x],log[y/(A - y)]) is required. For fractional saturation
    functions A would be 1 but variable A is provided in case a scaled saturation
    functions is input, when A must be >= maximum asymtotic Y-value.

Back to Menu or Subroutines

## Plot surfaces and contours

    subroutine: SURD2S
       program: SIMDEM22

          SUBROUTINE SURD2S (ISEND, NMAX, NX, NY, &
                             VECTOR, XMAX, XMIN, YMAX, YMIN, Z, &
                             UNUSED)
          INTEGER,          INTENT (IN)    :: ISEND, NMAX, NX, NY
          DOUBLE PRECISION, INTENT (INOUT) :: VECTOR(NMAX**2 + 6), &
                                              XMAX, XMIN, YMAX, YMIN, &
                                              Z(NMAX,NMAX)
          LOGICAL,          INTENT (INOUT) :: UNUSED(NMAX,NMAX)

    The arguments for surd2s depend on exactly how the routine is to be called.
    It can be called to plot a supplied model, to read data from a file
    (like surface.tf1, etc), to plot data generated as a vector, or to plot
    data supplied as a matrix at equally spaced coordinates.

    Simdem22 demonstrates this last (simplest) case.

     ISEND: ISEND = 1: supply model, calculate then plot.
            ISEND = 2: read vector from file, then plot.
            ISEND = 3: supply vector, then plot.
            ISEND = 4: supply z(i,j), then plot.
      NMAX: This MUST be exactly 100 in this particular version.
        NX: Number of x divisions =< NMAX.
        NY: Number of y divisions =< NMAX.
    VECTOR: Supplies data when isend = 3, not used when ISEND = 4.
            VECTOR MUST have dimension at least NMAX**2 + 6 in this version.
      XMAX: Range.
      XMIN: Range.
      YMAX: Range.
      YMIN: Range.
         Z: Data when isend = 4, not used when isend = 3.
    UNUSED: Logical array used by the contouring routine.

Back to Menu or Subroutines

## Plot curves in space

    subroutine: SPACE0
       program: SIMDEM23

Subroutine SPACE0 should be called with parameteric data in the form X(t),Y(t),Z(t) and will then plot a 3D space curve that can be edited. Workspaces dimensioned at least N must be provided to permit rotations of the X,Y plane.

          SUBROUTINE SPACE0 (N, NMAX, &
                             X, XTEMP, Y, YTEMP, Z)
          INTEGER,          INTENT (IN)    :: N, NMAX
          DOUBLE PRECISION, INTENT (IN)    :: X(NMAX), Y(NMAX), &
                                              Z(NMAX)
          DOUBLE PRECISION, INTENT (INOUT) :: XTEMP(NMAX), YTEMP(NMAX)

        N: Dimension required.
     NMAX: Maximum dimension >= N.
        X: Data for X(t).
    XTEMP: Workspace.
        Y: Data for Y(t).
    YTEMP: Workspace.
        Z: Data for Z(t).

Back to Menu or Subroutines

## Plot a vector field

    subroutine: GKSVF1
       program: SIMDEM24

          SUBROUTINE GKSVF1 (IARROW, IKOLOR, JARROW, LCOLOR, NGKS, &
                             HEAD, X1, X2, Y1, Y2, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, GSAVE)
          INTEGER,             INTENT (IN) :: JARROW
          INTEGER,             INTENT (IN) :: IARROW(JARROW), &
                                              IKOLOR(JARROW), &
                                              LCOLOR, NGKS
          DOUBLE PRECISION,    INTENT (IN) :: HEAD(JARROW), &
                                              X1(JARROW), X2(JARROW), &
                                              Y1(JARROW), Y2(JARROW)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL,             INTENT (IN) :: AXES, GSAVE

    IARROW: Arrow type, use 1.
    IKOLOR: Arrow colour.
    JARROW: Grid size.
    LCOLOR: Background colour.
      NGKS: GKS transformation number, use 0.
      HEAD: Size of arrow head.
        X1: Head position.
        X2: Tail position.
        Y1: Head position.
        Y2: Tail position.
    PTITLE: Plot title.
    XTITLE: X legend.
    YTITLE: Y legend.
      AXES: Use .true.
     GSAVE: Use .true.

Back to Menu or Subroutines

## Plot error bars

    subroutine: GKSEB4
       program: SIMDEM25

          SUBROUTINE GKSEB4 (L1, L2, L3, L4, M1, M2, M3, M4, &
                             N1, N2, N3, N4, &
                             X1, X2, X3, X4, &
                             YH1, YH3, YL1, YL3, Y1, Y2, Y3, Y4, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, GSAVE)
          INTEGER,             INTENT (IN) :: L1, L2, L3, L4, &
                                              M1, M2, M3, M4, &
                                              N1, N2, N3, N4
          DOUBLE PRECISION,    INTENT (IN) :: X1(*), X2(*), &
                                              X3(*), X4(*), &
                                              YH1(*), YH3(*), &
                                              YL1(*), YL3(*), &
                                              Y1(*), Y2(*), &
                                              Y3(*), Y4(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL,             INTENT (IN) :: AXES, GSAVE

    The subroutine is designed to fit up to two sets of data with error bars
    and up to two best fit curves. Usually X1, Y1, YH1, YL1 would be data for one
    components and X2, Y2 would be the best-fit curve, etc., but actually all four
    components are independent.

    L1 to L4: Line type (see GKS001).
    M1 to M4: Symbol type (see GKS001).
    N1 to N4: Number of points to be plotted.
    X1 to X4: X-coordinates.
         YH1: Upper error bar for Y1.
         YL1: Lower error bar for Y1.
         YH3: Upper error bar for Y3.
         YL3: Lower error bar for Y3.
    Y1 to Y4: Y-coordinates.
      PTITLE: Plot title.
      XTITLE: X legend subtitle.
      YTITLE: Y legend subtitle.
        AXES: Use .TRUE.
       GSAVE: Use .TRUE.

Back to Menu or Subroutines

## Plot n data sets

    subroutines: SMPLOT, DELTMP
        program: SIMDEM46

Subroutine SMPLOT requires a number of files containing data for plotting, together with colours, line types, symbol types, and titles, then it displays a composite graph. The data files must be consistent types for plotting and in Simfit format.

          SUBROUTINE SMPLOT (JFILES, LFILES, MFILES, NFILES, &
                             FILES, TITLES)
          INTEGER,             INTENT (IN) :: NFILES
          INTEGER,             INTENT (IN) :: JFILES(NFILES), &
                                              LFILES(NFILES), &
                                              MFILES(NFILES)
          CHARACTER (LEN = *), INTENT (IN) :: FILES(NFILES), TITLES(4)

    JFILES: Colours (see PALETT).
    LFILES: Line types (see GKS001).
    MFILES: Symbol types (see GKS001).
    NFILES: Number of files.
     FILES: Filenames of acceptable Simfit-format data files.
            2 columns (x,y) for standard plots (any column 3 will be ignored).
            4 columns (x,y1,y2,y3) for vertical error bars.
            6 columns (x1 x2,x3,y1,y2,y3) for slanting error bars.
    TITLES: TITLES(1) = Plot title.
            TITLES(2) = X-legend.
            TITLES(3) = Y-legend.
            TITLES(4) not referenced.

Often temporary files are created for plotting data using subroutine GETTMP, and in such circumstances it is advisable to call subroutine DELTMP to delete all temporary files like f$123456.tmp in the %TEMP% folder.

          SUBROUTINE DELTMP

Back to Menu or Subroutines

## Plot a pie chart

    subroutine: PCPLOT
       program: SIMDEM47

Subroutine PCPLOT can be called with ISEND = 1 when only the vector and relative size of the positive elements would be used, as the area of the segments is proportional to the size of the positive elements. When called with ISEND = 2 all the arguments will be used. Note that FACT(i) is the centrifugal displacement of segment i and would normally be somewhere between 0 and 1.

          SUBROUTINE PCPLOT (ISEND, IFILLV, IHUEV, NVEC, &
                             FACT, XVEC, &
                             LVEC, TVEC)
          INTEGER,             INTENT (IN) :: NVEC
          INTEGER,             INTENT (IN) :: ISEND, IFILLV(NVEC), &
                                              IHUEV(NVEC)
          DOUBLE PRECISION,    INTENT (IN) :: FACT(NVEC), XVEC(NVEC)
          CHARACTER (LEN = *), INTENT (IN) :: LVEC(NVEC), TVEC

     ISEND: ISEND = 1: default type pie chart.
            ISEND = 2: fully specified pie chart.
    IFILLV: Segment fill styles     (if ISEND = 2).
            0  no display
            1  empty
            2  solid
            3  upward diagonals
            4  downward diagonals
            5  criss cross
            6  horizontal
            7  vertical
            8  dashes
            9  dots
            10 dots-dashes
     IHUEV: Segment colours         (if ISEND = 2) (see PALETT).
      NVEC: Dimension of vector.
      FACT: Vector of displacements (if ISEND = 2).
      XVEC: Vector (XVEC(i) > 0).
      LVEC: Segment labels          (if ISEND = 2).
      TVEC: Title.

Back to Menu or Subroutines

## Plot a bar chart

    subroutine: BCPLOT
       program: SIMDEM48

The NROWS by NCOLS matrix supplied to subroutine BCPLOT will be used to create a bar chart with NROWS groups, each with NCOL bars. The bar chart labels, colours and fill styles will be taken from the default set unless ISEND = 2 when the LABELS supplied will be used as group labels.

          SUBROUTINE BCPLOT (ISEND, NCOL, NRMAX, NROW, &
                             XMAT, &
                             LABELS, TITLES)
          INTEGER,             INTENT (IN) :: ISEND, NCOL, NRMAX, NROW
          DOUBLE PRECISION,    INTENT (IN) :: XMAT(NRMAX,NCOL)
          CHARACTER (LEN = *), INTENT (IN) :: LABELS(NROW), TITLES(4)

     ISEND: ISEND = 1: default type bar chart.
            ISEND = 2: bar chart using LABELS supplied.
      NCOL: Number of columns.
     NRMAX: Leading dimension.
      NROW: Number of rows.
      XMAT: Matrix of values.
    LABELS: Used as labels if ISEND = 2.
    TITLES: TITLE(1) = title.
            TITLE(2) = X-legend.
            TITLE(3) = Y-legend.
            TITLE(4) not used.

Back to Menu or Subroutines

## Plot as boxes and whiskers

    subroutine: BWPLOT
       program: SIMDEM49

Data for BWPLOT must consist of a vector of data values XVEC, and a vector NOBS consisting of the number of items per set. As long as there are at least 4 items in each of the NSET sets of data, BWPLOT will analyse the sets sequentially and create a box and whisker plot with median, quartiles, and range for each set.

          SUBROUTINE BWPLOT (ISEND, NOBS, NSET, NVEC, &
                             XVEC, &
                             LABELS, TITLES)
          INTEGER,             INTENT (IN) :: NSET, NVEC
          INTEGER,             INTENT (IN) :: ISEND, NOBS(NSET)
          DOUBLE PRECISION,    INTENT (IN) :: XVEC(NVEC)
          CHARACTER (LEN = *), INTENT (IN) :: LABELS(NSET), TITLES(4)

     ISEND: ISEND = 1: use default configuration labels.
            ISEND = 2: use labels from argument list.
      NOBS: Observations per set(i), NOBS(i) >= 4.
      NSET: Number of sets of data.
      NVEC: Total number of items, NVEC >= sum NOBS(i).
      XVEC: Vector of values i = 1, NVEC.
    LABELS: Used as labels if ISEND = 2.
    TITLES: TITLE(1) = title.
            TITLE(2) = X-legend.
            TITLE(3) = Y-legend.
            TITLE(4) not used.

Back to Menu or Subroutines

## Plot as bars/symbols plus error bars

    subroutine: EBPLOT
       program: SIMDEM50

Data for EBPLOT must consist of a vector of data values XVEC, and a vector NOBS consisting of the number of items per set. As long as there are at least 2 items in each of the NSET sets of data, EBPLOT will analyse the sets sequentially and create a bar or symbol plot with error bars.

          SUBROUTINE EBPLOT (ISEND, NOBS, NSET, NVEC, &
                             XVEC, &
                             LABELS, TITLES)
          INTEGER,             INTENT (IN) :: NSET, NVEC
          INTEGER,             INTENT (IN) :: ISEND, NOBS(NSET)
          DOUBLE PRECISION,    INTENT (IN) :: XVEC(NVEC)
          CHARACTER (LEN = *), INTENT (IN) :: LABELS(NSET), TITLES(4)

     ISEND: ISEND = 1: use default configuration labels.
            ISEND = 2: use labels from argument list.
      NOBS: Observations per set(i), NOBS(i) >= 2.
      NSET: Number of sets of data.
      NVEC: Total number of items, NVEC >= sum NOBS(i).
      XVEC: Vector of values i = 1, NVEC.
    LABELS: Used as labels if ISEND = 2.
    TITLES: TITLE(1) = title.
            TITLE(2) = X-legend.
            TITLE(3) = Y-legend.
            TITLE(4) not used.

Back to Menu or Subroutines

## Plot a 2D scatter plus labels

    subroutine: LBPLOT
       program: SIMDEM53

          SUBROUTINE LBPLOT (N, &
                             X, Y, &
                             PTITLE, WORDX, XTITLE, YTITLE)
          INTEGER,             INTENT (IN) :: N
          DOUBLE PRECISION,    INTENT (IN) :: X(N), Y(N)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, WORDX(N), XTITLE, &
                                              YTITLE

         N: Number of points.
         X: X-coordinate.
         Y: Y-coordinate.
    PTITLE: Plot title.
     WORDX: Labels.
    XTITLE: X-legend.
    YTITLE: Y-legend.

Back to Menu or Subroutines

## Plot sample cumulative plus best-fit cdf

    subroutine: CDPLOT
       program: SIMDEM54

Subroutine CDPLOT should be provided with an ordered sample and an array of exact or estimated best-fit pdf(t) values that covers the sample range. It then plots the sample cumulative plus exact or estimated best-fit cdf. Note that there should be (say) >= 20 points to estimate a best-fit pdf in a meaningful way, and as subroutine CDPLOT integrates the best-fit pdf by the trapezoidal method to show a smooth cdf curve, there should be (say) >= 10 best-fit pdf points.

          AUBROUTINE CDPLOT (NPDF, NRMAX, NSAMP, &
                             PDF, SAMPLE, T, X, Y, Z, &
                             PTITLE, XTITLE, YTITLE)
          INTEGER,             INTENT (IN)    :: NPDF, NRMAX, NSAMP
          DOUBLE PRECISION,    INTENT (IN)    :: PDF(NPDF), SAMPLE(NSAMP)
          DOUBLE PRECISION,    INTENT (INOUT) :: T(NPDF), X(2*NRMAX), &
                                                 Y(2*NRMAX), Z(2*NRMAX)
          CHARACTER (LEN = *), INTENT (IN)    :: PTITLE, XTITLE, YTITLE

      NPDF: Number of pdf(t) values (>= 10 ?).
     NRMAX: Dimension of workspace (>= 2*nsamp).
     NSAMP: Size of sample (>= 20 ?).
       PDF: Best-fit (or exact) pdf(t) as calculated elsewhere.
    SAMPLE: Sample (must be in nondecreasing order).
         T: Argument for pdf (any spacing as required).
     X,Y,Z: Workspaces for creating step curve.
    PTITLE: Plot title.
    XTITLE: X-legend.
    YTITLE: Y-legend.

Back to Menu or Subroutines

## Plot sample histogram plus best-fit pdf

    subroutine: PDPLOT
       program: SIMDEM55

Subroutine PDPLOT should be provided with an ordered sample and an array of exact or estimated best-fit pdf(t) values that covers the sample range. It then plots a histogram with the exact or estimated best-fit cdf. Note that there should be (say) >= 40 points to plot a histogram in a meaningful way. Then the subroutine PDPLOT creates the histogram and plots the best-fit pdf as a smooth curve, so there should be (say) >= 10 best-fit pdf points.

          SUBROUTINE PDPLOT (NBINS, NPDF, NRMAX, NSAMP, &
                             PDF, SAMPLE, T, X, Y, &
                             PTITLE, XTITLE, YTITLE)
          INTEGER,             INTENT (IN)    :: NBINS, NPDF, NRMAX, NSAMP
          DOUBLE PRECISION,    INTENT (IN)    :: PDF(NPDF), SAMPLE(NSAMP), &
                                                 T(NPDF)
          DOUBLE PRECISION,    INTENT (INOUT) :: X(NRMAX), Y(NRMAX)
          CHARACTER (LEN = *), INTENT (IN)    :: PTITLE, XTITLE, YTITLE

     NBINS: Number of histogram bins (say nsamp/nbins >= 5)
      NPDF: Number of pdf(t) values (>= 10 ?)
     NRMAX: Dimension of workspace (>= 4*nbins)
     NSAMP: Size of sample (>= 20 ?)
       PDF: Best-fit (or exact) pdf(t) as calculated elsewhere
    SAMPLE: Sample (must be in nondecreasing order)
         T: Argument for pdf (any spacing as required)
       X,Y: Workspaces for creating histogram
    PTITLE: Plot title
    XTITLE: X-legend
    YTITLE: Y-legend

Back to Menu or Subroutines

## Plot a histogram with error bars

    subroutine: HIST01
       program: SIMDEM56

Subroutine HIST01 must be called with coordinates X,Y for the centres and heights required for histogram bars. Also error bar spacings can be supplied to display user-chosen error bar spacings, and large workspace arrays have to be supplied due to the large number of possible histogram formats allowed.

          SUBROUTINE HIST01 (N, NH, NUMBER, &
                             E, X, XH, Y, YH, &
                             GSAVE)
          INTEGER,          INTENT (IN)    :: N, NH
          INTEGER,          INTENT (OUT)   :: NUMBER
          DOUBLE PRECISION, INTENT (IN)    :: E(N), X(N), Y(N)
          DOUBLE PRECISION, INTENT (INOUT) :: XH(NH), YH(NH)
          LOGICAL,          INTENT (IN)    :: GSAVE

         N: Number of histogram bins requested (N >= 1).
        NH: Maximum dimension of plotting arrays (NH >= 10*N + 1).
    NUMBER: Number of actual plotting points.
         E: Error bar vertical spacing (E >= 0, e.g. t_{nu}*standard error).
         X: Centre of bins.
        XH: Workspace for plotting.
         Y: Height of bins (Y >= 0).
        YH: Workspace for plotting.
     GSAVE: Unused but set to .TRUE..

Back to Menu or Subroutines

## Plot a dendrogram with theshold

    subroutine: DGPLOT
       program: SIMDEM57

After calling G03ECF the arguments are used to construct an X array of succesive dendrogram hooks which are then written to a file with the title %simfitdendrogramfile%. Subroutine SMPLOT then calls the simplot plotting routines which work out that a dendrogram is required from the title. Parameters are as returned from G03ECF except that THRESH = threshold to plot horizontal line as used for selecting subgroups in the Simfit package.

          SUBROUTINE DGPLOT (ILC, IUC, IORD, N, NRMAX, &
                             CD, THRESH, X, &
                             PTITLE, WORDX, XTITLE, YTITLE)
          INTEGER,             INTENT (IN)    :: N, NRMAX
          INTEGER,             INTENT (IN)    :: ILC(N - 1), IUC(N - 1), &
                                                 IORD(N)
          DOUBLE PRECISION,    INTENT (IN)    :: CD(N - 1), THRESH
          DOUBLE PRECISION,    INTENT (INOUT) :: X(NRMAX,3)
          CHARACTER (LEN = *), INTENT (IN)    :: PTITLE, WORDX(N), XTITLE, &
                                                 YTITLE

       ILC: As G03ECF.
       IUC: As G03ECF.
      IORD: As G03ECF.
         N: Number of observations.
     NRMAX: Dimension >= N.
        CD: As G03ECF.
    THRESH: Dendrogram threshold for selecting subgroups.
         X: Workspace.
    PTITLE: Plot title.
     WORDX: Labels.
    XTITLE: X-legend.
    YTITLE: Y-legend.

Back to Menu or Subroutines

## Plot half-normal and normal scores

    subroutine: HNPLOT
       program: SIMDEM61

          SUBROUTINE HNPLOT (ISEND, NVEC, &
                             XVEC)
          INTEGER,          INTENT (IN) :: ISEND, NVEC
          DOUBLE PRECISION, INTENT (IN) :: XVEC(NVEC)

    ISEND: ISEND = 1: half-normal.
           ISEND = 2: normal.
     NVEC: Size of vector (NVEC > 3).
     XVEC: Vector to be plotted.

Back to Menu or Subroutines

## Plot bivariate normal confidence ellipses

    subroutines: ELIPS1, NAGSUB
        program: SIMDEM62

          SUBROUTINE ELIPS1 (N, &
                             RESUL, X, Y)
          INTEGER,          INTENT (IN) :: N
          DOUBLE PRECISION, INTENT (IN) :: RESUL(5), X(N), Y(N)

        N: Dimension.
    RESUL: As from a previous call to G02CAF.
           RESUL(1) = XBAR ... sample mean for X.
           RESUL(2) = YBAR ... sample mean for Y.
           RESUL(3) = XSIG ... sample standard deviation for X.
           RESUL(4) = YSIG ... sample standard deviation for Y.
           RESUL(5) = R    ... sample correlation coefficient.
        X: X-data.
        Y: X-data.

In order to make the Simdem graphics routines free-standing a number of subroutines based on NAG calling sequences are provided and illustrated at various points, e.g. SIMDEM62. These routines have a final G added to the name to emphasize that they are not true NAG routines, only Simdem replacements. The following subroutines can be called from the Simdem GUI.

    G01EAFG
    G01EBFG
    G01EEFG
    G01FAFG
    G01FBFG
    G01FCFG
    G01FDFG
    G01FEFG
    G02CAFG
    G05CAFG
    G05CBFG
    G05CCFG
    G05DDFG
    S14ABFG
    S14BAFG
    S15ABFG
    S15ADFG
    X01AAFG
    X02AJFG
    X02AMFG

Back to Menu or Subroutines

## Plot rows and columns from a matrix

    subroutine: MTPLOT
       program: SIMDEM63

Subroutine MTPLOT must be supplied with a matrix and it can then display a selection of 1, 2, or 3 dimensional plots of rows and/or columns together with labels if required. It would normally be used to inspect rows or columns for a supposed functional relationship.

          SUBROUTINE MTPLOT (ISEND, NCMAX, NCOL, NRMAX, NROW, &
                             A)
          INTEGER,          INTENT (IN) :: ISEND, NCMAX, NCOL, NRMAX, &
                                           NROW
          DOUBLE PRECISION, INTENT (IN) :: A(NRMAX,NCMAX)

    ISEND: ISEND = 1: only a vector is supplied
           ISEND = 2: only columns can be plotted
           ISEND = 3: only rows can be plotted
           ISEND = 4: rows or columns can be plotted
    NCMAX: Dimension
     NCOL: Number of columns supplied
    NRMAX: Dimension
     NROW: Number of rows supplied
        A: Matrix of values for plotting

Back to Menu or Subroutines

## Plot a parametric curve r = r(theta)

    subroutine: RTPLOT
       program: SIMDEM64

Subroutine RTPLOT must be called with a parametric curve of the form R = R(THETA). It then transforms (R,THETA) into (X,Y) and plots the curve (X,Y) space but note that R is returned as Y and THETA as X.

          SUBROUTINE RTPLOT (N, &
                             R, THETA)
          INTEGER,          INTENT (IN)    :: N
          DOUBLE PRECISION, INTENT (INOUT) :: R(N), THETA(N)

        N: Must be > 2
        R: Returned as Y
    THETA: Returned as X

Back to Menu or Subroutines

## Plot a vector field with labels

    subroutine: GKSVF3
       program: SIMDEM69

Simdem can plot a variety of graphical objects that require two sets of coordinates, e.g. the head and tail of an arrow, opposite corners of a rectangle, extreme positions of an ellipse, etc. The arrow type required to define such arrow/line/box type objects is as follows.

     1 Arrow: normal
     2 Arrow: hollow
     3 Arrow: filled
     4 Line: normal
     5 Line: dashed
     6 Line: dotted
     7 Line: dash-dot
     8 Rectangle: slanting, outline
     9 Rectangle: slanting, opaque
     10 Rectangle: slanting, filled
     11 Vector arrow heads
     12 Hook: connecting, bridge
     13 Box: horizontal, outline
     14 Box: horizontal, opaque
     15 Box: horizontal, filled
     16 Arrow: dashed
     17 Symbol: plus sign
     18 Symbol: multiply sign
     19 Symbol: asterisk
     20 Script arrow: solid
     21 Script arrow: dashed
     22 Ellipse: outline
     23 Ellipse: filled
     Otherwise Suppressed

Subroutine GKSVF3 is able to create many styles of vetcor field plots in which every object has a defined position, type, colour, and so on, together with a label if required. This is very useful for displaying phase portraits of differential eaquations where the arrow colour depends on direction and the arrow size on magnitude of a derivative, or as in biplots where the arrow is calculated from the singular value decomposition.

          SUBROUTINE GKSVF3 (IARROW, IKOLOR, JARROW, JCOLOR, LCOLOR, M, &
                             NGKS, &
                             HEAD, SIZE1, X1, X2, X3, Y1, Y2, Y3, &
                             LABEL1, LABEL2, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, GSAVE)
          INTEGER,             INTENT (IN) :: JARROW
          INTEGER,             INTENT (IN) :: IARROW(JARROW), &
                                              IKOLOR(JARROW), JCOLOR, &
                                              LCOLOR, M, NGKS
          DOUBLE PRECISION,    INTENT (IN) :: HEAD(JARROW), SIZE1, &
                                              X1(JARROW), X2(JARROW), &
                                              X3(JARROW), &
                                              Y1(JARROW), Y2(JARROW), &
                                              Y3(JARROW)
          CHARACTER (LEN = *), INTENT (IN) :: LABEL1(*), LABEL2(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL,             INTENT (IN) :: AXES, GSAVE

    IARROW: Type of arrow.
    IKOLOR: Colour of arrow.
    JARROW: Number of arrows.
    JCOLOR: Colour for text.
    LCOLOR: Backgound colour.
         M: Label displacement type (usually 0).
      NGKS: Transformation (usually 0).
      HEAD: Size of arrow head.
     SIZE1: Size of labels and also string displacement factor if M > 0.
        X1: Head.
        X2: Tail.
        X3: Label coordinate.
        Y1: Head.
        Y2: Tail.
        Y3: Label coordinate.
    LABEL1: Label character string.
    LABEL2: Plotting key for subscripts, etc. (see pscodes.pdf).
    PTITLE: Plot title.
    XTITLE: X-legend.
    YTITLE: Y-legend.
    AXES  : Unused.
    GSAVE : Unused.

Back to Menu or Subroutines

## Summary of plotting routines

    subroutines: GKS012 ... plot up to 12 data sets
                 GKST12 ... plot up to 12 transformed data sets
                 GKSCB4 ... plot error bars (no advanced options)
                 GKSHB4 ... plot horizontal error bars
                 TSPLOT ... plot time series data
                 SBPLOT ... plot a stacked bar chart
                 XFONTS ... plot the Simfit font substitution maps
                 RESDEF ... restore Simfit plotting defaults
                 EDITPS ... edit PostScript files and make collages
                 DBPLOT ... plot with LHS and RHS axes (a double plot)
                 GSTYLE ... define/retrieve plot configuration parameters (all)
                 GRFLGL ... define/retrieve plot configuration parameters (advanced)
                 GKSLGL ... define/retrieve plot configuration parameters (simple)
                 SYMCFG ... define/retrieve plot symbols, lines, colours
                 LABCFG ... define/retrieve plot labels, fill styles, colours
                 MFPLOT ... replay a metafile to resume editing
                 DEFKEY ... define/retrieve character configuration keys
                 TSIZES ... define/retrieve font sizes
                 DEFLAB ... define/retrieve arrays of labels or character keys
                 NSTEPS ... define/retrieve groups of data points to be omitted
                 CLOCK1 ... return current clock time in seconds
                 SPACE6 ... plot 3D space curves
        program: SIMDEM70

Some of these routines are difficult to understand by simply reading the argument lists and will be best understood by running the examples provided for SIMDEM70 when using the [Run] command in simdem.exe.

For details of GKS012 see GKS004.

          SUBROUTINE GKS012 ( &
          L1,  L2,  L3,  L4,  L5,  L6,  L7,  L8,  L9,  L10,  L11,  L12, &
          M1,  M2,  M3,  M4,  M5,  M6,  M7,  M8,  M9,  M10,  M11,  M12, &
          N1D, N2D, N3D, N4D, N5D, N6D, N7D, N8D, N9D, N10D, N11D, N12D, &
          X1D, X2D, X3D, X4D, X5D, X6D, X7D, X8D, X9D, X10D, X11D, X12D, &
          Y1D, Y2D, Y3D, Y4D, Y5D, Y6D, Y7D, Y8D, Y9D, Y10D, Y11D, Y12D, &
          PTITLE, XTITLE, YTITLE, &
          AXES, GSAVE)
          INTEGER, INTENT (IN) :: &
          L1,  L2,  L3,  L4,  L5,  L6,  L7,  L8,  L9,  L10,  L11,  L12, &
          M1,  M2,  M3,  M4,  M5,  M6,  M7,  M8,  M9,  M10,  M11,  M12, &
          N1D, N2D, N3D, N4D, N5D, N6D, N7D, N8D, N9D, N10D, N11D, N12D
          DOUBLE PRECISION, INTENT (IN) :: &
          X1D(*), X2D(*), X3D(*), X4D(*),   X5D(*),  X6D(*), &
          X7D(*), X8D(*), X9D(*), X10D(*), X11D(*), X12D(*)
          DOUBLE PRECISION, INTENT (IN) :: &
          Y1D(*), Y2D(*), Y3D(*), Y4D(*),   Y5D(*),  Y6D(*), &
          Y7D(*), Y8D(*), Y9D(*), Y10D(*), Y11D(*), Y12D(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL, INTENT (IN) :: AXES, GSAVE

For details of GKST12 see GKST04.

          SUBROUTINE GKST12 (L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, &
                             L12, &
                             M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, &
                             M12, &
                             N1D, N2D, N3D, N4D, N5D, N6D, N7D, N8D, N9D, &
                             N10D, N11D, N12D, &
                             A, &
                             X1D, X2D, X3D, X4D, X5D, X6D, X7D, X8D, X9D, &
                             X10D, X11D, X12D, &
                             Y1D, Y2D, Y3D, Y4D, Y5D, Y6D, Y7D, Y8D, Y9D, &
                             Y10D, Y11D, Y12D, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, SAVEIT)
          INTEGER, INTENT (IN) :: &
                     L1, L2, L3, L4, L5, L6, L7, L8, L9, L10, L11, L12, &
                     M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, &
                     N1D, N2D, N3D, N4D, N5D, N6D, N7D, N8D, N9D, N10D, &
                     N11D, N12D
          DOUBLE PRECISION, INTENT (IN) :: A
          DOUBLE PRECISION, INTENT (IN) :: &
                           X1D(*), X2D(*), X3D(*), X4D(*), X5D(*), X6D(*), &
                           X7D(*), X8D(*), X9D(*), X10D(*), X11D(*), X12D(*)
          DOUBLE PRECISION, INTENT (IN) :: &
                           Y1D(*), Y2D(*), Y3D(*), Y4D(*), Y5D(*), Y6D(*), &
                           Y7D(*), Y8D(*), Y9D(*), Y10D(*), Y11D(*), Y12D(*)
          CHARACTER, INTENT (IN) :: PTITLE*(*), XTITLE*(*), YTITLE*(*)
          LOGICAL, INTENT (IN) :: AXES, SAVEIT

GKSCB4 is similar to GKSEB4 but has the advanced options disabled, which avoids confusing users when GKSCB4 is used cyclically to generate plots with alternative definitions for calculating error bars.

          SUBROUTINE GKSCB4 (L1, L2, L3, L4, M1, M2, M3, M4, &
                             N1D, N2D, N3D, N4D, &
                             X1D, X2D, X3D, X4D, &
                             YH1D, YH3D, YL1D, YL3D, Y1D, Y2D, Y3D, Y4D, &
                             PTITLE, XTITLE, YTITLE, &
                             AXES, GSAVE)
          INTEGER,             INTENT (IN) :: L1, L2, L3, L4, &
                                              M1, M2, M3, M4, &
                                              N1D, N2D, N3D, N4D
          DOUBLE PRECISION,    INTENT (IN) :: X1D(*), X2D(*), &
                                              X3D(*), X4D(*), &
                                              YH1D(*), YH3D(*), &
                                              YL1D(*), YL3D(*), &
                                              Y1D(*), Y2D(*), &
                                              Y3D(*), Y4D(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE
          LOGICAL,             INTENT (IN) :: AXES, GSAVE

GKSHB4 is similar to GKSEB4 except that the axes are reversed to display horizontal error bars and there are other options dictated by ITYPE to create forest plots and other types of log odds and log odds ratio plots.

          SUBROUTINE GKSHB4 (ITYPE, &
                             L1, L2, L3, L4, M1, M2, M3, M4, &
                             N1D, N2D, N3D, N4D, &
                             X1D, X2D, X3D, X4D, &
                             YH1D, YH3D, YL1D, YL3D, Y1D, Y2D, Y3D, Y4D, &
                             PTITLE, YTITLE, XTITLE, &
                             AXES, GSAVE)

          INTEGER,             INTENT (IN) :: ITYPE, &
                                              L1, L2, L3, L4, &
                                              M1, M2, M3, M4, &
                                              N1D, N2D, N3D, N4D
          DOUBLE PRECISION,    INTENT (IN) :: X1D(*), X2D(*), X3D(*), X4D(*)
          DOUBLE PRECISION,    INTENT (IN) :: YH1D(*), YH3D(*), YL1D(*), &
                                              YL3D(*)
          DOUBLE PRECISION,    INTENT (IN) :: Y1D(*), Y2D(*), Y3D(*), Y4D(*)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE(2), XTITLE(2), &
                                              YTITLE(2)
          LOGICAL,             INTENT (IN) :: AXES, GSAVE

    ACTION: Call GKS as for GKSEB4 except as follows:
            ITYPE = 0: no transformation
            ITYPE = 1: y to log base e of y
            ITYPE = 2: y to log base 10 of y

Subroutine TSPLOT can create time series plots in a wide variety of formats as dictated by ISEND.

          SUBROUTINE TSPLOT (ISEND, LVEC, MVEC, NVEC, &
                             DELTA, ERROR1, ERROR2, START, XVEC, &
                             PTITLE, XTITLE, YTITLE)
          INTEGER,             INTENT (IN) :: ISEND, LVEC, MVEC, NVEC
          DOUBLE PRECISION,    INTENT (IN) :: DELTA, ERROR1(NVEC), &
                                              ERROR2(NVEC), START, &
                                              XVEC(NVEC)
          CHARACTER (LEN = *), INTENT (IN) :: PTITLE, XTITLE, YTITLE

     ISEND = 1: Ask for delta, start, then time series type plot.
                This line-joins Y = XVEC at chosen intervals.
     ISEND = 2: Assign DELTA, START, then time series type plot.
                This line-joins Y = XVEC at specified intervals
     ISEND = 3: Ask for DELTA, START, then rod type plot.
                This plots Y = XVEC as rods at chosen intervals.
     ISEND = 4: DELTA, START defaults, then rod type plot.
                This plots Y = XVEC as rods at specified intervals.
     ISEND = 5: DELTA, START defaults, then autocorrelation type plot.
                The zero point is added.
     ISEND = 6: DELTA, START defaults, then autocorrelations plus errors.
                The zero point is added.
      LVEC = Linetype.
      MVEC = Symbol type.
      NVEC = Number of XVEC values.
     DELTA = Increment (only used if ISEND = 2).
    ERROR1 = Error limits (only used if ISEND = 6).
    ERROR1 = Error limits (only used if ISEND = 6).
     START = Start value (only used if ISEND = 2).
      XVEC = Values (isend = 1, 2) or correlations (ISEND = 3).
    PTITLE = Plot title.
    XTITLE = X-legend.
    YTITLE = Y-legend.

Subroutine SBPLOT is like BCPLOT except that the bar chart has stacked bars instead of groups of side-by-side bars.

          SUBROUTINE SBPLOT (ISEND, NCOL, NRMAX, NROW, &
                             XMAT, &
                             LABELS, TITLES)
          INTEGER,             INTENT (IN) :: ISEND, NCOL, NRMAX, NROW
          DOUBLE PRECISION,    INTENT (IN) :: XMAT(NRMAX,NCOL)
          CHARACTER (LEN = *), INTENT (IN) :: LABELS(NROW), TITLES(4)

Subroutine XFONTS has no arguments but it displays the font substitution maps that Simdem can use for subscripts, superscripts, accents, and maths symbols.

Subroutine RESDEF restores the default graphics parameters and is intended to be used as part of a clean up operation after users have redefined the defaults using subroutines demonstrated in SIMDEM70. It makes sure all the plotting parameters are intialised and it also restores plot style parameters to those set by GSTYLE and stored in w_graphs.cfg

          SUBROUTINE RESDEF (ITYPE)
          INTEGER, INTENT (IN) :: ITYPE

    ITYPE = 0: menu
    ITYPE = 1: simple graphics
    ITYPE = 2: advanced graphics
    ITYPE = 3: labels, panels, and keys
    ITYPE = 4: lines and symbols
    ITYPE = 5: As 1, 2, 3, 4, plus NSTEPS = 0, and font sizes

The subroutine EDITPS that is demonstrated in SIMDEM70 takes no arguments but merely sets up the interface to subroutine EDITPS_DRIVER so it can find the demonstration *.tfl and *.eps files. EDITPS_DRIVER is a user-callable interface to a DLL version of the Simfit program w_editps.exe that can edit PS files, and make structured or arbitrary collages from Simfit *.eps files. Subroutine EDITPS_DRIVER can do a limited number of things with arbitrary *.eps files but only has full functionality with Simfit *.eps files that have the standard default size and orientation.

Subroutine DBPLOT is a special version of SMPLOT that allows a double axis plot where files identified by LEFT_AXIS(i) = .TRUE. are plotted on a LHS Y-axis and files with LEFT_AXIS(i) = .FALSE. are plotted using a scale defined by a RHS Z-axis.

          SUBROUTINE DBPLOT (JFILES, LFILES, MFILES, NFILES, &
                             FILES, TITLES, &
                             LEFT_AXIS)
          INTEGER,             INTENT (IN) :: NFILES
          INTEGER,             INTENT (IN) :: JFILES(NFILES), &
                                              LFILES(NFILES), &
                                              MFILES(NFILES)
          CHARACTER (LEN = *), INTENT (IN) :: FILES(NFILES), TITLES(4)
          LOGICAL,             INTENT (IN) :: LEFT_AXIS(NFILES)

Subroutine GSTYLE retrieves plotting parameters from w_graphics.cfg and, if called with STORE = .TRUE., it displays a control to set values interactively. It can be used to retrieve or store both advanced and simple 2D graphics configuration parameters.

          SUBROUTINE GSTYLE (N, &
                             LA, LS, STORE)
          INTEGER, INTENT (IN)  :: N
          LOGICAL, INTENT (IN)  :: STORE
          LOGICAL, INTENT (OUT) :: LA(N), LS(N)

        N: Dimension of LA and LS.
       LA: Advanced logicals.
       LS: Simple logicals.
    STORE: STORE = .FALSE. then just retrieve current values.
           STORE = .TRUE. then display check box to change defaults and
                          return the new defaults.
    it is assumed that there will only be up to 10 simple parameters and
    up to NMAX advanced parameters. The configuration file w_graphs.cfg
    allows up to at least 15 parameters as follows.
    LA(1)  BOXIT      ... box round data plotted
    LA(2)  FRAME      ... frame round outside edge of diagram
    LA(3)  OFFSET     ... offset intersection of axes at origin
    LA(4)  XGRID      ... grid marks at X-axis tick marks
    LA(5)  YGRID      ... grid marks at Y-axis tick marks
    LA(6)  XHAIRS     ... extra axes intersecting at (0,0)
    LA(7)  TICK MARKS ... .TRUE. = in (KTIC = 3), .FALSE. = out (KTIC = 1)
    LA(8)  Display an information panel
    LA(9)  Panel at RHS of plot
    LA(10) Display line-types in panel
    LA(10) Display symbol-types in panel
    LA(12) Border round plot
    LS(1)  BOXIT      ... box round data plotted
    LS(2)  FRAME      ... frame round outside edge of diagram
    LS(3)  OFFSET     ... offset intersection of axes at origin
    LS(4)  XGRID      ... grid marks at X-axis tick marks
    LS(5)  YGRID      ... grid marks at Y-axis tick marks
    LS(6)  XHAIRS     ... extra axes intersecting at (0,0)
    LS(7)  TICK MARKS ... .TRUE. = in (KTIC = 3), .FALSE. = out (KTIC = 1)

Subroutine GRFLGL can store or retrieve plotting parameters for advanced 2D graphics. Data are stored in w_graphics.cfg.

          SUBROUTINE GRFLGL (ISEND, NLGL, &
                             VARLGL)
          INTEGER, INTENT (IN)    :: ISEND, NLGL
          LOGICAL, INTENT (INOUT) :: VARLGL(NLGL)

     ISEND: ISEND = 1: install defaults.
            ISEND = 2: set defaults from menu.
            ISEND = 3: retrieve current defaults.
      NLGL: must be >= 7.
    VARLGL: control advanced graphics as follows
     (1) Box round data plotted                 ... default = .true.
     (2) Frame round outside of figure          ... default = .false.
     (3) Offset X, Y axes                       ... default = .true.
     (4) Grid at X-tic marks parallel to Y axis ... default = .false.
     (5) Grid at Y-tic marks parallel to X axis ... default = .false.
     (6) Cross hairs at 0,0 if in range         ... default = .false.
     (7) Tick marks pointing in                 ... default = .true.
     (8) Display information panel              ... default = .false.
     (9) Information panel at side              ... default = .false.
    (10) Display lines in panels                ... default = .true.
    (11) Display symbols in panels              ... default = .true.
    (12) Information panel at side              ... default = .false.

Subroutine GKSLGL can store or retrieve plotting parameters for simple 2D graphics. Data are stored in w_graphics.cfg.

         SUBROUTINE GKSLGL (ISEND, NLGL, &
                            VARLGL)
          INTEGER, INTENT (IN)    :: ISEND, NLGL
          LOGICAL, INTENT (INOUT) :: VARLGL(NLGL)

    ISEND: ISEND = 1: install defaults
           ISEND = 2: set defaults from menu
           ISEND = 3: retrieve current defaults
      NLGL: must be >= 7
    VARLGL: control simple graphics as follows
    (1) Box round data plotted                 ... default = .true.
    (2) Frame round outside of figure          ... default = .false.
    (3) Offset X, Y axes                       ... default = .true.
    (4) Grid at X-tic marks parallel to Y axis ... default = .false.
    (5) Grid at Y-tic marks parallel to X axis ... default = .false.
    (6) Cross hairs at 0,0 if in range         ... default = .false.
    (7) Tick marks pointing in                 ... default = .true.

Subroutine SYMCFG is a user friendly interface to configure symbols, colours, line types, symbol sizes and line thicknesses for advanced 2D graphics. The configuration parameters referenced by this subroutine are stored in w_symbol.cfg.

          SUBROUTINE SYMCFG (ISEND, JCOLOR, KCOLOR, L, M, N, &
                             SIZES, THICK)
          INTEGER,          INTENT (IN)    :: ISEND, N
          INTEGER,          INTENT (INOUT) :: JCOLOR(N), KCOLOR(N), &
                                              L(N), M(N)
          DOUBLE PRECISION, INTENT (INOUT) :: SIZES(N), THICK(N)

     ISEND: ISEND = 1 ... retrieve current defaults   ... return new values.
            ISEND = 2 ... edit defaults interactively ... return new values.
            ISEND = 3 ... restore built-in defaults   ... return new values.
            ISEND = 4 ... over-write current defaults ... use values supplied.
    JCOLOR: Symbol colours.
    KCOLOR: Feature colours.
         L: Line styles.
         M: Symbol styles.
         N: Dimension.
     SIZES: Symbol sizes.
     THICK: Line thicknesses.

Subroutine LABCFG is a user friendly interface to configure colours, fill styles, segment/bar/plot labels and information panel labels for 2D advanced graphics. The configuration parameters referenced by this subroutine are stored in w_labels.cfg.

          SUBROUTINE LABCFG (ISEND, JCOLOR, JFILL, N, &
                             LABEL, PANEL)
          INTEGER,             INTENT (IN)    :: ISEND, N
          INTEGER,             INTENT (INOUT) :: JCOLOR(N), JFILL(N)
          CHARACTER (LEN = *), INTENT (INOUT) :: LABEL(N), PANEL(N)

     ISEND: ISEND = 1 ... retrieve current defaults   ... return new values.
            ISEND = 2 ... edit defaults interactively ... return new values.
            ISEND = 3 ... restore built-in defaults   ... return new values.
            ISEND = 4 ... over-write current defaults ... use values supplied.
    JCOLOR: Colours.
     JFILL: Fill styles.
         N: Dimension.
     LABEL: Piechart segment or barchart labels.
     PANEL: Information panel labels.

Subroutine MFPLOT replays a metafile that has been saved using the [Config] option from the Simfit advanced graphics procedure. Such metafiles contain a list of all graphics parameters and data so that the graph can be restored for printing, transforming to graphics files or to resume editing.

          SUBROUTINE MFPLOT

Subroutine DEFKEY can be used to install a new character key or retrieve a stored character key, where the character key controls the way a character string is displayed and printed in 2D advanced graphics. Each character string has an associated character key to specify subscripts, superscripts, maths font, etc. as explained in the Simfit reference manual and the document psfonts.pdf. Usually JSEND would be in the range 1 to 6 for titles, 1 to 20 for information panels and 1 to 2000 for other labels. Note that when ISEND = 1 the case JSEND = 6 refers to the subsidiary title character string, not the key which is JSEND = 5. When STORE = .TRUE. DEFKEY does not alter the default values stored in w_labels.cfg.

          SUBROUTINE DEFKEY (ISEND, JSEND, &
                             KEY, &
                             STORE)
          INTEGER,             INTENT (IN)    :: ISEND, JSEND
          CHARACTER (LEN = *), INTENT (INOUT) :: KEY
          LOGICAL,             INTENT (IN)    :: STORE

    ISEND: ISEND = 1: Titles as follows
                      JSEND = 1: main title font-key.
                      JSEND = 2: x-legend font-key.
                      JSEND = 3: y_legend font-key.
                      JSEND = 4: z-legend font-key.
                      JSEND = 5: subsidary title font-key.
                      JSEND = 6: subsidary title string.
           ISEND = 2: Information panels.
           ISEND = 3: Arbitrary labels.
           isend = 4: X_tic labels.
    JSEND: Index for the key except for the case ISEND = 1.
      KEY: Character configuration key.
    STORE: STORE = .TRUE. then archive the value supplied.
           STORE = .FALSE. then retrieve the archived value.

Subroutine TSIZES can be called to make a temporary change to the size of font used when plotting in 2D advanced graphics. All the font size are initialised to 1 on startup but this can be altered interactively by editing the value in w_ps.cfg using the [PS] or [Win] button when the plot is displayed.

          SUBROUTINE TSIZES (ITYPE, &
                             FSIZE, &
                             STORE)
          INTEGER,          INTENT (IN)    :: ITYPE
          DOUBLE PRECISION, INTENT (INOUT) :: FSIZE
          LOGICAL,          INTENT (IN)    :: STORE

    ITYPE: Type of font required as follows
            1: title (main)
            2: X-legend
            3: Y-legend
            4: Z-legend
            5: X-text-labels
            6: Y-text-labels
            7: Z-text-labels
            8: bar chart labels
            9: pie chart labels
           10: panel labels
           11: data point labels
           12: title (extra)
           13: x-axis numbers
           14: y-axis numbers
           15: z-axis numbers
    FSIZE: Font size.
           STORE = .TRUE. then install
           STORE = .FALSE. then just return the stored value
    STORE: Type of action required as above.

Subroutine DEFLAB provides a convenient mechanism for setting or retrieving sets of N labels or N character keys for 2D advanced graphics, where N is less than or equal to 20. When STORE = .TRUE. DEFLAB alters the default values stored in w_labels.cfg.

          SUBROUTINE DEFLAB (ISEND, N, &
                             TEXT, &
                             STORE)
          INTEGER,             INTENT (IN)    :: ISEND, N
          CHARACTER (LEN = *), INTENT (INOUT) :: TEXT(N)
          LOGICAL,             INTENT (IN)    :: STORE

    ISEND: ISEND = 1 ... use/install default plot-labels.
           ISEND = 2 ... use/install default panel-labels.
           ISEND = 3 ... use/install default plot-label keys.
           ISEND = 4 ... use/install default panel-label keys.
           ISEND = 5 ... use/install default X_tic labels.
           ISEND = 6 ... use/install default X_tic label keys.
     TEXT: ISEND = 1 ... contains/returns default plot-labels.
           ISEND = 2 ... contains/returns default panel-labels.
           ISEND = 3 ... contains/returns default plot-label keys.
           ISEND = 4 ... contains/returns default panel-label keys.
           ISEND = 5 ... contains/returns default X_tic labels.
           ISEND = 6 ... contains/returns default X_tic label keys.
    STORE: STORE = .TRUE. store TEXT.
           STORE = .FALSE. retrieve TEXT.

Subroutine NSTEPS can be used when there exist very large data sets and it would be convenient to omit groups of NSTEP data points. Typically this could occur where plotting of machine-generated data is required to have all points joined by lines to display a continuous curve, but only a few points to be plotted as symbols so that the data can be identified. If a value of NSTEP > 0 is requested for a particular line or symbol, then intermediate groups of NSTEP data ponts will be suppresed, i.e. stepped over for that file. Note that the first and last data points are always plotted and any NSTEP values < 0 are re-set to 0.

          SUBROUTINE NSTEPS (ISEND, L_STEP, M_STEP, NFILES)
          INTEGER, INTENT (IN)    :: ISEND, NFILES
          INTEGER, INTENT (INOUT) :: L_STEP(NFILES), M_STEP(NFILES)

     ISEND: ISEND = 1 ... retrieve current values
            ISEND = 2 ... interactive control then return new values
            ISEND = 3 ... install new defaults using values supplied
            ISEND = 4 ... restore original defaults (all = 0)
    L_STEP: NSTEP values for lines
    M_STEP: NSTEP values for symbols
    NFILES: Number of current files for plotting

          SUBROUTINE CLOCK1 (TIME)
          DOUBLE PRECISION, INTENT (OUT) :: TIME

    TIME: This is the current clock time in seconds, as is required to
          calculate the time taken for a process by subtracting TIME
          at the start of the process from TIME at the end of the process.

          SUBROUTINE SPACE6 (NFILES, &
                             FNAME, &
                             PLOT_ARROWS, &
                             PLOT_LABELS, &
                             PLOT_LINES, &
                             PLOT_PERPENDICULARS, &
                             PLOT_SYMBOLS)
          INTEGER,             INTENT (IN)    :: NFILES
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAME(NFILES)
          LOGICAL,             INTENT (IN)    :: PLOT_ARROWS, &
                                                 PLOT_LABELS, &
                                                 PLOT_LINES, &
                                                 PLOT_PERPENDICULARS, &
                                                 PLOT_SYMBOLS

    ACTION: Draw one or several 3D space curves, scatter plots, or biplots

Back to Menu or Subroutines

## Configure the Simfit DLLs

    subroutine: CONFIG
       program: SIMDEM40

Subroutine CONFIG is used to configure the Simfit DLLs. This is very important if you want to control paths for printers, etc. Details are taken from and written to the Simfit configuration file w_simfit.cfg. Details are in the documents configure.txt and linux.txt. Simdem users should press [Check] to correct the paths to auxiliaries then [Apply] to overwrite the installation defaults.

          SUBROUTINE CONFIG (MODE, NVAL, &
                             CVAL)
          INTEGER,             INTENT (IN)    :: MODE
          INTEGER,             INTENT (INOUT) :: NVAL(12)
          CHARACTER (LEN = *), INTENT (INOUT) :: CVAL(12)

    MODE: MODE = 0: just return arguments silently
          MODE = 1: set the arguments interactively
    NVAL: Integer arguments
    CVAL: Character arguments

Back to Menu or Subroutines

## Print a text file

    subroutine: FPRINT
       program: SIMDEM45

Subroutine FPRINT opens the Windows printer dialogue and allows users to copy selected text files to the printer. This version will not attempt to print Postscript or PDF files, or any special file types with standard extensions, like, .bat, .com, .exe, .dll, etc.

          SUBROUTINE FPRINT (LPTI, &
                             FNAME)
          INTEGER,            INTENT (IN) :: LPTI
          CHARACTER (LEN = *) INTENT (IN) :: FNAME

     LPTI: Parallel port, usually l.
           Note: In this version LPTI is not referenced but should
                 be set equal to 1 in order to print to all types
                 of remote and local printers.
    FNAME: File name of a text file.

Back to Menu or Subroutines

## Matrix read/write procedures

    subroutines: MAT2IN, ISITMF, MATOUT
        program: SIMDEM66

Subroutine MAT2IN would usually be called to read in a matrix X from FNAME that has been checked to be a valid Simfit data file, e.g. by a previous call to ISITMF.
See simdem66, simdem67, and simdem68 in order to appreciate how to use ISITMF, MATTRN, MAT2IN, MAT3IN, and MAT4IN to create a fully featured scheme for supplying defaults, re-using data, editing then re-analysing, etc.

          SUBROUTINE MAT2IN (NIN, NCMAX, NCOL, NRMAX, NROW, &
                             X, &
                             FNAME, TITLE, &
                             ABORT)
          INTEGER,             INTENT (IN)    :: NIN, NCMAX, NRMAX
          INTEGER,             INTENT (INOUT) :: NCOL, NROW
          DOUBLE PRECISION,    INTENT (INOUT) :: X(NRMAX,NCMAX)
          CHARACTER (LEN = *), INTENT (OUT)   :: FNAME, TITLE
          LOGICAL,             INTENT (OUT)   :: ABORT

      NIN: Unconnected unit for data input.
    NCMAX: Maximum column dimension for X.
     NCOL: Actual number of columns.
    NRMAX: Maximum row dimension for X.
     NROW: Actual number of rows.
        X: Data matrix.
    FNAME: Filename.
    TITLE: Data title.
    ABORT: Error indicator.

Subroutine ISITMF is provided to test if a named file is a matrix file in acceptable Simfit format. If the file is satisfactory NCOL and NROW are output as the column and row dimensions of the matrix. Otherwise NCOL and NROW are output as less than or equal to zero as described below.

          SUBROUTINE ISITMF (NCOL, NROW, &
                             FNAME)
          INTEGER,             INTENT (OUT) :: NCOL, NROW
          CHARACTER (LEN = *), INTENT (IN)  :: FNAME

     NCOL: Output as =< 0 for error, or else number of columns > 0 if OK
     NROW: Output as =< 0 for error, or else number of rows > 0 if OK
    FNAME: File to be analysed

    Error values: NCOL NROW
                   -1   -1 ... file does not exist
                   -2   -2 ... file cannot be opened
                   -3   -3 ... title cannot be read
                   -4   -4 ... header dimensions cannot be read
                   -5   -5 ... file does not have n*m values

          SUBROUTINE MATOUT (ISEND, NCOL, NOUT, NRMAX, NROW, NTEXT, &
                             A, &
                             FNAME, TEXT, TITLE, &
                             ABORT, HEADER, QTEXT, QTITLE)
          INTEGER,             INTENT (IN)    :: ISEND, NCOL, NOUT, NRMAX, &
                                                 NROW, NTEXT
          DOUBLE PRECISION,    INTENT (IN)    :: A(NRMAX,NCOL)
          CHARACTER (LEN = *), INTENT (IN)    :: TEXT(NTEXT)
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAME, TITLE
          LOGICAL,             INTENT (OUT)   :: ABORT
          LOGICAL,             INTENT (IN)    :: HEADER, QTEXT, QTITLE

    ACTION: Write a matrix to a data file as follows:-

     ISEND: if 1, User supplies filename at terminal, then OPEN new file
            if 2, Filename as argument to subroutine, then OPEN new file
            if 3, File named FILENAME already opened on unit NOUT
      NCOL: column size >= 1
      NOUT: unit that must be connected if ISEND = 3
     NRMAX: leading dimension
      NROW: row size >= 1
     NTEXT: text size >= 1
         A: data matrix
     FNAME: file name
      TEXT: trailing text
     TITLE: title
     ABORT: error indicator
    HEADER: if .TRUE. add header and trailing text
     QTEXT: if .TRUE. ask for text , otherwise use TEXT supplied
    QTITLE: if .TRUE. ask for title, otherwise use TITLE supplied

Back to Menu or Subroutines

## Matrix editing and transforming

    subroutine: MATTRN
       program: SIMDEM67

Subroutine MATTRN accepts a matrix but then returns it transformed. The output matrix will have the same number of rows and columns as the input matrix, but the title may be altered on exit if ISEND is not equal to 4.
See simdem66, simdem67, and simdem68 in order to appreciate how to use ISITMF, MATTRN, MAT2IN, MAT3IN, and MAT4IN to create a fully featured scheme for supplying defaults, re-using data, editing then re-analysing, etc.

          SUBROUTINE MATTRN (ISEND, NCOLS, NRMAX, NROWS, &
                             A, &
                             TITLE)
          INTEGER,             INTENT (IN)    :: ISEND, NCOLS, NRMAX, NROWS
          DOUBLE PRECISION,    INTENT (INOUT) :: A(NRMAX,NCOLS)
          CHARACTER (LEN = *), INTENT (INOUT) :: TITLE

    ISEND: ISEND = 1: columns only.
           ISEND = 2: rows only.
           ISEND = 3: columns and rows.
           ISEND = 4: columns and rows but do not ask for new title.
    NCOLS: Number of columns in A.
    NRMAX: Leading dimension of A.
    NROWS: Number of rows in A.
        A: Matrix supplied is returned transformed.
    TITLE: Data title.

Back to Menu

## Matrices defaults of arbitrary size

    subroutines: MAT3IN, MAT4IN, CHOP80
        program: SIMDEM68

Subroutine MAT3IN allows comprehensive control over the input of a matrix from a file, from the clipboard, or from the console.
See simdem66, simdem67, and simdem68 in order to appreciate how to use ISITMF, MATTRN, MAT2IN, MAT3IN, and MAT4IN to create a fully featured scheme for supplying defaults, re-using data, editing then re-analysing, etc.

          SUBROUTINE MAT3IN (ISEND, NCOL, NIN, NROW, &
                             FNAME, TITLE, &
                             ABORT, FIXCOL, FIXROW, LABEL)
          INTEGER,             INTENT (INOUT) :: ISEND
          INTEGER,             INTENT (IN)    :: NIN
          INTEGER,             INTENT (INOUT) :: NCOL, NROW
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAME, TITLE
          LOGICAL,             INTENT (IN)    :: FIXCOL, FIXROW, LABEL
          LOGICAL,             INTENT (OUT)   :: ABORT

     ISEND: ISEND = 1: user inputs TITLE etc. and ISEND is unchanged
            ISEND = 2: TITLE etc. from file and ISEND is unchanged
            OTHERWISE: user chooses mode and ISEND is returned as 1 or 2
      NCOL: Size of X as follows
             FIXCOL = .TRUE. then NCOL is unchanged
             FIXCOL = .FALSE. then NCOL is arbitrary
       NIN: Unconnected unit for data input
            Note: if an existing file is successfully opened, then NIN is
                  returned connected for further reading. Otherwise NIN is
                  closed on exit
      NROW: Size of X as follows
            FIXROW = .TRUE. then NROW is unchanged
            FIXROW = .FALSE. then NROW is arbitrary
     FNAME: ISEND = 1: file supplied by user (unchanged)
            OTHERWISE: temporary file name like matrix_k.tmp
     TITLE: ISEND = 1: read off file
            OTHERWISE: returned depending on LABEL
     ABORT: Error indicator
    FIXCOL: FIXCOL = .TRUE. return exactly NCOL data points
            FIXCOL = .FALSE. then return arbitrary NCOL data points
    FIXROW: FIXROW = .TRUE. return exactly NROW data points
            FIXROW = .FALSE. then return arbitrary NROW data points
     LABEL: As follows if data are to be typed in
            LABEL = .TRUE. then the user supplies a title
            LABEL = .FALSE. a temporary title is supplied

Subroutine MAT4IN displays a menus with numerous possibilities for matrix analysis. It does not change NCOL and NROW and only returns ABORT = .TRUE. if there are no appropriate data, or the user has selected Cancel to abort further calculations. It does not set ABORT = .TRUE. if the user fails to read in data as it will just leave any existing data unchanged. This involves the use of X and Y so it is important that NRMAX >= NROW. NEWDAT is returned as .TRUE. only if new data are requested. If data are edited then a new file and title are created.
See simdem66, simdem67, and simdem68 in order to appreciate how to use ISITMF, MATTRN, MAT2IN, MAT3IN, and MAT4IN to create a fully featured scheme for supplying defaults, re-using data, editing then re-analysing, etc.

          SUBROUTINE MAT4IN (NCMAX, NCOL, NRMAX, NROW, &
                             A, &
                             FNAMEA, HEADER, TITLEA, &
                             ABORT, NEWDAT)
          INTEGER,             INTENT (IN)    :: NCMAX, NCOL, NRMAX, NROW
          DOUBLE PRECISION,    INTENT (INOUT) :: A(NRMAX,NCMAX)
          CHARACTER (LEN = *), INTENT (IN)    :: HEADER
          CHARACTER (LEN = *), INTENT (INOUT) :: FNAMEA, TITLEA
          LOGICAL,             INTENT (OUT)   :: ABORT, NEWDAT

     NCMAX: Maximum column dimension
      NCOL: Column dimension
     NRMAX: Maximum row dimension
      NROW: Row dimension
         A: Sample (may be edited)
    FNAMEA: File name (may be changed)
    HEADER: Header for menu
    TITLEA: Title
     ABORT: Error indicator
    NEWDAT: Requests new data

          SUBROUTINE CHOP80 (LINE)
          CHARACTER (LEN = *), INTENT (INOUT) :: LINE

    LINE: This is typically a long title that is trimmed so that the
          left-most 80 characters are the first characters of the title,
          in order to avoid overflow when writing character strings to output
          devices and files. There are also routines CHOP40, and CHOP60.

Back to Menu or Subroutines