Creating and Working with Executable Programs

Simply put, an executable program (EP) is a program that when clicking on it, the operating system can run it without using another executable program. It is usually a file that ends with extension “.exe”. And also, one of the major aspects of EP run is that usually it uses libraries that are linked to it dynamically (DLL).

Till enables the programmer to convert any Till program into an EP, that will be referred as Till executable program (TEP). It is done in the Till Launcher by setting the state of the two toggle buttons “foreground application” and “fast execution”, and clicking “CREATE EXECUTABLE”.

Say we have this (file based) text inverter program “textinv.file.till”:

  1. “l” gets length of list “cs” (essentially number of items), that gets all characters in file “TEXT”
  2. “invt” aggregates all inverted text
  3. loop over decreasing values of “l” and add the item of “cs” in position “l” to “invt”
  4. write the result to file “INVTEXT”

First, let’s make a background EP from the program using Till Launcher. Load the program with Till Launcher. Set EP buttons “foreground” and “fast” to OFF (actually, since there is no interactivity in the code, it is possible to set button “fast” to ON, which will automatically set “foreground” to OFF), and “CREATE EXCUTABLE”. It will create program “textinv.file.exe” (TI).

Till provides the Till Utility, which is an EP “till.exe”, also referred as till. With till you can handle Till programs, including creating a Till executable program.

To create TI with Till Utility, run (in console):

The benefit of using the utility is that when we load the program in Till Launcher, it is run automatically, but the utility just creates the EP.

To invert text, first create file “TEXT” and put there the text to be inverted. Then, run TI. The program will create (or update) file “INVTEXT” with the result.

EPs have input/output mechanism and Till System supports it by system functions “in” and “out”. EP arguments can be retrieved by using “in” with their appropriate zero-based-index. System function “in” returns a record that its keys are the indexes, and the values are the incoming arguments.

  1. “firstarg” gets the first incoming argument, otherwise it will be NULL
  2. if “firstarg” is not NULL, continue with program action

System function “out” outputs text to the output stream. It is effective only in EPs. Each time “out” is called, the EP will output the message:

  1. loop ten times and output the index

In this way the EP acts as a black box that gets data, does work and outputs a result.

Let’s modify “textinv.file.till” to “textinv.till” and create the EP “textinv.exe” (TI):

  1. “text” gets first incoming argument or NULL
  2. if NULL then break (since the break is in the module level, the program will terminate, otherwise, use system function “exit”)
  3. continue text inversion process
  4. output “invt”

Now we can use TI like this (in console):

TI can be used by Till Process Module as seen in “textinv.app.till”:

In function “inverttext” we run the TI by Till Process and get the result.

Note that this is merely an example of using EP and in practice it is used to do (complicated) tasks that mainly need to be separated from the application or be used by a program that is written in another programming language.

Foreground and Background Applications

Applications that need to show messages or interact with the user, need a user interface (UI). These applications are called foreground applications. Similar to any software that upon running shows an interactive UI, whenever a TEP is run, Till Runner is shown and interacts with the user.

Applications that do their task without interacting with the user, and hence do not need a UI, are called background applications. Nonetheless, they will activate Till Runner as a background process for handling their task.

Fast Applications

Applications that do not need to interact with the user and do not have delays while running are called fast applications. Whenever the developer chooses this option, the system automatically will designate the application also as a background application.

When an application is running as a fast application, it will forego all UI activities and will do only background work like calculations, file system management, Till storage management, specialized Till system modules tasks and debugging.