Changeset 195

Show
Ignore:
Timestamp:
09/14/08 01:45:22 (4 months ago)
Author:
hak
Message:

Ver.0.91.0.137
- Added OSX/GCC support!
- Can compile in XCode 3.1/GCC 4.0.1 & Visual Studio 2005.
- Runs in OSX 10.5.4 & Windows XP/Vista
- Number::toString support a radix.
- BRFALSE bug fix
- Minor code clean up

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • build/win32/CRIScript

    • Property svn:ignore set to
      debug
  • inc/cilBuiltinObject.h

    r138 r195  
    7070        const wchar_t STRING_INTERNAL_CALLNAME[] = L"call"; 
    7171 
    72  
    73         //RID definitions 
    74         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 object 
    88         \ingroup MDL_LIB_BUILTINOBJECT 
    89         */ 
    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  
    10472        const wchar_t STRING_INTERNAL_UNDEFINED[]       = L"undefined"; 
    10573        const wchar_t STRING_INTERNAL_NULL[]            = L"null"; 
     
    11482        const wchar_t STRING_INTERNAL_NAN[]                     = L"NaN"; 
    11583        const wchar_t STRING_INTERNAL_INFINITY[]        = L"Infinity"; 
     84        const wchar_t STRING_INTERNAL_NEGATIVE_INFINITY[]       = L"-Infinity"; 
    11685        const wchar_t STRING_INTERNAL_INFINITY_TOBEREPLACED[] = L"1.#INF"; 
    11786        const wchar_t STRING_INTERNAL_ARGUMENTSTMP[]    = L"argumentsTemporaryField"; 
     
    368337                */ 
    369338                virtual bool InitializeVm( CCilVm& vm ) = 0; 
     339                 
     340                /*EN Ctor*/ 
     341                CBuiltinObject() {}; 
     342                 
     343                /*EN Dtor*/ 
     344                virtual ~CBuiltinObject() {}; 
    370345        }; 
    371346 
     
    463438                                                                        CVariable* pArguments ); 
    464439                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 given 
     440                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 
    469444                                                                                                                        Note that it's using static member for a function pointer*/ 
    470445                static CCilVm* g_pVm;                                                           /*EN< Static member for Array.sort*/ 
     
    632607        public: 
    633608                //Override it not to initialize keyword map 
    634                 bool init(); 
     609                CNumberparser() {}; 
     610                virtual ~CNumberparser() {}; 
     611                virtual bool init(); 
    635612        protected: 
    636613                //Override tokenFound 
     
    654631                static PROPERTY_INITIALIZATION_PARAM initPropertyParams[]; 
    655632 
    656                 static CNumberparser m_numberparser; 
     633                static CNumberparser* m_pNumberparser; 
    657634 
    658635        public: 
     
    663640                bool InitializeVm( CCilVm& vm ); 
    664641                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                } 
    665654        }; 
    666655 
     
    949938                                                                                        const int32_t iNumArguments,  
    950939                                                                                        CVariable* pArguments ); 
    951                 static void typeof( CCilVm* const pVm, 
     940                static void Typeof( CCilVm* const pVm, 
    952941                                                                                        const int32_t iNumArguments,  
    953942                                                                                        CVariable* pArguments ); 
  • inc/cilCodegen.h

    r138 r195  
    458458                //--------------------------------------------------------- 
    459459                CErrorPool*             m_pError; 
    460                 CParser*                m_pparser; 
     460                CParser*                m_pParser; 
    461461                CLexer*                 m_pLex; 
    462462                CStringLexer*   m_pStringLexer; 
  • inc/cilDebugger.h

    r138 r195  
    9191                void setDumpSymbolInfo( bool b ) { m_bDumpSymbolInfo = b;} 
    9292                void setILStream( ILFRAGMENT& ILStream); 
     93                void setILStream( const uint8_t* pStream, const size_t size ); 
    9394 
    9495        private: 
     
    117118                bool m_bDumpByteCodeData; 
    118119                bool m_bDumpSymbolInfo; 
    119                 int8_t m_strBuffer[ SIZE_ERRORSTRING ]; 
     120                char m_strBuffer[ SIZE_ERRORSTRING ]; 
    120121                wchar_t m_wstrBuffer[ SIZE_ERRORSTRING ]; 
    121122 
  • inc/cilErrorDef_English.h

    r110 r195  
    1919#pragma once 
    2020 
     21#include "stdafx.h" 
    2122#include "Error.h" 
    2223 
    2324namespace cri { 
    24  
     25         
    2526const ERROR_DEF g_ErrorTable_English[] = { 
    2627//Tool error code 
    27 { ERROR_FILENOTFOUND,   E_ERROR, true,  L"File %s not found" }, 
     28{ ERROR_FILENOTFOUND,   E_ERROR, true,  L"File " INFO_STRING L" not found" }, 
    2829{ 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"'" }, 
    3031 
    3132//Compiler error code 
     
    5253{ ERROR_EXPECTED_WHILE,                 E_ERROR, false, L"Expected 'while'" }, 
    5354{ 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" }, 
    5556{ ERROR_LABELALREADYDEFINED,    E_ERROR, false, L"Label redefined" }, 
    5657{ ERROR_INVALIDRETURN,                  E_ERROR, false, L"'return' statement outside of function" }, 
     
    6061{ ERROR_INVALIDSTRING,                  E_ERROR, false, L"Unterminated string constant. \" expected." }, 
    6162{ 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" }, 
    6465{ ERROR_STATEMENTNOTALLOWED,    E_ERROR, false, L"Statement is not allowed" }, 
    6566{ 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" }, 
    7172{ 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"\"" }, 
    7374{ ERROR_ONLYONEDEFAULTISALLOWED,        E_ERROR, false,  L"Just 1 default clause is allowed inside a switch clause" }, 
    7475{ 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" }, 
    7677{ ERROR_FUNCTIONCTORNOTSUPPORTED,                       E_ERROR, false,  L"The Function constructor with arguments is not supported in this version" }, 
    7778{ 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"\"" }, 
    7980{ 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"\"" }, 
    8182{ ERROR_DYNAMICEVALNOTSUPPORTED,        E_ERROR, false,  L"Dynamic eval not supported in this version." }, 
    8283 
     
    8485{ INFO_IF_NOEFFECT,                             E_INFORMATION, false, L"IF statement has no effect" }, 
    8586{ 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" }, 
    8889{ 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"\"." }, 
    9091{ 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." }, 
    9293 
    9394 
  • inc/cilOpcode.h

    r138 r195  
    2323 
    2424namespace cri { 
    25  
    26 // 
    27 // Token tags. 
    28 // 
    29 typedef enum COR_TOKEN_TYPE 
    30 { 
    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 table 
    58 } COR_TOKEN_TYPE; 
    5925 
    6026// 
     
    6430#define TokenFromRid(rid,tktype) ((rid) | (tktype)) 
    6531#define RidFromToken(tk) ((RID) ((tk) & 0x00ffffff)) 
    66 #define TypeFromToken(tk) ((ULONG32)((tk) & 0xff000000)) 
     32#define TypeFromToken(tk) ((uint32_t)((tk) & 0xff000000)) 
    6733#define isNilToken(tk) ((RidFromToken(tk)) == 0) 
    6834#define isBuiltinRid(tk) ((tk) & 0x800000) 
     
    484450struct OPCODE_TABLEENTRY { 
    485451        OP_CODE OpCode; 
    486         int8_t * pName; 
     452        const char * pName; 
    487453        int32_t iPopbehaivor; 
    488454        int32_t iPushbehaivor; 
     
    495461}; 
    496462 
    497 typedef vector< uint8_t > ILFRAGMENT; 
     463typedef std::vector< uint8_t > ILFRAGMENT; 
    498464 
    499465class ILFRAGMENTINFO { 
     
    501467        ILFRAGMENTINFO() : MethodRID( 0 ), iNumEvalStackEntries( 0 ) {} 
    502468        ~ILFRAGMENTINFO() {} 
     469        RID             MethodRID; 
     470        int32_t iNumEvalStackEntries; 
     471        wstring strScopeName; 
    503472        ILFRAGMENT ILPool; 
    504         RID             MethodRID; 
    505         wstring strScopeName; 
    506         int32_t iNumEvalStackEntries; 
    507473}; 
    508474 
     
    517483 
    518484}//namespace cri 
     485 
     486#ifdef __APPLE__ 
     487//Hash function 
     488namespace __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  
    2323#include "iCodeGen.h" 
    2424#include "cilCodeGen.h" 
    25 #include "win32/StopWatch.h" 
    2625#include "variable.h" 
    2726#include "vmRuntimeError.h" 
     
    164163}; 
    165164 
    166  
    167 /*************************************************************************** 
    168  *      VM helper APIs 
    169  ***************************************************************************/ 
    170 #define VMRET_INT int32_t 
    171 #define VMRET_FLOAT float 
    172 #define VMRET_DOUBLE double 
    173  
    174 #define VMARG_INT int32_t 
    175 #define VMARG_FLOAT float 
    176 #define VMARG_DOUBLE double 
    177  
    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 VM 
    182 \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_VM 
    186 */ 
    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 VM 
    203 \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_VM 
    207 */ 
    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 pointer 
    215         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 VM 
    236 \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_VM 
    240 */ 
    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 pointer 
    248         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 VM 
    272 \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_VM 
    276 */ 
    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 pointer 
    284         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 VM 
    311 \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_VM 
    315 */ 
    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 pointer 
    323         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 VM 
    353 \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_VM 
    357 */ 
    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 pointer 
    365         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 version 
    396 //---------------------- 
    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 VM 
    401 \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_VM 
    405 */ 
    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 VM 
    422 \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_VM 
    426 */ 
    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 pointer 
    434         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 VM 
    455 \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_VM 
    459 */ 
    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 pointer 
    467         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 VM 
    492 \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_VM 
    496 */ 
    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 pointer 
    504         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 VM 
    531 \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_VM 
    535 */ 
    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 pointer 
    543         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 VM 
    573 \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_VM 
    577 */ 
    578 template< class P1, class P2, class P3, class P4, class P5 > 
    579