The code of lt application is split into different C source and header files. The most relevant files are the following:
- main.c It is the main file present in all C programs. It calls the routines that set up the variables and the USB port, and it starts the main loop that catches the events of the application by running the function RunApplicationEventLoop().
- ltdata.c and ltdata.h These two files define the structure of data that contains the variables used by the code, as well as the routines that initiate and give the default values to the variables. The main structure of data is called Data which has several substructures such as,
- Control, which holds the variables related to the event handling (e.g., keymap, mouse sensitivity, etc.);
- Instrument, which contains all the status variables of the instrument (calibration factors, running protocol);
- Quicktime, which stores all the experimental data (distance, force);
- FileData, which holds the data file parameters (file name, writing speed);
- ltcontrol.c and ltcontrol.h These files contain the routines that allow the application to communicate with the electronic controller, run the experimental protocols and dispatch the events. The most important routine is ControlEvent().
- ltosx.c and ltosx.h These files contain the Mac OSX functions that set up the event-handling of the application. The application has two types of events: 1) triggered by the user or 2) triggered by a timer. The first kind of event is handled by routines such as AppEventHandler(), while IdleTimer() is an example of the second kind.
- ltopengl.c and ltopengl.h All the OpenGL windows that plot data and their rendering are defined here. Each window has its own data structure called RecContext (for recreation context) and the rendering is performed by the routine DrawGL().
- ltFileIO.c and ltFileIO.h All the routines related to the input and output files are defined here. Output files are mainly data and comment files. Input files are the calibration file and preferences file (i.e., user defined). The routine ltFileIO() does all these tasks.
- ltposix.c and ltposix.h These files contain the routines that use the POSIX library to set up a thread that communicates with the USB port (i.e., the electronic controller). The most important routine is the InstrumentTask().
- main.nib It is a Mac specific file that contains the information to create the graphical interface of the applications (menu bar, windows, etc.).