Main class used by SML functions. More...
#include <sml/context.h>
Public Member Functions | |
| SYMBOL * | AddClassSymbol (const char *name, char *classname, void *ptr) |
| SYMBOL * | AddClassSymbol (const MIUNICODE *name, char *classname, void *ptr) |
| void | AddNameAlias (const char *NewName, const char *OldName) |
| ERRVALUE | AddObjectSymbol (const char *name, const RVC::OBJITEM &objitem, SYMBOL **symp, UINT32 flags=0, const RVC::CREDENTIALS *Credentials=0) |
| ERRVALUE | AddObjectSymbol (const MIUNICODE *name, const RVC::OBJITEM &objitem, SYMBOL **symp, UINT32 flags=0, const RVC::CREDENTIALS *Credentials=0) |
| void | AddOnExit (ONEXITDATA *data) |
| void | AddRef () |
| SYMBOL * | AddSymbol (const char *name, STYPE stype) |
| SYMBOL * | AddSymbol (const MIUNICODE *name, STYPE stype) |
| int | AppendPrintBuffer (const char *) |
| int | AppendPrintBuffer (const MIUNICODE *) |
| int | BreakPointAdd (int offset) |
| int | BreakPointRemove (int offset) |
| int | BreakPointToggle (int offset) |
| int | CallbackAdd (McbCallbackFunc func, void *cbdata, UINT32 reason) |
| int | CallbackRemove (McbCallbackFunc func, void *cbdata, UINT32 reason) |
| int | CallCallbacks (CALLBACKSTRUCT *cbs) |
| void | CallDestructors () |
| double | CallFunction (const char *name, ELEMTYPE elemtype, INT32 element=0) |
| ERRVALUE | CallFunction (SYMBOL *func, ARG *args, int numargs, UINT8 *tlist, ARG *ret) |
| int | CheckForClassMemberErrors (FILE_TEXT &MissingClassFile) |
| void | ClearPrintBuffer () |
| UINT32 | ClearStatusBits (UINT32 bits) |
| void | CloseObjects () |
| void * | ConstructClassInstance (const char *ClassName) |
| bool | CurrentFunctionIsClassMethod () const |
| DEPRECATED int | Destroy () |
| int | Evaluate (int segnum, INT32 element, void *valp) |
| int | Evaluate (int segnum, INT32 element, int ElemType, void *valp) |
| GEOSTRUCT * | GeorefAlloc () |
| GEOSTRUCT * | GeorefCopy (const GEOSTRUCT *src) |
| void | GeorefFree (GEOSTRUCT *georef) |
| bool | GetAbortOnError () const |
| int | GetArg (ARG *args, int numargs, int num, OBJECT **pObject, bool UndefinedOK=false) |
| int | GetArrayIndexBase () const |
| double | GetCancelCheckInterval () const |
| bool | GetCaseSensitiveStrings () const |
| int | GetCodeSize () const |
| CONSOLE * | GetConsoleInterface () const |
| const MACHINEINST * | GetCS () const |
| MACHINEINST * | GetCSNonConst () const |
| const SML::FUNC * | GetCurrentFunction () const |
| MIUNICODE * | GetCurrentFunctionName () const |
| SYMBOL * | GetDestObjectSymbol (int numargs, ARG *args, UINT8 *argtype, STYPE OutSTYPE, UINT32 flags) |
| const DISPLAYINFO * | GetDispInfo () const |
| int | GetErrorLine () const |
| int | GetExitOnError () const |
| SYMBOL * | GetFieldSymbol (SYMBOL *t, SYMBOL *f) |
| SYMBOL * | GetFieldSymbol (int table, int field) |
| SYMBOL * | GetForEachRastSym () const |
| char * | GetFuncGroupName (int num) const |
| int | GetFunctionTypeList (char ***namep, int **typep) const |
| ERRVALUE | GetLastError (INT32 *pos=0, bool bClearErrorState=true) |
| int | GetLastError (MISTRING &msg, INT32 *pos=0) |
| STRING * | GetLastPoppedString () const |
| int | GetMainObject (RVC::OBJITEM &ObjItem) const |
| int | GetNeedLineNumbersInCode () const |
| int | GetNumBreakPoints () const |
| int | GetNumFuncClasses () const |
| OBJECT * | GetObjectList () const |
| const MACHINEINSTRUCTION * | GetOpCodeData (int opcode) const |
| MDLGPARENT | GetParentWidget () const |
| void * | GetParentWidgetVoid () const |
| int | GetParserWarningLevel () const |
| const MISTRING & | GetParserWarnings () const |
| const MACHINEINST * | GetPC () const |
| ERRVALUE | GetPCList (SIMPLE_ARRAY< const MACHINEINST * > &plist) |
| int | GetPCList (MACHINEINST ***plist) |
| SYMBOL * | GetPrimaryKeySymbol (SYMBOL *fk_sym) |
| int | GetPrimaryTable (int segment) const |
| const MISTRING & | GetPrintBufferMISTRING () const |
| DEVPRIVATE * | GetPrivData (int pindex) const |
| int | GetProgBase () const |
| int | GetProgPtr () const |
| char * | GetRCSID (SOURCEINFO *fni) |
| CLASS * | GetRegisteredClassList () const |
| RVC::DATABASEHANDLE * | GetRootElemDBHandle () const |
| int | GetRootElemNum () const |
| int | GetRootElemType () const |
| const FILEPATH & | GetScriptFilePath () const |
| INT32 | GetScriptInode () const |
| const RVC::OBJITEM & | GetScriptObjItem () const |
| int | GetSegmentByXMLNode (const XMLNODE *node) const |
| int | GetSegmentElemType (int segment=-1) const |
| const XMLNODE * | GetSegmentXMLNode (int segnum) const |
| const SOURCEINFO * | GetSourceInfo (const MACHINEINST *pc) const |
| bool | GetSourceLine (const MACHINEINST *pc, MISTRING &mistr) const |
| const PARSEPOS * | GetSourcePos (const MACHINEINST *pc) const |
| UINT32 | GetStatus () const |
| MISTATUSCONTEXT * | GetStatusContext () const |
| SYMBOL * | GetStdSym () const |
| SYMBOL * | GetSymbol (const MIUNICODE *name) const |
| SYMBOL * | GetSymbol (const char *name) const |
| SYMBOL * | GetSymbolListFuncs (int group=0) const |
| SYMBOL * | GetSymbolListGlobal (int level=0) const |
| SYMBOL * | GetSymbolListLocal () const |
| SYMBOL * | GetSymbolListPerm () const |
| int | GetSymbolNameList (int funcgroup, MISTRINGLIST &names, bool bIncludeAliases=true) const |
| int | GetSymbolTypeList (char ***namep, int **typep) const |
| SYMBOL * | GetTableSymbol (int table) |
| MIPRODUCTCODE | GetTargetProductCode () const |
| const SIMPLE_ARRAY< FIELDDATA > & | GetUnindexedFieldList () const |
| USAGE | GetUsage (int Segment) const |
| XMLDOC * | GetXMLDoc () const |
| bool | HasBreakPoint (int offset) const |
| bool | HasCancelFunc () const |
| int | InstallClass (CLASS *staticClass) |
| int | InstallEnum (const char *name, int(*func)(CONTEXT *, void *, FLAG **), void *funcdata, UINT32 flags) |
| int | InstallEnum (const char *name, FLAG *smlflags, UINT32 flags) |
| int | InstallFunctionList (const FUNCINSTALLER *funclist) |
| int | InstallFunctions (const char *symclass, const FUNC *vfuncs) |
| void | InstallSMLOnlyFunctions () |
| bool | IsBeingDestroied () const |
| void | List (MISTRING &) |
| void | List (FILE *file) |
| int | ListLine (const MACHINEINST *c, bool bIgnoreBad, bool bMarkIt, MIUNICODE *buf, int len) |
| int | ListLine (const MACHINEINST *c, bool bIgnoreBad, bool bMarkIt, MISTRING &buf) |
| FLAG * | LookupEnumList (const char *name) |
| ERRVALUE | MemAlloc (void **pRet, UINT32 size) |
| ERRVALUE | MemAllocC (void **pRet, UINT32 size) |
| void | MemFree (void *ptr) |
| int | ObjectAlloc (TINOBJECT **) |
| int | ObjectAlloc (CADOBJECT **) |
| int | ObjectAlloc (VECTOROBJECT **) |
| int | ObjectAlloc (RASTEROBJECT **) |
| OBJECT * | ObjectAlloc (STYPE stype) |
| int | Optimize () |
| void | OutstandingDestroysDec () |
| int | OutstandingDestroysGet () const |
| void | OutstandingDestroysInc () |
| int | Parse (int segnum, const MIUNICODE *str, UINT32 flags=0) |
| int | PrivDataIndexAlloc () |
| void | RecycleStrings (bool FreeStringsInCodeToo=false) |
| void | RegisterObjectCloseFunc (STYPE stype, int(*func)(CONTEXT *, OBJECT *)) |
| void | Release () |
| int | Run (int segnum, UINT32 flags=0) |
| int | SegmentCreate (USAGE usage, ELEMTYPE ElemType=ELEMTYPE_Empty, int table=-1) |
| int | SegmentDestroy (int segment) |
| void | SetAbortOnError (bool value) |
| void | SetCancelCheckInterval (double seconds) |
| void | SetCancelFunc (int(*func)(CONTEXT *, void *), void *data) |
| void | SetCaseSensitiveStrings (bool sensitive=true) |
| void | SetConsole (CONSOLE *console) |
| void | SetDebugger (SMLDEBUG *debug) |
| void | SetDispInfo (const DISPLAYINFO &info) |
| int | SetErrorCode (int code) |
| int | SetErrorCodeAndAbort (int code) |
| void | SetErrorMessageForce (MIUNICODE *s) |
| void | SetNeedLineNumbersInCode (int val) |
| void | SetParentWidget (MDLGPARENT widget) |
| ERRVALUE | SetParmError (int parmnum, int errcode=EBadFuncParm, const MIUNICODE *funcname=0) |
| void | SetParserWarningLevel (int level) |
| void | SetPrivData (int pindex, DEVPRIVATE *pdata) |
| void | SetScriptFilePath (const FILEPATH &filepath) |
| void | SetScriptObjItem (const RVC::OBJITEM &objitem) |
| ERRVALUE | SetSegment (int segnum) |
| void | SetSegmentXMLNode (int segnum, const XMLNODE *node) |
| UINT32 | SetStatusBits (UINT32 bits) |
| void | SetStatusContext (MISTATUSCONTEXT *pStatusContext) |
| void | SetTargetProductCode (MIPRODUCTCODE ProductCode) |
| int | SetupObjectDatabase (OBJECT *obj, RVC::FILEHANDLE *filehandle, RVC::DATABASEHANDLE *dbhandle, ELEMDATA *ElemData, ELEMTYPE ElemType, const RVC::CREDENTIALS *Credentials, bool fromcb=false) |
| void | SetUsage (int Segment, USAGE usage) |
| void | SetXMLDoc (XMLDOC *doc) |
| int | Stop () |
| int | Stop (bool bCanDestroyContext) |
| STRING * | StringAlloc (const MIUNICODE *str) |
| STRING * | StringAlloc (const STRUTF8 &str) |
| STRING * | StringAlloc (const MISTRING &str) |
| STRING * | StringAlloc (const UINT8 *str) |
| STRING * | StringAlloc (const char *str) |
| void | StringFree (STRING *) |
| SYMBOL * | TempObjectSymbolAlloc (STYPE stype) |
| void | TempObjectSymbolFree (SYMBOL *) |
| int | TestCancelOnce () |
| bool | TestClass (const CLASS *GivenClass, const CLASS *NeededClass) const |
| bool | TestClass (const char *GivenClassName, const CLASS *NeededClass) const |
| void | VMExecute (MACHINEINST *pc) |
| int | VMReset () |
Static Public Member Functions | |
| static int | CallbackAddGlobal (McbCallbackFunc func, void *cbdata, UINT32 reason) |
| static int | CallbackRemoveGlobal (McbCallbackFunc func, void *cbdata, UINT32 reason) |
| static char * | GetOperator (int num) |
| static char * | GetOperatorDescription (int num) |
| static char * | GetOperatorHelp (int num) |
| static char ** | GetOperatorList () |
| static void | RegisterFunctionList (const FUNCINSTALLER *FuncList) |
| static void | RegisterMinimalFunctionList (const FUNCINSTALLER *FuncList) |
| static int | STYPEFlags (STYPE stype) |
| static char * | STYPEtoString (STYPE stype) |
| static int | STYPEToTokenVal (STYPE stype) |
| static STYPE | TokenValToSTYPE (int tval) |
Main class used by SML functions.
| SYMBOL* SML::CONTEXT::AddClassSymbol | ( | const char * | name, | |
| char * | classname, | |||
| void * | ptr | |||
| ) |
Add a class symbol to the context (char*) name.
See details in the (MIUNICODE*) version of this method
| name | Symbol name | |
| classname | SML class name (SMLCLASSNAME_...) | |
| ptr | Pointer to the data the symbol represents |
| void SML::CONTEXT::AddNameAlias | ( | const char * | NewName, | |
| const char * | OldName | |||
| ) |
Setup an alias for a class or function Existing scripts will be able to refer to the class or function using OldName, but will get a parser warning that the name has changed.
Note: both names must be string literals or static. The context only keeps the pointers
| ERRVALUE SML::CONTEXT::AddObjectSymbol | ( | const char * | name, | |
| const RVC::OBJITEM & | objitem, | |||
| SYMBOL ** | symp, | |||
| UINT32 | flags = 0, |
|||
| const RVC::CREDENTIALS * | Credentials = 0 | |||
| ) |
Add symbol referring to object using 'char*' name.
| ERRVALUE SML::CONTEXT::AddObjectSymbol | ( | const MIUNICODE * | name, | |
| const RVC::OBJITEM & | objitem, | |||
| SYMBOL ** | symp, | |||
| UINT32 | flags = 0, |
|||
| const RVC::CREDENTIALS * | Credentials = 0 | |||
| ) |
Add symbol referring to object using 'MIUNICODE*' name.
| void SML::CONTEXT::AddOnExit | ( | ONEXITDATA * | data | ) |
Add an OnExit entry to the OnExitList.
| void SML::CONTEXT::AddRef | ( | ) |
COM-like AddRef method An SMLCONTEXT is not a COM object, but uses AddRef/Release symantics.
Add a symbol to the context (char*) name.
Add a symbol to the context (MIUNICODE*) name.
| int SML::CONTEXT::AppendPrintBuffer | ( | const char * | ) |
Append an ISO-2022 string to the print buffer.
| int SML::CONTEXT::AppendPrintBuffer | ( | const MIUNICODE * | ) |
Append a Unicode string to the print buffer.
| int SML::CONTEXT::BreakPointAdd | ( | int | offset | ) |
Add a breakpoint at the current offset.
(offset = pc - cs)
| int SML::CONTEXT::BreakPointRemove | ( | int | offset | ) |
Remove a breakpoint from the current offset.
(offset = pc - cs)
| int SML::CONTEXT::BreakPointToggle | ( | int | offset | ) |
Toggle a breakpoint at the current offset.
(offset = pc - cs)
| int SML::CONTEXT::CallbackAdd | ( | McbCallbackFunc | func, | |
| void * | cbdata, | |||
| UINT32 | reason | |||
| ) |
| static int SML::CONTEXT::CallbackAddGlobal | ( | McbCallbackFunc | func, | |
| void * | cbdata, | |||
| UINT32 | reason | |||
| ) | [static] |
Add a callback to the Global callback list.
For a list of possible callback reasons
| int SML::CONTEXT::CallbackRemove | ( | McbCallbackFunc | func, | |
| void * | cbdata, | |||
| UINT32 | reason | |||
| ) |
| static int SML::CONTEXT::CallbackRemoveGlobal | ( | McbCallbackFunc | func, | |
| void * | cbdata, | |||
| UINT32 | reason | |||
| ) | [static] |
Remove a callback from the Global callback list.
For a list of possible callback reasons
| int SML::CONTEXT::CallCallbacks | ( | CALLBACKSTRUCT * | cbs | ) |
| void SML::CONTEXT::CallDestructors | ( | ) |
Call the destructors symbols pointing to class data.
This calls SYMBOL::DisposeOFContents() for all STYPE_ClassVar symbols
Calls the named function.
Looks up a built-in or user-defined function by name and calls it with no parameters. Also sets the current element like SML::CONTEXT::Evaluate().
There's a more flexible version of this function which takes a list of parameters to be passed to the function.
| ERRVALUE SML::CONTEXT::CallFunction | ( | SYMBOL * | func, | |
| ARG * | args, | |||
| int | numargs, | |||
| UINT8 * | tlist, | |||
| ARG * | ret | |||
| ) |
Call a function pointed to by a given symbol.
This is used internally to call both user-defined and built-in SML functions. One possible use for this function would be to see if a query has some user-defined function in it and if so, call it once before drawing. For example:
UINT8 type = SML::STYPE_Class; SML::ARG arg, ret; SML::SYMBOL* func; arg.ptr = layer; // Layer about to be drawn func = context->GetSymbol("OnDrawBegin"); if (func) context->CallFunction(func, args, 1, types, &ret); // Do the drawing here func = context->GetSymbol("OnDrawEnd"); if (func) context->CallFunction(func, args, 1, types, &ret);
| func | SML::SYMBOL of function to call | |
| args | List of arguments to pass | |
| numargs | Number of arguments in "args" | |
| tlist | SML::STYPEs of the args | |
| ret | Return value |
| int SML::CONTEXT::CheckForClassMemberErrors | ( | FILE_TEXT & | MissingClassFile | ) |
Scans all functions and classes to make sure the classes their members and parameters refer to are known.
Any errors are written out to the MissingClassFile
| void SML::CONTEXT::ClearPrintBuffer | ( | ) |
Clears the buffer used by printf functions.
When running in an SML context, printf prints to a console window and there is no print buffer. In all other contexts, printf functions append text to a buffer which the caller can retrieve.
| void SML::CONTEXT::CloseObjects | ( | ) |
Closes all open objects.
This is done automatically when the script exits.
| void* SML::CONTEXT::ConstructClassInstance | ( | const char * | ClassName | ) |
Create an instance of a class pointer You should use the SMLCLASSNAME_Xxx macros for the class name.
This makes them easier to search for and prevents mistakes due to typos (or at least lets the compiler catch them). Any SML function or class member that returns a copy of something that it expects SML to delete should use this method to allocate the thing being returned, unless you know for a fact that SML expects it to be allocated with new/delete. That way, as the older classes get converted over to be allocated with new/delete, you won't have to change anything.
| bool SML::CONTEXT::CurrentFunctionIsClassMethod | ( | ) | const |
Returns true if the current function is a class method.
This is for use in built-in functions. If it returns true, then args[-1] is a pointer to "this". This is useful when you have an existing function that takes a pointer to a class as its first member and want to make it do double duty as a class method. For example, the SML function ViewRedraw() takes a view (args[0] and a flag (args[1]). As a class method, it would take the same parameters but view would be args[-1] and the flags args[0]) Note that this is only valid for functions which match the prototype whatever FuncName(int numargs, SML::ARG* args, UINT8* type, SML::CONTEXT* context)
| DEPRECATED int SML::CONTEXT::Destroy | ( | ) |
Destroy the context.
Will free it as well, so don't access the context after calling this function. If we were using constructor/desctructors for this, this would be the destructor. However, If any widget destroy callbacks have been registered, the actual context will stick around until the last of them has been called.
| int SML::CONTEXT::Evaluate | ( | int | segnum, | |
| INT32 | element, | |||
| void * | valp | |||
| ) |
Evaluate a query for a given element Uses the element type given when the segment was created.
| int SML::CONTEXT::Evaluate | ( | int | segnum, | |
| INT32 | element, | |||
| int | ElemType, | |||
| void * | valp | |||
| ) |
Evaluate a query for a given element of a given type Might be better to call the other version of this method which does not take an elemtype.
| GEOSTRUCT* SML::CONTEXT::GeorefAlloc | ( | ) |
Allocate an SML::GEOSTRUCT.
Code outside rvcsys.dll cannot construct SML::GEOSTRUCTs since the size of the struct is private
| GEOSTRUCT* SML::CONTEXT::GeorefCopy | ( | const GEOSTRUCT * | src | ) |
Copy an SML::GEOSTRUCT.
| void SML::CONTEXT::GeorefFree | ( | GEOSTRUCT * | georef | ) |
Free an SML::GEOSTRUCT.
| bool SML::CONTEXT::GetAbortOnError | ( | ) | const |
Get the AbortOnError flag.
If set (which it is by default, then any built-in function that gets an error and calls SetErrorCode() will cause the script to abort and popup an error dialog. If cleared, the error will be noted but the script will go on and the script writer can check GetLastError() to see if there was an error.
| int SML::CONTEXT::GetArg | ( | ARG * | args, | |
| int | numargs, | |||
| int | num, | |||
| OBJECT ** | pObject, | |||
| bool | UndefinedOK = false | |||
| ) |
Get an argument from the argument list Can return an error if the argument is invalid in this case, the SML ErrorCode has already been set and you just have to return.
Note, the args/numargs parameters are in the opposite order of the old function. I thought that was a stupid order.
| int SML::CONTEXT::GetArrayIndexBase | ( | ) | const |
Get the array index base (normally 1, but can be overridden).
| double SML::CONTEXT::GetCancelCheckInterval | ( | ) | const |
Return the time in seconds between each cancel check.
| bool SML::CONTEXT::GetCaseSensitiveStrings | ( | ) | const |
Return whether or not string comparisons should be case sensitive.
| int SML::CONTEXT::GetCodeSize | ( | ) | const |
Get the size of the bytecode in memory.
| CONSOLE* SML::CONTEXT::GetConsoleInterface | ( | ) | const |
Returns the console handle.
| const MACHINEINST* SML::CONTEXT::GetCS | ( | ) | const |
Get the current Code Segment (CS) (const).
| MACHINEINST* SML::CONTEXT::GetCSNonConst | ( | ) | const |
Get the current Code Segment (CS) (non-const).
| const SML::FUNC* SML::CONTEXT::GetCurrentFunction | ( | ) | const |
Return the SML::FUNC* of the current function.
This is only valid while running, not parsing.
| MIUNICODE* SML::CONTEXT::GetCurrentFunctionName | ( | ) | const |
Return the name of the current function.
This is only valid while running, not parsing. This should return a (const MIUNICODE *), but not all the places that need it know about const yet.
| SYMBOL* SML::CONTEXT::GetDestObjectSymbol | ( | int | numargs, | |
| ARG * | args, | |||
| UINT8 * | argtype, | |||
| STYPE | OutSTYPE, | |||
| UINT32 | flags | |||
| ) |
Return symbol for return value of a function returning an object.
This is a magic function. Given the arguments, it returns a symbol pointing to the destination symbol. If it has to, it makes a new temporary symbol and returns that. However, it first looks at the next instruction in the code. If it's an opOBJASGN, it returns the next symbol on the stack (args[-1]), which will be the variable that opOBJASGN will assign into. It then adjusts the PC to skip the assignment instruction and adjusts the frame pointer to make the dest variable pop off with the rest of the function parameters when the funtion returns.
Allowable flags:
| const DISPLAYINFO* SML::CONTEXT::GetDispInfo | ( | ) | const |
Returns the display info set by previous call to SetDispInfo.
SML doesn't use this information except to pass it through to the script is _context.DisplayInfo
| int SML::CONTEXT::GetErrorLine | ( | ) | const |
Returns the line of the last error.
| int SML::CONTEXT::GetExitOnError | ( | ) | const |
Returns true if we want scripts to exit on errors.
We let the script change this and a few SML functions return error codes rather than causing the script to exit.
Return the SYMBOL of a database field.
This version only used by the parser.
| SYMBOL* SML::CONTEXT::GetFieldSymbol | ( | int | table, | |
| int | field | |||
| ) |
Return the SYMBOL of a database field.
| table | Table number | |
| field | Field number |
| SYMBOL* SML::CONTEXT::GetForEachRastSym | ( | ) | const |
Returns the current raster being processed by a "foreach" or NULL if none.
| char* SML::CONTEXT::GetFuncGroupName | ( | int | num | ) | const |
Get the name of a function group (don't free this) Maybe this should return const? Should it look up the name in messages.txt for us or should the caller? (Currently we expect the caller to do that).
| int SML::CONTEXT::GetFunctionTypeList | ( | char *** | namep, | |
| int ** | typep | |||
| ) | const |
Returns function types and names for the "Insert Function" dialogs.
Returns the last error code, and (optionally) position where the error occured.
Calling this function also clears the error condition by default. You can pass false for bClearErrorState to prevent that. If error occured in an include file, pos returned will be -1 to tell us not to try to move the cursor (not in the text widget)
Returns the last error code, message and position where the error occured.
Calling this function also clears the error condition If error occured in an include file, pos returned will be -1 to tell us not to try to move the cursor (not in the text widget)
| STRING* SML::CONTEXT::GetLastPoppedString | ( | ) | const |
Retrieves the last STRING to be popped from the stack.
| int SML::CONTEXT::GetMainObject | ( | RVC::OBJITEM & | ObjItem | ) | const |
Returns the RVC::OBJITEM of the main object this query is for.
Returns 1 if there is a main object, 0 if not
| int SML::CONTEXT::GetNeedLineNumbersInCode | ( | ) | const |
Will return true if the parser needs to emit opLINE codes for the debugger.
(Used to interleave source and assembly)
| int SML::CONTEXT::GetNumBreakPoints | ( | ) | const |
Returns the current number of breakpoints set in the debugger.
| int SML::CONTEXT::GetNumFuncClasses | ( | ) | const |
Get the number of function groups.
| OBJECT* SML::CONTEXT::GetObjectList | ( | ) | const |
For internal use only (should be private, but used by non-member funcs in qqobject.c).
| const MACHINEINSTRUCTION* SML::CONTEXT::GetOpCodeData | ( | int | opcode | ) | const |
Get specification of an SML bytecode opcode.
Bad name. Should have been GetOpcodeData()
| static char* SML::CONTEXT::GetOperator | ( | int | num | ) | [static] |
Return the string for the n'th operator.
| static char* SML::CONTEXT::GetOperatorDescription | ( | int | num | ) | [static] |
Return the description for the n'th operator.
| static char* SML::CONTEXT::GetOperatorHelp | ( | int | num | ) | [static] |
Return the help code for the n'th operator.
| static char** SML::CONTEXT::GetOperatorList | ( | ) | [static] |
Return the list of operators (for the Insert Operator dialog).
| MDLGPARENT SML::CONTEXT::GetParentWidget | ( | ) | const |
Get the parent widget to use for popping up dialogs and such.
We ran into a problem with WIN32_NATIVE code. Since MDLGPARENT is just a typedef that normally resolves to Widget, the function signature said it returned a Widget. Then if you compile for WIN32_NATIVE, the prototype says it should be a CWnd and the signatures don't match, giving an unresolved external. To get around this, I added the (void*) version below and modified all code to use that instead. Need to keep the other one around though for old code.
| void* SML::CONTEXT::GetParentWidgetVoid | ( | ) | const |
Get Parent Widget.
| int SML::CONTEXT::GetParserWarningLevel | ( | ) | const |
| const MISTRING& SML::CONTEXT::GetParserWarnings | ( | ) | const |
Return the warnings from the most recient call to Parse().
| const MACHINEINST* SML::CONTEXT::GetPC | ( | ) | const |
| ERRVALUE SML::CONTEXT::GetPCList | ( | SIMPLE_ARRAY< const MACHINEINST * > & | plist | ) |
| int SML::CONTEXT::GetPCList | ( | MACHINEINST *** | plist | ) |
Function used by the debugger only.
If debugger becomes a friend class, this function can be made private
| int SML::CONTEXT::GetPrimaryTable | ( | int | segment | ) | const |
Return the primary table for a segment.
(assuming a pinmap query or computed field)
| const MISTRING& SML::CONTEXT::GetPrintBufferMISTRING | ( | ) | const |
Return the contents of the print buffer in Unicode.
When running in an SML context, printf prints to a console window and there is no print buffer. In all other contexts, printf functions append text to a buffer which the caller can retrieve.
| DEVPRIVATE* SML::CONTEXT::GetPrivData | ( | int | pindex | ) | const |
Get private data for this context.
Allocate an index with PrivDataIndexAlloc()
| int SML::CONTEXT::GetProgBase | ( | ) | const |
Used by parser.
| int SML::CONTEXT::GetProgPtr | ( | ) | const |
Used by parser.
| char* SML::CONTEXT::GetRCSID | ( | SOURCEINFO * | fni | ) |
this function should be private but.
.. for now needs to be called from a C style stub function.
| CLASS* SML::CONTEXT::GetRegisteredClassList | ( | ) | const |
Returns the list of registered classes.
| RVC::DATABASEHANDLE* SML::CONTEXT::GetRootElemDBHandle | ( | ) | const |
Returns the root database handle (may be null) which should be used to allocate a cursor if calling Evaluate with ELEMTYPE_DBCursor Note: for internal use only.
| int SML::CONTEXT::GetRootElemNum | ( | ) | const |
return the element number we're evauating the query for.
| int SML::CONTEXT::GetRootElemType | ( | ) | const |
Returns the main ELEMTYPE_Xxxx if this is a query.
(eg, polygon style query)
| const FILEPATH& SML::CONTEXT::GetScriptFilePath | ( | ) | const |
Get the filename of the current script.
| INT32 SML::CONTEXT::GetScriptInode | ( | ) | const |
| const RVC::OBJITEM& SML::CONTEXT::GetScriptObjItem | ( | ) | const |
Gets the RVC::OBJITEM of the script.
| int SML::CONTEXT::GetSegmentByXMLNode | ( | const XMLNODE * | node | ) | const |
Given an XMLNODE, return the segment that was parsed from it.
This is used to identify scripts from an XML <script> tag so that we don't parse the same tag twice. Returns the segment number or -1 if no segment came from the given node. Note that if node is 0, it will return the first node that did NOT come from an XML node.
| int SML::CONTEXT::GetSegmentElemType | ( | int | segment = -1 |
) | const |
Returns SegmentType() & QTYPE_ELEMTYPE_MASK.
If segment -1 is passed (or omitted since -1 is the default) it will use the "current" segment. This only works while a script is running
| const XMLNODE* SML::CONTEXT::GetSegmentXMLNode | ( | int | segnum | ) | const |
Return the XMLNODE this segment was parsed from.
Assumes SetSegmentXMLNode was called to set the segment earlier
| const SOURCEINFO* SML::CONTEXT::GetSourceInfo | ( | const MACHINEINST * | pc | ) | const |
| bool SML::CONTEXT::GetSourceLine | ( | const MACHINEINST * | pc, | |
| MISTRING & | mistr | |||
| ) | const |
| const PARSEPOS* SML::CONTEXT::GetSourcePos | ( | const MACHINEINST * | pc | ) | const |
| UINT32 SML::CONTEXT::GetStatus | ( | ) | const |
Get the current STATUS bits.
| MISTATUSCONTEXT* SML::CONTEXT::GetStatusContext | ( | ) | const |
Get the MISTATUSCONTEXT of the status line of the SML editor.
| SYMBOL* SML::CONTEXT::GetStdSym | ( | ) | const |
Need to rename this.
_I_ don't even rememeber what it is (DCW)
Get an SYMBOL by (MIUNICODE*) name.
Programmer accessable function to get a symbol from the symbol table after evaluating the query. Actually returns a pointer to the symbol.
| SYMBOL* SML::CONTEXT::GetSymbol | ( | const char * | name | ) | const |
Get an SYMBOL by (char*) name.
Programmer accessable function to get a symbol from the symbol table after evaluating the query. Actually returns a pointer to the symbol.
| SYMBOL* SML::CONTEXT::GetSymbolListFuncs | ( | int | group = 0 |
) | const |
Get the symbol list for a group of functions.
| SYMBOL* SML::CONTEXT::GetSymbolListGlobal | ( | int | level = 0 |
) | const |
Gets the main symbol list.
| SYMBOL* SML::CONTEXT::GetSymbolListLocal | ( | ) | const |
Gets the symbol list at the current scope.
| SYMBOL* SML::CONTEXT::GetSymbolListPerm | ( | ) | const |
Gets the symbol list for permanent symbols.
| int SML::CONTEXT::GetSymbolNameList | ( | int | funcgroup, | |
| MISTRINGLIST & | names, | |||
| bool | bIncludeAliases = true | |||
| ) | const |
Get the list of symbols for a function group.
This function gives you a list of the functions in a particular function group.
| funcgroup | is the group number of the function group to get. You can find the number of function groups by calling SMLCONTEXT::GetNumFuncClasses(). | |
| names | Gets filled in with a list of function names | |
| bIncludeAliases | If true (default), include aliases in the list of symbols. |
| int SML::CONTEXT::GetSymbolTypeList | ( | char *** | namep, | |
| int ** | typep | |||
| ) | const |
Returns symbol types and names for the "Insert Symbol" dialogs.
| SYMBOL* SML::CONTEXT::GetTableSymbol | ( | int | table | ) |
Get the SYMBOL for a database table.
| table | Table number |
| MIPRODUCTCODE SML::CONTEXT::GetTargetProductCode | ( | ) | const |
Get the ProductCode for the script being executed or parsed.
This is used to limit the set of available classes to only those available in the given product
| const SIMPLE_ARRAY<FIELDDATA>& SML::CONTEXT::GetUnindexedFieldList | ( | ) | const |
Return a list of fields accessed by the most reciently parsed query which are not indexed.
If the query will be evaluated multiple times, you may decide to index the fields first, or possibly let the user decide. If you do end up indexing them, you should reparse the query to get it to use the index.
| USAGE SML::CONTEXT::GetUsage | ( | int | Segment | ) | const |
Set the usage for this script.
Allows parser to warn or give an error if user tries to use a script for the wrong thing
| XMLDOC* SML::CONTEXT::GetXMLDoc | ( | ) | const |
Get the XMLDOC that this script was parsed from, if any.
Note: the document is owned by the context. The caller may modify it, but should not free it.
| bool SML::CONTEXT::HasBreakPoint | ( | int | offset | ) | const |
Returns true if there is a breakpoint at a particular offset.
| bool SML::CONTEXT::HasCancelFunc | ( | ) | const |
Returns true if we should call TestCancleOnce() occasionally in grunt loops (to keep the server happy).
| int SML::CONTEXT::InstallClass | ( | CLASS * | staticClass | ) |
Install a class definition.
| int SML::CONTEXT::InstallEnum | ( | const char * | name, | |
| int(*)(CONTEXT *, void *, FLAG **) | func, | |||
| void * | funcdata, | |||
| UINT32 | flags | |||
| ) |
Installs a list of enum values which must be generated at runtime.
This is useful for installing things like distance units which must be read from units.txt
Possible flags: SMLFLAG_FreeFlagArray - Free the smlflags when the context is destroyed SMLFLAG_FreeName - Free the name parameter of all the flags (not the name parameter, that's const and it makes a copy) SMLFLAG_FreeDesc - Free the desc parameter of all the flags
Installs a list of enum values which can be used in SML::CLASSMEMBERs.
To define a member which is an enum, you make the member's type as if it were a numeric member, but give it STYPE_Enum and set the ResourceName to the name the enum was registered as
Possible flags: SMLFLAG_FreeFlagArray - Free the smlflags when the context is destroyed SMLFLAG_FreeName - Free the name parameter of all the flags (not the name parameter, that's const and it makes a copy) SMLFLAG_FreeDesc - Free the desc parameter of all the flagss
| int SML::CONTEXT::InstallFunctionList | ( | const FUNCINSTALLER * | funclist | ) |
Install a list of functions (For a new method of installing functions which has not been completely implemented yet.
Use InstallFunctions() for now)
| int SML::CONTEXT::InstallFunctions | ( | const char * | symclass, | |
| const FUNC * | vfuncs | |||
| ) |
Install a list of functions.
The vfuncs parameter is an array of SML::FUNCs with the last member of the array having NULL for the function name
| void SML::CONTEXT::InstallSMLOnlyFunctions | ( | ) |
Install functions which should only be available in SML (not query).
This just calls all MsmlCR_InstallFuncsSML callbacks. It is done for you by the various
| bool SML::CONTEXT::IsBeingDestroied | ( | ) | const |
Returns true if the contest is being destroied or has been destoied and is waiting for the last widget destroy callback to actually free itself.
| void SML::CONTEXT::List | ( | FILE * | file | ) |
Dump a disassembled listing of the bytecode to a file.
| int SML::CONTEXT::ListLine | ( | const MACHINEINST * | c, | |
| bool | bIgnoreBad, | |||
| bool | bMarkIt, | |||
| MIUNICODE * | buf, | |||
| int | len | |||
| ) |
Function used by List() and by the debugger.
(If debugger becomes a friend class, this function can become private)
| int SML::CONTEXT::ListLine | ( | const MACHINEINST * | c, | |
| bool | bIgnoreBad, | |||
| bool | bMarkIt, | |||
| MISTRING & | buf | |||
| ) |
Function used by List() and by the debugger.
(If debugger becomes a friend class, this function can become private)
| FLAG* SML::CONTEXT::LookupEnumList | ( | const char * | name | ) |
Lookup the array of SML::FLAGs given the name of an enum list Mostly internal.
May become private
Allocate memory.
Very similar to MmAlloc(), but this one keeps track of the allocated memory and it gets freed when the context is destroied. It is also optimized to handle lots of requests for little chunks of memory. IMPORTANT! Memory allocated with this method MUST be freed with the MemFree() method. Freeing it with MmFree() or free() will result in a painful death. This should NOT be used to allocate anything returned by an SML function or class member.
Allocate and clear memory.
Very similar to MmAllocC(), but this one keeps track of the allocated memory and it gets freed when the context is destroied. It is also optimized to handle lots of requests for little chunks of memory. IMPORTANT! Memory allocated with this method MUST be freed with the MemFree() method. Freeing it with MmFree() or free() will result in a painful death.
| void SML::CONTEXT::MemFree | ( | void * | ptr | ) |
Free memory.
IMPORTANT! This function must only be used to free memory allocted with the SML::CONTEXT::MemAlloc() and SML::CONTEXT::MemAllocC() methods. Attempting to free other memory will result in a painful death. Attempting to free a NULL pointer is ignored. Unlike MmFree, this does NOT set the pointer to NULL for you.
| int SML::CONTEXT::ObjectAlloc | ( | TINOBJECT ** | ) |
Allocate an SML::TINOBJECT.
| int SML::CONTEXT::ObjectAlloc | ( | CADOBJECT ** | ) |
Allocate an SML::CADOBJECT.
| int SML::CONTEXT::ObjectAlloc | ( | VECTOROBJECT ** | ) |
Allocate an SML::VECTOROBJECT.
| int SML::CONTEXT::ObjectAlloc | ( | RASTEROBJECT ** | ) |
Allocate an SML::RASTEROBJECT.
Allocate any kind of SML::OBJECT.
| int SML::CONTEXT::Optimize | ( | ) |
byte-code optimizer.
This is automatically called by Parse(). However, if you cal GetUnindexedFieldList() after Parse() and decide to index something, you should call Optimize() again to get the query to actually use the index.
| void SML::CONTEXT::OutstandingDestroysDec | ( | ) |
Decrement the number of outstanding XtDestroy callbacks which refer to this context.
| int SML::CONTEXT::OutstandingDestroysGet | ( | ) | const |
Return the number of outstanding XtDestroy callbacks which refer to this context.
| void SML::CONTEXT::OutstandingDestroysInc | ( | ) |
Increment the number of outstanding XtDestroy callbacks which refer to this context.
| int SML::CONTEXT::PrivDataIndexAlloc | ( | ) |
Allocate a private data index.
This should only be called once per module and kept in a static variable. You use when you call GetPrivData() and SetPrivData()
| void SML::CONTEXT::RecycleStrings | ( | bool | FreeStringsInCodeToo = false |
) |
Do garbage collection on string pool.
Runs through the pool of strings and frees any which are no longer referenced by any symbols or code. Since strings are refcounted, this should be unnecessary, but since the refcount isn't automatic, its error prone. This prevents leaks.
| static void SML::CONTEXT::RegisterFunctionList | ( | const FUNCINSTALLER * | FuncList | ) | [static] |
Register a list of function installers to be installed for any context, This may be called on program startup.
| static void SML::CONTEXT::RegisterMinimalFunctionList | ( | const FUNCINSTALLER * | FuncList | ) | [static] |
Register a list of function installers to be installed for any context, This may be called on program startup.
Registers the function to call to close an object type Would be done through virtual destructors on SML::OBJECT derived classes if we could do that.
| void SML::CONTEXT::Release | ( | ) |
| int SML::CONTEXT::Run | ( | int | segnum, | |
| UINT32 | flags = 0 | |||
| ) |
Create a query segment.
A context can have multiple segments, each with its own code. Keep in mind that the symbol table is shared between all segments in a context.
| usage | Usage | |
| ElemType | ELEMTYPE_Xxxxx | |
| table | Base table for pinmap queries |
| int SML::CONTEXT::SegmentDestroy | ( | int | segment | ) |
Destroy a segment.
| void SML::CONTEXT::SetAbortOnError | ( | bool | value | ) |
Set the AbortOnError flag.
If set (which it is by default, then any built-in function that gets an error and calls SetErrorCode() will cause the script to abort and popup an error dialog. If cleared, the error will be noted but the script will go on and the script writer can check GetLastError() to see if there was an error.
| void SML::CONTEXT::SetCancelCheckInterval | ( | double | seconds | ) |
Set the time in seconds between each cancel check.
| void SML::CONTEXT::SetCancelFunc | ( | int(*)(CONTEXT *, void *) | func, | |
| void * | data | |||
| ) |
Set the function to check cancel.
| void SML::CONTEXT::SetCaseSensitiveStrings | ( | bool | sensitive = true |
) |
Set whether or not string comparisons are case sensitive The default is true.
Note, this is NOT for symbol name comparisons
| void SML::CONTEXT::SetConsole | ( | CONSOLE * | console | ) |
Set the console handle. This is done by the editor.
| void SML::CONTEXT::SetDebugger | ( | SMLDEBUG * | debug | ) |
| void SML::CONTEXT::SetDispInfo | ( | const DISPLAYINFO & | info | ) |
Set display info.
This has to be done outside the DLL
| int SML::CONTEXT::SetErrorCode | ( | int | code | ) |
Set an error condition (and maybe abort the script).
By default, this will also cause the script to abort, but the script author can override that by setting _context.AbortOnError = 0 and use GetLastError() to check for errors.
| int SML::CONTEXT::SetErrorCodeAndAbort | ( | int | code | ) |
Set an error condition (and abort script).
This WILL cause the script to abort
| void SML::CONTEXT::SetErrorMessageForce | ( | MIUNICODE * | s | ) |
Used for parse errors (qqerrorext).
| void SML::CONTEXT::SetNeedLineNumbersInCode | ( | int | val | ) |
Called by the editor when debugger is activated/deactivated.
| void SML::CONTEXT::SetParentWidget | ( | MDLGPARENT | widget | ) |
Set the parent widget to use for popping up dialogs and such.
| ERRVALUE SML::CONTEXT::SetParmError | ( | int | parmnum, | |
| int | errcode = EBadFuncParm, |
|||
| const MIUNICODE * | funcname = 0 | |||
| ) |
Set an error code for a function argument.
Parameter numbers start at 0. If errcode is omitted, EBadFuncParm will be used If funcname is omitted, the current function name will be used Returns the error code passed in
| parmnum | Parameter, 0-based |
| void SML::CONTEXT::SetParserWarningLevel | ( | int | level | ) |
Set the level for parser warnings.
0 = none, 1 = Warn about deprecated function/class usage 2 = Warn about unindexed fields 3 = Warn about things that would cause errors on "strict" syntax checking
| void SML::CONTEXT::SetPrivData | ( | int | pindex, | |
| DEVPRIVATE * | pdata | |||
| ) |
Turns ownership of the pointer over to the context.
Pointer will be deleted when the context is destroied.
| void SML::CONTEXT::SetScriptFilePath | ( | const FILEPATH & | filepath | ) |
Set the script filename Use if the script is not in an RVC object.
| void SML::CONTEXT::SetScriptObjItem | ( | const RVC::OBJITEM & | objitem | ) |
| ERRVALUE SML::CONTEXT::SetSegment | ( | int | segnum | ) |
Set segment to be parsed or executed.
| void SML::CONTEXT::SetSegmentXMLNode | ( | int | segnum, | |
| const XMLNODE * | node | |||
| ) |
Keep track of the XMLNODE this segment was parsed from.
This is used to identify scripts from an XML <script> tag so that we don't parse the same tag twice.
| void SML::CONTEXT::SetStatusContext | ( | MISTATUSCONTEXT * | pStatusContext | ) |
Set the status context.
| void SML::CONTEXT::SetTargetProductCode | ( | MIPRODUCTCODE | ProductCode | ) |
Set the ProductCode for the script being executed or parsed.
This is used to limit the set of available classes to only those available in the given product
| int SML::CONTEXT::SetupObjectDatabase | ( | OBJECT * | obj, | |
| RVC::FILEHANDLE * | filehandle, | |||
| RVC::DATABASEHANDLE * | dbhandle, | |||
| ELEMDATA * | ElemData, | |||
| ELEMTYPE | ElemType, | |||
| const RVC::CREDENTIALS * | Credentials, | |||
| bool | fromcb = false | |||
| ) |
Used internally to setup the database.
| void SML::CONTEXT::SetUsage | ( | int | Segment, | |
| USAGE | usage | |||
| ) |
Set the usage for this script.
Allows parser to warn or give an error if user tries to use a script for the wrong thing
| void SML::CONTEXT::SetXMLDoc | ( | XMLDOC * | doc | ) |
| int SML::CONTEXT::Stop | ( | ) |
Called internally to make the script exit and notify the parent.
Old version without parameters, still need to export for backward compatibility. Forces CanDestroyContext to true. This version CAN NOT be called from within another method in SML::CONTEXT.
| int SML::CONTEXT::Stop | ( | bool | bCanDestroyContext | ) |
Called internally to make the script exit and notify the parent.
If called from within a method, we have to set bCanDestroyContext to false or the calling context may be destroied before we return to it.
Allocate an SML::STRING (MIUNICODE*).
Allocate an SML::STRING (STRUTF8).
Allocate an SML::STRING (MISTRING).
Allocate an SML::STRING (UINT8*).
Assumes UTF8
| STRING* SML::CONTEXT::StringAlloc | ( | const char * | str | ) |
Allocate an SML::STRING (char*).
Assumes ISO-2022
| void SML::CONTEXT::StringFree | ( | STRING * | ) |
Free an SML::STRING.
| static int SML::CONTEXT::STYPEFlags | ( | STYPE | stype | ) | [static] |
Get the STYPEFlags for a given STYPE.
This gets used in 2 places. When checking parameters, it's used to see if a symbol is an STYPE_ObjSym. If it is but not the kind we want, we cast it. It's also used after a function call to see if the parameter was an ObjSym and if it was a temp object, free it. Not currently used for anything else, so the contents are not that important except for the ones that have ObjSym set.
| static char* SML::CONTEXT::STYPEtoString | ( | STYPE | stype | ) | [static] |
convet an SML::STYPE into a string for display purposes.
Note, these are not i18n-able on purpose. SML keywords cannot be translated
| static int SML::CONTEXT::STYPEToTokenVal | ( | STYPE | stype | ) | [static] |
Convert STYPE_Xxxx to the token value as assigned by YACC.
| void SML::CONTEXT::TempObjectSymbolFree | ( | SYMBOL * | ) |
| int SML::CONTEXT::TestCancelOnce | ( | ) |
Call the test_cancel function.
Check to see if a class is derived from another class.
(internal use by the parser)
| bool SML::CONTEXT::TestClass | ( | const char * | GivenClassName, | |
| const CLASS * | NeededClass | |||
| ) | const |
Check to see if a class is derived from another class.
(internal use by the parser)
| static STYPE SML::CONTEXT::TokenValToSTYPE | ( | int | tval | ) | [static] |
Convert a token value as assigned by YACC to an STYPE_Xxxx.
| void SML::CONTEXT::VMExecute | ( | MACHINEINST * | pc | ) |
| int SML::CONTEXT::VMReset | ( | ) |
1.6.1