00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef INC_SML_CONTEXT_H
00048 #define INC_SML_CONTEXT_H
00049
00050 #ifndef INC_SML_SYMBOL_H
00051 #include <sml/symbol.h>
00052 #endif
00053
00054 #ifndef INC_SML_ARG_H
00055 #include <sml/arg.h>
00056 #endif
00057
00058 #ifndef INC_SML_CONTEXTTYPE_H
00059 #include <sml/contexttype.h>
00060 #endif
00061
00062 #ifndef INC_MI32_SMLBASE_H
00063 #include <mi32/smlbase.h>
00064 #endif
00065
00066 #ifndef INC_RVC_OBJITEM_H
00067 #include <rvc/objitem.h>
00068 #endif
00069
00070 #ifndef INC_MI32_MICALLBACKLIST_H
00071 #include <mi32/micallbacklist.h>
00072 #endif
00073
00074 #ifndef INC_MI32_SIMPLEAR_H
00075 #include <mi32/simplear.h>
00076 #endif
00077
00078 #ifndef INC_MI32_MTIMER_H
00079 #include <mi32/mtimer.h>
00080 #endif
00081
00082 #ifndef INC_MI32_MILIST_H
00083 #include <mi32/milist.h>
00084 #endif
00085
00086 #ifndef INC_MI32_MCB_H
00087 #include <mi32/mcb.h>
00088 #endif
00089
00090 #ifndef INC_MI32_ELEMTYPE_H
00091 #include <mi32/elemtype.h>
00092 #endif
00093
00094 #ifndef INC_MI32_SMLFUNCS_H
00095 #include <mi32/smlfuncs.h>
00096 #endif
00097
00098 #ifdef RVCSYSDLL
00099 #define RVCSYSLIBEXPORT MI_DLLEXPORT
00100 #define RVCSYSLIBCLASSEXPORT MI_DLLCLASSEXPORT
00101 #else
00102 #define RVCSYSLIBEXPORT MI_DLLIMPORT
00103 #define RVCSYSLIBCLASSEXPORT MI_DLLCLASSIMPORT
00104 #endif
00105
00106 #include <stdio.h>
00107
00108
00109 #ifdef WIN32
00110 #pragma warning (disable: 4018)
00111 #pragma warning (disable: 4251)
00112 #endif
00113
00114
00115 #define NSTACK 2048
00116 #define NFRAME 512
00117
00118
00119
00120
00121
00122 #ifndef GENERATING_DOXYGEN_OUTPUT
00123 class CONSOLE;
00124 class FILEPATH;
00125 class MISTRING;
00126 class MISTATUSCONTEXT;
00127 class XMLDOC;
00128 class XMLNODE;
00129 class FILE_TEXT;
00130 struct DISPLAYINFO;
00131
00132 #ifdef X_NATIVE
00133
00134
00135 class CWnd;
00136 struct _GUID;
00137 #endif
00138
00139 struct ITypeInfo;
00140 struct IDispatch;
00141
00142 namespace MGD {
00143 class CONTEXT;
00144 }
00145
00146 namespace RVC {
00147 class FILEHANDLE;
00148 class DESCRIPTOR;
00149 class DATABASEHANDLE;
00150 class OBJITEM;
00151 class CREDENTIALS;
00152 }
00153
00154 namespace SML {
00155 union ARG;
00156 struct CALLBACKSTRUCT;
00157 class FIELDDATA;
00158 class SYMBOL;
00159 class STRING;
00160 class DEVPRIVATE;
00161 class GEOSTRUCT;
00162 class CONTEXT;
00163 class RASTEROBJECT;
00164 class VECTOROBJECT;
00165 class CADOBJECT;
00166 class TINOBJECT;
00167 class SHAPEOBJECT;
00168 class ELEMDATA;
00169 class ENUMLIST;
00170 class SOURCEINFO;
00171 class PARSEPOS;
00172 class FLAG;
00173 class CLASS;
00174 class FUNC;
00175 class OBJECT;
00176 class ONEXITDATA;
00177 class MACHINEINSTRUCTION;
00178 class SMLDEBUG;
00179 class PARSER;
00180 class MEMPOOL;
00181 class SEGMENT;
00182 class PREPROCESSORSTACK;
00183 }
00184
00185 #endif // GENERATING_DOXYGEN_OUTPUT
00186
00187
00188
00189 #ifndef GENERATING_DOXYGEN_OUTPUT
00190 int qqlex(void*, SML::PARSER*);
00191 void qqerrorext(SML::CONTEXT*, int, const char* const*, const short*, int);
00192 void qqerror(void*, const char*);
00193 #endif
00194
00195 namespace SML {
00196 typedef int (* FUNCINSTALLER)(CONTEXT*);
00197 typedef PTRINT MACHINEINST;
00198
00199
00200
00201 #ifndef GENERATING_DOXYGEN_OUTPUT
00202
00203 class FRAME {
00204 public:
00205 SYMBOL *symp;
00206 MACHINEINST *retpc;
00207 MACHINEINST *retcs;
00208 ARG *argn;
00209 SYMBOL *localvars;
00210 int nargs;
00211 };
00212 #endif // GENERATING_DOXYGEN_OUTPUT
00213
00214
00215 #ifndef GENERATING_DOXYGEN_OUTPUT
00216
00217 class FIELDDATA {
00218 public:
00219 INT32 IsTableData;
00220 ELEMDATA *ElemData;
00221 int TableNum;
00222 int FieldNum;
00223 };
00224 #endif // GENERATING_DOXYGEN_OUTPUT
00225
00226
00253 class DEVPRIVATE {
00254 public:
00255 virtual ~DEVPRIVATE() {
00256 }
00257 protected:
00261 DEVPRIVATE() {
00262 }
00263 };
00264
00265
00266 #ifndef GENERATING_DOXYGEN_OUTPUT
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279 class CLASSSTACK {
00280 public:
00281 void *parent;
00282 void *ptr;
00283 CLASSMEMBER *member;
00284 bool bIsBound;
00285 };
00286 #endif
00287
00288
00289
00290
00291
00292
00293 #define SMLFLAG_FreeName 0x0001
00294 #define SMLFLAG_FreeDesc 0x0002
00295 #define SMLFLAG_FreeFlagArray 0x0004
00296
00298 #define DESTOBJ_OutputCantBeInput 0x0001
00299 #define DESTOBJ_DeleteExisting 0x0002
00300 #define DESTOBJ_CreateEmpty 0x0004
00301 #define DESTOBJ_DestIsFirstParm 0x0008
00302 #define DESTOBJ_FunctionReturnsObject 0x0010
00303
00304
00305 #define SMLRUN_StayResident 0x00000001
00306 #define SMLRUN_BreakAtLine0 0x00000002
00307
00308
00309
00311 class RVCSYSLIBCLASSEXPORT CONTEXT {
00312 public:
00313
00314
00315
00316
00317
00318
00319 #ifndef GENERATING_DOXYGEN_OUTPUT
00321 //-------- Static public methods ---------------
00322 #if defined(RVCSYSDLL)
00328
00329 static ERRVALUE Create (
00330 RVC::DATABASEHANDLE* dbhandle,
00331 CONTEXT*& context,
00332 bool ReopenHandle = true
00333 );
00334 #endif
00335
00343 static ERRVALUE Create (
00344 CONTEXT*& context,
00345 const RVC::OBJITEM& ObjItem,
00346 const RVC::CREDENTIALS* credentials,
00347 UINT32 flags = 0
00348 );
00349
00350 #if defined(RVCSYSDLL)
00358 DEPRECATED static ERRVALUE Create (
00359 CONTEXT*& context,
00360 const RVC::OBJITEM& objitem,
00361 UINT32 flags = 0
00362 );
00363 #endif
00364
00365 static ERRVALUE Create (
00366 CONTEXT*& context,
00367 UINT32 flags = 0
00368 );
00369
00370 #endif // GENERATING_DOXYGEN_OUTPUT
00371
00377 void AddNameAlias (
00378 const char* NewName,
00379 const char* OldName
00380 );
00381
00384 void AddRef (
00385 );
00386
00391 void Release (
00392 );
00393
00395 static char *GetOperator (
00396 int num
00397 );
00398
00400 static char *GetOperatorHelp (
00401 int num
00402 );
00403
00405 static char *GetOperatorDescription (
00406 int num
00407 );
00408
00410 static char **GetOperatorList (
00411 ) ;
00412
00416 static char *STYPEtoString (
00417 STYPE stype
00418 );
00419
00428 static int STYPEFlags (
00429 STYPE stype
00430 );
00431
00433 static int STYPEToTokenVal (
00434 STYPE stype
00435 );
00436
00438 static STYPE TokenValToSTYPE (
00439 int tval
00440 );
00441
00444 static void RegisterFunctionList (
00445 const FUNCINSTALLER* FuncList
00446 );
00447
00450 static void RegisterMinimalFunctionList (
00451 const FUNCINSTALLER* FuncList
00452 );
00453
00454
00455
00462 bool GetAbortOnError (
00463 ) const;
00464
00465
00472 int GetArg (
00473 ARG* args,
00474 int numargs,
00475 int num,
00476 OBJECT** pObject,
00477 bool UndefinedOK = false
00478 );
00479
00481 int GetArrayIndexBase (
00482 ) const;
00483
00485 double GetCancelCheckInterval (
00486 ) const;
00487
00489 bool GetCaseSensitiveStrings (
00490 ) const;
00491
00493 int GetCodeSize (
00494 ) const;
00495
00497 const MACHINEINST* GetCS (
00498 ) const;
00499
00501 MACHINEINST* GetCSNonConst (
00502 ) const;
00503
00505 CONSOLE *GetConsoleInterface (
00506 ) const;
00507
00510 const SML::FUNC* GetCurrentFunction (
00511 ) const;
00512
00517 MIUNICODE* GetCurrentFunctionName (
00518 ) const;
00519
00558 SYMBOL* GetDestObjectSymbol (
00559 int numargs,
00560 ARG* args,
00561 UINT8* argtype,
00562 STYPE OutSTYPE,
00563 UINT32 flags
00564 );
00565
00569 const DISPLAYINFO* GetDispInfo (
00570 ) const;
00571
00573 int GetErrorLine (
00574 ) const;
00575
00580 int GetExitOnError (
00581 ) const;
00582
00584 SYMBOL* GetFieldSymbol (
00585 int table,
00586 int field
00587 );
00588
00592 SYMBOL* GetFieldSymbol (
00593 SYMBOL* t,
00594 SYMBOL* f
00595 );
00596
00598 SYMBOL* GetForEachRastSym (
00599 ) const;
00600
00605 char* GetFuncGroupName (
00606 int num
00607 ) const;
00608
00610 int GetFunctionTypeList (
00611 char ***namep,
00612 int **typep
00613 ) const;
00614
00621 int GetLastError (
00622 MISTRING& msg,
00623 INT32 *pos = 0
00624 );
00625
00633 ERRVALUE GetLastError (
00634 INT32 *pos = 0,
00635 bool bClearErrorState = true
00636 );
00637
00638 #ifdef RVCSYSDLL
00639 ERRVALUE GetLastError (
00640 INT32 *pos
00641 );
00642 #endif
00643
00648 STRING* GetLastPoppedString (
00649 ) const;
00650
00653 int GetMainObject (
00654 RVC::OBJITEM& ObjItem
00655 ) const;
00656
00659 int GetNeedLineNumbersInCode (
00660 ) const;
00661
00663 int GetNumBreakPoints (
00664 ) const;
00665
00667 int GetNumFuncClasses (
00668 ) const;
00669
00672 OBJECT* GetObjectList (
00673 ) const;
00674
00677 const MACHINEINSTRUCTION* GetOpCodeData (
00678 int opcode
00679 ) const;
00680
00690 MDLGPARENT GetParentWidget (
00691 ) const;
00692
00695 void* GetParentWidgetVoid (
00696 ) const;
00697
00698 int GetParserWarningLevel() const;
00699
00701 const MISTRING& GetParserWarnings() const;
00702
00709 const SIMPLE_ARRAY<FIELDDATA>& GetUnindexedFieldList() const;
00710
00718 void SetParserWarningLevel(int level);
00719
00720 const MACHINEINST* GetPC (
00721 ) const;
00722
00725 int GetPCList (
00726 MACHINEINST ***plist
00727 );
00728
00729 ERRVALUE GetPCList (
00730 SIMPLE_ARRAY<const MACHINEINST*> &plist
00731 );
00732
00733 const SOURCEINFO* GetSourceInfo (
00734 const MACHINEINST* pc
00735 ) const;
00736
00737 const PARSEPOS* GetSourcePos (
00738 const MACHINEINST* pc
00739 ) const;
00740
00741 bool GetSourceLine (
00742 const MACHINEINST* pc,
00743 MISTRING& mistr
00744 ) const;
00745
00746 SYMBOL* GetPrimaryKeySymbol (
00747 SYMBOL* fk_sym
00748 );
00749
00752 int GetPrimaryTable (
00753 int segment
00754 ) const;
00755
00759 XMLDOC* GetXMLDoc (
00760 ) const;
00761
00762
00764 int AppendPrintBuffer (
00765 const MIUNICODE*
00766 );
00767
00769 int AppendPrintBuffer (
00770 const char*
00771 );
00772
00780 const MISTRING& GetPrintBufferMISTRING (
00781 ) const;
00782
00785 DEVPRIVATE* GetPrivData (
00786 int pindex
00787 ) const;
00788
00790 int GetProgBase (
00791 ) const;
00792
00794 int GetProgPtr (
00795 ) const;
00796
00800 char *GetRCSID (
00801 SOURCEINFO *fni
00802 );
00803
00805 CLASS* GetRegisteredClassList (
00806 ) const;
00807
00811 RVC::DATABASEHANDLE* GetRootElemDBHandle (
00812 ) const;
00813
00817 int GetRootElemNum (
00818 ) const;
00819
00822 int GetRootElemType (
00823 ) const;
00824
00826 const FILEPATH& GetScriptFilePath (
00827 ) const;
00828
00832 INT32 GetScriptInode (
00833 ) const;
00834
00836 const RVC::OBJITEM& GetScriptObjItem (
00837 ) const;
00838
00839 #ifndef GENERATING_DOXYGEN_OUTPUT
00843 RVC::DATABASEHANDLE* GetSegmentDBHandle (
00844 int segment
00845 ) const;
00846 #endif
00847
00851 int GetSegmentElemType (
00852 int segment = -1
00853 ) const;
00854
00857 const XMLNODE* GetSegmentXMLNode (
00858 int segnum
00859 ) const;
00860
00867 int GetSegmentByXMLNode (
00868 const XMLNODE* node
00869 ) const;
00870
00872 UINT32 GetStatus (
00873 ) const;
00874
00877 MISTATUSCONTEXT* GetStatusContext (
00878 ) const;
00879
00883 SYMBOL *GetStdSym (
00884 ) const;
00885
00890 SYMBOL *GetSymbol (
00891 const char *name
00892 ) const;
00893
00898 SYMBOL *GetSymbol (
00899 const MIUNICODE *name
00900 ) const;
00901
00903 int GetSymbolTypeList (
00904 char ***namep,
00905 int **typep
00906 ) const;
00907
00909 SYMBOL* GetSymbolListFuncs (
00910 int group = 0
00911 ) const;
00912
00914 SYMBOL* GetSymbolListGlobal (
00915 int level = 0
00916 ) const;
00917
00919 SYMBOL* GetSymbolListLocal (
00920 ) const;
00921
00923 SYMBOL* GetSymbolListPerm (
00924 ) const;
00925
00926
00945 int GetSymbolNameList (
00946 int funcgroup,
00947 MISTRINGLIST& names,
00948 bool bIncludeAliases = true
00949 ) const;
00950
00952 SYMBOL* GetTableSymbol (
00953 int table
00954 );
00955
00959 MIPRODUCTCODE GetTargetProductCode (
00960 ) const;
00961
00962
00963
00964
00971 void SetAbortOnError (
00972 bool value
00973 );
00974
00980 ERRVALUE SetParmError (
00981 int parmnum,
00982 int errcode = EBadFuncParm,
00983 const MIUNICODE* funcname = 0
00984 );
00985
00987 void SetCancelCheckInterval (
00988 double seconds
00989 );
00990
00992 void SetCancelFunc (
00993 int (*func)(CONTEXT *, void *),
00994 void *data
00995 );
00996
01000 void SetCaseSensitiveStrings (
01001 bool sensitive = true
01002 );
01003
01004 #if defined (RVCSYSDLL)
01007 DEPRECATED void SetConsole (
01008 void *console
01009 );
01010 #endif
01011
01013 void SetConsole (
01014 CONSOLE *console
01015 );
01016
01017 void SetDebugger (
01018 SMLDEBUG* debug
01019 );
01020
01023 void SetDispInfo (
01024 const DISPLAYINFO& info
01025 );
01026
01031 int SetErrorCode (
01032 int code
01033 );
01034
01037 int SetErrorCodeAndAbort (
01038 int code
01039 );
01040
01042 void SetErrorMessageForce (
01043 MIUNICODE *s
01044 );
01045
01049 void SetTargetProductCode (
01050 MIPRODUCTCODE ProductCode
01051 );
01052
01054 void SetNeedLineNumbersInCode (
01055 int val
01056 );
01057
01059 void SetParentWidget (
01060 MDLGPARENT widget
01061 );
01062
01063 #if !defined(WIN32_NATIVE) || defined(RVCSYSDLL)
01071 void SetParentWidget (
01072 CWnd* widget
01073 );
01074 #endif
01075
01078 void SetPrivData (
01079 int pindex,
01080 DEVPRIVATE* pdata
01081 );
01082
01085 void SetScriptFilePath (
01086 const FILEPATH& filepath
01087 );
01088
01089 void SetScriptObjItem (
01090 const RVC::OBJITEM& objitem
01091 );
01092
01094 ERRVALUE SetSegment (
01095 int segnum
01096 );
01097
01101 void SetSegmentXMLNode (
01102 int segnum,
01103 const XMLNODE* node
01104 );
01105
01107 UINT32 SetStatusBits (
01108 UINT32 bits
01109 );
01110
01112 void SetStatusContext (
01113 MISTATUSCONTEXT* pStatusContext
01114 );
01115
01119 void SetXMLDoc (
01120 XMLDOC* doc
01121 );
01122
01125 bool TestClass (
01126 const char* GivenClassName,
01127 const CLASS* NeededClass
01128 ) const;
01129
01132 bool TestClass (
01133 const CLASS* GivenClass,
01134 const CLASS* NeededClass
01135 ) const;
01136
01137
01138
01140 ERRVALUE AddObjectSymbol (
01141 const MIUNICODE *name,
01142 const RVC::OBJITEM& objitem,
01143 SYMBOL **symp,
01144 UINT32 flags = 0,
01145 const RVC::CREDENTIALS* Credentials = 0
01146 );
01147
01149 ERRVALUE AddObjectSymbol (
01150 const char *name,
01151 const RVC::OBJITEM& objitem,
01152 SYMBOL **symp,
01153 UINT32 flags = 0,
01154 const RVC::CREDENTIALS* Credentials = 0
01155 );
01156
01158 void AddOnExit (
01159 ONEXITDATA* data
01160 );
01161
01164 SYMBOL *AddSymbol (
01165 const MIUNICODE *name,
01166 STYPE stype
01167 );
01168
01171 SYMBOL *AddSymbol (
01172 const char *name,
01173 STYPE stype
01174 );
01175
01182 SYMBOL *AddClassSymbol (
01183 const MIUNICODE *name,
01184 char *classname,
01185 void *ptr
01186 );
01187
01191 SYMBOL *AddClassSymbol (
01192 const char *name,
01193 char *classname,
01194 void *ptr
01195 );
01196
01199 int BreakPointAdd (
01200 int offset
01201 );
01202
01205 int BreakPointRemove (
01206 int offset
01207 );
01208
01211 int BreakPointToggle (
01212 int offset
01213 );
01214
01219 int CallbackAdd (
01220 McbCallbackFunc func,
01221 void *cbdata,
01222 UINT32 reason
01223 );
01224
01229 static int CallbackAddGlobal (
01230 McbCallbackFunc func,
01231 void *cbdata,
01232 UINT32 reason
01233 );
01234
01239 int CallbackRemove (
01240 McbCallbackFunc func,
01241 void *cbdata,
01242 UINT32 reason
01243 );
01244
01249 static int CallbackRemoveGlobal (
01250 McbCallbackFunc func,
01251 void *cbdata,
01252 UINT32 reason
01253 );
01254
01259 int CallCallbacks (
01260 CALLBACKSTRUCT *cbs
01261 );
01262
01267 void CallDestructors (
01268 );
01269
01270 #if defined(RVCSYSDLL) && !defined(GENERATING_DOXYGEN_OUTPUT)
01275 DEPRECATED void CallFunction (
01276 SYMBOL* func,
01277 ARG* args,
01278 int numargs,
01279 UINT8* tlist,
01280 ARG* ret,
01281 UINT32 flags
01282 );
01283 #endif
01284
01304 ERRVALUE CallFunction (
01305 SYMBOL* func,
01306 ARG* args,
01307 int numargs,
01308 UINT8* tlist,
01309 ARG* ret
01310 );
01311
01327 double CallFunction (
01328 const char *name,
01329 ELEMTYPE elemtype,
01330 INT32 element = 0
01331 );
01332
01333
01340 void ClearPrintBuffer (
01341 );
01342
01344 UINT32 ClearStatusBits (
01345 UINT32 bits
01346 );
01347
01350 void CloseObjects (
01351 );
01352
01362 void* ConstructClassInstance (
01363 const char* ClassName
01364 );
01365
01377 bool CurrentFunctionIsClassMethod (
01378 ) const;
01379
01387 DEPRECATED int Destroy (
01388 );
01389
01393 int Evaluate (
01394 int segnum,
01395 INT32 element,
01396 int ElemType,
01397 void *valp
01398 );
01399
01402 int Evaluate (
01403 int segnum,
01404 INT32 element,
01405 void *valp
01406 );
01407
01408
01413 GEOSTRUCT* GeorefAlloc (
01414 );
01415
01417 GEOSTRUCT* GeorefCopy (
01418 const GEOSTRUCT* src
01419 );
01420
01422 void GeorefFree (
01423 GEOSTRUCT* georef
01424 );
01425
01429 USAGE GetUsage (
01430 int Segment
01431 ) const;
01432
01434 bool HasBreakPoint (
01435 int offset
01436 ) const;
01437
01440 bool HasCancelFunc (
01441 ) const;
01442
01444 int InstallClass (
01445 CLASS* staticClass
01446 );
01447
01457 int InstallEnum (
01458 const char* name,
01459 FLAG* smlflags,
01460 UINT32 flags
01461 );
01462
01471 int InstallEnum (
01472 const char* name,
01473 int (*func)(CONTEXT* , void*, FLAG**),
01474 void* funcdata,
01475 UINT32 flags
01476 );
01477
01481 int InstallFunctionList (
01482 const FUNCINSTALLER *funclist
01483 );
01484
01488 int InstallFunctions (
01489 const char* symclass,
01490 const FUNC* vfuncs
01491 );
01492
01496 void InstallSMLOnlyFunctions (
01497 );
01498
01502 bool IsBeingDestroied (
01503 ) const;
01504
01506 void List (
01507 FILE *file
01508 );
01509
01511 void List (
01512 MISTRING&
01513 );
01514
01517 int ListLine (
01518 const MACHINEINST* c,
01519 bool bIgnoreBad,
01520 bool bMarkIt,
01521 MISTRING& buf
01522 );
01523
01526 int ListLine (
01527 const MACHINEINST* c,
01528 bool bIgnoreBad,
01529 bool bMarkIt,
01530 MIUNICODE* buf,
01531 int len
01532 );
01533
01536 FLAG* LookupEnumList (
01537 const char* name
01538 );
01539
01540 #ifdef RVCSYSDLL
01542 FLAG* LookupEnumList (
01543 char* name
01544 );
01545 #endif
01546
01548 OBJECT* ObjectAlloc (
01549 STYPE stype
01550 );
01551
01553 int ObjectAlloc (
01554 RASTEROBJECT**
01555 );
01556
01558 int ObjectAlloc (
01559 VECTOROBJECT**
01560 );
01561
01563 int ObjectAlloc (
01564 CADOBJECT**
01565 );
01566
01568 int ObjectAlloc (
01569 TINOBJECT**
01570 );
01571
01577 int Optimize (
01578 );
01579
01582 void OutstandingDestroysDec (
01583 );
01584
01587 int OutstandingDestroysGet (
01588 ) const;
01589
01592 void OutstandingDestroysInc (
01593 );
01594
01596 int Parse (
01597 int segnum,
01598 const MIUNICODE *str,
01599 UINT32 flags = 0
01600 );
01601
01605 int PrivDataIndexAlloc (
01606 );
01607
01614 void RecycleStrings (
01615 bool FreeStringsInCodeToo = false
01616 );
01617
01621 void RegisterObjectCloseFunc (
01622 STYPE stype,
01623 int (*func)(CONTEXT *, OBJECT *)
01624 );
01625
01626 #ifndef GENERATING_DOXYGEN_OUTPUT
01627 #ifdef RVCSYSDLL
01631 int ResolveClassMembers (
01632 );
01633 #endif
01634 #endif
01635
01639 int CheckForClassMemberErrors (
01640 FILE_TEXT& MissingClassFile
01641 );
01642
01650 int Run (
01651 int segnum,
01652 UINT32 flags = 0
01653 );
01654
01661 int SegmentCreate (
01662 USAGE usage,
01663 ELEMTYPE ElemType = ELEMTYPE_Empty,
01664 int table = -1
01665 );
01666
01668 int SegmentDestroy (
01669 int segment
01670 );
01671
01673 int SetupObjectDatabase (
01674 OBJECT *obj,
01675 RVC::FILEHANDLE* filehandle,
01676 RVC::DATABASEHANDLE* dbhandle,
01677 ELEMDATA *ElemData,
01678 ELEMTYPE ElemType,
01679 const RVC::CREDENTIALS* Credentials,
01680 bool fromcb = false
01681 );
01682
01686 void SetUsage (
01687 int Segment,
01688 USAGE usage
01689 );
01690
01695 int Stop (
01696 bool bCanDestroyContext
01697 );
01698
01703 int Stop (
01704 );
01705
01708 STRING* StringAlloc (
01709 const char* str
01710 );
01711
01714 STRING* StringAlloc (
01715 const UINT8* str
01716 );
01717
01719 STRING* StringAlloc (
01720 const MISTRING& str
01721 );
01722
01724 STRING* StringAlloc (
01725 const STRUTF8& str
01726 );
01727
01729 STRING* StringAlloc (
01730 const MIUNICODE* str
01731 );
01732
01734 void StringFree (
01735 STRING*
01736 );
01737
01738 SYMBOL* TempObjectSymbolAlloc (
01739 STYPE stype
01740 );
01741
01742 void TempObjectSymbolFree (
01743 SYMBOL*
01744 );
01745
01752 int TestCancelOnce (
01753 );
01754
01755 void VMExecute (
01756 MACHINEINST* pc
01757 );
01758
01759 int VMReset (
01760 );
01761
01762
01773 ERRVALUE MemAlloc (
01774 void** pRet,
01775 UINT32 size
01776 );
01777
01786 ERRVALUE MemAllocC (
01787 void** pRet,
01788 UINT32 size
01789 );
01790
01797 void MemFree (
01798 void* ptr
01799 );
01800
01801 private:
01802 #ifndef GENERATING_DOXYGEN_OUTPUT
01803 CONTEXT();
01804 ~CONTEXT();
01805
01806 ERRVALUE CallFunctionLow (
01807 SYMBOL* func,
01808 ARG* args,
01809 int numargs,
01810 UINT8* tlist,
01811 ARG* ret,
01812 UINT32 flags
01813 );
01814 class REENTER;
01815
01816 class MEMMGR {
01817 public:
01818 MEMMGR();
01819 ~MEMMGR();
01820
01821 ERRVALUE Alloc(void**, UINT32);
01822
01828 static void Free(void*);
01829
01830 private:
01831 MEMPOOL* m_pool[16];
01832 };
01833
01834
01835
01836 int CheckVM (
01837 );
01838
01840 void DestroyLow (
01841 );
01842
01843 int _Evaluate (
01844 int segnum,
01845 INT32 element,
01846 int ElemType,
01847 void *valp
01848 );
01849
01850 void FreeOnExitData (
01851 );
01852
01853 int GetAllFunctions (
01854 MISTRINGLIST& list,
01855 bool bIncludeAliases = true
01856 ) const;
01857
01858 int GetOpcodeByteCount (
01859 const MACHINEINST* pc
01860 );
01861
01862 int InstallFunction (
01863 const FUNC* func,
01864 SYMBOL **psp,
01865 int funcgroup
01866 );
01867
01869 int InstallQueryFunctions (
01870 );
01871
01872 void DestroyPriv();
01873
01879
01880 public:
01881
01883 void DestroyClassInstance (
01884 void* ptr,
01885 const CLASS* Class,
01886 int NumItems = 1
01887 );
01888
01890 void* ConstructClassInstance (
01891 const CLASS* Class
01892 );
01893
01895 void* CopyClassInstance (
01896 void* ptr,
01897 const CLASS* Class
01898 );
01899
01901 CLASS* FindNamedClass (
01902 const char* name
01903 ) const;
01904
01907 void FreeEnum (
01908 ENUMLIST* smlenum
01909 );
01910
01912 SYMBOL* FreeSymbols (
01913 SYMBOL* sp,
01914 int freelocal
01915 );
01916
01918 void FreeUserFuncs (
01919 int segnum
01920 );
01921
01927 int InitFromDBHandle (
01928 RVC::DATABASEHANDLE* dbhandle,
01929 bool ReopenHandle = true
01930 );
01931
01934 int InitLow (
01935 );
01936
01938 bool IsRunning (
01939 ) const;
01940
01943 const char* GetAliasNewName (
01944 const char* OldName
01945 ) const;
01946
01949 const char* GetAliasOldName (
01950 const char* NewName
01951 ) const;
01952
01955 const char* GetAliasOldName (
01956 const char* NewName,
01957 int index
01958 ) const;
01959
01960 void ParserReset (
01961 );
01962
01963 int _Run (
01964 int segnum,
01965 UINT32 flags = 0
01966 );
01967
01968
01969 int SetupDatabase (
01970 RVC::FILEHANDLE* filehandle,
01971 RVC::DATABASEHANDLE* dbhandle,
01972 const RVC::CREDENTIALS* Credentials,
01973 bool fromcb
01974 );
01975
01976 int SetupParentObjectSymbol (
01977 const RVC::OBJITEM& ParentObjItem,
01978 const RVC::CREDENTIALS* Credentials = 0
01979 );
01980
01983 void SMLSetErrorPos (
01984 );
01985
01991 SYMBOL* SymbolAlloc (
01992 const MIUNICODE* s
01993 );
01994
01995 ERRVALUE SymbolSetDescriptor (
01996 SYMBOL* sym,
01997 const RVC::DESCRIPTOR& Descriptor
01998 );
01999
02001 void SetStrictSyntax (
02002 bool strict = true
02003 );
02004
02005 void SetErrorLow (
02006 int code,
02007 bool bAbort = true
02008 );
02009
02011 SYMBOL* SymbolAlloc (
02012 const char* s
02013 );
02014
02016 SYMBOL* SymbolInstall (
02017 const char* s,
02018 int t,
02019 double d,
02020 SYMBOL::SCOPE scope
02021 );
02022
02024 SYMBOL* SymbolInstall (
02025 const MIUNICODE* s,
02026 int t,
02027 double d,
02028 SYMBOL::SCOPE scope
02029 );
02030
02032 void SymbolTableFree (
02033 int FreePerm
02034 );
02035
02037 void SymbolTableInit (
02038 );
02041 void SymbolTablePop (
02042 );
02043
02045 void SymbolTablePush (
02046 SYMBOL* sym
02047 );
02048
02052 friend int ::qqlex(void*, SML::PARSER*);
02053 friend void ::qqerrorext(SML::CONTEXT*, int, const char* const*, const short*, int);
02054 friend void ::qqerror(void*, const char*);
02064 friend class PARSER;
02065 friend class VM;
02066 friend class REENTER;
02067
02068 friend class STRING;
02069 friend class OBJECT;
02070 friend class STRGC;
02071 friend class AUTOCLASS;
02072 friend class SYMBOL;
02073
02074 private:
02078 int Init (
02079 const RVC::OBJITEM* pParentObjItem,
02080 const RVC::CREDENTIALS* Credentials,
02081 UINT32
02082 );
02083
02084 #define SML_NUM_REGISTERS 8
02085 ARG *m_sp;
02086 ARG m_registers[SML_NUM_REGISTERS];
02087 FRAME *m_fp;
02088 int m_progp;
02089 const MIUNICODE *m_pSource;
02090 MACHINEINST *m_cs, *m_pc;
02091 MISTRING m_message;
02092 int m_ParsePos;
02093 int m_ParseLine;
02094 int m_LineCount;
02095 MISTRING m_PrintBuf;
02096
02097 int m_ErrorCode;
02098 SYMBOL *m_pLastSym;
02099 SYMBOL *m_symlist[10];
02100 SYMBOL **m_funcs;
02101 char **m_pFuncClass;
02102 int m_NumFuncClasses;
02103 SIMPLE_ARRAY<SEGMENT*> m_SegTable;
02104 int m_CurrentSegNum;
02105 int m_TablePtr;
02106 int m_NextTopen;
02107 bool m_bReturning;
02108 bool m_bHalting;
02109 bool m_Brk;
02110 bool m_bParseBegin;
02111 bool m_bParseEnd;
02112 bool m_bParseForEach;
02113 bool m_bEOF;
02114 bool m_bOnlyNeedName;
02115 bool m_bDatabaseRoot;
02116 bool m_bNoExitError;
02117 bool m_bNewLine;
02118 bool m_bDestroied;
02119 bool m_bNeedLineNumbersInCode;
02120 bool m_bNeedTableName;
02121 bool m_bNeedFieldName;
02122 bool m_bNeedElemType;
02123 bool m_bParsing;
02124 bool m_bInStopCallback;
02125 bool m_bDestroiedInStopCallback;
02126 bool m_bClassesResolved;
02127 bool m_bForceLocalScope;
02128 bool m_bStartOfLine;
02129 ELEMDATA *m_pElemData, *m_pCurElemData, *m_pRootElemData;
02130 ELEMTYPE m_RootElemType, m_CurElemType;
02131 void *m_pConsole;
02132 bool m_bConsoleIsOld;
02133 MDLGPARENT m_parent;
02134 STRING *m_pStrList;
02135 MILIST<STRING*> m_ConstStrings;
02136 int *m_pSrcPos;
02137 MISTATUSCONTEXT *m_pStatusContext;
02138 int (*m_CancelFunc)(CONTEXT *, void *);
02139 void *m_CancelData;
02140 SYMBOL *m_pStdSym;
02141 int m_LastParse;
02142 SIMPLE_ARRAY<SML::DEVPRIVATE*> m_DevPrivatePool;
02143 int m_scope, m_vartype;
02144 INT32 m_SeqNum;
02145 SYMBOL *m_pForEachRastSym;
02146 FILEPATH m_pScriptFilepath;
02147 INT32 m_ScriptInode;
02148 RVC::OBJITEM m_ScriptObjItem;
02149 CLASS *m_pRegisteredClasses;
02150 OBJECT* m_ObjListHead;
02151 OBJECT* m_ObjListTail;
02152 MTIMER m_CancelCheckTimer;
02153 UINT32 m_CancelCheckInterval;
02154 UINT32 m_NextCancelCheckTick;
02155 int m_LastPoppedType;
02156 MICALLBACKLIST m_CallbackList;
02157 int m_fid;
02158 UINT32 m_status;
02159 int m_ArrayIndexBase;
02160 SIMPLE_ARRAY<int> m_BreakPoints;
02161 SMLDEBUG* m_Debugger;
02162 void (*m_DebugCallback)(CONTEXT *context, void *DebugData);
02163 void *m_DebugData;
02164 int m_OutstandingDestroys;
02165 int m_RefCount;
02166 SIMPLE_ARRAY<ONEXITDATA*> m_OnExitList;
02167 int *m_pPCLine;
02168 SEGMENT *m_pCurSeg;
02169 SYMBOL *m_PredefSymTable;
02170 SOURCEINFO *m_pParseFile;
02171 int m_ParseFileNum;
02172 SYMBOL *m_pPermSymbols;
02173 DISPLAYINFO *m_pDispInfo;
02174
02175
02176 SYMBOL *m_pDefFunc;
02177 int m_ClassPtrStackDepth;
02178 CLASSSTACK m_ClassPtrStack[20];
02179 ENUMLIST *m_EnumList;
02180 STRING *m_pLastPoppedString;
02181 CLASS *m_pLastPoppedClassType;
02182 void *m_pLastPoppedClassPtr;
02183 bool m_bLastPoppedClassIsBound;
02184
02185 PREPROCESSORSTACK *m_pCPPStack;
02186 MEMMGR m_Mem;
02187 CONTEXTTYPE m_AutoClassTypesInstalled;
02188 MIPRODUCTCODE m_ProductCode;
02189
02190 #ifdef WIN32
02191 int LoadActiveXModule(const MIUNICODE* name);
02192 int InstallOLEType(IDispatch*, _GUID* pclsid, ITypeInfo*);
02193 #endif
02194 static int s_RefCount;
02195 static SIMPLE_ARRAY<void*> s_hPlugins;
02196 int LoadPlugins();
02197 int UnloadPlugins();
02198
02199 static MICALLBACKLIST s_CallbackList;
02200
02201 bool m_bCaseSensitiveStrings;
02202 bool m_bCurrentFuncIsClassMethod;
02203 bool m_bAbortOnError;
02204 UINT32 m_OptimizationFlags;
02205
02206 protected:
02209 CLASS* m_LastClass;
02210 CLASS* m_CurrentClass;
02211 SYMBOL *m_CallStack[20], *m_CurFunc;
02212 SYMBOL *m_CurOverload;
02213 int m_CallStackDepth;
02214 mutable SYMBOL *m_LastTable;
02215 struct LOOPDATA;
02216
02217 LOOPDATA *m_LoopData;
02218 int m_numparms;
02219 int m_defparms;
02220 bool m_bInStr;
02221 int m_lastToken;
02222 int m_thisToken;
02223 int m_prevToken;
02224
02225 MISTRING m_ParserWarnings;
02226 int m_ParserWarningLevel;
02227 SIMPLE_ARRAY<FIELDDATA> m_UnindexedFields;
02228 bool m_bStrictSyntax;
02229 SIMPLE_ARRAY<const void*> m_AlreadyWarned;
02230 SYMBOL* m_PrevTableSym;
02231 XMLDOC* m_XMLDoc;
02232
02233 SYMBOL* m_ParserCurFuncProto;
02234 SYMBOL* m_ParserCurObject;
02235 SYMBOL* m_ParserCurTable;
02236 ELEMTYPE m_ParserCurElemType;
02237 UINT32 m_RegisterUsage;
02238 bool m_bForceNextToken;
02239 int m_NextToken;
02240 SIMPLE_ARRAY<INT32> m_ScopeStack;
02241 INT32 m_ScopeRules;
02242
02243 struct NAMEALIAS {
02244 NAMEALIAS(const char* o, const char* n) :
02245 OldName(o),
02246 NewName(n)
02247 {
02248 }
02249 const char* OldName;
02250 const char* NewName;
02251 };
02252
02253 SIMPLE_ARRAY<NAMEALIAS> m_Aliases;
02254
02255 struct UNRESOLVED {
02256 const char* name;
02257 void** ptr;
02258 bool bIsEnum;
02259 };
02260
02261 MILIST<UNRESOLVED> m_UnresolvedList;
02262
02263 void AddParserWarning (
02264 const MISTRING&,
02265 int WarningLevel = 1
02266 );
02267
02268 void AddParserWarning (
02269 TEXTID id,
02270 int WarningLevel = 1
02271 );
02272
02273 void AddDeprecatedWarning (
02274 const void* whatever,
02275 const char* name,
02276 const char* desc
02277 );
02278 #endif // GENERATING_DOXYGEN_OUTPUT
02279 };
02280
02281
02282
02283 class CONTEXT_REFCOUNT {
02284 public:
02285 CONTEXT_REFCOUNT (
02286 CONTEXT* context
02287 ) :
02288 m_context(context)
02289 {
02290 if (m_context != 0) m_context->AddRef();
02291 }
02292
02293 ~CONTEXT_REFCOUNT (
02294 ) {
02295 if (m_context != 0) m_context->Release();
02296 }
02297 private:
02298 CONTEXT* m_context;
02299 };
02300
02301
02302
02303 RVCSYSLIBEXPORT int CreateContextFromDBHandle (
02304 RVC::DATABASEHANDLE* dbhandle,
02305 SML::CONTEXT *& context,
02306 UINT32 flags
02307 );
02308
02309 }
02310
02311
02312 typedef SML::CONTEXT SMLCONTEXT;
02313 typedef SML::CONTEXT_REFCOUNT SMLCONTEXT_REFCOUNT;
02314 typedef SML::DEVPRIVATE SMLDEVPRIVATE;
02315 typedef SML::FIELDDATA SMLFIELDDATA;
02316
02317 #undef RVCSYSLIBEXPORT
02318 #undef RVCSYSLIBCLASSEXPORT
02319
02322 void SML_AppInit (
02323 );
02324
02334 MDLGPARENT SML_GetParent (
02335 SML::CONTEXT *context
02336 );
02337
02341 int SML_InitExt (
02342 SML::CONTEXT **pContext,
02343 SML::USAGE Usage = SML::USAGE_StandAlone
02344 );
02345
02346 #if !defined(GENERATING_DOXYGEN_OUTPUT)
02350 int DBQuery_CreateContextFromDBHandle (
02351 RVC::DATABASEHANDLE* dbhandle,
02352 SML::CONTEXT *& context,
02353 UINT32 flags
02354 );
02355 #endif // GENERATING_DOXYGEN_OUTPUT
02356
02358 int SML_CreateObjectContext (
02359 const RVC::OBJITEM& item,
02360 SML::CONTEXT **pcontext
02361 );
02362
02363 #endif // INC_SML_CONTEXT_H