Changeset 195
- Timestamp:
- 09/14/08 01:45:22 (4 months ago)
- Files:
-
- build/osx (added)
- build/osx/criscript (added)
- build/osx/criscript/criscript.xcodeproj (added)
- build/osx/criscript/criscript.xcodeproj/project.pbxproj (added)
- build/win32/CRIScript (modified) (1 prop)
- inc/cilBuiltinObject.h (modified) (8 diffs)
- inc/cilCodegen.h (modified) (1 diff)
- inc/cilDebugger.h (modified) (2 diffs)
- inc/cilErrorDef_English.h (modified) (4 diffs)
- inc/cilOpcode.h (modified) (6 diffs)
- inc/cilVm.h (modified) (5 diffs)
- inc/criscript.h (modified) (2 diffs)
- inc/error.h (modified) (2 diffs)
- inc/icodegen.h (modified) (6 diffs)
- inc/lexer.h (modified) (10 diffs)
- inc/osx (added)
- inc/osx/StopWatch_osx.h (added)
- inc/osx/stdafx_osx.h (added)
- inc/parser.h (modified) (4 diffs)
- inc/stdafx.h (modified) (1 diff)
- inc/stdint.h (modified) (2 diffs)
- inc/variable.h (modified) (3 diffs)
- inc/versions.h (modified) (1 diff)
- inc/win32/StopWatch.h (modified) (1 diff)
- inc/win32/stdafx_win32.h (modified) (1 diff)
- source-archive-win32.txt (modified) (1 diff)
- src/BuiltInObject/cil/cilBuiltinArrayObject.cpp (modified) (14 diffs)
- src/BuiltInObject/cil/cilBuiltinBooleanObject.cpp (modified) (3 diffs)
- src/BuiltInObject/cil/cilBuiltinDateObject.cpp (modified) (7 diffs)
- src/BuiltInObject/cil/cilBuiltinErrorObject.cpp (modified) (5 diffs)
- src/BuiltInObject/cil/cilBuiltinFunctionObject.cpp (modified) (2 diffs)
- src/BuiltInObject/cil/cilBuiltinMathObject.cpp (modified) (3 diffs)
- src/BuiltInObject/cil/cilBuiltinNumberObject.cpp (modified) (10 diffs)
- src/BuiltInObject/cil/cilBuiltinObjectObject.cpp (modified) (2 diffs)
- src/BuiltInObject/cil/cilBuiltinRegexObject.cpp (modified) (8 diffs)
- src/BuiltInObject/cil/cilBuiltinStringObject.cpp (modified) (34 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObject.cpp (modified) (2 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectForIn.cpp (modified) (1 diff)
- src/BuiltInObject/cil/cilBuiltinSystemObjectGlobal.cpp (modified) (3 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectInstanceOf.cpp (modified) (2 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectLoadLiteral.cpp (modified) (2 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectObjectAccess.cpp (modified) (2 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectPropertyAccess.cpp (modified) (4 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectStrictCompare.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilArrayLiteral.cpp (modified) (1 diff)
- src/CodeGen/cil/cilCodeGen.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilConstantFloat.cpp (modified) (1 diff)
- src/CodeGen/cil/cilConstantInteger.cpp (modified) (1 diff)
- src/CodeGen/cil/cilConstantLiteral.cpp (modified) (1 diff)
- src/CodeGen/cil/cilConstantRegex.cpp (modified) (1 diff)
- src/CodeGen/cil/cilFunctionCall.cpp (modified) (3 diffs)
- src/CodeGen/cil/cilFunctionDeclaration.cpp (modified) (1 diff)
- src/CodeGen/cil/cilIdentifier.cpp (modified) (1 diff)
- src/CodeGen/cil/cilLinkage.cpp (modified) (1 diff)
- src/CodeGen/cil/cilNodeTree.cpp (modified) (1 diff)
- src/CodeGen/cil/cilOpcode.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilScope.cpp (modified) (1 diff)
- src/CodeGen/cil/cilSymbolInfo.cpp (modified) (1 diff)
- src/Debugger/cil/cilDebuggerDisasm.cpp (modified) (1 diff)
- src/Parser/criscript.y (modified) (1 diff)
- src/Parser/criscriptparser.cpp (modified) (1 diff)
- src/Parser/error.cpp (modified) (6 diffs)
- src/Parser/filestreamlexer.cpp (modified) (5 diffs)
- src/Parser/lexer.cpp (modified) (7 diffs)
- src/VM/Win32/StopWatch.cpp (modified) (1 diff)
- src/VM/cil/cilVMArgumentList.cpp (modified) (2 diffs)
- src/VM/cil/cilVMBind.cpp (modified) (1 diff)
- src/VM/cil/cilVMExceptionHandling.cpp (modified) (2 diffs)
- src/VM/cil/cilVMILPool.cpp (modified) (1 diff)
- src/VM/cil/cilVMObject.cpp (modified) (3 diffs)
- src/VM/cil/cilVMOperatorBrFalse.cpp (modified) (3 diffs)
- src/VM/cil/cilVMTemplate.cpp (modified) (1 diff)
- tools/cscl/cscl.cpp (added)
- tools/cscl/mkosx (added)
- tools/cscl/mkosx/cscl (added)
- tools/cscl/mkosx/cscl/cscl.xcodeproj (added)
- tools/cscl/mkosx/cscl/cscl.xcodeproj/project.pbxproj (added)
- tools/cscl/mkwin32 (added)
- tools/cscl/mkwin32/cscl.sln (added)
- tools/cscl/mkwin32/cscl.vcproj (added)
- tools/cscl/stdafx.cpp (added)
- tools/cscl/stdafx.h (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
build/win32/CRIScript
- Property svn:ignore set to
debug
- Property svn:ignore set to
inc/cilBuiltinObject.h
r138 r195 70 70 const wchar_t STRING_INTERNAL_CALLNAME[] = L"call"; 71 71 72 73 //RID definitions74 enum RID_BUILTIN_CONSTANT {75 RID_CONSTANT_UNDEFINED = MDT_FIELDDEF | 0,76 RID_CONSTANT_NULL = MDT_FIELDDEF | 1,77 RID_CONSTANT_THIS = MDT_FIELDDEF | 2,78 RID_CONSTANT_BOOL_TRUE = MDT_FIELDDEF | 3,79 RID_CONSTANT_BOOL_FALSE = MDT_FIELDDEF | 4,80 RID_SWITCHTMP = MDT_FIELDDEF | 5,81 RID_CONSTANT_DELETION = MDT_FIELDDEF | 6,82 RID_CONSTANT_NAN = MDT_FIELDDEF | 7,83 RID_CONSTANT_INFINITY = MDT_FIELDDEF | 8,84 RID_ARGUMENTS_TMP = MDT_FIELDDEF | 9,85 };86 87 /*EN An enum values that defines a number of parameters for a built-in object88 \ingroup MDL_LIB_BUILTINOBJECT89 */90 enum RID_BUILTIN_PARAM {91 RID_BUILTINPARAM_NULL = 0, /*EN< No parameter */92 RID_BUILTINPARAM_DEFAULT_ZERO = MDT_PARAMDEF| 0xffffff, /*EN< 0 parameter */93 RID_BUILTINPARAM_DEFAULT_ONE = MDT_PARAMDEF| 0xfffffe, /*EN< 1 parameter */94 RID_BUILTINPARAM_DEFAULT_TWO = MDT_PARAMDEF| 0xfffffd, /*EN< 2 parameters */95 RID_BUILTINPARAM_DEFAULT_THREE = MDT_PARAMDEF| 0xfffffc, /*EN< 3 parameters */96 RID_BUILTINPARAM_DEFAULT_FOUR = MDT_PARAMDEF| 0xfffffb, /*EN< 4 parameters */97 RID_BUILTINPARAM_DEFAULT_FIVE = MDT_PARAMDEF| 0xfffffa, /*EN< 5 parameters */98 RID_BUILTINPARAM_DEFAULT_SIX = MDT_PARAMDEF| 0xfffff9, /*EN< 6 parameters */99 RID_BUILTINPARAM_DEFAULT_SEVEN = MDT_PARAMDEF| 0xfffff8, /*EN< 7 parameters */100 RID_BUILTINPARAM_DEFAULT_EIGHT = MDT_PARAMDEF| 0xfffff7, /*EN< 8 parameters */101 RID_BUILTINPARAM_DEFAULT_NINE = MDT_PARAMDEF| 0xfffff6, /*EN< 9 parameters */102 };103 104 72 const wchar_t STRING_INTERNAL_UNDEFINED[] = L"undefined"; 105 73 const wchar_t STRING_INTERNAL_NULL[] = L"null"; … … 114 82 const wchar_t STRING_INTERNAL_NAN[] = L"NaN"; 115 83 const wchar_t STRING_INTERNAL_INFINITY[] = L"Infinity"; 84 const wchar_t STRING_INTERNAL_NEGATIVE_INFINITY[] = L"-Infinity"; 116 85 const wchar_t STRING_INTERNAL_INFINITY_TOBEREPLACED[] = L"1.#INF"; 117 86 const wchar_t STRING_INTERNAL_ARGUMENTSTMP[] = L"argumentsTemporaryField"; … … 368 337 */ 369 338 virtual bool InitializeVm( CCilVm& vm ) = 0; 339 340 /*EN Ctor*/ 341 CBuiltinObject() {}; 342 343 /*EN Dtor*/ 344 virtual ~CBuiltinObject() {}; 370 345 }; 371 346 … … 463 438 CVariable* pArguments ); 464 439 static bool CheckArrayIndex( const wstring& str ); /*EN< Check if the string is array index*/ 465 static bool Predicater( CVariable& elem1,466 CVariable& elem2 ); /*EN< Array.sort predicater*/467 static bool CilPredicater( CVariable& elem1,468 CVariable& elem2 ); /*EN< Array.sort predicater with script function given440 static bool Predicater( const CVariable& elem1, 441 const CVariable& elem2 ); /*EN< Array.sort predicater*/ 442 static bool CilPredicater( const CVariable& elem1, 443 const CVariable& elem2 ); /*EN< Array.sort predicater with script function given 469 444 Note that it's using static member for a function pointer*/ 470 445 static CCilVm* g_pVm; /*EN< Static member for Array.sort*/ … … 632 607 public: 633 608 //Override it not to initialize keyword map 634 bool init(); 609 CNumberparser() {}; 610 virtual ~CNumberparser() {}; 611 virtual bool init(); 635 612 protected: 636 613 //Override tokenFound … … 654 631 static PROPERTY_INITIALIZATION_PARAM initPropertyParams[]; 655 632 656 static CNumberparser m_numberparser;633 static CNumberparser* m_pNumberparser; 657 634 658 635 public: … … 663 640 bool InitializeVm( CCilVm& vm ); 664 641 static bool parseNumber( CVariable& var, const wstring* const pstr ); 642 643 CNumberObject() 644 { 645 if( m_pNumberparser == NULL ) 646 { 647 m_pNumberparser = new CNumberparser(); 648 } 649 650 } 651 virtual ~CNumberObject() 652 { 653 } 665 654 }; 666 655 … … 949 938 const int32_t iNumArguments, 950 939 CVariable* pArguments ); 951 static void typeof( CCilVm* const pVm,940 static void Typeof( CCilVm* const pVm, 952 941 const int32_t iNumArguments, 953 942 CVariable* pArguments ); inc/cilCodegen.h
r138 r195 458 458 //--------------------------------------------------------- 459 459 CErrorPool* m_pError; 460 CParser* m_p parser;460 CParser* m_pParser; 461 461 CLexer* m_pLex; 462 462 CStringLexer* m_pStringLexer; inc/cilDebugger.h
r138 r195 91 91 void setDumpSymbolInfo( bool b ) { m_bDumpSymbolInfo = b;} 92 92 void setILStream( ILFRAGMENT& ILStream); 93 void setILStream( const uint8_t* pStream, const size_t size ); 93 94 94 95 private: … … 117 118 bool m_bDumpByteCodeData; 118 119 bool m_bDumpSymbolInfo; 119 int8_tm_strBuffer[ SIZE_ERRORSTRING ];120 char m_strBuffer[ SIZE_ERRORSTRING ]; 120 121 wchar_t m_wstrBuffer[ SIZE_ERRORSTRING ]; 121 122 inc/cilErrorDef_English.h
r110 r195 19 19 #pragma once 20 20 21 #include "stdafx.h" 21 22 #include "Error.h" 22 23 23 24 namespace cri { 24 25 25 26 const ERROR_DEF g_ErrorTable_English[] = { 26 27 //Tool error code 27 { ERROR_FILENOTFOUND, E_ERROR, true, L"File %snot found" },28 { ERROR_FILENOTFOUND, E_ERROR, true, L"File " INFO_STRING L" not found" }, 28 29 { ERROR_INVALIDFILEENCODING, E_ERROR, false, L"Source File format is not in UTF16(BOM)" }, 29 { ERROR_INVALIDOPTIONSWITCH, E_ERROR, true, L"Unknown option switch ' %s'" },30 { ERROR_INVALIDOPTIONSWITCH, E_ERROR, true, L"Unknown option switch '" INFO_STRING L"'" }, 30 31 31 32 //Compiler error code … … 52 53 { ERROR_EXPECTED_WHILE, E_ERROR, false, L"Expected 'while'" }, 53 54 { ERROR_INVALIDCHARACTER, E_ERROR, false, L"Invalid character" }, 54 { ERROR_LABELNOTFOUND, E_ERROR, true, L"Label \" %s\" not found" },55 { ERROR_LABELNOTFOUND, E_ERROR, true, L"Label \"" INFO_STRING L"\" not found" }, 55 56 { ERROR_LABELALREADYDEFINED, E_ERROR, false, L"Label redefined" }, 56 57 { ERROR_INVALIDRETURN, E_ERROR, false, L"'return' statement outside of function" }, … … 60 61 { ERROR_INVALIDSTRING, E_ERROR, false, L"Unterminated string constant. \" expected." }, 61 62 { ERROR_INVALIDSTRINGCOLON, E_ERROR, false, L"Unterminated string constant. ' expected." }, 62 { ERROR_RESERVEDWORD, E_ERROR, true, L"Reserved word \" %s\" can not be used." },63 { ERROR_IDALREADYDEFINED, E_ERROR, true, L"identifier \" %s\" already defined" },63 { ERROR_RESERVEDWORD, E_ERROR, true, L"Reserved word \"" INFO_STRING L"\" can not be used." }, 64 { ERROR_IDALREADYDEFINED, E_ERROR, true, L"identifier \"" INFO_STRING L"\" already defined" }, 64 65 { ERROR_STATEMENTNOTALLOWED, E_ERROR, false, L"Statement is not allowed" }, 65 66 { ERROR_FOR_INFINITE, E_ERROR, false, L"Infinite 'for' loop is not allowed" }, 66 { ERROR_INTERNALIDALREADYDEFINED,E_ERROR, true, L"Internal identifier \" %s\" already defined" },67 { ERROR_PARAMETERALREADYDEFINED,E_ERROR, true, L"An argument \" %s\" already defined" },68 { ERROR_FUNCTIONNAMENOTFOUND, E_ERROR, true, L"Could not find a function name \" %s\"" },69 { ERROR_METHODNAMEASSIGNMENTNOTALLOWED, E_ERROR, true, L"Assigment to \" %s\" is not allowed by the compile setting" },70 { ERROR_ILLEGALCALLTYPE, E_ERROR, true, L"\" %s\" can not be a function nor a pointer" },67 { ERROR_INTERNALIDALREADYDEFINED,E_ERROR, true, L"Internal identifier \"" INFO_STRING L"\" already defined" }, 68 { ERROR_PARAMETERALREADYDEFINED,E_ERROR, true, L"An argument \"" INFO_STRING L"\" already defined" }, 69 { ERROR_FUNCTIONNAMENOTFOUND, E_ERROR, true, L"Could not find a function name \"" INFO_STRING L"\"" }, 70 { ERROR_METHODNAMEASSIGNMENTNOTALLOWED, E_ERROR, true, L"Assigment to \"" INFO_STRING L"\" is not allowed by the compile setting" }, 71 { ERROR_ILLEGALCALLTYPE, E_ERROR, true, L"\"" INFO_STRING L"\" can not be a function nor a pointer" }, 71 72 { ERROR_CANNOTASSIGNCONSTANT, E_ERROR, false, L"Can not assign to a constant value" }, 72 { ERROR_CANNOTASSIGNREADONLY, E_ERROR, true, L"Can not assign to a readonly variable \" %s\"" },73 { ERROR_CANNOTASSIGNREADONLY, E_ERROR, true, L"Can not assign to a readonly variable \"" INFO_STRING L"\"" }, 73 74 { ERROR_ONLYONEDEFAULTISALLOWED, E_ERROR, false, L"Just 1 default clause is allowed inside a switch clause" }, 74 75 { ERROR_CANNOTHAVECASE, E_ERROR, false, L"Can't have 'case/default' outside of a switch statement" }, 75 { ERROR_NOOBJECTCTOR, E_ERROR, true, L"The object \" %s\" does not have a constructor" },76 { ERROR_NOOBJECTCTOR, E_ERROR, true, L"The object \"" INFO_STRING L"\" does not have a constructor" }, 76 77 { ERROR_FUNCTIONCTORNOTSUPPORTED, E_ERROR, false, L"The Function constructor with arguments is not supported in this version" }, 77 78 { ERROR_WITHONLYACCEPTOBJREF, E_ERROR, false, L"'with' statement only accepts an object definition as the argument in this version for a performance reason" }, 78 { ERROR_OBJECTNAMENOTFOUND, E_ERROR, true, L"Can not find an object name \" %s\"" },79 { ERROR_OBJECTNAMENOTFOUND, E_ERROR, true, L"Can not find an object name \"" INFO_STRING L"\"" }, 79 80 { ERROR_BADREGEXLITERALFORMAT, E_ERROR, false, L"Bad RegExp literal format" }, 80 { ERROR_ILLEGALTYPESPECIFIER, E_ERROR, true, L"Illegal type name \" %s\"" },81 { ERROR_ILLEGALTYPESPECIFIER, E_ERROR, true, L"Illegal type name \"" INFO_STRING L"\"" }, 81 82 { ERROR_DYNAMICEVALNOTSUPPORTED, E_ERROR, false, L"Dynamic eval not supported in this version." }, 82 83 … … 84 85 { INFO_IF_NOEFFECT, E_INFORMATION, false, L"IF statement has no effect" }, 85 86 { INFO_FOR_NOEFFECT, E_INFORMATION, false, L"For statement has no effect" }, 86 { INFO_IDNOTREGISTERED, E_INFORMATION, true, L"Variable \" %s\" is not registered explicitly" },87 { INFO_VARIABLENOTASSIGNED, E_INFORMATION, true, L"Variable \" %s\" is not initialized here" },87 { INFO_IDNOTREGISTERED, E_INFORMATION, true, L"Variable \"" INFO_STRING L"\" is not registered explicitly" }, 88 { INFO_VARIABLENOTASSIGNED, E_INFORMATION, true, L"Variable \"" INFO_STRING L"\" is not initialized here" }, 88 89 { INFO_DIFFERENTNUMARGS, E_INFORMATION, false, L"A number of given arguments differs from the function signature" }, 89 { INFO_OBJECTINITIALIZORDUPLICATION, E_INFORMATION, true, L"Duplicating object property name \" %s\"." },90 { INFO_OBJECTINITIALIZORDUPLICATION, E_INFORMATION, true, L"Duplicating object property name \"" INFO_STRING L"\"." }, 90 91 { INFO_arrayLiteralTOOLARGE, E_INFORMATION, false, L"Array size could be too large." }, 91 { INFO_INVOKINGVARIABLE, E_INFORMATION, true, L"Invoking variable \" %s\". Could involve runtime exception if the variable is not a function reference." },92 { INFO_INVOKINGVARIABLE, E_INFORMATION, true, L"Invoking variable \"" INFO_STRING L"\". Could involve runtime exception if the variable is not a function reference." }, 92 93 93 94 inc/cilOpcode.h
r138 r195 23 23 24 24 namespace cri { 25 26 //27 // Token tags.28 //29 typedef enum COR_TOKEN_TYPE30 {31 MDT_MODULE = 0x00000000, //32 MDT_TYPEREF = 0x01000000, //33 MDT_TYPEDEF = 0x02000000, //34 MDT_FIELDDEF = 0x04000000, //35 MDT_METHODDEF = 0x06000000, //36 MDT_PARAMDEF = 0x08000000, //37 MDT_INTERFACEIMPL = 0x09000000, //38 MDT_MEMBERREF = 0x0a000000, //39 MDT_CUSTOMATTRIBUTE = 0x0c000000, //40 MDT_PERMISSION = 0x0e000000, //41 MDT_SIGNATURE = 0x11000000, //42 MDT_EVENT = 0x14000000, //43 MDT_PROPERTY = 0x17000000, //44 MDT_MODULEREF = 0x1a000000, //45 MDT_TYPESPEC = 0x1b000000, //46 MDT_ASSEMBLY = 0x20000000, //47 MDT_ASSEMBLYREF = 0x23000000, //48 MDT_FILE = 0x26000000, //49 MDT_EXPORTEDTYPE = 0x27000000, //50 MDT_MANIFESTRESOURCE = 0x28000000, //51 MDT_GENERICPARAM = 0x2a000000, //52 MDT_METHAODSPEC = 0x2b000000, //53 MDT_GENERICPARAMCONSTRAINT = 0x2c000000,54 55 MDT_STRING = 0x70000000, //56 MDT_NAME = 0x71000000, //57 MDT_BASETYPE = 0x72000000, // Leave this on the high end value. This does not correspond to metadata table58 } COR_TOKEN_TYPE;59 25 60 26 // … … 64 30 #define TokenFromRid(rid,tktype) ((rid) | (tktype)) 65 31 #define RidFromToken(tk) ((RID) ((tk) & 0x00ffffff)) 66 #define TypeFromToken(tk) (( ULONG32)((tk) & 0xff000000))32 #define TypeFromToken(tk) ((uint32_t)((tk) & 0xff000000)) 67 33 #define isNilToken(tk) ((RidFromToken(tk)) == 0) 68 34 #define isBuiltinRid(tk) ((tk) & 0x800000) … … 484 450 struct OPCODE_TABLEENTRY { 485 451 OP_CODE OpCode; 486 int8_t* pName;452 const char * pName; 487 453 int32_t iPopbehaivor; 488 454 int32_t iPushbehaivor; … … 495 461 }; 496 462 497 typedef vector< uint8_t > ILFRAGMENT;463 typedef std::vector< uint8_t > ILFRAGMENT; 498 464 499 465 class ILFRAGMENTINFO { … … 501 467 ILFRAGMENTINFO() : MethodRID( 0 ), iNumEvalStackEntries( 0 ) {} 502 468 ~ILFRAGMENTINFO() {} 469 RID MethodRID; 470 int32_t iNumEvalStackEntries; 471 wstring strScopeName; 503 472 ILFRAGMENT ILPool; 504 RID MethodRID;505 wstring strScopeName;506 int32_t iNumEvalStackEntries;507 473 }; 508 474 … … 517 483 518 484 }//namespace cri 485 486 #ifdef __APPLE__ 487 //Hash function 488 namespace __gnu_cxx { 489 template<> 490 struct hash<cri::OP_CODE> 491 { 492 size_t operator()(const cri::OP_CODE __x) const 493 { 494 return size_t(__x); 495 } 496 }; 497 } 498 #endif 499 inc/cilVm.h
r138 r195 23 23 #include "iCodeGen.h" 24 24 #include "cilCodeGen.h" 25 #include "win32/StopWatch.h"26 25 #include "variable.h" 27 26 #include "vmRuntimeError.h" … … 164 163 }; 165 164 166 167 /***************************************************************************168 * VM helper APIs169 ***************************************************************************/170 #define VMRET_INT int32_t171 #define VMRET_FLOAT float172 #define VMRET_DOUBLE double173 174 #define VMARG_INT int32_t175 #define VMARG_FLOAT float176 #define VMARG_DOUBLE double177 178 /*EN Wrapper template classes for user specified functions.179 This wrapper is for a function that does not require 'this' value.180 no parameter, with return variable version.181 \param pVm A pointer to the VM182 \param iNumArguments A number of given parameters.183 \param pArguments A pointer to the arguments array.184 \param pMethodBody An API body.185 \ingroup MDL_LIB_VM186 */187 template< class RET >188 void MakeWrapperStdP0( CCilVm* const pVm,189 const int32_t iNumArguments,190 CVariable* pArguments,191 PMETHOD pMethodBody )192 {193 RET ret = ((RET (*)( void ) )pMethodBody)();194 pVm->pushEvalStack( ret );195 196 return;197 }198 199 /*EN Wrapper template classes for user specified functions.200 This wrapper is for a function that does not require 'this' value.201 1 parameter, with return variable version.202 \param pVm A pointer to the VM203 \param iNumArguments A number of given parameters.204 \param pArguments A pointer to the arguments array.205 \param pMethodBody An API body.206 \ingroup MDL_LIB_VM207 */208 template< class RET, class P1 >209 void MakeWrapperStdP1( CCilVm* const pVm,210 const int32_t iNumArguments,211 CVariable* pArguments,212 PMETHOD pMethodBody )213 {214 //Skip This pointer215 pArguments ++;216 217 P1 param1;218 switch( iNumArguments )219 {220 default:221 param1 = (P1)*pArguments;222 case 1:223 break;224 }225 226 RET ret = ((RET (*)( P1 ) )pMethodBody)( param1 );227 pVm->pushEvalStack( ret );228 229 return;230 }231 232 /*EN Wrapper template classes for user specified functions.233 This wrapper is for a function that does not require 'this' value.234 2 parameters, with return variable version.235 \param pVm A pointer to the VM236 \param iNumArguments A number of given parameters.237 \param pArguments A pointer to the arguments array.238 \param pMethodBody An API body.239 \ingroup MDL_LIB_VM240 */241 template< class RET, class P1, class P2 >242 void MakeWrapperStdP2( CCilVm* const pVm,243 const int32_t iNumArguments,244 CVariable* pArguments,245 PMETHOD pMethodBody )246 {247 //Skip This pointer248 pArguments ++;249 250 P1 param1 = (P1)0;251 P2 param2 = (P2)0;252 switch( iNumArguments )253 {254 default:255 param2 = (P2)*(pArguments+1);256 case 2:257 param1 = (P1)*pArguments;258 case 1:259 break;260 }261 262 RET ret = ((RET (*)( P1, P2 ) )pMethodBody)( param1, param2 );263 pVm->pushEvalStack( ret );264 265 return;266 }267 268 /*EN Wrapper template classes for user specified functions.269 This wrapper is for a function that does not require 'this' value.270 3 parameters, with return variable version.271 \param pVm A pointer to the VM272 \param iNumArguments A number of given parameters.273 \param pArguments A pointer to the arguments array.274 \param pMethodBody An API body.275 \ingroup MDL_LIB_VM276 */277 template< class RET, class P1, class P2, class P3 >278 void MakeWrapperStdP3( CCilVm* const pVm,279 const int32_t iNumArguments,280 CVariable* pArguments,281 PMETHOD pMethodBody )282 {283 //Skip This pointer284 pArguments ++;285 286 P1 param1 = (P1)0;287 P2 param2 = (P2)0;288 P3 param3 = (P3)0;289 switch( iNumArguments )290 {291 default:292 param3 = (P3)*(pArguments+2);293 case 3:294 param2 = (P2)*(pArguments+1);295 case 2:296 param1 = (P1)*pArguments;297 case 1:298 break;299 }300 301 RET ret = ((RET (*)( P1, P2, P3 ) )pMethodBody)( param1, param2, param3 );302 pVm->pushEvalStack( ret );303 304 return;305 }306 307 /*EN Wrapper template classes for user specified functions.308 This wrapper is for a function that does not require 'this' value.309 4 parameters, with return variable version.310 \param pVm A pointer to the VM311 \param iNumArguments A number of given parameters.312 \param pArguments A pointer to the arguments array.313 \param pMethodBody An API body.314 \ingroup MDL_LIB_VM315 */316 template< class RET, class P1, class P2, class P3, class P4 >317 void MakeWrapperStdP4( CCilVm* const pVm,318 const int32_t iNumArguments,319 CVariable* pArguments,320 PMETHOD pMethodBody )321 {322 //Skip This pointer323 pArguments ++;324 325 P1 param1 = (P1)0;326 P2 param2 = (P2)0;327 P3 param3 = (P3)0;328 P4 param4 = (P4)0;329 switch( iNumArguments )330 {331 default:332 param4 = (P4)*(pArguments+3);333 case 4:334 param3 = (P3)*(pArguments+2);335 case 3:336 param2 = (P2)*(pArguments+1);337 case 2:338 param1 = (P1)*pArguments;339 case 1:340 break;341 }342 343 RET ret = ((RET (*)( P1, P2, P3, P4 ) )pMethodBody)( param1, param2, param3, param4 );344 pVm->pushEvalStack( ret );345 346 return;347 }348 349 /*EN Wrapper template classes for user specified functions.350 This wrapper is for a function that does not require 'this' value.351 5 parameters, with return variable version.352 \param pVm A pointer to the VM353 \param iNumArguments A number of given parameters.354 \param pArguments A pointer to the arguments array.355 \param pMethodBody An API body.356 \ingroup MDL_LIB_VM357 */358 template< class RET, class P1, class P2, class P3, class P4, class P5 >359 void MakeWrapperStdP5( CCilVm* const pVm,360 const int32_t iNumArguments,361 CVariable* pArguments,362 PMETHOD pMethodBody )363 {364 //Skip This pointer365 pArguments ++;366 367 P1 param1 = (P1)0;368 P2 param2 = (P2)0;369 P3 param3 = (P3)0;370 P4 param4 = (P4)0;371 P5 param5 = (P5)0;372 switch( iNumArguments )373 {374 default:375 param5 = (P5)*(pArguments+4);376 case 5:377 param4 = (P4)*(pArguments+3);378 case 4:379 param3 = (P3)*(pArguments+2);380 case 3:381 param2 = (P2)*(pArguments+1);382 case 2:383 param1 = (P1)*pArguments;384 case 1:385 break;386 }387 388 RET ret = ((RET (*)( P1, P2, P3, P4, P5 ) )pMethodBody)( param1, param2, param3, param4, param5 );389 pVm->pushEvalStack( ret );390 391 return;392 }393 394 //----------------------395 //Void return version396 //----------------------397 /*EN Wrapper template classes for user specified functions.398 This wrapper is for a function that does not require 'this' value.399 no parameter, without return variable version.400 \param pVm A pointer to the VM401 \param iNumArguments A number of given parameters.402 \param pArguments A pointer to the arguments array.403 \param pMethodBody An API body.404 \ingroup MDL_LIB_VM405 */406 void MakeWrapperStdVoidP0( CCilVm* const pVm,407 const int32_t iNumArguments,408 CVariable* pArguments,409 PMETHOD pMethodBody );410 /*411 {412 ((void (*)( void ) )pMethodBody)();413 pVm->pushEvalStackUndefined();414 415 return;416 }*/417 418 /*EN Wrapper template classes for user specified functions.419 This wrapper is for a function that does not require 'this' value.420 1 parameter, without return variable version.421 \param pVm A pointer to the VM422 \param iNumArguments A number of given parameters.423 \param pArguments A pointer to the arguments array.424 \param pMethodBody An API body.425 \ingroup MDL_LIB_VM426 */427 template< class P1 >428 void MakeWrapperStdVoidP1( CCilVm* const pVm,429 const int32_t iNumArguments,430 CVariable* pArguments,431 PMETHOD pMethodBody )432 {433 //Skip This pointer434 pArguments ++;435 436 P1 param1;437 switch( iNumArguments )438 {439 default:440 param1 = (P1)*pArguments;441 case 1:442 break;443 }444 445 ((void (*)( P1 ) )pMethodBody)( param1 );446 pVm->pushEvalStackUndefined();447 448 return;449 }450 451 /*EN Wrapper template classes for user specified functions.452 This wrapper is for a function that does not require 'this' value.453 2 parameters, without return variable version.454 \param pVm A pointer to the VM455 \param iNumArguments A number of given parameters.456 \param pArguments A pointer to the arguments array.457 \param pMethodBody An API body.458 \ingroup MDL_LIB_VM459 */460 template< class P1, class P2 >461 void MakeWrapperStdVoidP2( CCilVm* const pVm,462 const int32_t iNumArguments,463 CVariable* pArguments,464 PMETHOD pMethodBody )465 {466 //Skip This pointer467 pArguments ++;468 469 P1 param1 = (P1)0;470 P2 param2 = (P2)0;471 switch( iNumArguments )472 {473 default:474 param2 = (P2)*(pArguments+1);475 case 2:476 param1 = (P1)*pArguments;477 case 1:478 break;479 }480 481 482 ((void (*)( P1, P2 ) )pMethodBody)( param1, param2 );483 pVm->pushEvalStackUndefined();484 485 return;486 }487 488 /*EN Wrapper template classes for user specified functions.489 This wrapper is for a function that does not require 'this' value.490 3 parameters, without return variable version.491 \param pVm A pointer to the VM492 \param iNumArguments A number of given parameters.493 \param pArguments A pointer to the arguments array.494 \param pMethodBody An API body.495 \ingroup MDL_LIB_VM496 */497 template< class P1, class P2, class P3 >498 void MakeWrapperStdVoidP3( CCilVm* const pVm,499 const int32_t iNumArguments,500 CVariable* pArguments,501 PMETHOD pMethodBody )502 {503 //Skip This pointer504 pArguments ++;505 506 P1 param1 = (P1)0;507 P2 param2 = (P2)0;508 P3 param3 = (P3)0;509 switch( iNumArguments )510 {511 default:512 param3 = (P3)*(pArguments+2);513 case 3:514 param2 = (P2)*(pArguments+1);515 case 2:516 param1 = (P1)*pArguments;517 case 1:518 break;519 }520 521 ((void (*)( P1, P2, P3 ) )pMethodBody)( param1, param2, param3 );522 pVm->pushEvalStackUndefined();523 524 return;525 }526 527 /*EN Wrapper template classes for user specified functions.528 This wrapper is for a function that does not require 'this' value.529 4 parameters, without return variable version.530 \param pVm A pointer to the VM531 \param iNumArguments A number of given parameters.532 \param pArguments A pointer to the arguments array.533 \param pMethodBody An API body.534 \ingroup MDL_LIB_VM535 */536 template< class P1, class P2, class P3, class P4 >537 void MakeWrapperStdVoidP4( CCilVm* const pVm,538 const int32_t iNumArguments,539 CVariable* pArguments,540 PMETHOD pMethodBody )541 {542 //Skip This pointer543 pArguments ++;544 545 P1 param1 = (P1)0;546 P2 param2 = (P2)0;547 P3 param3 = (P3)0;548 P4 param4 = (P4)0;549 switch( iNumArguments )550 {551 default:552 param4 = (P4)*(pArguments+3);553 case 4:554 param3 = (P3)*(pArguments+2);555 case 3:556 param2 = (P2)*(pArguments+1);557 case 2:558 param1 = (P1)*pArguments;559 case 1:560 break;561 }562 563 ((void (*)( P1, P2, P3, P4 ) )pMethodBody)( param1, param2, param3, param4 );564 pVm->pushEvalStackUndefined();565 566 return;567 }568 569 /*EN Wrapper template classes for user specified functions.570 This wrapper is for a function that does not require 'this' value.571 5 parameters, without return variable version.572 \param pVm A pointer to the VM573 \param iNumArguments A number of given parameters.574 \param pArguments A pointer to the arguments array.575 \param pMethodBody An API body.576 \ingroup MDL_LIB_VM577 */578 template< class P1, class P2, class P3, class P4, class P5 >579
