Files used -------------- OperansClasses.c Definition of the classes whose instances will implement the operations of the calculation. If DEBUG is defined, the progress of the code execution is put out in the console. The Debug routine is made of several versions. It puts the script code to the display in a readable format. If MAC_UI is not defined, it is written on the console (standard output). Otherwise it opens a new window to write it in. For the Mac version, if the macro USE_FORMATX2STR is defined, it uses the FormatX2Str (new name ExtendedToString). I have a problem here. In a first test program it worked find but here the first conversion gives the correct result but the following not. The routine does not return any error code. Maybe someone will find out what's wrong. If not, the conversion is implemented directly. Parsers.cpp Parsing routines that will read in the textual calculations and generate the object structure that will execute them. They used recessive calls to each other and are structured so as to respect the priority of the operators. Parser.c routines to read in the test file and its code. if MIT_SMICOL is defined, arithmetic expressions may be separated by ;. main.cp main routine to setup GUI and selection of function and its execution. If MAC_UI is defined a complete GUI is compiled. Otherwise, only output to a standard terminal is implemented. For this second case the definition of the Mac macro implements small adaptations for MacOS classic compared to unix. UX_StdLib.cp MacOS implementation of the UX stdio routines (not complete) to use the lower right part of a window as a terminal window for printf/scanf routines. Those functions are used when including the MacOS GUI by defining the macro MAC_UI. Otherwhise, the stdio routines printf and scanf have to be provided through a library. In the printf routine the conversion from floating point to string is implemented in two ways: - if the macro USE_FORMATX2STR is defined, it uses the FormatX2Str (new name ExtendedToString). I have a problem here. In a first test program it worked find but here the first conversion gives the correct result but the following not. The routine does not return any error code. Maybe someone will find out what's wrong. - otherwise, the conversion is implemented directly. Test.cp routines to test execution of read in code. The code given in the input file is duplicated in C. Its return value is compared with the one of the original code and if not equal, a message printed out. This functionally is activated by defining macro TEST. Text2.txt input text file in which parameters are given with the corresponding calculation code. content description: Start of the file. Values for memory allocation: SPEICHER_KODE: SPEICHER_STACK: unused (only for Reverse Polish Notation version) SPEICHER_CONST: Definitions of code/scripts. For each script GRAPHIK: ID=> identification number of the script. Several scripts may have the same Id. NAME=>"" DATEI=>"<File name>" PARAMETER=><value> number of input parameters named p_1 to p_4 (limited to 4 now. may be more). RESOLUTIONS=>0.0 0 0 0 FORMEL=> <Kode in C style> except: comparisons lth less than leth less or equal to eq equal to neq not equal to gth greater than beth greater or equal to and for loops only limited to following syntax: for(a variable setting; a comparison; a pre or post inc/decrementation) The implemented operators are +, -, *, / and ^ (raise to power!) If OPERAT_EQ is defined, also +=, -=, *=, /= and ^= (raise to power!) are defined. The standard mathematical routines that take one floating point as argument and return a floating point result. Display.c routines to display results of calculations. If MAC_UI is defined, the input parameters are handed over in a row. Otherwhise, two input methods are provided. if SPRACHE is defined, a scheme adapted to the input per voice recognition: first the parameter to be changed is selected. Then its values is set with keys -, 0 to 9, . and the execution started with =. If it is not defined, ten parameter values are modified with key 1 to 8 used as increment/decrement key for parameters 1 to 4. The incrementation/decrementation step values are given in the RESOLUTIONS field. Other macros: MIT_VAR includes the code to use variables within the code (scripts) to be executed. MIT_IF includes the code to use if else control structures in the code to be executed. MIT_WHILE includes the code to use while and do while control structures in the code to be executed. ARG_DOUBLE if not defined, the constants in the code are defined as 32 floating point types stored in the "compiled" code just after the our instruction. Otherwise they are defined as 64 bits floating point types, and stored in a separate array. Software description This software reads in a list of calculations scripts from a text file and provides the ability to execute them. Each script can have up to 5 input parameters named p_0 to p_4 (this may be exuded to any number of parameters) and return one value of type 64 bit floating point. The calculation script must produce a value (as for functions in C programming) but whithout the return instruction. The calculation scripts are identified by a number. Several scripts may have the same identification number. One calculation run will execute all the calculation scripts that have the selected identification number. /* Exec_Calculs This routine counts the calculation scripts. It then transfers the parameter values to the display and executes successively every calculation script with the given ID to transmit the result to the display. */ /* main.cp This main routine is build up of several versions. A terminal version in which has an outer loop reading the selected identification number on the standard input (-1 to exit the application). Once the identifier is set, the input parameters are initialized to 0 and the calculations scripts executed. The user can then assign the values to the 4 input parameters (first parameter p_0 always contains the number of input parameters 0..4) following two methods: - in the standard method, keys 1 to 8 are defined as + and - keys If MAC_UI is defined a MacOS Classic like interface is provided: - A main window separated in 2 parts: an upper part in which the results are displayed, and a lower part that is a unix like terminal window in which debugging information is displayed if macro DEBUG is defined (Calculs.c). - A selection window with a popup menu listing all available titles associated with an identification number. if this window is selected, pressing q ends the application, - A parameter window in which the values for the input parameter values can be set and the calculation scripts executed. When this window is selected. pressing the d key, a new window is opened and the 'code' of the selected calculation script (if several scripts are associated with the identifier, the first one found in the input file is taken). This code is in reverse polish notation (arguments come before the operators acting on them). To leave and close this window press q. The 'code' is copied into the scrap, and can be transferred to a text editor. */