# Experix

Experix is an open-source command interpreter designed for operating laboratory equipment, especially data acquisition devices, and processing, displaying and storing the data from them. It is usable now, only under Linux on the x86 architecture, but still under development, and users are welcome to participate in extending and improving it.
Experix is radically different from most commercial data acquisition programs, for example LabVIEW, which model a measurement and control application as a network of operational units represented graphically as boxes with connections that stand for data flow. In these systems an application is created by manipulating these symbols on the screen, and then it is used by clicking buttons and filling dialog boxes in a GUI environment.
Experix, in contrast, represents the application as a series of operations generally taking place one after another. It processes a command line in a sequential way, and numbers, operators, functions and commands in the command line consume and create objects on a stack. These objects include integers and floating-point numbers in several sizes, complex and polar numbers, multi-dimensional arrays made from any of the numerical types, several kinds of strings, and pointers to functions, commands and variables (which can be numbers, arrays and strings). A function, command or operator requires certain types of objects on the stack and puts objects on the stack, and may also change values in stack objects and variables, draw graphs, order operations in device drivers, and read and write files.
Experix is released under the GNU GPL.

## Syntax

A command line can have practically arbitrary length, and is a series of tokens. For example, .01 1000 ]+ \c .sin * graph/yK function1= would create an array of 1000 double-precision values representing the function j*0.01*sin(j*.01) for j from 0 to 999; draw a graph of that using black points on a yellow background; and copy that array into a variable called function1. This sample of command tokens will give an idea of the range of capabilities that experix has.
* 123e4 puts the double-precision number 1.23*10^6 on the stack
* #x5a1 puts the integer 0x5a1 on the stack
* + adds the object in stack level 1 to the object in level 2; what that means exactly depends on what those objects are: add two numbers, or add a number to each member of an array, or add corresponding members of two arrays
* .cos replaces the number in stack level 1, or each member of the array in stack level 1, with cosine (that number)
* ;c puts the speed of light on the stack
* :BS sets the bit designated by stack level 1 (integer) in the integer in stack level 2; does arrays too
* ] makes an array from numbers on the stack
* ]+ makes a ramp array using the increment value in level 2 and number of elements in level 1
* [= sets the value of an array element
* [s extracts a subspace of an array as specified by stack arguments
* %v gets the smaller value of two stack objects
* \/D (that's backslash,slash,D) decodes the option characters which follow the name of a command in a command string
* ?\/ displays the help file about the command-option operators
* ??fft starts a virtual terminal session with a text editor loaded with the help file about the Fourier transform function
* &path runs the commands from the file specified by "path"
* $9: command string label number 9
* >=$9 if the value in stack level 1 is greater than that in level 2, command execution branches to label $9:
* >D makes a deferred command
* <D runs a deferred command
* ,3s sets command string local variable number 3
* | concatenates two strings or arrays
* ) makes a complex number from two numbers or a complex array from two arrays
* .>3Y makes an unsigned 1-byte number or array with values from stack level 3, which may be in any numerical type
* \d drops stack level 1
* \;3u gets the number of data units in the object in stack level 3
* >0A makes a truth value: 1 (true) if all members of the array in stack level 1 are greater than 0; 0 (false) otherwise
* def creates variables and commands
* graph draws graphs
* exec runs programs and collects the standard output and standard error in files that can be displayed or edited by special help operators
* file transfers data between files and stack objects
* xcd performs operations on experix device files
Experix provides hardware operations by way of a command-line interface to device drivers. An experix driver has a 'read' entry point which functions more like an ioctl. It copies the integer array that experix has prepared, finds in it an operation code and supporting information, performs the operation and returns results to the array. The driver maintains a control page which experix maps with read-only permission, and a number of data pages which are mapped with read-write permission. The xcd function performs this memory mapping and creates command variables that represent the data pages. These variables can then be used in command strings to perform data display and analysis.
A data acquisition device driver has an interrupt handler which uses data from the output pages and stores data in the input pages. At designated index values it sends the new data signal to experix. The xcd function is used to bind the signal to an experix command string. Then that command is executed whenever the new data signal comes. A device handler command might update variables, perform analysis functions, draw graphs and issue warnings. It runs atomically, which means it uses a separate stack and runs uninterrupted between two tokens in whatever user command happens to be in progress.

## Documentation

Documentation is extensive. The keywords.doc file describes functions and data structures in the program. Commands, functions and operators are described in help files, which are accessed in experix by the help operators. Help files are ordinary text files with terminal escape sequences to provide color highlights. System commands such as cat and grep will show these files with their colorization, and the editor that experix uses for the two-question-mark help operator is nano (from the GNU project) with the escape sequence extension. The source files for nano that were changed to provide this extension are available on the experix website. Experix users are encouraged to correct and improve help files as they work.

## Limitations

Currently, experix is only available for Linux and, due to assembly language code, only on the x86 architecture.
At present the only graphics support for experix is with the open-source SVGALib. It is possible to have an experix graphics session in one virtual terminal and text or X sessions in others, and switch between them with the ⟨alt-F#⟩ keys. Graphics operations are done by a server process, and experix sends commands and data to this process through a fifo. It has an execution thread that uses readline (an open-source library from the GNU project) to obtain command lines and place them in the execution queue. Another thread translates the standard output (i.e. the echo from readline) into graphics server commands. Experix can also run in a text screen or X-term without using svgalib at all.
There is some assembly code and other matters to attend to before it can run on architectures other than x86.
The range of device drivers and applications available now is extremely limited.
It runs as root, which is a considerable security hazard on a networked computer. It should be possible to run experix without root privileges, but this has not yet been done.