Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CentumSharedCode.h File Reference

This file contains the definitions needed to link and use CentumSharedCode.lib. More...

#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <windows.h>
#include <time.h>

Include dependency graph for CentumSharedCode.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  FunctionCalls
namespace  StackOperations
namespace  ThingManipulation
namespace  bytecodes
namespace  ThingReferences

Defines

#define CENTUMSHAREDCODE_API   __declspec(dllimport)
 A layer of indirection for including this file safely in all places.
#define CENUTUMSHAREDCODE_H
 A unique define for this include file to prevent multiple inclusion.
#define INST_ALIAS   0x01
 the member variable is an alias to the CThing indicated
#define INST_CREATE   0x02
 the member variable is a new instance of the CThing indicated
#define INST_MEMBER   0x03
 the member variable is a new instance and a contained variable
#define FIND_SCOPE   0x01
 the search function is currently within a scope
#define FIND_THING   0x02
 the search function is currently within a rebi
#define FIND_UNDEF   0x03
 the search function is currently not within any object
#define EXEC_NORMAL   0x00000000
 this return value means keep looping to execute the next byte code
#define EXEC_RETURN   0x00000001
 this return value means stop looping and take the values on stack and return
#define EXEC_EXCEPTION   0x00000002
 this return value means stop executing until you find an exception handler and call it with the return stack
#define EXEC_MULTIPLERETURN   0x000FFFFF
 values above this indicate a multiple return is to be made
#define EXEC_RETURNTO   0x00000003
 for labeled functions, return to the function with the given label
#define EXEC_RETURNFROM   0x00000004
 for labeled functions, return from the function with the given label
#define CTHING_READONLY   0x80000000
 flag for a read-only CThing, neither the definition, local, or any data can be changed
#define CTHING_REGISTEREDFUNCTION   0x00000001
 this CThing is a wrapper arround a registered external function, and the data holds its address
#define CTHING_DLLFUNCTION   0x00000002
 this CThing is a wrapper arrounf a dll function call, the data holds the .dll name and function name or function address
#define CTHING_UNDEF   0x00000004
 this CThing is the predefined "undef" value, and should also be considered read-only
#define DATA_TYPE_RAW   0x80000001
 stores "raw" (other) type data, variable length
#define DATA_TYPE_SIGNED_LONG   0x80000002
 stores long type data (4 bytes)
#define DATA_TYPE_FLOAT   0x80000003
 stores float type data (4 bytes)
#define DATA_TYPE_BOOLEAN   0x80000004
 represents a true or false value, 4 bytes, 1 is true, 0 is false.
#define DATA_TYPE_STRING   0x80000005
 string data in the form of one or more chars ending with a 0, varaible length
#define DATA_TYPE_ARRAY   0x80000006
 the first node of a linked list representing an array of rebis
#define DATA_TYPE_EXTERNAL_FUNCTION   0x80000007
 for CThings with the CTHING_REGISTEDFUNCTION flag, the address of the function
#define DATA_TYPE_DLL_NAME   0x80000008
 for CThings with the CTHING_DLLFUNCTION flag, the name of the dll
#define DATA_TYPE_DLL_FUNCTION_NAME   0x80000009
 for CThings with the CTHING_DLLFUNCTION flag, the name of the function
#define DATA_TYPE_DLL_FUNCTION_VALUE   0x8000000A
 for CThings with the CTHING_DLLFUNCTION flag, the ordinal of the function
#define DATA_TYPE_CONSOLE   0x8000000B
 a structure that keeps track of console handles for print and read operations
#define DATA_TYPE_FILE   0x8000000C
 the handle to an open file
#define DATA_TYPE_SOCKET   0x8000000D
 a socket structre
#define DATA_TYPE_CLIENT_CONNECTION   0x8000000E
 Data that keeps track of a network connection from a server ot a client.
#define DATA_TYPE_SCRIPT   0x8000000F
 Pointer to a CProcessData structure, DEPRECIATED.
#define DATA_TYPE_THREADLIST   0x80000010
 A list of all running threads.
#define DATA_TYPE_TIME   0x80000011
 A structure that stores time and date information.
#define DATA_TYPE_FILE_STREAM   0x80000011
 Stores a pointer that can be used to get symbols from a file being compiled, used for compiler macros.
#define DATA_TYPE_WORD_TYPE   0x80000012
 The type of a symbol, used for compiler macros.
#define DATA_TYPE_SCOPE   0x80000012
 A pointer to a CScope object.
#define DATA_TYPE_HWND   0x80000014
 A handle to a window (HWND).
#define DATA_TYPE_PYTHON   0x80000015
 Would have been Python data, DEPRECIATED.
#define DATA_TYPE_JAVAVM   0x80000016
 Stores a structue that contains information needed to make java calls.
#define DATA_TYPE_JAVA_CLASS   0x80000017
 Stores a Java data type.
#define DATA_TYPE_JAVA_OBJECT   0x80000018
 Stores a Java data type.
#define DATA_TYPE_JAVA_LONG   0x80000019
 Stores a Java data type.
#define DATA_TYPE_JAVA_METHODID   0x8000001A
 Stores a Java data type.
#define DATA_TYPE_JAVA_MEMBERID   0x8000001B
 Stores a Java data type.
#define DATA_TYPE_JAVA_BYTE   0x8000001C
 Stores a Java data type.
#define DATA_TYPE_JAVA_CHAR   0x8000001D
 Stores a Java data type.
#define DATA_TYPE_JAVA_SHORT   0x8000001E
 Stores a Java data type.
#define DATA_TYPE_JAVA_DOUBLE   0x8000001F
 Stores a Java data type.
#define DATA_TYPE_JAVA_BOOL   0x80000020
 Stores a Java data type.
#define DATA_TYPE_JAVA_INT   0x80000021
 Stores a Java data type.
#define DATA_TYPE_JAVA_FLOAT   0x80000022
 Stores a Java data type.
#define DATA_TYPE_HKEY   0x80000023
 An HKEY (handle to a registry key).
#define DATA_TYPE_HANDLE   0x80000024
 Any handle, currently only used for mutexs and events.
#define DATA_TYPE_READANDWRITE   0x80000025
 A thread protection object.
#define SOBJ_TYPE_BLOCK   1
 signifies the end of a stack section
#define SOBJ_TYPE_SREF   2
 singifies a reference with a string table offset as well (to be used locally)
#define SOBJ_TYPE_BREF   3
 signifies a bare reference (no allusion to string table)
#define SOBJ_NULL   ((StackObj*)0)
 NULL.

Typedefs

typedef ExecutionReturn(* ExternalCall )(unsigned long, CScope *, CThingStack *, CThingStack *)
 The signature for a registed call or a dll call.

Functions

CENTUMSHAREDCODE_API ExecutionReturn ExecuteSingleFunction (CProcessData *dat, CThing *function, CThingStack *params, CThingStack *usings)
 This function executes the passed CThing.
CENTUMSHAREDCODE_API void AddCProcessDataReference (CProcessData *p)
 Increases the reference count of the process.
CENTUMSHAREDCODE_API void ReleaseCProcessData (CProcessData *p)
 Decreases the reference count of the process.
CENTUMSHAREDCODE_API void ConvertSRefToBRef (StackObj *o)
 This function rearranges the internal structure of the StackObj so that it is a bare reference to a red instead of a named (string) reference.
CENTUMSHAREDCODE_API ExecutionReturn CallFunction (CScope *caller, CThing *func, CThingStack *params, CThingStack *usings)
 This function calls a rebi and returns the results of its execution.
CENTUMSHAREDCODE_API ExecutionReturn ExecuteByteCode (CScope *scope)
 This function executes the current byte code command for the scope.
CENTUMSHAREDCODE_API void AddCScopeReference (CScope *scope)
 This function increases the reference count of the scope by one.
CENTUMSHAREDCODE_API void ReleaseCScope (CScope *scope)
 This function decreases the reference count of the scope by one.
CENTUMSHAREDCODE_API void FillWithStack (CThingArray *a, CThingStack *s)
 The FillWithStack function takes a CThingStack and adds its elements to the CThingArray.
CENTUMSHAREDCODE_API void ReleaseAll (CThingArray *a)
 The ReleaseAll function calls ReleaseCThing on all elements of the array and then destroys the array.
CENTUMSHAREDCODE_API CThingCreateCThing (IMemory *m, CProcessData *p)
 The CreateCThing function returns a new CThing object.
CENTUMSHAREDCODE_API CDefinitionCreateCDefinition (IMemory *m, CProcessData *p)
 The CreateCDefinition function returns a new CDefinition object.
CENTUMSHAREDCODE_API CScopeCreateCScope (IMemory *m, CScope *caller, CProcessData *process)
 The CreateCScope function returns a new CScope object.
CENTUMSHAREDCODE_API CLocalCreateCLocal (IMemory *m)
 The CreateCLocal function returns a new CLocal object.
CENTUMSHAREDCODE_API CThingStackCreateCThingStack (IMemory *m)
 The CreateCThingStack function returns a new CThingStack object.
CENTUMSHAREDCODE_API void FinishCScope (CScope *s)
 The FinishCScope function simply calls the ReleaseCScope function on the passed scope.
CENTUMSHAREDCODE_API ExecutionReturn HandleReturnValue (CScope *scope, ExecutionReturn ret)
 This function takes the return value of a function that is to have its results pushed onto the local stack and calls HandleReturnValueAll with the appropriate parameters.
CENTUMSHAREDCODE_API ExecutionReturn HandleUReturnValue (CScope *scope, ExecutionReturn ret)
 This function takes the return value of a function that is to have its results pushed onto the usings stack and calls HandleReturnValueAll with the appropriate parameters.
CENTUMSHAREDCODE_API void ExtractAndReleaseParamsAndUsings (CScope *scope)
 The ExtractAndReleaseParamsAndUsings takes a substack from both the parms and usings stacks passed to a function and finishes them.
CENTUMSHAREDCODE_API ExecutionReturn MakeARegisteredCall (CThing *func, CScope *scope)
 The MakeARegisteredCall function is used when a rebi with the CTHING_REGISTEREDFUNCTION flag is to be called.
CENTUMSHAREDCODE_API ExecutionReturn MakeADLLCall (CThing *func, CScope *scope)
 The MakeADllCall function is used when a rebi with the CTHING_DLLFUNCTION flag is to be called.
CENTUMSHAREDCODE_API ExecutionReturn MakeANormalCall (CThing *func, CScope *scope)
 This function is used to execute a rebi that has no special flags relating to its call.
CENTUMSHAREDCODE_API ExecutionReturn HandleReturnValueAll (CScope *scope, ExecutionReturn ret, CThingStack *dest)
 This function deals with the results of a function return as appropriate, adding them to the correct stack, retuning them further or handling an excpetion.
CENTUMSHAREDCODE_API ExecutionReturn HandleReturnedException (CScope *scope, ExecutionReturn ret)
 The HandleReturnedException function attempts to use an exception handler with the current scope.
CENTUMSHAREDCODE_API ExecutionReturn CleanReturnValue (ExecutionReturn ret)
 This function adjusts the return type of a return value to represent that it has passed though a function.
CENTUMSHAREDCODE_API CThingStackObjToCThing (StackObj *p)
 This function takes a stack object as a parameter and returns the CThing pointer that it is holding, or NULL if there is none, and releases the StackObj.
CENTUMSHAREDCODE_API CThingStackObjToCThingSafe (const StackObj *p)
 This function takes a stack object as a parameter and returns the CThing pointer that it is holding, or NULL if there is none.
CENTUMSHAREDCODE_API void FinishCThingStack (CThingStack *s)
 This function takes a CThingStack pointer and releases it.
CENTUMSHAREDCODE_API ExecutionReturn CreateExceptionReturn (CScope *scope, const char *message)
 This function create a new ExecutionReturn with the type EXEC_EXCEPTION, and a single thrown value holding the message.
CENTUMSHAREDCODE_API CThingFindInScope (CScope *s, unsigned long stringindex, const CStringManager *strings, CThing *newvalue=(CThing *) 0, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 The FindInScope Function finds a rebi with a given name within a scope.
CENTUMSHAREDCODE_API CThingFindInThing (CThing *t, unsigned long stringindex, const CStringManager *strings, CThing *newvalue=(CThing *) 0, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 The FindInThing Function finds a rebi with a given name within a scope.
CENTUMSHAREDCODE_API CThingFindInThingSub (CThing *t, unsigned long stringindex, const CStringManager *strings, CThing *newvalue=(CThing *) 0, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 This function looks though a given rebi for a rebi with the given name, possibly replacing it and/or returning data about the object that it is a member of.
CENTUMSHAREDCODE_API SFindThing FindInScopeSub (CScope *s, unsigned long stringindex, const CStringManager *strings, CThing *newvalue=(CThing *) 0, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 This function looks though a given scope for a rebi with the given name, possibly replacing it and/or returning data about the object that it is a member of.
CENTUMSHAREDCODE_API SFindThing UniversalFind (SFindThing current, unsigned long stroffset, const CStringManager *strings, CThing *newvalue=(CThing *) 0, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 The UniversalFind function takes a variable name, and a context to search for it in (can be a scope or a rebi), and returns the result of the search.
CENTUMSHAREDCODE_API SFindThing UniversalArrayFind (SFindThing current, unsigned long stroffset, const CStringManager *strings, CThingArray *dest, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 The UniversaArrayFind function takes a variable name, and a context to search for it in (can be a scope or a rebi), and returns the result of the search, and if more than one return is called for they are stored in an array.
CENTUMSHAREDCODE_API CThingFindInScopeArray (CScope *s, unsigned long stringindex, const CStringManager *strings, CThingArray *dest, CThing **parent=(CThing **) 0, long *name=(long *) 0)
 The FindInScopArray Function finds a rebi or more than one rebi with a given name within a scope.
CENTUMSHAREDCODE_API void ReturnAllTied (CThing *current, unsigned long cname, CThingArray *ta, LongArray *la)
 This function takes a rebi and the name of a local variable and adds to the passed arrays all the rebi and local variables it is tied to.
CENTUMSHAREDCODE_API CThingReturnDestructor (const CThing *t)
 This function searches for a local or static rebi called "Destructor" that belongs to the passed rebi and returns it.
CENTUMSHAREDCODE_API CThingReturnConstructor (const CThing *t)
 This function searches for a local or static rebi called "Constructor" that belongs to the passed rebi and returns it.
CENTUMSHAREDCODE_API CThingBuildFromDef (CDefinition *def, CScope *scope, CThingStack *params, CThingStack *usings, CThing *owner)
 Given a CDefinition object and a scope this function will return a new rebi instance of that definition constructed in the given scope.
CENTUMSHAREDCODE_API CThingBuildFromString (const char *str, CScope *scope, CThingStack *params, CThingStack *usings, CThing *owner)
 This function creates a new rebi instance based on the definition of the rebi named.
CENTUMSHAREDCODE_API void MakeEqual (CThing *dest, CThing *source)
 This function makes one rebi equal to another, this is not the same as an alias operation.
CENTUMSHAREDCODE_API void CallConstructor (CThing *ret, CScope *scope, CThingStack *params, CThingStack *usings)
 This function calls the "Constructor" function of a rebi.
CENTUMSHAREDCODE_API void CallDestructor (CThing *thing)
 This function calls the "Destructor" function of the given rebi.
CENTUMSHAREDCODE_API char * GetData (const CThing *t, unsigned long type)
 This function returns a pointer to a type of data associated with a rebi instance.
CENTUMSHAREDCODE_API void AddData (CThing *t, unsigned long type, unsigned long length, const char *data)
 This function adds data of a given type and size to a CThing.
CENTUMSHAREDCODE_API long GetLong (const CThing *t, long def=0)
 The GetLong function returns a long based on the data the rebi contains, or the default value if it cannot extract one.
CENTUMSHAREDCODE_API float GetFloat (const CThing *t, float def=0.0)
 The GetFloat function returns a float based on the data the rebi contains, or the default value if it cannot extract one.
CENTUMSHAREDCODE_API char * GetString (const CThing *t, char *def=(char *) 0)
 The GetString function returns a char pointer based on the data the rebi contains, or the default (NULL if not supplied) value if it cannot extract one.
CENTUMSHAREDCODE_API bool HasLong (const CThing *t)
 Returns true if the rebi has either DATA_TYPE_SIGNED_LONG or DATA_TYPE_FLOAT data attached to it.
CENTUMSHAREDCODE_API void RemoveData (CThing *t, unsigned long type)
 This function removes a specific type of data from a CThing.
CENTUMSHAREDCODE_API bool HasDataType (const CThing *t, unsigned long type)
 This function returns true if the rebi instance has data of the given type attached to it and false otherwise.
CENTUMSHAREDCODE_API unsigned
long 
GetDataLength (const CThing *t, unsigned long type)
 This function returns length of a type of data associated with a rebi instance.
CENTUMSHAREDCODE_API CThingReplaceAndReturn (CThingArray *refs, unsigned long index, CThing *rep)
 This function replaces the rebi at the provided position in the array if neccessary, and then returns the rebi at that position.
CENTUMSHAREDCODE_API CThingReplaceAndReturnGC (CThingArray *refs, unsigned long index, CThing *rep, CThing *from)
 This function replaces the rebi at the provided position in the array if neccessary, and then returns the rebi at that position.
CENTUMSHAREDCODE_API void AddCThingReference (CThing *thing)
 Increases the reference count of a CThing object.
CENTUMSHAREDCODE_API void AddDefReference (CDefinition *def)
 Increases the reference count of a CDefinition object.
CENTUMSHAREDCODE_API void ReleaseCThing (CThing *thing)
 Decrements the reference count of a CThing object and releases its memory if appropriate.
CENTUMSHAREDCODE_API void ReleaseCDefinition (CDefinition *def)
 Decrements the reference count of a CDefinition object and releases its memory if appropriate.
CENTUMSHAREDCODE_API void AddCThingReferenceGC (CThing *thing, CThing *from)
 Increases the reference count of a CThing object and adds a backtrace pointer for garbage collection.
CENTUMSHAREDCODE_API void ReleaseCThingGC (CThing *thing, CThing *from)
 Removes the appropriate back-pointer fromt the CThing parameter and decrements its reference count, releasing it if appropriate.
CENTUMSHAREDCODE_API void GarbageCollect (CThing *thing)
 Traces through the back-pointers stored in a thing and releases it if it is in a closed memory loop.

Variables

CENTUMSHAREDCODE_API CMemoryTracker def
 this variable is a global memory manager instance, in case one is not accessable by other means.
CENTUMSHAREDCODE_API char rootpath [512]
 The path to the Centum directory, ends in a slash.


Detailed Description

This file contains the definitions needed to link and use CentumSharedCode.lib.


Function Documentation

CENTUMSHAREDCODE_API void AddCProcessDataReference CProcessData p  ) 
 

Increases the reference count of the process.

Parameters:
p the process.

CENTUMSHAREDCODE_API void AddCScopeReference CScope scope  ) 
 

This function increases the reference count of the scope by one.

Parameters:
scope the CScope to have its reference count adjusted.

CENTUMSHAREDCODE_API void ThingReferences::AddCThingReference CThing thing  ) 
 

Increases the reference count of a CThing object.

Each call to AddCThingReference must be matched to a single call to ReleaseCThing somewhere. AddCThinReference needs to acquire the mutex assocaited with the CThing object.

See also:
ReleaseCThing()
Parameters:
thing a valid CThing pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::AddCThingReferenceGC CThing thing,
CThing from
 

Increases the reference count of a CThing object and adds a backtrace pointer for garbage collection.

Each call to AddCThingReferenceGC must be matched to a single call to ReleaseCThingGC somewhere. AddCThinReferenceGC needs to acquire the mutex assocaited with the CThing object. This function adds the from pointer to the pointedto member of the thing parameter. The function itself calls AddCThingReference to increase the reference count.

See also:
ReleaseCThingGC()

AddCThingReference()

Parameters:
thing a valid CThing pointer, may be NULL
from a valid CThing pointer

CENTUMSHAREDCODE_API void ThingManipulation::AddData CThing t,
unsigned long  type,
unsigned long  length,
const char *  data
 

This function adds data of a given type and size to a CThing.

If the CThing is NULL, it has no local, or it is marked as read only or the undef object this function has no effect. A new block of data is allocated equal to the length parameter, the old data is copied into it and the buffer is associated with the rebi. Giving this function a length greate than the data being passed or passing NULL as the data pointer is ans error.

Parameters:
t the rebi the data is to be added to
type the type of data to be added.
length the size of the data in bytes.
data the data to be added.

CENTUMSHAREDCODE_API void ThingReferences::AddDefReference CDefinition def  ) 
 

Increases the reference count of a CDefinition object.

Each call to AddDefReference must be matched to a single call to ReleaseCDefinition somewhere. AddDefReference needs to acquire the mutex assocaited with the CDefinition object.

See also:
ReleaseCDefinition()
Parameters:
def a valid CDefinition pointer, may be NULL

CENTUMSHAREDCODE_API CThing * ThingManipulation::BuildFromDef CDefinition def,
CScope scope,
CThingStack params,
CThingStack usings,
CThing owner
 

Given a CDefinition object and a scope this function will return a new rebi instance of that definition constructed in the given scope.

This function uses the localinstantiation types under the CDefinition objects to construct the locals for this new object. Locals that are themselves instances are consructed recursively using this function. Passing either the definition or the scope as NULL is an error.

Parameters:
def the definition which the new rebi should be an instance of.
scope the scope the new instacne is to be constructed within.
params parameters to pass to the constructor function.
usings usings to call the constructor function under.
owner if the rebi is to be constructed as a member this is its container rebi.
Returns:
the newly constructed rebi
See also:
CallConstructor()

CDefinition

CENTUMSHAREDCODE_API CThing * ThingManipulation::BuildFromString const char *  str,
CScope scope,
CThingStack params,
CThingStack usings,
CThing owner
 

This function creates a new rebi instance based on the definition of the rebi named.

The rebi is searched for in the scope passed to this function. If the rebi cannot be founf the new rebi is created as an instance of the undef rebi. This function works the same as BuildFromDef in all other ways.

Parameters:
str the name of the rebi which this function obtains the definition from.
scope the scope the new instacne is to be constructed within.
params parameters to pass to the constructor function.
usings usings to call the constructor function under.
owner if the rebi is to be constructed as a member this is its container rebi.
Returns:
the newly constructed rebi
See also:
BuildFromDef()

CENTUMSHAREDCODE_API void ThingManipulation::CallConstructor CThing ret,
CScope scope,
CThingStack params,
CThingStack usings
 

This function calls the "Constructor" function of a rebi.

The caller of the constructor function is a new scope which is the rebi that is being constucted so that inside the destructor rebi varaibles may be accessed. Parameters and usings may also be passed to the constructor function.

Parameters:
ret the rebi to be constructed.
scope the scope the constructor is being called in
params any parameters to be passed to the constructor
usings any usings to be passed to the constructor
See also:
ReturnConstructor()

CENTUMSHAREDCODE_API void ThingManipulation::CallDestructor CThing thing  ) 
 

This function calls the "Destructor" function of the given rebi.

The caller of the destructor function is a new scope which is the rebi that is being destucted so that inside the destructor rebi varaibles may be accessed.

Parameters:
thing the rebi to be destructed.
See also:
ReturnDestructor()

CENTUMSHAREDCODE_API ExecutionReturn CallFunction CScope caller,
CThing func,
CThingStack params,
CThingStack usings
 

This function calls a rebi and returns the results of its execution.

Passing NULL as the rebi is an error. If either the parameters to this function or the usings are NULL than an empty stack is used in their place (so passing them as NULL is safe). Then an ExecuteByteCode loop is entered until the result of the byte code execution is not EXEC_NORMAL. Finally the last non- EXEC_NORMAL return value is readied for being returned by the use of the CleanReturnValue function, and then it is returned.

Parameters:
caller the scope the rebi is being called in.
func the rebi being called
params the parameters the function is to be called with.
usings the usings the function is to be called under.
Returns:
the result of the last executed byte code, adjusted for an extra layer of return.
See also:
ExecuteByteCode()

CleanReturnValue()

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::CleanReturnValue ExecutionReturn  ret  ) 
 

This function adjusts the return type of a return value to represent that it has passed though a function.

Multiple return values are adjusted to reflect having returned through another layer, and single returns are turned into normal results to signal that they should be added to the stack and not passed further on.

Parameters:
ret the return value before adjustements
Returns:
the return value after being adjusted.

CENTUMSHAREDCODE_API void ConvertSRefToBRef StackObj o  ) 
 

This function rearranges the internal structure of the StackObj so that it is a bare reference to a red instead of a named (string) reference.

If the StackObj passed to this function is not a string reference no action is taken.

Parameters:
o the StackObj to be changed, may be NULL

CENTUMSHAREDCODE_API CDefinition* CreateCDefinition IMemory m,
CProcessData p
 

The CreateCDefinition function returns a new CDefinition object.

Parameters:
m the memory manager used to allocate memory for this object.
p the process that this object belongs to.
See also:
CDefinition

CENTUMSHAREDCODE_API CLocal* CreateCLocal IMemory m  ) 
 

The CreateCLocal function returns a new CLocal object.

Parameters:
m the memory manager used to allocate memory for this object.
See also:
CLocal

CENTUMSHAREDCODE_API CScope* CreateCScope IMemory m,
CScope caller,
CProcessData process
 

The CreateCScope function returns a new CScope object.

Parameters:
m the memory manager used to allocate memory for this object.
caller the scope which called the function this scope represents.
process the process that this object belongs to.
See also:
CScope

CENTUMSHAREDCODE_API CThing* CreateCThing IMemory m,
CProcessData p
 

The CreateCThing function returns a new CThing object.

The CThing returned by this function needs to have a CDictionary assigned to it for many parts of the code to function properly.

Parameters:
m the memory manager used to allocate memory for this object.
p the process that this object belongs to.
See also:
CThing

CENTUMSHAREDCODE_API CThingStack* CreateCThingStack IMemory m  ) 
 

The CreateCThingStack function returns a new CThingStack object.

Parameters:
m the memory manager used to allocate memory for this object.
See also:
CThingStack

CENTUMSHAREDCODE_API ExecutionReturn ThingManipulation::CreateExceptionReturn CScope scope,
const char *  message
 

This function create a new ExecutionReturn with the type EXEC_EXCEPTION, and a single thrown value holding the message.

The thown rebi is an intance of the type interpreterexception. The message is attached as string data to that instance.

Parameters:
scope the scope the exception is to be thrown from.
message the string message to be returned.
Returns:
the ExecutionRetuen that represents the exception.

CENTUMSHAREDCODE_API ExecutionReturn ExecuteByteCode CScope scope  ) 
 

This function executes the current byte code command for the scope.

If the current code position is greater than the length of the bytecode for the scope than a sub-stack is taken off the interal localstack and returned with a value of EXEC_RETURN. Otherwise the 5 bytes of the bytecode are read, the first byte being the ident.

Parameters:
scope the CScope that an instruction is being executed in.
Returns:
the result of this byte code.
See also:
bytecodes

CENTUMSHAREDCODE_API ExecutionReturn ExecuteSingleFunction CProcessData dat,
CThing function,
CThingStack params,
CThingStack usings
 

This function executes the passed CThing.

The CThing is called with the passed parameters and usings (which may be NULL), and is called from the global scope.

Parameters:
dat the process to call the function in.
function the CThing / rebi to call.
params any parameters to pass this function.
usings any usings to call this function under.

CENTUMSHAREDCODE_API void FunctionCalls::ExtractAndReleaseParamsAndUsings CScope scope  ) 
 

The ExtractAndReleaseParamsAndUsings takes a substack from both the parms and usings stacks passed to a function and finishes them.

Parameters:
scope the scope the parameters and usings were passed to.

CENTUMSHAREDCODE_API void FillWithStack CThingArray a,
CThingStack s
 

The FillWithStack function takes a CThingStack and adds its elements to the CThingArray.

The CThingStack is emptied added to the array from top to bottom. This operation stops as soon as it finds a NULL CThing pointer, which may not necessarily be the entire stack. CThings taken off the stack are not dereferenced, it is your responsibility to clean up after using this function, probably by a call to ReleaseAll.

See also:
CThingArray

CThingStack

ReleaseAll()

Parameters:
a the CThingArray the stack elements will be added to.
s the CThingStack that the elements are taken off of.

CENTUMSHAREDCODE_API CThing * ThingManipulation::FindInScope CScope s,
unsigned long  stringindex,
const CStringManager strings,
CThing newvalue,
CThing **  parent,
long *  n
 

The FindInScope Function finds a rebi with a given name within a scope.

This function will replace the old value when found if a replacement value is provided. If the [out] parameters are non-NULL this function will also provide the name of the rebi and the rebi that it is a local variable of. Note that these will not be provided if the rebi is found but not as a local variable. If the name of the rebi to search for contains one or more ":" each part of the name is searched through and then the next part is searched through in the result of the that search.

Parameters:
s the scope to search in
stringindex the name of the rebi to search for
strings the string manager the name is an index into.
newvalue the replacement value (may be NULL)
parent [out] the containing rebi if any (may be NULL)
n [out] the name of the rebi in its containing rebi (may be NULL)
Returns:
the searched for rebi if found, NULL if not found.
See also:
FindInThing()

FindInScopeArray()

UniversalFind()

CENTUMSHAREDCODE_API CThing * ThingManipulation::FindInScopeArray CScope s,
unsigned long  stringindex,
const CStringManager strings,
CThingArray dest,
CThing **  parent,
long *  n
 

The FindInScopArray Function finds a rebi or more than one rebi with a given name within a scope.

If more than one rebi is to be returned, such as searching for params, they are placed in the dest array (along with a single NULL value to indicate that the results are in the array, as there may be no parameters). If the [out] parameters are non-NULL this function will also provide the name of the rebi and the rebi that it is a local variable of. Note that these will not be provided if the rebi is found but not as a local variable. If the name of the rebi to search for contains one or more ":" each part of the name is searched through and then the next part is searched through in the result of the that search.

Parameters:
s the scope to search in
stringindex the name of the rebi to search for
strings the string manager the name is an index into.
dest a CThingArray for holding the results if more than one is to be returned
parent [out] the containing rebi if any (may be NULL)
n [out] the name of the rebi in its containing rebi (may be NULL)
Returns:
the searched for rebi if found, NULL if not found.
See also:
CThingArray

FindInThing()

FindInScope()

UniversalArrayFind()

CENTUMSHAREDCODE_API SFindThing ThingManipulation::FindInScopeSub CScope s,
unsigned long  stringindex,
const CStringManager strings,
CThing newvalue,
CThing **  parent,
long *  name
 

This function looks though a given scope for a rebi with the given name, possibly replacing it and/or returning data about the object that it is a member of.

This function searches though the "my" variables of the scope, and if it is not found there through the scope's usings, container, and then the caller. The usings and container (if they exist) are searched with calls to FindInThingSub, and the caller is searched with FindInScopeSub. If a variable with the searched for name exists in the "my" variables it is returned wrapped in a SFindThing structure, and if a repacement value has been passed the previous value will be substituted for it before hand. The name and parent parameters will not be filled by this function, but will be passed on.

Parameters:
s the scope being searched in
stringindex the name of the variable as a string offset
strings the string manager that the offset is an index into
newvalue the new value that will replace the old one, if it is non-NULL
parent the containing thing the variable was found in (if non-NULL) [out]
name the name the variable was found as (if non-NULL) [out]
Returns:
a structure that containst the result of the search operation
See also:
FindInThingSub()

SFindThing

UniversalFind()

UniversalArrayFind()

CENTUMSHAREDCODE_API CThing * ThingManipulation::FindInThing CThing t,
unsigned long  stringindex,
const CStringManager strings,
CThing newvalue,
CThing **  parent,
long *  n
 

The FindInThing Function finds a rebi with a given name within a scope.

This function will replace the old value when found if a replacement value is provided. If the [out] parameters are non-NULL this function will also provide the name of the rebi and the rebi that it is a local variable of. Note that these will not be provided if the rebi is found but not as a local variable. If the name of the rebi to search for contains one or more ":" each part of the name is searched through and then the next part is searched through in the result of the that search.

Parameters:
t the rebi to search in
stringindex the name of the rebi to search for
strings the string manager the name is an index into.
newvalue the replacement value (may be NULL)
parent [out] the containing rebi if any (may be NULL)
n [out] the name of the rebi in its containing rebi (may be NULL)
Returns:
the searched for rebi if found, NULL if not found.
See also:
FindInScope()

FindInScopeArray()

UniversalFind()

CENTUMSHAREDCODE_API CThing * ThingManipulation::FindInThingSub CThing t,
unsigned long  stringindex,
const CStringManager strings,
CThing newvalue,
CThing **  parent,
long *  name
 

This function looks though a given rebi for a rebi with the given name, possibly replacing it and/or returning data about the object that it is a member of.

This function searches though the local variable, and if it is not found there through the, container, and then the static variables. The container (if there is one)is searched with a call to FindInThingSub. If a variable with the searched for name exists in the local or static variables it is returned wrapped in a SFindThing structure, and if a repacement value has been passed the previous value will be substituted for it before hand. If it is a local variable the name and parent parameters will be filled in if they exist. Also if the local varaible being re-aliased is tied to any other variables those variables are re-aliased as well.

Parameters:
t the rebi being searched in
stringindex the name of the variable as a string offset
strings the string manager that the offset is an index into
newvalue the new value that will replace the old one, if it is non-NULL
parent the containing thing the variable was found in (if non-NULL) [out]
name the name the variable was found as (if non-NULL) [out]
Returns:
a structure that containst the result of the search operation
See also:
FindInScopeSub()

SFindThing

UniversalFind()

UniversalArrayFind()

CENTUMSHAREDCODE_API void FinishCScope CScope s  ) 
 

The FinishCScope function simply calls the ReleaseCScope function on the passed scope.

See also:
ReleaseCScope()

CScope

CENTUMSHAREDCODE_API void StackOperations::FinishCThingStack CThingStack s  ) 
 

This function takes a CThingStack pointer and releases it.

This function releases the CThingStack with a call to IMemoryManager::Free(). It also calls the CThingStack::Destruct() function to clean up any data associated with the stack. Using the pointer after a call to this function is an error.

Parameters:
s a valid CThingStack pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::GarbageCollect CThing thing  ) 
 

Traces through the back-pointers stored in a thing and releases it if it is in a closed memory loop.

Calling Garbage collect on a CThing that has a reference count greater than its number of back-pointers is an error. This function operates by searching through each back pointer and then througn the back-pointers of all objects that can be found though back-pointers until either an object that has a reference count greater than its number of back pointers is found or all possible backpointers have been fully searched through. If the second is the case than the object is is a closed memory loop and this function releases it in the same manner that ReleaseCThing does, altough it does not call this function. Releasing this one CThing should release the entire memory loop.

See also:
AddCThingReferenceGC()

ReleaseCThingGC()

ReleaseCThing()

Parameters:
thing a valid CThing pointer, may NOT be NULL

CENTUMSHAREDCODE_API char * ThingManipulation::GetData const CThing t,
unsigned long  type
 

This function returns a pointer to a type of data associated with a rebi instance.

If the CThing passed is NULL, its CLocal is NULL, or it does not have the requested type this function returns NULL.

Parameters:
t the rebi with the data you want to retrieve
type the type of data to be retrieved
Returns:
the pointer to the data
See also:
CLocal::GetDataByType()

CENTUMSHAREDCODE_API unsigned long ThingManipulation::GetDataLength const CThing t,
unsigned long  type
 

This function returns length of a type of data associated with a rebi instance.

If the CThing passed is NULL, its CLocal is NULL, or it does not have the requested type this function returns 0.

Parameters:
t the rebi with the data you want to retrieve
type the type of data to be retrieved
Returns:
length of the data

CENTUMSHAREDCODE_API float ThingManipulation::GetFloat const CThing t,
float  def
 

The GetFloat function returns a float based on the data the rebi contains, or the default value if it cannot extract one.

First the rebi is examined for DATA_TYPE_FLOAT, and if it has that data it is returned. Next this function looks for DATA_TYPE_SIGNED_LONG attached to the rebi, and if it exists it is cast to a float and returned. Finally if the rebi has string data (DATA_TYPE_STRING) that data is converted to a number using atof(). If all these attempts fail the default value attached to this function is returned.

Parameters:
t the rebi to get the float from
def the result if no float can be extracted.
Returns:
the extracted float.

CENTUMSHAREDCODE_API long ThingManipulation::GetLong const CThing t,
long  def
 

The GetLong function returns a long based on the data the rebi contains, or the default value if it cannot extract one.

First this function looks for DATA_TYPE_SIGNED_LONG attached to the rebi, and returns that data if possible. Next the rebi is examined for DATA_TYPE_FLOAT, and if it has that data it is truncated to a long value and returned. Finally if the rebi has string data (DATA_TYPE_STRING) that data is converted to a number using atoi(). If all these attempts fail the default value attached to this function is returned.

Parameters:
t the rebi to get the long from
def the result if no long can be extracted.
Returns:
the extracted long.

CENTUMSHAREDCODE_API char * ThingManipulation::GetString const CThing t,
char *  def
 

The GetString function returns a char pointer based on the data the rebi contains, or the default (NULL if not supplied) value if it cannot extract one.

First the rebi is examined for DATA_TYPE_STRING, and if it has that data it is returned. Next this function looks for DATA_TYPE_FLOAT attached to the rebi, and if it exists it is turned into a string with sprintf and the format string: "%#.8f" and returned. Finally if the rebi has DATA_TYPE_SIGNED_LONG that data is turned into a string with sprintf and the format string: "%d" and returned. If all these attempts fail the default value attached to this function is returned (remember this may be NULL). WARNING: longs and floats converted into strings this way reside in a single static buffer, and subseqent calls may change this value. You should use the string this function returns as soon as possible and then consider it invalid afterwards.

Parameters:
t the rebi to get the char pointer from
def the result if no char pointer can be extracted.
Returns:
the string.

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::HandleReturnedException CScope scope,
ExecutionReturn  ret
 

The HandleReturnedException function attempts to use an exception handler with the current scope.

This function searches though the byte code of the current scope, starting at the current position looking for a bytecode with an ident of 0x03, singifying that it is a handler. This handler is then called with the returned value and the returned value of the handler is subsequently returned. If no handler can be found the value passed to this function is returned unchanged.

Parameters:
scope the scope to look for the exception handler within.
ret the returned exception that needs to be handled.
Returns:
the result of the handler function or the intial value if it cannot be handled.

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::HandleReturnValue CScope scope,
ExecutionReturn  ret
 

This function takes the return value of a function that is to have its results pushed onto the local stack and calls HandleReturnValueAll with the appropriate parameters.

This function provides a layer of indirection that prevents code duplication.

See also:
HandleReturnValueAll
Parameters:
scope the current scope
ret the return value to be handled.
Returns:
the return value after it has been processed.

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::HandleReturnValueAll CScope scope,
ExecutionReturn  ret,
CThingStack dest
 

This function deals with the results of a function return as appropriate, adding them to the correct stack, retuning them further or handling an excpetion.

First return values of type EXEC_NORMAL have their values pushed onto the stack passed to the function, and normal return with no stack is returned from the function. Return values of type EXEC_RETURN or multiple returns are passed on with no action taken. Return values of type EXEC_RETURNTO or EXEC_RETURNFROM have their top value of their return stack compared either to the label of the current scope if it is a string reference or if their pointers and the scope's rebi if it is a bare reference. If they pass this test return values of type EXEC_RETURNTO have their return stack added to the appropriate stack as if they were a normal return and returns of type EXEC_RETURNFROM are converted into normal returns. Finally exceptions have HandleReturnedException called on them repeatedly until a handler returns a non-exception which is then returned, or until no more handlers can be found (each passed the result of the previous handler) in that case the resulting exception is returned to be handled in the calling scope.

Parameters:
scope the scope in which this return value is to be handled.
ret the returned value to be handled.
dest the stack to push any values onto. If it is needed passing NULL is an error.
Returns:
the return value after being altered by handling.
See also:
HandleReturnedException()

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::HandleUReturnValue CScope scope,
ExecutionReturn  ret
 

This function takes the return value of a function that is to have its results pushed onto the usings stack and calls HandleReturnValueAll with the appropriate parameters.

This function provides a layer of indirection that prevents code duplication.

See also:
HandleReturnValueAll
Parameters:
scope the current scope
ret the return value to be handled.
Returns:
the return value after it has been processed.

CENTUMSHAREDCODE_API bool ThingManipulation::HasDataType const CThing t,
unsigned long  type
 

This function returns true if the rebi instance has data of the given type attached to it and false otherwise.

If the CThing passed is NULL, its CLocal is NULL, or it does not have the requested type this function returns false.

Parameters:
t the rebi with the data you want to retrieve
type the type of data to be retrieved
Returns:
boolean representing if the rebi has the data

CENTUMSHAREDCODE_API bool ThingManipulation::HasLong const CThing t  ) 
 

Returns true if the rebi has either DATA_TYPE_SIGNED_LONG or DATA_TYPE_FLOAT data attached to it.

Parameters:
t the rebi to be tested.
Returns:
weather it has numberical data attached to it or not.

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::MakeADLLCall CThing func,
CScope scope
 

The MakeADllCall function is used when a rebi with the CTHING_DLLFUNCTION flag is to be called.

This function gets the dll name, stored as local data of type DATA_TYPE_DLL_NAME, and then either the name of the function to call, as stored in local data with type: DATA_TYPE_DLL_FUNCTION_NAME or the ordinal as stored in local data of type DATA_TYPE_DLL_FUNCTION_VALUE. Then parameters and usings are extracted from the calling scope ( using CThingStack::GetASubStackUnsafe() ). After being called once as a dll function the rebi is converted into a registed function rebi (flag CTHING_REGISTEREDFUNCTION) for a speed boost. Finally the function itself is called, and then its return stack is reversed and then its return value is processed by the CleanReturnValue function before being returned.

Parameters:
func the rebi with the dll function flag being called.
scope the scope the rebi is being called within.
Returns:
the result of the dll function call.
See also:
CThingStack::GetASubStackUnsafe()

CleanReturnValue()

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::MakeANormalCall CThing func,
CScope scope
 

This function is used to execute a rebi that has no special flags relating to its call.

Parameters and usings are extracted from the calling scope ( using CThingStack::GetASubStack() ). Finally the function itself is called, and its return value is processed by the CleanReturnValue function before being returned.

Parameters:
func the rebi being called.
scope the scope the rebi is being called within.
Returns:
the result of the function call.
See also:
CThingStack::GetASubStack()

CleanReturnValue()

CallFunction()

CENTUMSHAREDCODE_API ExecutionReturn FunctionCalls::MakeARegisteredCall CThing func,
CScope scope
 

The MakeARegisteredCall function is used when a rebi with the CTHING_REGISTEREDFUNCTION flag is to be called.

This function gets the address of the external function, stored as local data of type DATA_TYPE_EXTERNAL_FUNCTION. Then parameters and usings are extracted from the calling scope ( using CThingStack::GetASubStackUnsafe() ). Finally the function itself is called, and then its return stack is reversed and then its return value is processed by the CleanReturnValue function before being returned.

Parameters:
func the rebi with the resitered function flag being called.
scope the scope the rebi is being called within.
Returns:
the result of the registered function call.
See also:
CThingStack::GetASubStackUnsafe()

CleanReturnValue()

CENTUMSHAREDCODE_API void ThingManipulation::MakeEqual CThing dest,
CThing source
 

This function makes one rebi equal to another, this is not the same as an alias operation.

The equals operation alters the structure of the destination rebi to make it equal to the source rebi. Any references to it will remain valid, but will now point to the altered version. This function should not be called on the undef rebi or one marked as read-only, although it will not fail if you do. After the copying operation has been completed the function searches for an "=" function and calls it if possible. You can also consult the Centum language manual for more details on the equality operation.

Parameters:
dest the rebi to be altered (made equal to the source)
source the rebi that is to be copied.

CENTUMSHAREDCODE_API void ReleaseAll CThingArray a  ) 
 

The ReleaseAll function calls ReleaseCThing on all elements of the array and then destroys the array.

Make sure that when you call this function that you want to call ReleaseCThing on all the elements, and not for example ReleaseCThingGC. Also all of the pointers need either to be valid or NULL or an error will result.

See also:
CThingArray

FillWithStack()

Parameters:
a the CThingArray with the elements to be released.

CENTUMSHAREDCODE_API void ThingReferences::ReleaseCDefinition CDefinition def  ) 
 

Decrements the reference count of a CDefinition object and releases its memory if appropriate.

Calling ReleaseCDefinition more times than you have called AddDefReference is an error. This function needs to acquire the mutex associated with the definition. If you have aquired it you must release it before calling this function. ReleaseCThing is called on all static members.

See also:
AddDefReference()

ReleaseCThing()

Parameters:
def a valid CDefinition pointer, may be NULL

CENTUMSHAREDCODE_API void ReleaseCProcessData CProcessData p  ) 
 

Decreases the reference count of the process.

If the reference count is zero the process' destruct function is called and it is freed with its own memory manager.

See also:
CProcessData::Destruct()
Parameters:
p the process.

CENTUMSHAREDCODE_API void ReleaseCScope CScope scope  ) 
 

This function decreases the reference count of the scope by one.

If the reference count of the scope reaches zero than it is destroyed and its memory is released.

Parameters:
scope the CScope to have its reference count adjusted.

CENTUMSHAREDCODE_API void ThingReferences::ReleaseCThing CThing thing  ) 
 

Decrements the reference count of a CThing object and releases its memory if appropriate.

Calling ReleaseCThing more times than you have called AddCThingReference is an error. This function needs to acquire the mutex associated with the CThing. If you have aquired it you must release it before calling this function. If the reference count of the CThing is equal to the number of backpointers it has then GarbageCollect is called, which may or may not release it. Otherwise if its reference count is zero the objects locals and data are de-referenced, it is untied from other variables, and its memory is freed.

See also:
AddCThingReference()

GarbageCollect()

Parameters:
thing a valid CThing pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::ReleaseCThingGC CThing thing,
CThing from
 

Removes the appropriate back-pointer fromt the CThing parameter and decrements its reference count, releasing it if appropriate.

Calling ReleaseCThingGC more times than you have called AddCThingReferenceGC is an error. Likewise each call to AddCThingReferenceGC needs to be matched to a call to ReleaseCThingGC with the same from parameter. Internally the reference count it decremented through a call to ReleaseCThing.

See also:
ReleaseCThing()
Parameters:
thing a valid CThing pointer, may be NULL
from the CThing which previously was pointing to the thing parameter.

CENTUMSHAREDCODE_API void ThingManipulation::RemoveData CThing t,
unsigned long  type
 

This function removes a specific type of data from a CThing.

If the CThing is NULL, it has no local, or it is marked as read only or the undef object this function has no effect. The data of the chosen type is removed from the CThing.

Parameters:
t the rebi the data is to be removed from.
type the type of data to be removed.

CENTUMSHAREDCODE_API CThing * ThingManipulation::ReplaceAndReturn CThingArray refs,
unsigned long  index,
CThing rep
 

This function replaces the rebi at the provided position in the array if neccessary, and then returns the rebi at that position.

The rebi is replaces if the rep parameter is non-NULL. CThings replaced in this manner have ReleaseCThing called on them.

Parameters:
refs the array of rebi
index the index in the array which is to be returned/modified
rep the rebi that should replace the old one
Returns:
the rebi at the requested index.
See also:
ReleaseCThing()

ReplaceAndReturnGC()

CENTUMSHAREDCODE_API CThing * ThingManipulation::ReplaceAndReturnGC CThingArray refs,
unsigned long  index,
CThing rep,
CThing from
 

This function replaces the rebi at the provided position in the array if neccessary, and then returns the rebi at that position.

The rebi is replaces if the rep parameter is non-NULL. CThings replaced in this manner have ReleaseCThingGC called on them. The ReleaseCThingGC uses the from parameter passed to this function.

Parameters:
refs the array of rebi
index the index in the array which is to be returned/modified
rep the rebi that should replace the old one
from the rebi that was previously referencing the replaced rebi
Returns:
the rebi at the requested index.
See also:
ReleaseCThingGC()

ReplaceAndReturn()

CENTUMSHAREDCODE_API void ThingManipulation::ReturnAllTied CThing current,
unsigned long  cname,
CThingArray ta,
LongArray la
 

This function takes a rebi and the name of a local variable and adds to the passed arrays all the rebi and local variables it is tied to.

The arrays passed to this function should already exist and contain the rebi and the name you are passing to this function. The rebi and the name at the same position in the arrays correspond to one tied variable (the rebi it is a local variable in and its name). This function operates recursively.

Parameters:
current the rebi the tied variable is a local variable of.
cname the name of the tied variable
ta [in/out} the array that stores the rebi to be returned, passing NULL is an error
la [in/out} the array that stores the name of the variables to be returned, passing NULL is an error

CENTUMSHAREDCODE_API CThing * ThingManipulation::ReturnConstructor const CThing t  ) 
 

This function searches for a local or static rebi called "Constructor" that belongs to the passed rebi and returns it.

No Constructor rebi will be returned for a rebi that is not an instance. Calling this function with a NULL parameter will return NULL.

Parameters:
t the rebi whose constructor rebi is to be returned.
Returns:
the Constructor rebi if found, or NULL if it is not.

CENTUMSHAREDCODE_API CThing * ThingManipulation::ReturnDestructor const CThing t  ) 
 

This function searches for a local or static rebi called "Destructor" that belongs to the passed rebi and returns it.

No Destructor rebi will be returned for a rebi that is not an instance. Calling this function with a NULL parameter will return NULL.

Parameters:
t the rebi whose destructor rebi is to be returned.
Returns:
the Destructor rebi if found, or NULL if it is not.

CENTUMSHAREDCODE_API CThing * StackOperations::StackObjToCThing StackObj p  ) 
 

This function takes a stack object as a parameter and returns the CThing pointer that it is holding, or NULL if there is none, and releases the StackObj.

The StackObjToCThingSafe function examines the type of the StackObj and returns the appropriate value. The StackObj pointer IS not released by a call to this function, but the reference count of the CThing affected. Calling this function on a StackObj that is still part of the stack is an error.

See also:
StackObjToCThingSafe()
Parameters:
p a valid StackObj pointer, may be NULL
Returns:
the CThing pointer, if any, inside the StackObj

CENTUMSHAREDCODE_API CThing * StackOperations::StackObjToCThingSafe const StackObj p  ) 
 

This function takes a stack object as a parameter and returns the CThing pointer that it is holding, or NULL if there is none.

The StackObjToCThingSafe function examines the type of the StackObj and returns the appropriate value. The StackObj pointer is not released by a call to this function, nor is the reference count of the CThing affected.

See also:
StackObjToCThing()
Parameters:
p a valid StackObj pointer, may be NULL
Returns:
the CThing pointer, if any, inside the StackObj

CENTUMSHAREDCODE_API SFindThing ThingManipulation::UniversalArrayFind SFindThing  current,
unsigned long  stroffset,
const CStringManager strings,
CThingArray dest,
CThing **  parent,
long *  name
 

The UniversaArrayFind function takes a variable name, and a context to search for it in (can be a scope or a rebi), and returns the result of the search, and if more than one return is called for they are stored in an array.

If the [out] parameters are non-NULL this function will also provide the name of the rebi and the rebi that it is a local variable of. To do searching within a specific scope or rebi FindInThingSub and FindInScopeSub are called internally to accomplish this in typical cases. However this function checks for special cases such as caller or this and returns the appropriate values, internally. The universal find functions are the only place these special cases are checked for.

Parameters:
current the SFindThing that the current search takes place in. If more than one rebi is to be returned, such as searching for params, they are placed in the dest array (along with a single NULL value to indicate that the results are in the array, as there may be no parameters).
stroffset the name of the rebi to search for
strings the string manager the name is an index into.
dest the array in which multiple returns are stored, may not be NULL.
parent [out] the containing rebi if any (may be NULL)
name [out] the name of the rebi in its containing rebi (may be NULL)
Returns:
the SFindThing that holds the result of the search.
See also:
FindInThing()

FindInScopeArray()

FindInThingSub()

FindInScopeSub()

CENTUMSHAREDCODE_API SFindThing ThingManipulation::UniversalFind SFindThing  current,
unsigned long  stroffset,
const CStringManager strings,
CThing newvalue,
CThing **  parent,
long *  name
 

The UniversalFind function takes a variable name, and a context to search for it in (can be a scope or a rebi), and returns the result of the search.

This function will replace the old value when found if a replacement value is provided. If the [out] parameters are non-NULL this function will also provide the name of the rebi and the rebi that it is a local variable of. To do searching within a specific scope or rebi FindInThingSub and FindInScopeSub are called internally to accomplish this in typical cases. However this function checks for special cases such as caller or this and returns the appropriate values, internally. The universal find functions are the only place these special cases are checked for.

Parameters:
current the SFindThing that the current search takes place in
stroffset the name of the rebi to search for
strings the string manager the name is an index into.
newvalue the replacement value (may be NULL)
parent [out] the containing rebi if any (may be NULL)
name [out] the name of the rebi in its containing rebi (may be NULL)
Returns:
the SFindThing that holds the result of the search.
See also:
FindInThing()

FindInScope()

FindInThingSub()

FindInScopeSub()


Generated on Sat Apr 16 16:31:09 2005 for Centum API by  doxygen 1.4.2