Updates


Version 1.0 Oktober 2013 Initial version

Version 1.1 RPN 7/8 January 2014 Several bug corrections for postfix application
Version 1.2 RPN 1.1 Objects 04 February 2014 For MacOS classic users: missing initialization call added.
The call to FormatStr2X in the implementation of the atof routine used for converting the floating point values in the input code and the values set in the window for the input parameter values needs an initialization done in the InitStdLib routine. This routine wasn't called at all. Despite this the atof routine performed the conversions properly.
I noticed the error when implementing version 1.3 when checking the status return by FormatStr2X that indicated an error code.
The modified files for the RPN version are:
The modified files for the Object version are:

Version 1.3 RPN 1.2 Objects 08 February 2014 For MacOS classic users: decimal separator read out of system resources.
This new code is compiled in when compiler switch USE_ITL is defined. The system provides internationalization features, one of them can be chosen in the Numbers control panel: the decimal separator. In this version, depending on the setting of the USE_FORMATX2STR compiler switch, the decimal separator is read out of the itl0 resource or the itl4 resource (that is loaded anyway when using FormatX2Str or FormatStr2X).
This decimal separator is used in the floating point values in the input files Text2.txt, as well as the parameter values in the TextEdit fields for the parameters and the floating point values displayed in the main or code windows. This means that the input formulas needs adaptation. To avoid this a second set of conversion routines would need to be implemented or the parser routine would need to adapt the decimal separator in the floating point values read in from the input code. I have not done this here.
The implementation of the Unix standard routines in UX_StdLib.c has been further completed and better tested.
The modified files are:

Postfix version
Object oriented version
This functionality requires special attention to keep things consistent. Because the parser used to read in the code of the input file also uses the conversion routines, the input code has to be adapted.
The provided Text2.txt file uses the comma ',' as decimal separator. This will have to be set in the control panel to have things working.

Version 1.4 RPN 14 June 2014 Bug correction in code parser and call to checking routine for Mac Version.
calculs.c:
Corrections in routine implemented to check argument stack usage.
main.c:
Added call to routine to check the used size of the arguments stack for the MacOS version.
parser.c:
When handling the case of an unary + operator as in
tmp = index1 - 3.0 * +index2;
no modification of the operator stack has to be done (in fact just ignore the operator). Especially when getting the priority of the operator whose value has been set to -1 is wrong.
Moreover, when debugging I noticed that the enumeration type seems to be an unsigned char, so assigning it a value of -1 results in fact in a value of 0xFF. I modified it in an implementation independent way.

Version 1.5 RPN 1.3 Objects 11 Aug 2014 Correction in handling of formats %n.mg in printf.
Added additional character at start of result string in handling format %n.mg for cases when values as 9_9.9999 have to be rounded up. If not used it is suppressed.

Version 1.4 Objects 2 Sept 2014 Correction in comparison parsing routine
Buffer in which string of comparison operator is read now null terminated to suppress data left in uninitialised buffer (this caused in a test to identify twice the <= operator in an expression like a <= b and c < d). Added two code expressions using a more generalised end condition in for loops in input text file and test code.
Arithemitic and boolean expressions written out in code window in reverse polish notation. This is more difficult to read but makes clear in which order the operations are executed.

Version 1.6 RPN 1.5 Objects 05 Okt 2014 Extended format of for loops to have a generalised stop condition and loop expression.
Modified file: Parser.c.
The additional code is compiled when compiler switch EXT_FOR is defined. It can handle for commands as follows:
for (count=2^3-5; tmp<p_1 and sin(index/30.0)> 0.5; index+=1.5 )
instead of the simplified format implemented before.
Correction and optimisation of %s format handling in printf in file UX_StdLib.c.

Separate lexical analysis 14 Jun 2015 improvement prototype.
Until now, we have implemented the whole analysis into one single code, with in in the is quite complex.
The idea here is to separate as done by the Lex & Yacc tools the lexical from the syntactical analysis. As a first step, I provide two prototypes. The first works with a bit pattern identifying in which pattern (string, numeric value) a given ASCII character belongs to, the second works by direct identification of the character (this is the method used until now).
The syntax analysis would just call the main routine to get the next element (called Token) with its value.
Source code

Version 1.7 RPN 1.6 Objects 06 May 2016 Adaptation to CodeWarrior IDE
The code has been adapted to be compiled with MW CodeWarrior 6.0, and the usage of the text buffers in the parsing routines have been protected against overflow.
A description of to setup the project is here ReadMeCW.txt
as well as the modified prefix files RPN and C++ Applications compiled with CW:
RPN
C++
At the same time added calls for diverse functions.
Modified files: Calculs.h Calculs.c
Parser.c
main.c
OperandClasses.h, OperandClasses.cpp
Parsers.cpp
UX_StdLib.c : added type definition for CW version.
At the same time, code to handle special routines not par of the calculations has been implemented.
The additional code is compiled when compiler switch ADD_FUNCT is defined. These additional routines are not meant to perform calculations but another action in the SW.
As example 2 print routines have been implemented:
One to print a hardcoded sting on the console, and on to print the value of a variable to the console.

Version 1.8 RPN 1.7 Objects 23 July 2016 Several corrections.
Modified files:
UX_StdLib.c Suppressed unused variable,
main.cp, Parser.c Added compiler switch to prevent warning about unused variables,
Parser.c String buffers Funktion & toConvert with counters put global instead of local in several routines with reset of counter for Funktion moved to right place,
mode setting corrected in variable assignment and corrected missing identification of power operator ^ in parseBool,
main.c Size of list of formulas set with a define.
Parsers.cpp Buffer TextBuffer with its counter defined global instead of locally in several routines,
Test.c, Test.cp corrected Test18 & 19 routines to suit source code and Test13 to prevent endless loops as well as small error.
OperandClasses.cpp Corrected spacing in Print method of class FunctOperat.
The Source code in Test2* files for ID 13 has been corrected (inconsistencies with test code).
Code Warrior generated applications :
RPN
C++