Return to MTsort guide base window
The sort setup window presents a graphical interface to organise and hopefully simplify the task of creating a sort program.

To setup a sort you need to create a sort language description file. This is a text file that satisfies the syntax described in the Sort Language Manual ("Return to MTsort guide base window" and select "Language Manual"). These text files are normally kept in the directory ~/sortfiles.

Compile sortfile

The button labelled "Compile sortfile" causes the chosen sortfile to be processed into the many files needed to run the sort. These files are normally stored in the directory ~/sortdirs/.

The listbox to the upper right of the window can be toggled between listing sortfiles and sort directories.

The results of a compilation are presented in two places. The sort compiler processes the sortfile and generates C code. If there are any problems with the sort file syntax, warning and error messages appear in the text window occupying the lower half of the setup window.

If the sort compiler finds no errors, then the resulting C source is compiled. If there are any compilation errors produced by this stage, then they may be seen by clicking on the "View compiler messages" button.

If the sort compilation is successful, you will see a message saying so in the lower text window,
and the "Setup status:" message will say "OK".

The "Setup Status" will also indicate if the sortfile has been compiled for a different machine architecture, or a previous non-compatible version of the sort compiler. In either of these cases, a compile will correct the bad status.

With the correct sortfile shown in the "Sortfile:" box, and a "Setup status:" saying "OK" , the sort can be executed by clicking on the "run sort program" button.

Optional User Library

User written routines can be included in a sort program. These must be specified by name in the USER or EXEC commands in the sort description file, and a C routine of the same name compiled and placed in either an object file (.o) or a library (.a). The full path name of the file must be entered into the "optional user library" field of the setup window.

On Linux, for example, the relevant commands might be ..

gcc -c user.o user.c
ar rcvs libuser.a user.o

Users must make sure that the included object file or library does not include routine or variable names that would conflict with ones in the sort.
i.e. there should be no visible routine or variable name other than the routine name(s) of the user supplied routine(s).
The library may contain several user functions, but all other routines and variables should be defined as static.

The path name entered in the setup window is kept with the sort directory, and should not need to be entered if re-compiled.

User Routine example

int myuser(short *sortword) { return(0); }


Maintained by Janet Sampson and John Cresswell (University of Liverpool)
Email to support@ns.ph.liv.ac.uk