We’ve been spending some time creating a generic RB tree routine for use within MSB for Global variables, Memory files, and likely a number of other items as time goes by. During the coding we were using the general BSD tree.h module as a prototype (with appropriate copyright credit), however we did notice what appears to be a performance issue in the generally released RB tree logic.
We have contacted the original author and will be trying our performance enhancement in the MSB release. It should give us one of the best RB tree implementations in terms of performance.
The CSE function was added to the system. In adding the function we had the opportunity to look at the compare logic in the system. With the design of the compare routine and the built in stacking logic, the CSE function took only a few hours to implement. This bodes well for future enhancements.
Tomorrow we will look at enhancing the TBL function.
We added the COS, SIN, TAN, ACS, ASN, ATN trigonometric functions along with the LOG, EXP and SQR math functions to the system. In order to simplify the coding we placed all these functions in a common module called nf_trig.c rather than separate modules for each function which seemed a waste given each function was basically identical and only a few lines long.
Finalized the coding for the specialized assignment options for the LET directive. While we did the array assignment with this change we did not include the string template variables for the assignments since this will need to looked at longer term.
During the coding we reviewed the current array assignment functions in the system. MSB only supports assignments on full arrays — not ranges. I will need to come back to this logic later to add in range assignments.
When adding the ENV function to the system we have added an additional option of ENV(-1). This will return ‘all’ ENV entries to the application as a single string delimited using the system field separator.
We spent some time today working out the implementation of the -= and += logic. These (and ultimately the *=, /=, ++ and –) all pose some issues for the syntax parser. Currently when a symbol is detected (non-alphanumeric) the logic looks at the first character and from that determines what the internal code should be. We need to change the logic slightly to handle these multi-character codes. To do this we will basically steal the logic around the : ( which is used for input validation.
We also spent some time looking into MySql and in particular Berkley DB. While this is now be owned by Oracle, the Berkley DB interface looks like it could be easily adapted to handle a Business Basic style file system. The records are dynamic is size and key segments values are defined by the caller. This might be a way to bring Database technology to MicroShare while avoiding the need to generate SQL which itself causes quite a bit of overhead. Still are anticipating a MySql interface — but a direct Berkley DB may be a interesting offering.
Completed adding a SUB function to the system which gave us a chance to play with a bit of the stack manipulation routines within the MSB source. With the addition of the SUB function we are getting closer to be able to run our Apache CGI interface within the MSB code. We will still need to add an ENV function in order to access the environment variables along with += and -=.
Added (or should I say finished the implementation of) the MASK function. The original MSB source we started with only had a MASK function ’stub’ so we implemented it. The MASK function regular expression uses standard POSIX expression standards for expression evaluation. We also added the MSL system variable.
We also added the MID function and an option 3 to the STP function to remove ALL occurrences of character within the string.
This was the first major test of the new Syntax parser definition structure and it proved quite easy to add new functions and variables. A good test of the flexibility of the syntax parser will be modifying the NEXT directive not to require a variable and the auto-increment/decrement operators ( ++ / — ). While I think the NEXT will work in the current logic the ++ / — will likely need some internal logic.
Added GLOBAL file handles to MSB this morning. Rather than extending the file handles beyond the current range, we decided to use the range of 32000 through 32499 for global file handles. This allows for up to 500 global files which should be more than enough for most applications.
We will look at completing the addition of the GFN function later today.
We checked out the new syntax control file msb.syntax and its associated generation utility to verify that the code works correctly. In order to fully it through the paces we added the following system variables:
The logic worked well and should make adding new variables and functions easy. We should add an overflow check for the listing table in case the number of added variables, functions or directives exceeds the table capacity.