Data Structures | Defines | Enumerations | Functions

interpreter.h File Reference

Structures and functions for interpreting a parse tree. More...

Data Structures

struct  ReturnObject
 Stores a return state. More...
struct  ScopeObject
 Stores the variables in a particular scope. More...
union  ValueData
 Stores the data associated with a ValueObject structure. More...
struct  ValueObject
 Stores a value. More...

Defines

#define getFloat(value)   (value->data.f)
 Gets the floating point data associated with a ValueObject structure.
#define getInteger(value)   (value->data.i)
 Gets the integer data associated with a ValueObject structure.
#define getString(value)   (value->data.s)
 Gets the string data associated with a ValueObject structure.
#define P(value)   (value->semaphore--)
 Decrements the semaphore of a ValueObject structure.
#define V(value)   (value->semaphore++)
 Increments the semaphore of a ValueObject structure.

Enumerations

enum  ReturnType { RT_DEFAULT, RT_BREAK, RT_RETURN }
 

Denotes the type of return encountered.

More...
enum  ValueType {
  VT_INTEGER, VT_FLOAT, VT_BOOLEAN, VT_STRING,
  VT_NIL
}
 

Denotes the type of a value.

More...

Functions

ValueObjectcastBooleanExplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to boolean type in an explicit context.
ValueObjectcastBooleanImplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to boolean type in an implicit context.
ValueObjectcastFloatExplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to floating point decimal type in an explicit context.
ValueObjectcastFloatImplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to floating point decimal type in an implicit context.
ValueObjectcastIntegerExplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to integer type in an explicit context.
ValueObjectcastIntegerImplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to integer type in an implicit context.
ValueObjectcastStringExplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to string type in an explicit context.
ValueObjectcastStringImplicit (ValueObject *, ScopeObject *)
 Casts the contents of a ValueObject structure to string type in an implicit context.
ValueObjectcopyValueObject (ValueObject *)
 Copies a ValueObject structure.
ValueObjectcreateBooleanValueObject (int)
 Creates a boolean type ValueObject structure.
ValueObjectcreateFloatValueObject (float)
 Creates a floating point data decimal type ValueObject structure.
ValueObjectcreateIntegerValueObject (int)
 Creates an integer type ValueObject structure.
ValueObjectcreateNilValueObject (void)
 Creates a nil type ValueObject structure.
ReturnObjectcreateReturnObject (ReturnType, ValueObject *)
 Creates a ReturnObject structure.
ScopeObjectcreateScopeObject (ScopeObject *)
 Creates a ScopeObject structure.
ValueObjectcreateScopeValue (ScopeObject *, IdentifierNode *)
 Creates a new, nil, named ValueObject structure in a ScopeObject structure.
char * createString (char *)
 Creates a string by copying the contents of another string.
ValueObjectcreateStringValueObject (char *)
 Creates a string type ValueObject structure.
void deleteReturnObject (ReturnObject *)
 Deletes a ReturnObject structure.
void deleteScopeObject (ScopeObject *)
 Deletes a ScopeObject structure.
void deleteValueObject (ValueObject *)
 Deletes a ValueObject structure.
ValueObjectgetLocalScopeValue (ScopeObject *, IdentifierNode *)
 Retrieves a named ValueObject structure from a ScopeObject structure without traversing through its parents.
ValueObjectgetScopeValue (ScopeObject *, IdentifierNode *)
 Retrieves a named ValueObject structure from a ScopeObject structure, traversing its parents if necessary.
ValueObjectinterpretArithOpExprNode (OpExprNode *, ScopeObject *)
 Interprets an arithmetic operation expression.
ReturnObjectinterpretAssignmentStmtNode (StmtNode *, ScopeObject *)
 Interprets an assignment statement.
ReturnObjectinterpretBlockNode (BlockNode *, ScopeObject *)
 Interprets the contents of a BlockNode structure.
ValueObjectinterpretBoolOpExprNode (OpExprNode *, ScopeObject *)
 Interprets a boolean operation expression.
ReturnObjectinterpretBreakStmtNode (StmtNode *, ScopeObject *)
 Interprets a break statement.
ValueObjectinterpretCastExprNode (ExprNode *, ScopeObject *)
 Interprets a cast expression.
ReturnObjectinterpretCastStmtNode (StmtNode *, ScopeObject *)
 Interprets a cast statement.
ValueObjectinterpretConcatOpExprNode (OpExprNode *, ScopeObject *)
 Interprets a concatenation operation expression.
ValueObjectinterpretConstantExprNode (ExprNode *, ScopeObject *)
 Interprets a constant expression.
ReturnObjectinterpretDeclarationStmtNode (StmtNode *, ScopeObject *)
 Interprets a declaration statement.
ValueObjectinterpretEqualityOpExprNode (OpExprNode *, ScopeObject *)
 Interprets an equality operation expression.
ValueObjectinterpretExprNode (ExprNode *, ScopeObject *)
 Interprets the contents of an ExprNode structure.
ReturnObjectinterpretExprStmtNode (StmtNode *, ScopeObject *)
 Interprets an expression statement.
ValueObjectinterpretFuncCallExprNode (ExprNode *, ScopeObject *)
 Interprets a function call expression.
ReturnObjectinterpretFuncDefStmtNode (StmtNode *, ScopeObject *)
 Interprets a function definition statement.
ValueObjectinterpretIdentifierExprNode (ExprNode *, ScopeObject *)
 Interprets an identifier expression.
ReturnObjectinterpretIfThenElseStmtNode (StmtNode *, ScopeObject *)
 Interprets an if/then/else statement.
ValueObjectinterpretImpVarExprNode (ExprNode *, ScopeObject *)
 Interprets an implicit variable expression.
ReturnObjectinterpretInputStmtNode (StmtNode *, ScopeObject *)
 Interprets an input statement.
ReturnObjectinterpretLoopStmtNode (StmtNode *, ScopeObject *)
 Interprets a loop statement.
int interpretMainNode (MainNode *)
 Interprets the contents of a MainNode structure.
ValueObjectinterpretNotOpExprNode (OpExprNode *, ScopeObject *)
 Interprets a logical NOT operation expression.
ValueObjectinterpretOpExprNode (ExprNode *, ScopeObject *)
 Interprets an operation expression.
ReturnObjectinterpretPrintStmtNode (StmtNode *, ScopeObject *)
 Interprets a print statement.
ReturnObjectinterpretReturnStmtNode (StmtNode *, ScopeObject *)
 Interprets a return statement.
ReturnObjectinterpretStmtNode (StmtNode *, ScopeObject *)
 Interprets the contents of a StmtNode structure.
ReturnObjectinterpretStmtNodeList (StmtNodeList *, ScopeObject *)
 Interprets the contents of a StmtNodeList structure.
ReturnObjectinterpretSwitchStmtNode (StmtNode *, ScopeObject *)
 Interprets a switch statement.
unsigned int isHexString (const char *)
 Checks if a string of characters follows the format for a hexadecimal number.
unsigned int isNumString (const char *)
 Checks if a string of characters follows the format for a number.
ValueObjectopAddFloatFloat (ValueObject *, ValueObject *)
 Adds two floats.
ValueObjectopAddFloatInteger (ValueObject *, ValueObject *)
 Adds a float and an integer.
ValueObjectopAddIntegerFloat (ValueObject *, ValueObject *)
 Adds an integer and a float.
ValueObjectopAddIntegerInteger (ValueObject *, ValueObject *)
 Adds two integers.
ValueObjectopDivFloatFloat (ValueObject *, ValueObject *)
 Divides two floats.
ValueObjectopDivFloatInteger (ValueObject *, ValueObject *)
 Divides a float and an integer.
ValueObjectopDivIntegerFloat (ValueObject *, ValueObject *)
 Divides an integer and a float.
ValueObjectopDivIntegerInteger (ValueObject *, ValueObject *)
 Divides two integers.
ValueObjectopEqBooleanBoolean (ValueObject *, ValueObject *)
 Tests if two boolean values are equal.
ValueObjectopEqFloatFloat (ValueObject *, ValueObject *)
 Tests if two floats are equal.
ValueObjectopEqFloatInteger (ValueObject *, ValueObject *)
 Tests if a float and an integer are equal.
ValueObjectopEqIntegerFloat (ValueObject *, ValueObject *)
 Tests if an integer and a float are equal.
ValueObjectopEqIntegerInteger (ValueObject *, ValueObject *)
 Tests if two integers are equal.
ValueObjectopEqNilNil (ValueObject *, ValueObject *)
 Tests if two nil values are equal.
ValueObjectopEqStringString (ValueObject *, ValueObject *)
 Tests if two strings are equal.
ValueObjectopMaxFloatFloat (ValueObject *, ValueObject *)
 Finds the maximum of two floats.
ValueObjectopMaxFloatInteger (ValueObject *, ValueObject *)
 Finds the maximum of a float and an integer.
ValueObjectopMaxIntegerFloat (ValueObject *, ValueObject *)
 Finds the maximum of an integer and a float.
ValueObjectopMaxIntegerInteger (ValueObject *, ValueObject *)
 Finds the maximum of two integers.
ValueObjectopMinFloatFloat (ValueObject *, ValueObject *)
 Finds the minimum of two floats.
ValueObjectopMinFloatInteger (ValueObject *, ValueObject *)
 Finds the minimum of a float and an integer.
ValueObjectopMinIntegerFloat (ValueObject *, ValueObject *)
 Finds the minimum of an integer and a float.
ValueObjectopMinIntegerInteger (ValueObject *, ValueObject *)
 Finds the minimum of two integers.
ValueObjectopModFloatFloat (ValueObject *, ValueObject *)
 Calculates the modulus of two floats.
ValueObjectopModFloatInteger (ValueObject *, ValueObject *)
 Calculates the modulus of a float and an integer.
ValueObjectopModIntegerFloat (ValueObject *, ValueObject *)
 Calculates the modulus of an integer and a float.
ValueObjectopModIntegerInteger (ValueObject *, ValueObject *)
 Calculates the modulus of two integers.
ValueObjectopMultFloatFloat (ValueObject *, ValueObject *)
 Multiplies two floats.
ValueObjectopMultFloatInteger (ValueObject *, ValueObject *)
 Multiplies a float and an integer.
ValueObjectopMultIntegerFloat (ValueObject *, ValueObject *)
 Multiplies an integer and a float.
ValueObjectopMultIntegerInteger (ValueObject *, ValueObject *)
 Multiplies two integers.
ValueObjectopNeqBooleanBoolean (ValueObject *, ValueObject *)
 Tests if two boolean values are not equal.
ValueObjectopNeqFloatFloat (ValueObject *, ValueObject *)
 Tests if two floats are not equal.
ValueObjectopNeqFloatInteger (ValueObject *, ValueObject *)
 Tests if a float and an integer are not equal.
ValueObjectopNeqIntegerFloat (ValueObject *, ValueObject *)
 Tests if an integer and a float are not equal.
ValueObjectopNeqIntegerInteger (ValueObject *, ValueObject *)
 Tests if two integers are not equal.
ValueObjectopNeqNilNil (ValueObject *, ValueObject *)
 Tests if two nil values are not equal.
ValueObjectopNeqStringString (ValueObject *, ValueObject *)
 Tests if two strings are not equal.
ValueObjectopSubFloatFloat (ValueObject *, ValueObject *)
 Subtracts two floats.
ValueObjectopSubFloatInteger (ValueObject *, ValueObject *)
 Subtracts a float and an integer.
ValueObjectopSubIntegerFloat (ValueObject *, ValueObject *)
 Subtracts an integer and a float.
ValueObjectopSubIntegerInteger (ValueObject *, ValueObject *)
 Subtracts two integers.
ValueObjectupdateScopeValue (ScopeObject *, IdentifierNode *, ValueObject *)
 Updates a ValueObject structure named by an IdentifierNode structure in a ScopeObject structure.

Detailed Description

Structures and functions for interpreting a parse tree.

The interpreter traverses a parse tree in a depth-first manner, interpreting each node it reaches along the way. This is the last stage of the processing of a source code file.

Author:
Justin J. Meza
Date:
2010

Define Documentation

#define getFloat (   value  )     (value->data.f)

Gets the floating point data associated with a ValueObject structure.

#define getInteger (   value  )     (value->data.i)

Gets the integer data associated with a ValueObject structure.

#define getString (   value  )     (value->data.s)

Gets the string data associated with a ValueObject structure.

#define P (   value  )     (value->semaphore--)

Decrements the semaphore of a ValueObject structure.

#define V (   value  )     (value->semaphore++)

Increments the semaphore of a ValueObject structure.


Enumeration Type Documentation

enum ReturnType

Denotes the type of return encountered.

Enumerator:
RT_DEFAULT 

A block of code returned after evaluating all of its statements.

RT_BREAK 

A block of code within a LoopStmtNode or SwitchStmtNode returned via a break statement.

RT_RETURN 

A block of code within a FuncDefStmtNode called by a FuncCallExprNode returned (either with or without a value).

enum ValueType

Denotes the type of a value.

Enumerator:
VT_INTEGER 

An integer value.

VT_FLOAT 

A floating point decimal value.

VT_BOOLEAN 

A true/false value.

VT_STRING 

A character string value.

VT_NIL 

Represents no value.


Function Documentation

ValueObject* castBooleanExplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to boolean type in an explicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to boolean type.
Return values:
NULL An error occurred while casting.
See also:
castIntegerExplicit(ValueObject *, ScopeObject *)
castFloatExplicit(ValueObject *, ScopeObject *)
castStringExplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castBooleanImplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to boolean type in an implicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to boolean type.
Return values:
NULL An error occurred while casting.
See also:
castIntegerImplicit(ValueObject *, ScopeObject *)
castFloatImplicit(ValueObject *, ScopeObject *)
castStringImplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castFloatExplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to floating point decimal type in an explicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to floating point decimal type.
Return values:
NULL An error occurred while casting.
See also:
castBooleanExplicit(ValueObject *, ScopeObject *)
castIntegerExplicit(ValueObject *, ScopeObject *)
castStringExplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castFloatImplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to floating point decimal type in an implicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to floating point decimal type.
Return values:
NULL An error occurred while casting.
See also:
castBooleanImplicit(ValueObject *, ScopeObject *)
castIntegerImplicit(ValueObject *, ScopeObject *)
castStringImplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castIntegerExplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to integer type in an explicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to integer type.
Return values:
NULL An error occurred while casting.
See also:
castBooleanExplicit(ValueObject *, ScopeObject *)
castFloatExplicit(ValueObject *, ScopeObject *)
castStringExplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castIntegerImplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to integer type in an implicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to integer type.
Return values:
NULL An error occurred while casting.
See also:
castBooleanImplicit(ValueObject *, ScopeObject *)
castFloatImplicit(ValueObject *, ScopeObject *)
castStringImplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castStringExplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to string type in an explicit context.

Casting is not done to directly the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Note:
scope is used to resolve variable interpolation within the string before casting it. Therefore, a simple way to interpolate the variables within a string is to call this function with it.
Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to string type.
Return values:
NULL An error occurred while casting.
See also:
castBooleanExplicit(ValueObject *, ScopeObject *)
castIntegerExplicit(ValueObject *, ScopeObject *)
castFloatExplicit(ValueObject *, ScopeObject *)

Note:
The spec does not define how TROOFs may be cast to YARNs.

Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* castStringImplicit ( ValueObject node,
ScopeObject scope 
)

Casts the contents of a ValueObject structure to string type in an implicit context.

Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.

Note:
scope is used to resolve variable interpolation within the string before casting it. Therefore, a simple way to interpolate the variables within a string is to call this function with it.
Precondition:
node was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
scope was created by createScopeObject(ScopeObject *).
Returns:
A pointer to a ValueObject structure with a copy of the contents of node, cast to string type.
Return values:
NULL An error occurred while casting.
See also:
castBooleanImplicit(ValueObject *, ScopeObject *)
castIntegerImplicit(ValueObject *, ScopeObject *)
castFloatImplicit(ValueObject *, ScopeObject *)
Parameters:
[in] node The ValueObject structure to cast.
[in] scope The ScopeObject structure to use for variable interpolation.
ValueObject* copyValueObject ( ValueObject value  ) 

Copies a ValueObject structure.

Note:
What this function actually does is increment a semaphore in value and return value. The semaphore gets decremented when value gets deleted by deleteValueObject(ValueObject *). This way, an immutable copy of a ValueObject structure may be made without actaully copying its blocks of memory; this reduces the overhead associated with copying a ValueObject strcuture while still preserving its functionality.
Precondition:
value was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
Returns:
A pointer to a ValueObject with the same type and contents as value.
Return values:
NULL The type of value is unknown.
See also:
createNilValueObject(void)
createBooleanValueObject(int)
createIntegerValueObject(int)
createFloatValueObject(float)
createStringValueObject(char *)
deleteValueObject(ValueObject *)
Parameters:
[in,out] value The ValueObject structure to create a copy of.
ValueObject* createBooleanValueObject ( int  data  ) 

Creates a boolean type ValueObject structure.

Returns:
A pointer to a boolean type ValueObject structure with value 0 if data equals 0 and 1 otherwise.
Return values:
NULL malloc was unable to allocate memory.
Parameters:
[in] data The boolean data to store.
ValueObject* createFloatValueObject ( float  data  ) 

Creates a floating point data decimal type ValueObject structure.

Returns:
A pointer to a floating point decimal type ValueObject structure with value data.
Return values:
NULL malloc was unable to allocate memory.
Parameters:
[in] data The floating point data to store.
ValueObject* createIntegerValueObject ( int  data  ) 

Creates an integer type ValueObject structure.

Returns:
A pointer to an integer type ValueObject structure with value data.
Return values:
NULL malloc was unable to allocate memory.
Parameters:
[in] data The integer data to store.
ValueObject* createNilValueObject ( void   ) 

Creates a nil type ValueObject structure.

Returns:
A pointer to a nil type ValueObject structure.
Return values:
NULL malloc was unable to allocate memory.
ReturnObject* createReturnObject ( ReturnType  type,
ValueObject value 
)

Creates a ReturnObject structure.

Precondition:
value was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
Returns:
A pointer to a ReturnObject structure with the desired properties.
Return values:
NULL malloc was unable to allocate memory.
See also:
deleteReturnObject(ReturnObject *)
Parameters:
[in] type The type of return encountered.
[in] value A pointer to the ValueObject structure specifying the return value (optional, NULL if unused).
ScopeObject* createScopeObject ( ScopeObject parent  ) 

Creates a ScopeObject structure.

Precondition:
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *) or is NULL if creating the root parent.
Returns:
A pointer to a ScopeObject structure with the desired properties.
Return values:
NULL malloc was unable to allocate memory.
See also:
deleteScopeObject(ScopeObject *)
Parameters:
[in] parent A pointer to the parent ScopeObject.
ValueObject* createScopeValue ( ScopeObject scope,
IdentifierNode target 
)

Creates a new, nil, named ValueObject structure in a ScopeObject structure.

Precondition:
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
target was created by createIdentifierNode(char *).
Returns:
A pointer to the newly created ValueObject structure named by target.
Return values:
NULL realloc was unable to allocate memory.
See also:
getScopeValue(ScopeObject *, IdentifierNode *)
getLocalScopeValue(ScopeObject *, IdentifierNode *)
updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *)
Parameters:
[in,out] scope The ScopeObject structure to add a value to.
[in] target The name of the value to add.
char* createString ( char *  data  ) 

Creates a string by copying the contents of another string.

Returns:
A pointer to a string containing the copied contents of data.
Return values:
NULL malloc was unable to allocate memory.
Parameters:
[in] data A pointer to the string data to store.
ValueObject* createStringValueObject ( char *  data  ) 

Creates a string type ValueObject structure.

Returns:
A pointer to a string type ValueObject structure with value data.
Return values:
NULL malloc was unable to allocate memory.
Parameters:
[in] data The string data to store.
void deleteReturnObject ( ReturnObject object  ) 

Deletes a ReturnObject structure.

Precondition:
object was created by createReturnObject(ReturnType, ValueObject *).
Postcondition:
The memory at object and any of its associated members will be freed.
See also:
createReturnObject(ReturnType, ValueObject *)
Parameters:
[in,out] object The ReturnObject structure to be deleted.
void deleteScopeObject ( ScopeObject scope  ) 

Deletes a ScopeObject structure.

Precondition:
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Postcondition:
The memory at scope and any of its associated members will be freed.
See also:
createScopeObject(ScopeObject *)
Parameters:
[in,out] scope The ScopeObject structure to delete.
void deleteValueObject ( ValueObject value  ) 

Deletes a ValueObject structure.

Precondition:
value was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
Postcondition:
The memory at value and any of its associated members will be freed (see note).
Note:
What this function actually does is decrement a semaphore in value and delete value if the semaphore reaches 0 as a result of the decrement. The semaphore gets incremented when either the value is created or it gets copied by copyValueObject(ValueObject *). This way, an immutable copy of a ValueObject structure may be made without actually copying its blocks of memory.
See also:
createNilValueObject(void)
createBooleanValueObject(int)
createIntegerValueObject(int)
createFloatValueObject(float)
createStringValueObject(char *)
copyValueObject(ValueObject *)
Parameters:
[in,out] value A pointer to the ValueObject structure to be deleted.
ValueObject* getLocalScopeValue ( ScopeObject scope,
IdentifierNode target 
)

Retrieves a named ValueObject structure from a ScopeObject structure without traversing through its parents.

Precondition:
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
target was created by createIdentifierNode(char *).
Returns:
A pointer to the stored ValueObject structure named by target.
Return values:
NULL target could not be found in scope.
See also:
getScopeValue(ScopeObject *, IdentifierNode *)
createScopeValue(ScopeObject *, IdentifierNode *)
updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *)
Parameters:
[in] scope The ScopeObject structure to check.
[in] target The name of the value to find.
ValueObject* getScopeValue ( ScopeObject scope,
IdentifierNode target 
)

Retrieves a named ValueObject structure from a ScopeObject structure, traversing its parents if necessary.

Precondition:
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
target was created by createIdentifierNode(char *).
Returns:
A pointer to the stored ValueObject structure named by target.
Return values:
NULL target could not be found in scope.
See also:
getLocalScopeValue(ScopeObject *, IdentifierNode *)
createScopeValue(ScopeObject *, IdentifierNode *)
updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *)
Parameters:
[in] scope The ScopeObject structure to check.
[in] target The name of the value to find.
ValueObject* interpretArithOpExprNode ( OpExprNode expr,
ScopeObject scope 
)

Interprets an arithmetic operation expression.

Precondition:
expr was created by createOpExprNode(OpType type, ExprNodeList *args) where type is either OP_ADD, OP_SUB, OP_MULT, OP_DIV, or OP_MOD and args was created by createExprNodeList(void) and populated with ExprNode structures using addExprNode(ExprNodeList *, ExprNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
Only the first two elements in args are considered.
Returns:
A pointer to a ValueObject structure containing the interpreted operation expression value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretNotOpExprNode(OpExprNode *, ScopeObject *)
interpretBoolOpExprNode(OpExprNode *, ScopeObject *)
interpretEqualityOpExprNode(OpExprNode *, ScopeObject *)
interpretConcatOpExprNode(OpExprNode *, ScopeObject *)
Parameters:
[in] expr A pointer to the OpExprNode structure to interpret.
[in] scope A pointer to the ScopeObject structure to evaluate expr under.
ReturnObject* interpretAssignmentStmtNode ( StmtNode node,
ScopeObject scope 
)
ReturnObject* interpretBlockNode ( BlockNode node,
ScopeObject scope 
)

Interprets the contents of a BlockNode structure.

Precondition:
node was created by parseBlockNode(Token ***, FunctionTable *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ReturnObject structure with the return state of the interpreted node.
Return values:
NULL An error occurred during interpretation.
See also:
interpretExprNode(ExprNode *, ScopeObject *)
interpretStmtNode(StmtNode *, ScopeObject *)
interpretStmtNodeList(StmtNodeList *, ScopeObject *)
interpretMainNode(MainNode *)
Parameters:
[in] node A pointer to a BlockNode structure to interpret.
[in,out] scope A pointer to a ScopeObject structure to evaluate node under.
ValueObject* interpretBoolOpExprNode ( OpExprNode expr,
ScopeObject scope 
)

Interprets a boolean operation expression.

Precondition:
expr was created by createOpExprNode(OpType type, ExprNodeList *args) where type is either OP_AND, OP_OR, or OP_XOR and args was created by createExprNodeList(void) and populated with ExprNode structures using addExprNode(ExprNodeList *, ExprNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ValueObject structure containing the interpreted operation expression value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretArithOpExprNode(OpExprNode *, ScopeObject *)
interpretNotOpExprNode(OpExprNode *, ScopeObject *)
interpretEqualityOpExprNode(OpExprNode *, ScopeObject *)
interpretConcatOpExprNode(OpExprNode *, ScopeObject *)

Note:
The specification does not say whether boolean logic short circuits or not. Here, we assume it does.

Parameters:
[in] expr A pointer to the OpExprNode structure to interpret.
[in] scope A pointer to the ScopeObject structure to evaluate expr under.
ReturnObject* interpretBreakStmtNode ( StmtNode node,
ScopeObject scope 
)

Interprets a break statement.

Precondition:
node was created by createStmtNode(StmtType type, void *stmt) where type is ST_BREAK and stmt is NULL.
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
node and scope are not used by this function but are still included in its prototype to allow this function to be stored in a jump table for fast execution.
Returns:
A pointer to a ReturnObject structure indicating a break occurred.
Return values:
NULL An error occurred during interpretation.
See also:
interpretCastStmtNode(StmtNode *, ScopeObject *)
interpretPrintStmtNode(StmtNode *, ScopeObject *)
interpretInputStmtNode(StmtNode *, ScopeObject *)
interpretAssignmentStmtNode(StmtNode *, ScopeObject *)
interpretDeclarationStmtNode(StmtNode *, ScopeObject *)
interpretIfThenElseStmtNode(StmtNode *, ScopeObject *)
interpretSwitchStmtNode(StmtNode *, ScopeObject *)
interpretReturnStmtNode(StmtNode *, ScopeObject *)
interpretLoopStmtNode(StmtNode *, ScopeObject *)
interpretFuncDefStmtNode(StmtNode *, ScopeObject *)
interpretExprStmtNode(StmtNode *, ScopeObject *)
Parameters:
node Not used (see note).
scope Not used (see note).
ValueObject* interpretCastExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets a cast expression.

Precondition:
node was created by createExprNode(ExprType type, void *expr) where type is ET_CAST and expr is a CastExprNode structure created by createCastExprNode(ExprNode *, TypeNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ValueObject structure containing the result of the cast.
Return values:
NULL An error occurred during interpretation.
See also:
interpretImpVarExprNode(ExprNode *, ScopeObject *)
interpretFuncCallExprNode(ExprNode *, ScopeObject *)
interpretIdentifierExprNode(ExprNode *, ScopeObject *)
interpretConstantExprNode(ExprNode *, ScopeObject *)
Parameters:
[in] node A pointer to an ExprNode structure containing the CastExprNode structure to interpret.
[in,out] scope A pointer to a ScopeObject structure to evaluate node under.
ReturnObject* interpretCastStmtNode ( StmtNode node,
ScopeObject scope 
)
ValueObject* interpretConcatOpExprNode ( OpExprNode expr,
ScopeObject scope 
)

Interprets a concatenation operation expression.

Precondition:
expr was created by createOpExprNode(OpType type, ExprNodeList *args) where type is OP_CAT and args was created by createExprNodeList(void) and populated with ExprNode structures using addExprNode(ExprNodeList *, ExprNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ValueObject structure containing the concatenation of all the arguments in args.
Return values:
NULL An error occurred during interpretation.
See also:
interpretNotOpExprNode(OpExprNode *, ScopeObject *)
interpretArithOpExprNode(OpExprNode *, ScopeObject *)
interpretBoolOpExprNode(OpExprNode *, ScopeObject *)
interpretEqualityOpExprNode(OpExprNode *, ScopeObject *)
Parameters:
[in] expr A pointer to the OpExprNode structure to interpret.
[in] scope A pointer to the ScopeObject structure to evaluate expr under.
ValueObject* interpretConstantExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets a constant expression.

Precondition:
node was created by createExprNode(ExprType type, void *expr) where type is ET_CONSTANT and expr is a ConstantNode structure created by either createBooleanConstantNode(int), createIntegerConstantNode(int), createFloatConstantNode(float), or createStringConstantNode(char *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
scope is not used by this function but is still included in its prototype to allow this function to be stored in a jump table for fast execution.
Returns:
A pointer to a ValueObject structure containing the return value of function.
Return values:
NULL An error occurred during interpretation.
See also:
interpretImpVarExprNode(ExprNode *, ScopeObject *)
interpretCastExprNode(ExprNode *, ScopeObject *)
interpretFuncCallExprNode(ExprNode *, ScopeObject *)
interpretIdentifierExprNode(ExprNode *, ScopeObject *)

Note:
For efficiency, string interpolation should be performed by caller because it only needs to be performed when necessary.

Parameters:
[in] node A pointer to an ExprNode structure containing the ConstantNode structure to interpret.
scope Not used (see note).
ReturnObject* interpretDeclarationStmtNode ( StmtNode node,
ScopeObject scope 
)
ValueObject* interpretEqualityOpExprNode ( OpExprNode expr,
ScopeObject scope 
)

Interprets an equality operation expression.

Precondition:
expr was created by createOpExprNode(OpType type, ExprNodeList *args) where type is either OP_EQ or OP_NEQ and args was created by createExprNodeList(void) and populated with ExprNode structures using addExprNode(ExprNodeList *, ExprNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
Only the first two elements in args are considered.
Returns:
A pointer to a ValueObject structure containing the interpreted operation expression value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretArithOpExprNode(OpExprNode *, ScopeObject *)
interpretNotOpExprNode(OpExprNode *, ScopeObject *)
interpretBoolOpExprNode(OpExprNode *, ScopeObject *)
interpretConcatOpExprNode(OpExprNode *, ScopeObject *)
Parameters:
[in] expr A pointer to the OpExprNode structure to interpret.
[in] scope A pointer to the ScopeObject structure to evaluate expr under.
ValueObject* interpretExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets the contents of an ExprNode structure.

Precondition:
node was created by parseExprNode(Token ***, FunctionTable *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ValueObject structure with the evaluated contents of node in the scope scope.
Return values:
NULL An error occurred during interpretation.
See also:
interpretStmtNode(StmtNode *, ScopeObject *)
interpretStmtNodeList(StmtNodeList *, ScopeObject *)
interpretBlockNode(BlockNode *, ScopeObject *)
interpretMainNode(MainNode *)
Parameters:
[in] node A pointer to an ExprNode structure to interpret.
[in] scope A pointer to a ScopeObject structure to evaluate node under.
ReturnObject* interpretExprStmtNode ( StmtNode node,
ScopeObject scope 
)
ValueObject* interpretFuncCallExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets a function call expression.

Precondition:
node was created by createExprNode(ExprType type, void *expr) where type is ET_FUNCCALL and expr is a FunctionCallExprNode structure created by createFuncCallExprNode(FuncDefStmtNode *, ExprNodeList *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ValueObject structure containing the return value of function.
Return values:
NULL An error occurred during interpretation.
See also:
interpretImpVarExprNode(ExprNode *, ScopeObject *)
interpretCastExprNode(ExprNode *, ScopeObject *)
interpretIdentifierExprNode(ExprNode *, ScopeObject *)
interpretConstantExprNode(ExprNode *, ScopeObject *)
Parameters:
[in] node A pointer to an ExprNode structure containing the FuncCallExprNode structure to interpret.
[in,out] scope A pointer to a ScopeObject structure to evaluate node under.
ReturnObject* interpretFuncDefStmtNode ( StmtNode node,
ScopeObject scope 
)

Interprets a function definition statement.

Precondition:
node was created by createStmtNode(StmtType type, void *stmt) where type is ST_SWITCH and stmt was created by createSwitchStmtNode(IdentifierNode *, IdentifierNode *, IdentifierNodeList *, BlockNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
node and scope are not used by this function but are still included in its prototype to allow this function to be stored in a jump table for fast execution.
Returns:
A pointer to a ReturnObject structure with the default return value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretCastStmtNode(StmtNode *, ScopeObject *)
interpretPrintStmtNode(StmtNode *, ScopeObject *)
interpretInputStmtNode(StmtNode *, ScopeObject *)
interpretAssignmentStmtNode(StmtNode *, ScopeObject *)
interpretDeclarationStmtNode(StmtNode *, ScopeObject *)
interpretIfThenElseStmtNode(StmtNode *, ScopeObject *)
interpretSwitchStmtNode(StmtNode *, ScopeObject *)
interpretBreakStmtNode(StmtNode *, ScopeObject *)
interpretReturnStmtNode(StmtNode *, ScopeObject *)
interpretLoopStmtNode(StmtNode *, ScopeObject *)
interpretExprStmtNode(StmtNode *, ScopeObject *)
Parameters:
node Not used (see note).
scope Not used (see note).
ValueObject* interpretIdentifierExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets an identifier expression.

Precondition:
node was created by createExprNode(ExprType type, void *expr) where type is ET_IDENTIFIER and expr is an IdentifierNode structure created by createIdentifierNode(char *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
scope is not used by this function but is still included in its prototype to allow this function to be stored in a jump table for fast execution.
Returns:
A pointer to a ValueObject structure containing the return value of function.
Return values:
NULL An error occurred during interpretation.
See also:
interpretImpVarExprNode(ExprNode *, ScopeObject *)
interpretCastExprNode(ExprNode *, ScopeObject *)
interpretFuncCallExprNode(ExprNode *, ScopeObject *)
interpretConstantExprNode(ExprNode *, ScopeObject *)
Parameters:
[in] node A pointer to an ExprNode structure containing the IdentifierNode structure to interpret.
scope Not used (see note).
ReturnObject* interpretIfThenElseStmtNode ( StmtNode node,
ScopeObject scope 
)
ValueObject* interpretImpVarExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets an implicit variable expression.

Precondition:
node was created by createExprNode(ExprType type, void *expr) where type is ET_IMPVAR and expr is NULL.
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
node is not used by this function but is still included in its prototype to allow this function to be stored in a jump table for fast execution.
Returns:
A pointer to a ValueObject structure containing the value of the current scope's implicit variable.
See also:
interpretCastExprNode(ExprNode *, ScopeObject *)
interpretFuncCallExprNode(ExprNode *, ScopeObject *)
interpretIdentifierExprNode(ExprNode *, ScopeObject *)
interpretConstantExprNode(ExprNode *, ScopeObject *)
Parameters:
[in] node A pointer to an ExprNode structure with type set to ET_IMPVAR.
scope Not used (see note).
ReturnObject* interpretInputStmtNode ( StmtNode node,
ScopeObject scope 
)

Interprets an input statement.

Precondition:
node was created by createStmtNode(StmtType type, void *stmt) where type is ST_INPUT and stmt was created by createInputStmtNode(IdentifierNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ReturnObject structure with the default return value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretCastStmtNode(StmtNode *, ScopeObject *)
interpretPrintStmtNode(StmtNode *, ScopeObject *)
interpretAssignmentStmtNode(StmtNode *, ScopeObject *)
interpretDeclarationStmtNode(StmtNode *, ScopeObject *)
interpretIfThenElseStmtNode(StmtNode *, ScopeObject *)
interpretSwitchStmtNode(StmtNode *, ScopeObject *)
interpretBreakStmtNode(StmtNode *, ScopeObject *)
interpretReturnStmtNode(StmtNode *, ScopeObject *)
interpretLoopStmtNode(StmtNode *, ScopeObject *)
interpretFuncDefStmtNode(StmtNode *, ScopeObject *)
interpretExprStmtNode(StmtNode *, ScopeObject *)

Note:
The specification is unclear as to the exact semantics of input. Here, we read up until the first newline or EOF but do not store it.

Parameters:
[in] node A pointer to a StmtNode structure containing an InputStmtNode structure to interpret.
[in,out] scope A pointer to the ScopeObject structure to evaluate node under.
ReturnObject* interpretLoopStmtNode ( StmtNode node,
ScopeObject scope 
)
int interpretMainNode ( MainNode main  ) 

Interprets the contents of a MainNode structure.

Precondition:
node was created by parseMainNode(Token **, FunctionTable *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
The return status of the interpreted MainNode structure.
Return values:
0 main was interpreted without any errors.
1 An error occurred while interpreting main.
See also:
interpretExprNode(ExprNode *, ScopeObject *)
interpretStmtNode(StmtNode *, ScopeObject *)
interpretStmtNodeList(StmtNodeList *, ScopeObject *)
interpretBlockNode(BlockNode *, ScopeObject *)
Parameters:
[in] main A pointer to the MainNode structure to interpret.
ValueObject* interpretNotOpExprNode ( OpExprNode expr,
ScopeObject scope 
)

Interprets a logical NOT operation expression.

Precondition:
expr was created by createOpExprNode(OpType type, ExprNodeList *args) where type is OP_NOT and args was created by createExprNodeList(void) and populated with ExprNode structures using addExprNode(ExprNodeList *, ExprNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Note:
Only the first element in args is considered.
Returns:
A pointer to a ValueObject structure containing the interpreted operation expression value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretArithOpExprNode(OpExprNode *, ScopeObject *)
interpretBoolOpExprNode(OpExprNode *, ScopeObject *)
interpretEqualityOpExprNode(OpExprNode *, ScopeObject *)
interpretConcatOpExprNode(OpExprNode *, ScopeObject *)
Parameters:
[in] expr A pointer to the OpExprNode structure to interpret.
[in] scope A pointer to the ScopeObject structure to evaluate expr under.
ValueObject* interpretOpExprNode ( ExprNode node,
ScopeObject scope 
)

Interprets an operation expression.

Precondition:
expr was created by createOpExprNode(OpType, ExprNodeList *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ValueObject structure containing the interpreted operation expression value.
Return values:
NULL An error occurred during interpretation.
See also:
interpretNotOpExprNode(OpExprNode *, ScopeObject *)
interpretArithOpExprNode(OpExprNode *, ScopeObject *)
interpretBoolOpExprNode(OpExprNode *, ScopeObject *)
interpretEqualityOpExprNode(OpExprNode *, ScopeObject *)
interpretConcatOpExprNode(OpExprNode *, ScopeObject *)
Parameters:
[in] node A pointer to an ExprNode structure to interpret.
[in] scope A pointer to a ScopeObject structure to evaluate node under.
ReturnObject* interpretPrintStmtNode ( StmtNode node,
ScopeObject scope 
)
ReturnObject* interpretReturnStmtNode ( StmtNode node,
ScopeObject scope 
)
ReturnObject* interpretStmtNode ( StmtNode node,
ScopeObject scope 
)

Interprets the contents of a StmtNode structure.

Precondition:
node was created by parseStmtNode(Token ***, FunctionTable *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ReturnObject structure with the return state of the interpreted node.
Return values:
NULL An error occurred during interpretation.
See also:
interpretExprNode(ExprNode *, ScopeObject *)
interpretStmtNodeList(StmtNodeList *, ScopeObject *)
interpretBlockNode(BlockNode *, ScopeObject *)
interpretMainNode(MainNode *)
Parameters:
[in] node A pointer to a StmtNode structure to interpret.
[in,out] scope A pointer to a ScopeObject structure to evaluate node under.
ReturnObject* interpretStmtNodeList ( StmtNodeList list,
ScopeObject scope 
)

Interprets the contents of a StmtNodeList structure.

Precondition:
list was created by createStmtNodeList(void) and contains contents added by addStmtNode(StmtNodeList *, StmtNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ReturnObject structure with the return state of the interpreted list.
Return values:
NULL An error occurred during interpretation.
See also:
interpretExprNode(ExprNode *, ScopeObject *)
interpretStmtNode(StmtNode *, ScopeObject *)
interpretBlockNode(BlockNode *, ScopeObject *)
interpretMainNode(MainNode *)
Parameters:
[in] list A pointer to the StmtNodeList structure to interpret.
[in,out] scope A pointer to the ScopeObject structure to evaluate list under.
ReturnObject* interpretSwitchStmtNode ( StmtNode node,
ScopeObject scope 
)

Interprets a switch statement.

Note:
The specification is unclear as to whether guards are implicitly cast to the type of the implicit variable. This only matters in the case that mixed guard types are present and in this code, the action that is performed is the same as the comparison operator, that is, in order for a guard to match, both its type and value must match the implicit variable.
Precondition:
node was created by createStmtNode(StmtType type, void *stmt) where type is ST_SWITCH and stmt was created by createSwitchStmtNode(ExprNodeList *, BlockNodeList *, BlockNode *).
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
Returns:
A pointer to a ReturnObject structure with the return value after interpreting node in the scope scope.
Return values:
NULL An error occurred during interpretation.
See also:
interpretCastStmtNode(StmtNode *, ScopeObject *)
interpretPrintStmtNode(StmtNode *, ScopeObject *)
interpretInputStmtNode(StmtNode *, ScopeObject *)
interpretAssignmentStmtNode(StmtNode *, ScopeObject *)
interpretDeclarationStmtNode(StmtNode *, ScopeObject *)
interpretIfThenElseStmtNode(StmtNode *, ScopeObject *)
interpretBreakStmtNode(StmtNode *, ScopeObject *)
interpretReturnStmtNode(StmtNode *, ScopeObject *)
interpretLoopStmtNode(StmtNode *, ScopeObject *)
interpretFuncDefStmtNode(StmtNode *, ScopeObject *)
interpretExprStmtNode(StmtNode *, ScopeObject *)

Note:
Strings with interpolation should have already been checked for.

Parameters:
[in] node A pointer to the StmtNode structure containing the SwitchStmtNode structure to interpret.
[in,out] scope A pointer to the ScopeObject structure to evaluate node under.
unsigned int isHexString ( const char *  stringdata  ) 

Checks if a string of characters follows the format for a hexadecimal number.

Return values:
0 The string of characters is not a hexadecimal number.
1 The string of characters is a hexadecimal number.
Parameters:
[in] stringdata The array of characters to check the format of.
unsigned int isNumString ( const char *  stringdata  ) 

Checks if a string of characters follows the format for a number.

Return values:
0 The string of characters is not a number.
1 The string of characters is a number.
Parameters:
[in] stringdata The array of characters to check the format of.
ValueObject* opAddFloatFloat ( ValueObject a,
ValueObject b 
)

Adds two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the sum of the values a and b.
See also:
opSubFloatFloat(ValueObject *, ValueObject *)
opMultFloatFloat(ValueObject *, ValueObject *)
opDivFloatFloat(ValueObject *, ValueObject *)
opMaxFloatFloat(ValueObject *, ValueObject *)
opMinFloatFloat(ValueObject *, ValueObject *)
opModFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first term to add.
[in] b The second term to add.
ValueObject* opAddFloatInteger ( ValueObject a,
ValueObject b 
)

Adds a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the sum of the values a and b.
See also:
opSubFloatInteger(ValueObject *, ValueObject *)
opMultFloatInteger(ValueObject *, ValueObject *)
opDivFloatInteger(ValueObject *, ValueObject *)
opMaxFloatInteger(ValueObject *, ValueObject *)
opMinFloatInteger(ValueObject *, ValueObject *)
opModFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first term to add.
[in] b The second term to add.
ValueObject* opAddIntegerFloat ( ValueObject a,
ValueObject b 
)

Adds an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the sum of the values a and b.
See also:
opSubIntegerFloat(ValueObject *, ValueObject *)
opMultIntegerFloat(ValueObject *, ValueObject *)
opDivIntegerFloat(ValueObject *, ValueObject *)
opMaxIntegerFloat(ValueObject *, ValueObject *)
opMinIntegerFloat(ValueObject *, ValueObject *)
opModIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first term to add.
[in] b The second term to add.
ValueObject* opAddIntegerInteger ( ValueObject a,
ValueObject b 
)

Adds two integers.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the sum of the values a and b.
See also:
opSubIntegerInteger(ValueObject *, ValueObject *)
opMultIntegerInteger(ValueObject *, ValueObject *)
opDivIntegerInteger(ValueObject *, ValueObject *)
opMaxIntegerInteger(ValueObject *, ValueObject *)
opMinIntegerInteger(ValueObject *, ValueObject *)
opModIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first term to add.
[in] b The second term to add.
ValueObject* opDivFloatFloat ( ValueObject a,
ValueObject b 
)

Divides two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the quotient of the values a and b.
Return values:
NULL Division by zero was attempted.
See also:
opAddFloatFloat(ValueObject *, ValueObject *)
opSubFloatFloat(ValueObject *, ValueObject *)
opMultFloatFloat(ValueObject *, ValueObject *)
opMaxFloatFloat(ValueObject *, ValueObject *)
opMinFloatFloat(ValueObject *, ValueObject *)
opModFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opDivFloatInteger ( ValueObject a,
ValueObject b 
)

Divides a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the quotient of the values a and b.
Return values:
NULL Division by zero was attempted.
See also:
opAddFloatInteger(ValueObject *, ValueObject *)
opSubFloatInteger(ValueObject *, ValueObject *)
opMultFloatInteger(ValueObject *, ValueObject *)
opMaxFloatInteger(ValueObject *, ValueObject *)
opMinFloatInteger(ValueObject *, ValueObject *)
opModFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opDivIntegerFloat ( ValueObject a,
ValueObject b 
)

Divides an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the quotient of the values a and b.
Return values:
NULL Division by zero was attempted.
See also:
opAddIntegerFloat(ValueObject *, ValueObject *)
opSubIntegerFloat(ValueObject *, ValueObject *)
opMultIntegerFloat(ValueObject *, ValueObject *)
opMaxIntegerFloat(ValueObject *, ValueObject *)
opMinIntegerFloat(ValueObject *, ValueObject *)
opModIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opDivIntegerInteger ( ValueObject a,
ValueObject b 
)

Divides two integers.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the quotient of the values a and b.
Return values:
NULL Division by zero was attempted.
See also:
opAddIntegerInteger(ValueObject *, ValueObject *)
opSubIntegerInteger(ValueObject *, ValueObject *)
opMultIntegerInteger(ValueObject *, ValueObject *)
opMaxIntegerInteger(ValueObject *, ValueObject *)
opMinIntegerInteger(ValueObject *, ValueObject *)
opModIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opEqBooleanBoolean ( ValueObject a,
ValueObject b 
)

Tests if two boolean values are equal.

Precondition:
a and b were created by createBooleanValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqBooleanBoolean(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opEqFloatFloat ( ValueObject a,
ValueObject b 
)

Tests if two floats are equal.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opEqFloatInteger ( ValueObject a,
ValueObject b 
)

Tests if a float and an integer are equal.

Precondition:
a was created by createFloatValueObject(float) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opEqIntegerFloat ( ValueObject a,
ValueObject b 
)

Tests if an integer and a float are equal.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opEqIntegerInteger ( ValueObject a,
ValueObject b 
)

Tests if two integers are equal.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opEqNilNil ( ValueObject a,
ValueObject b 
)

Tests if two nil values are equal.

Note:
Two nil values are always equal, therefore a and b are not used by this function but are still included in its prototype to allow this function to be stored in a jump table for fast execution.
Precondition:
a and b were created by createNilValueObject(void).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqNilNil(ValueObject *, ValueObject *)
Parameters:
a Not used (see note).
b Not used (see note).
ValueObject* opEqStringString ( ValueObject a,
ValueObject b 
)

Tests if two strings are equal.

Precondition:
a and b were created by createStringValueObject(char *).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is equal to b.
See also:
opNeqStringString(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opMaxFloatFloat ( ValueObject a,
ValueObject b 
)

Finds the maximum of two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the maximum of the values a and b.
See also:
opAddFloatFloat(ValueObject *, ValueObject *)
opSubFloatFloat(ValueObject *, ValueObject *)
opMultFloatFloat(ValueObject *, ValueObject *)
opDivFloatFloat(ValueObject *, ValueObject *)
opMinFloatFloat(ValueObject *, ValueObject *)
opModFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMaxFloatInteger ( ValueObject a,
ValueObject b 
)

Finds the maximum of a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the maximum of the values a and b.
See also:
opAddFloatInteger(ValueObject *, ValueObject *)
opSubFloatInteger(ValueObject *, ValueObject *)
opMultFloatInteger(ValueObject *, ValueObject *)
opDivFloatInteger(ValueObject *, ValueObject *)
opMinFloatInteger(ValueObject *, ValueObject *)
opModFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMaxIntegerFloat ( ValueObject a,
ValueObject b 
)

Finds the maximum of an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the maximum of the values a and b.
See also:
opAddIntegerFloat(ValueObject *, ValueObject *)
opSubIntegerFloat(ValueObject *, ValueObject *)
opMultIntegerFloat(ValueObject *, ValueObject *)
opDivIntegerFloat(ValueObject *, ValueObject *)
opMinIntegerFloat(ValueObject *, ValueObject *)
opModIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMaxIntegerInteger ( ValueObject a,
ValueObject b 
)

Finds the maximum of two integers.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the maximum of the values a and b.
See also:
opAddIntegerInteger(ValueObject *, ValueObject *)
opSubIntegerInteger(ValueObject *, ValueObject *)
opMultIntegerInteger(ValueObject *, ValueObject *)
opDivIntegerInteger(ValueObject *, ValueObject *)
opMinIntegerInteger(ValueObject *, ValueObject *)
opModIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMinFloatFloat ( ValueObject a,
ValueObject b 
)

Finds the minimum of two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the minimum of the values a and b.
See also:
opAddFloatFloat(ValueObject *, ValueObject *)
opSubFloatFloat(ValueObject *, ValueObject *)
opMultFloatFloat(ValueObject *, ValueObject *)
opDivFloatFloat(ValueObject *, ValueObject *)
opMaxFloatFloat(ValueObject *, ValueObject *)
opModFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMinFloatInteger ( ValueObject a,
ValueObject b 
)

Finds the minimum of a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the minimum of the values a and b.
See also:
opAddFloatInteger(ValueObject *, ValueObject *)
opSubFloatInteger(ValueObject *, ValueObject *)
opMultFloatInteger(ValueObject *, ValueObject *)
opDivFloatInteger(ValueObject *, ValueObject *)
opMaxFloatInteger(ValueObject *, ValueObject *)
opModFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMinIntegerFloat ( ValueObject a,
ValueObject b 
)

Finds the minimum of an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the minimum of the values a and b.
See also:
opAddIntegerFloat(ValueObject *, ValueObject *)
opSubIntegerFloat(ValueObject *, ValueObject *)
opMultIntegerFloat(ValueObject *, ValueObject *)
opDivIntegerFloat(ValueObject *, ValueObject *)
opMaxIntegerFloat(ValueObject *, ValueObject *)
opModIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opMinIntegerInteger ( ValueObject a,
ValueObject b 
)

Finds the minimum of two integers.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the minimum of the values a and b.
See also:
opAddIntegerInteger(ValueObject *, ValueObject *)
opSubIntegerInteger(ValueObject *, ValueObject *)
opMultIntegerInteger(ValueObject *, ValueObject *)
opDivIntegerInteger(ValueObject *, ValueObject *)
opMaxIntegerInteger(ValueObject *, ValueObject *)
opModIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first number to compare.
[in] b The second number to compare.
ValueObject* opModFloatFloat ( ValueObject a,
ValueObject b 
)

Calculates the modulus of two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the modulus of the values a and b.
See also:
opAddFloatFloat(ValueObject *, ValueObject *)
opSubFloatFloat(ValueObject *, ValueObject *)
opMultFloatFloat(ValueObject *, ValueObject *)
opDivFloatFloat(ValueObject *, ValueObject *)
opMaxFloatFloat(ValueObject *, ValueObject *)
opMinFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opModFloatInteger ( ValueObject a,
ValueObject b 
)

Calculates the modulus of a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the modulus of the values a and b.
See also:
opAddFloatInteger(ValueObject *, ValueObject *)
opSubFloatInteger(ValueObject *, ValueObject *)
opMultFloatInteger(ValueObject *, ValueObject *)
opDivFloatInteger(ValueObject *, ValueObject *)
opMaxFloatInteger(ValueObject *, ValueObject *)
opMinFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opModIntegerFloat ( ValueObject a,
ValueObject b 
)

Calculates the modulus of an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the modulus of the values a and b.
See also:
opAddIntegerFloat(ValueObject *, ValueObject *)
opSubIntegerFloat(ValueObject *, ValueObject *)
opMultIntegerFloat(ValueObject *, ValueObject *)
opDivIntegerFloat(ValueObject *, ValueObject *)
opMaxIntegerFloat(ValueObject *, ValueObject *)
opMinIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opModIntegerInteger ( ValueObject a,
ValueObject b 
)

Calculates the modulus of two integers.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the modulus of the values a and b.
See also:
opAddIntegerInteger(ValueObject *, ValueObject *)
opSubIntegerInteger(ValueObject *, ValueObject *)
opMultIntegerInteger(ValueObject *, ValueObject *)
opDivIntegerInteger(ValueObject *, ValueObject *)
opMaxIntegerInteger(ValueObject *, ValueObject *)
opMinIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The dividend.
[in] b The divisor.
ValueObject* opMultFloatFloat ( ValueObject a,
ValueObject b 
)

Multiplies two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the product of the values a and b.
See also:
opAddFloatFloat(ValueObject *, ValueObject *)
opSubFloatFloat(ValueObject *, ValueObject *)
opDivFloatFloat(ValueObject *, ValueObject *)
opMaxFloatFloat(ValueObject *, ValueObject *)
opMinFloatFloat(ValueObject *, ValueObject *)
opModFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first factor to multiply.
[in] b The second factor to multiply.
ValueObject* opMultFloatInteger ( ValueObject a,
ValueObject b 
)

Multiplies a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the product of the values a and b.
See also:
opAddFloatInteger(ValueObject *, ValueObject *)
opSubFloatInteger(ValueObject *, ValueObject *)
opDivFloatInteger(ValueObject *, ValueObject *)
opMaxFloatInteger(ValueObject *, ValueObject *)
opMinFloatInteger(ValueObject *, ValueObject *)
opModFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first factor to multiply.
[in] b The second factor to multiply.
ValueObject* opMultIntegerFloat ( ValueObject a,
ValueObject b 
)

Multiplies an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the product of the values a and b.
See also:
opAddIntegerFloat(ValueObject *, ValueObject *)
opSubIntegerFloat(ValueObject *, ValueObject *)
opDivIntegerFloat(ValueObject *, ValueObject *)
opMaxIntegerFloat(ValueObject *, ValueObject *)
opMinIntegerFloat(ValueObject *, ValueObject *)
opModIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first factor to multiply.
[in] b The second factor to multiply.
ValueObject* opMultIntegerInteger ( ValueObject a,
ValueObject b 
)

Multiplies two integers.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the product of the values a and b.
See also:
opAddIntegerInteger(ValueObject *, ValueObject *)
opSubIntegerInteger(ValueObject *, ValueObject *)
opDivIntegerInteger(ValueObject *, ValueObject *)
opMaxIntegerInteger(ValueObject *, ValueObject *)
opMinIntegerInteger(ValueObject *, ValueObject *)
opModIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first factor to multiply.
[in] b The second factor to multiply.
ValueObject* opNeqBooleanBoolean ( ValueObject a,
ValueObject b 
)

Tests if two boolean values are not equal.

Precondition:
a and b were created by createBooleanValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opEqBooleanBoolean(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opNeqFloatFloat ( ValueObject a,
ValueObject b 
)

Tests if two floats are not equal.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opNeqFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opNeqFloatInteger ( ValueObject a,
ValueObject b 
)

Tests if a float and an integer are not equal.

Precondition:
a was created by createFloatValueObject(float) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opEqFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opNeqIntegerFloat ( ValueObject a,
ValueObject b 
)

Tests if an integer and a float are not equal.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opEqIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opNeqIntegerInteger ( ValueObject a,
ValueObject b 
)

Tests if two integers are not equal.

Precondition:
a and b were created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opEqIntegerInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opNeqNilNil ( ValueObject a,
ValueObject b 
)

Tests if two nil values are not equal.

Note:
Two nil values are always equal and thus never not equal, therefore a and b are not used by this function but are still included in its prototype to allow this function to be stored in a jump table for fast execution.
Precondition:
a and b were created by createNilValueObject(void).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opEqNilNil(ValueObject *, ValueObject *)
Parameters:
a Not used (see note).
b Not used (see note).
ValueObject* opNeqStringString ( ValueObject a,
ValueObject b 
)

Tests if two strings are not equal.

Precondition:
a and b were created by createStringValueObject(char *).
Returns:
A pointer to a ValueObject structure containing a boolean value indicating whether a is not equal to b.
See also:
opEqStringString(ValueObject *, ValueObject *)
Parameters:
[in] a The first value to test.
[in] b The second value to test.
ValueObject* opSubFloatFloat ( ValueObject a,
ValueObject b 
)

Subtracts two floats.

Precondition:
a and b were created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the difference of the values a and b.
See also:
opAddFloatFloat(ValueObject *, ValueObject *)
opMultFloatFloat(ValueObject *, ValueObject *)
opDivFloatFloat(ValueObject *, ValueObject *)
opMaxFloatFloat(ValueObject *, ValueObject *)
opMinFloatFloat(ValueObject *, ValueObject *)
opModFloatFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The minuend.
[in] b The subtrahend.
ValueObject* opSubFloatInteger ( ValueObject a,
ValueObject b 
)

Subtracts a float and an integer.

Precondition:
a was created by createFloatValueObject(float) and b was created by createIntegerValueObject(int).
Returns:
A pointer to a ValueObject structure containing the difference of the values a and b.
See also:
opAddFloatInteger(ValueObject *, ValueObject *)
opMultFloatInteger(ValueObject *, ValueObject *)
opDivFloatInteger(ValueObject *, ValueObject *)
opMaxFloatInteger(ValueObject *, ValueObject *)
opMinFloatInteger(ValueObject *, ValueObject *)
opModFloatInteger(ValueObject *, ValueObject *)
Parameters:
[in] a The minuend.
[in] b The subtrahend.
ValueObject* opSubIntegerFloat ( ValueObject a,
ValueObject b 
)

Subtracts an integer and a float.

Precondition:
a was created by createIntegerValueObject(int) and b was created by createFloatValueObject(float).
Returns:
A pointer to a ValueObject structure containing the difference of the values a and b.
See also:
opAddIntegerFloat(ValueObject *, ValueObject *)
opMultIntegerFloat(ValueObject *, ValueObject *)
opDivIntegerFloat(ValueObject *, ValueObject *)
opMaxIntegerFloat(ValueObject *, ValueObject *)
opMinIntegerFloat(ValueObject *, ValueObject *)
opModIntegerFloat(ValueObject *, ValueObject *)
Parameters:
[in] a The minuend.
[in] b The subtrahend.
ValueObject* opSubIntegerInteger ( ValueObject a,
ValueObject b 
)
ValueObject* updateScopeValue ( ScopeObject scope,
IdentifierNode target,
ValueObject value 
)

Updates a ValueObject structure named by an IdentifierNode structure in a ScopeObject structure.

Precondition:
scope was created by createScopeObject(ScopeObject *) and contains contents added by createScopeValue(ScopeObject *, IdentifierNode *) and contents updated by updateScopeValue(ScopeObject *, IdentifierNode *, ValueObject *).
target was created by createIdentifierNode(char *).
The value named by target was created by createScopeValue(ScopeObject *, IdentifierNode *).
value was created by either createNilValueObject(void), createBooleanValueObject(int), createIntegerValueObject(int), createFloatValueObject(float), createStringValueObject(char *), or copied with copyValueObject(ValueObject *).
Returns:
A pointer to the updated ValueObject structure named by target (will be the same as val).
Return values:
NULL target could not be found in scope.
See also:
getScopeValue(ScopeObject *, IdentifierNode *)
getLocalScopeValue(ScopeObject *, IdentifierNode *)
createScopeValue(ScopeObject *, IdentifierNode *)
Parameters:
[in,out] scope A pointer to the ScopeObject structure to update.
[in] target A pointer to the IdentifierNode structure containing the name of the value to update.
[in] value A pointer to the ValueObject structure containing the value to copy for the update.
 All Data Structures Files Functions Variables Enumerations Enumerator Defines