2.6.4.10. execute_Evaluate()

[<<<] [>>>]

This function evaluates an expression. You should not get confused! This is not syntax analysis, caring operator precedences and grouping by nested parentheses. That has already been done during syntax analysis. This code performs the code that was generated from an expression.

The result is usually a mortal memory value which is the final result of the expression. However this piece of code assumes that the caller is careful enough to handle the result as read only, and sometimes the return value is not mortal. In this case the return value is a memory object that a variable points to. Whenever the caller needs this value to perform an operation that does not alter the value it is OK. Duplicating the structure to create a mortal would be waste of time and memory. On the other hand sometimes operations modify their operands assuming that they are mortal values. They should be careful.

Operators are actually created in the directory commands and they use the macros defined in command.h (created by headerer.pl from command.c). They help to avoid pitfalls.

The argument iArrayAccepted tells the function whether an array as a result is accepted or not. If a whole array is accepted as a result of the expression evaluation the array is returned. If the array is not an acceptable result, then the first element of the array is retuned in case the result is an array. If the result is NOT an array this parameter has no effect.

pFixSizeMemoryObject execute_Evaluate(pExecuteObject pEo,
                                      unsigned long lExpressionRootNode,
                                      pMortalList pMyMortal,
                                      int *piErrorCode,
                                      int iArrayAccepted
  ){

[<<<] [>>>]