Changeset 138
- Timestamp:
- 07/24/08 17:04:30 (2 years ago)
- Files:
-
- SDK-archive.txt (modified) (1 diff)
- inc/cilBuiltinObject.h (modified) (1 diff)
- inc/cilCodegen.h (modified) (9 diffs)
- inc/cilDebugger.h (modified) (2 diffs)
- inc/cilOpcode.h (modified) (1 diff)
- inc/cilVm.h (modified) (75 diffs)
- inc/error.h (modified) (3 diffs)
- inc/icodegen.h (modified) (15 diffs)
- inc/lexer.h (modified) (14 diffs)
- inc/parser.h (modified) (4 diffs)
- inc/variable.h (modified) (1 diff)
- inc/win32/StopWatch.h (modified) (1 diff)
- samples/basic_native_userapi_bind/basic_native_userapi_bind.cpp (modified) (5 diffs)
- samples/basic_userapi_bind/basic_userapi_bind.cpp (modified) (3 diffs)
- samples/build_all (added)
- samples/build_all/mkwin32 (added)
- samples/build_all/mkwin32/criscriptsamples.sln (added)
- samples/helloworld/helloworld.cpp (modified) (2 diffs)
- samples/invoke_script_function/invoke_script_function.cpp (modified) (2 diffs)
- samples/property_bind/property_bind.cpp (modified) (4 diffs)
- samples/vm_contol (added)
- samples/vm_contol/mkwin32 (added)
- samples/vm_contol/mkwin32/vm_control.sln (added)
- samples/vm_contol/mkwin32/vm_control.vcproj (added)
- samples/vm_contol/stdafx.cpp (added)
- samples/vm_contol/stdafx.h (added)
- samples/vm_contol/vm_control.cpp (added)
- source-archive-win32.txt (modified) (1 diff)
- src/BuiltInObject/cil/cilBuiltinArrayObject.cpp (modified) (28 diffs)
- src/BuiltInObject/cil/cilBuiltinBooleanObject.cpp (modified) (12 diffs)
- src/BuiltInObject/cil/cilBuiltinDateObject.cpp (modified) (29 diffs)
- src/BuiltInObject/cil/cilBuiltinDateObjectTimeZone.cpp (modified) (12 diffs)
- src/BuiltInObject/cil/cilBuiltinErrorObject.cpp (modified) (14 diffs)
- src/BuiltInObject/cil/cilBuiltinFunctionObject.cpp (modified) (15 diffs)
- src/BuiltInObject/cil/cilBuiltinMathObject.cpp (modified) (40 diffs)
- src/BuiltInObject/cil/cilBuiltinNumberObject.cpp (modified) (22 diffs)
- src/BuiltInObject/cil/cilBuiltinObjectObject.cpp (modified) (25 diffs)
- src/BuiltInObject/cil/cilBuiltinRegexObject.cpp (modified) (29 diffs)
- src/BuiltInObject/cil/cilBuiltinStringObject.cpp (modified) (64 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObject.cpp (modified) (5 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectForIn.cpp (modified) (7 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectGlobal.cpp (modified) (22 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectInstanceOf.cpp (modified) (3 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectLoadLiteral.cpp (modified) (4 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectObjectAccess.cpp (modified) (4 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectPropertyAccess.cpp (modified) (11 diffs)
- src/BuiltInObject/cil/cilBuiltinSystemObjectStrictCompare.cpp (modified) (5 diffs)
- src/CodeGen/cil/cilArgumentListStack.cpp (modified) (3 diffs)
- src/CodeGen/cil/cilArrayLiteral.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilBuiltinObject.cpp (modified) (13 diffs)
- src/CodeGen/cil/cilCodeGen.cpp (modified) (36 diffs)
- src/CodeGen/cil/cilCodegenManagement.cpp (modified) (1 diff)
- src/CodeGen/cil/cilConditionalExpression.cpp (modified) (3 diffs)
- src/CodeGen/cil/cilConstantBoolean.cpp (modified) (1 diff)
- src/CodeGen/cil/cilConstantFloat.cpp (modified) (1 diff)
- src/CodeGen/cil/cilConstantInteger.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilConstantLiteral.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilConstantRegex.cpp (modified) (4 diffs)
- src/CodeGen/cil/cilExceptionHandling.cpp (modified) (15 diffs)
- src/CodeGen/cil/cilFunctionCall.cpp (modified) (14 diffs)
- src/CodeGen/cil/cilFunctionDeclaration.cpp (modified) (24 diffs)
- src/CodeGen/cil/cilFunctionRet.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilFunctionVariables.cpp (modified) (20 diffs)
- src/CodeGen/cil/cilLabel.cpp (modified) (11 diffs)
- src/CodeGen/cil/cilLinkage.cpp (modified) (25 diffs)
- src/CodeGen/cil/cilMetadata.cpp (modified) (52 diffs)
- src/CodeGen/cil/cilNodeTree.cpp (modified) (33 diffs)
- src/CodeGen/cil/cilObjectInformation.cpp (modified) (5 diffs)
- src/CodeGen/cil/cilObjectLiteral.cpp (modified) (5 diffs)
- src/CodeGen/cil/cilOperatorAdd.cpp (modified) (7 diffs)
- src/CodeGen/cil/cilOperatorBitwiseAnd.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorBitwiseOr.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorBitwiseShiftLeft.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorBitwiseShiftRight.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorBitwiseShiftRightUnsigned.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorBitwiseXor.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorCompare.cpp (modified) (4 diffs)
- src/CodeGen/cil/cilOperatorCompareStrict.cpp (modified) (4 diffs)
- src/CodeGen/cil/cilOperatorDivision.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorIn.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilOperatorInstanceOf.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilOperatorLogicalAnd.cpp (modified) (11 diffs)
- src/CodeGen/cil/cilOperatorLogicalOr.cpp (modified) (13 diffs)
- src/CodeGen/cil/cilOperatorMultiply.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorNew.cpp (modified) (7 diffs)
- src/CodeGen/cil/cilOperatorReminder.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorSubtract.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilOperatorUnaryBitwiseNot.cpp (modified) (5 diffs)
- src/CodeGen/cil/cilOperatorUnaryDelete.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilOperatorUnaryIncrement.cpp (modified) (10 diffs)
- src/CodeGen/cil/cilOperatorUnaryLogicalNot.cpp (modified) (5 diffs)
- src/CodeGen/cil/cilOperatorUnaryMinus.cpp (modified) (4 diffs)
- src/CodeGen/cil/cilOperatorUnaryPlus.cpp (modified) (4 diffs)
- src/CodeGen/cil/cilOperatorUnaryTypeof.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilOperatorUnaryVoid.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilProperty.cpp (modified) (9 diffs)
- src/CodeGen/cil/cilScope.cpp (modified) (7 diffs)
- src/CodeGen/cil/cilStatementBreak.cpp (modified) (14 diffs)
- src/CodeGen/cil/cilStatementExpression.cpp (modified) (1 diff)
- src/CodeGen/cil/cilStatementFor.cpp (modified) (7 diffs)
- src/CodeGen/cil/cilStatementForIn.cpp (modified) (5 diffs)
- src/CodeGen/cil/cilStatementIf.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilStatementSwitch.cpp (modified) (7 diffs)
- src/CodeGen/cil/cilStatementWith.cpp (modified) (2 diffs)
- src/CodeGen/cil/cilSymbolInfo.cpp (modified) (6 diffs)
- src/CodeGen/cil/cilTemporaryVariables.cpp (modified) (3 diffs)
- src/CodeGen/cil/cilVariableAssignment.cpp (modified) (10 diffs)
- src/CodeGen/cil/cilVariableDeclaration.cpp (modified) (12 diffs)
- src/Debugger/cil/cilDebuggerDisasm.cpp (modified) (20 diffs)
- src/Debugger/cil/cilDebuggerDump.cpp (modified) (4 diffs)
- src/Debugger/cil/cilDebuggerVMInterface.cpp (modified) (3 diffs)
- src/Parser/criscript.y (modified) (105 diffs)
- src/Parser/criscriptparser.cpp (modified) (333 diffs)
- src/Parser/error.cpp (modified) (8 diffs)
- src/Parser/filestreamlexer.cpp (modified) (6 diffs)
- src/Parser/lexer.cpp (modified) (76 diffs)
- src/Parser/onmemorylexer.cpp (modified) (6 diffs)
- src/Parser/parser.cpp (modified) (4 diffs)
- src/Parser/variable.cpp (modified) (32 diffs)
- src/VM/Win32/StopWatch.cpp (modified) (1 diff)
- src/VM/cil/cilVM.cpp (modified) (14 diffs)
- src/VM/cil/cilVMArgumentList.cpp (modified) (21 diffs)
- src/VM/cil/cilVMBind.cpp (modified) (10 diffs)
- src/VM/cil/cilVMConversion.cpp (modified) (2 diffs)
- src/VM/cil/cilVMDebugInfo.cpp (modified) (1 diff)
- src/VM/cil/cilVMEvalStack.cpp (modified) (23 diffs)
- src/VM/cil/cilVMExceptionHandling.cpp (modified) (24 diffs)
- src/VM/cil/cilVMGarbageCollector.cpp (modified) (5 diffs)
- src/VM/cil/cilVMHandler.cpp (modified) (1 diff)
- src/VM/cil/cilVMILPool.cpp (modified) (1 diff)
- src/VM/cil/cilVMInitialization.cpp (modified) (5 diffs)
- src/VM/cil/cilVMInvokeMethod.cpp (modified) (13 diffs)
- src/VM/cil/cilVMLocalVariable.cpp (modified) (9 diffs)
- src/VM/cil/cilVMMiscAPI.cpp (modified) (4 diffs)
- src/VM/cil/cilVMObject.cpp (modified) (19 diffs)
- src/VM/cil/cilVMObjectCreation.cpp (modified) (13 diffs)
- src/VM/cil/cilVMOperatorAdd.cpp (modified) (10 diffs)
- src/VM/cil/cilVMOperatorBeq.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBge.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBgt.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBitwiseAnd.cpp (modified) (11 diffs)
- src/VM/cil/cilVMOperatorBitwiseNot.cpp (modified) (6 diffs)
- src/VM/cil/cilVMOperatorBitwiseOr.cpp (modified) (12 diffs)
- src/VM/cil/cilVMOperatorBitwiseXor.cpp (modified) (12 diffs)
- src/VM/cil/cilVMOperatorBle.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBlt.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBne.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBrFalse.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorBrTrue.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorCall.cpp (modified) (16 diffs)
- src/VM/cil/cilVMOperatorCeq.cpp (modified) (2 diffs)
- src/VM/cil/cilVMOperatorCgt.cpp (modified) (2 diffs)
- src/VM/cil/cilVMOperatorClt.cpp (modified) (2 diffs)
- src/VM/cil/cilVMOperatorDivision.cpp (modified) (12 diffs)
- src/VM/cil/cilVMOperatorExtCge.cpp (modified) (2 diffs)
- src/VM/cil/cilVMOperatorExtCle.cpp (modified) (2 diffs)
- src/VM/cil/cilVMOperatorExtCne.cpp (modified) (2 diffs)
- src/VM/cil/cilVMOperatorIncDec.cpp (modified) (12 diffs)
- src/VM/cil/cilVMOperatorMultiply.cpp (modified) (11 diffs)
- src/VM/cil/cilVMOperatorNeg.cpp (modified) (4 diffs)
- src/VM/cil/cilVMOperatorReminder.cpp (modified) (19 diffs)
- src/VM/cil/cilVMOperatorShl.cpp (modified) (3 diffs)
- src/VM/cil/cilVMOperatorShr.cpp (modified) (3 diffs)
- src/VM/cil/cilVMOperatorShrUn.cpp (modified) (3 diffs)
- src/VM/cil/cilVMOperatorSubtract.cpp (modified) (12 diffs)
- src/VM/cil/cilVMPrototypeObject.cpp (modified) (3 diffs)
- src/VM/cil/cilVMStaticField.cpp (modified) (14 diffs)
- src/VM/cil/cilVMThreadedDispatcher.cpp (modified) (13 diffs)
- src/VM/cil/cilVMToken.cpp (modified) (8 diffs)
- tools/cscl/cscl/cscl.cpp (modified) (17 diffs)
- tools/cscl/cscl/cscl.vcproj (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
SDK-archive.txt
r32 r138 64 64 CriScript\samples\property_bind\mkwin32\property_bind.sln 65 65 CriScript\samples\property_bind\mkwin32\property_bind.vcproj 66 CriScript\samples\vm_control\vm_control.cpp 67 CriScript\samples\vm_control\stdafx.cpp 68 CriScript\samples\vm_control\stdafx.h 69 CriScript\samples\vm_control\mkwin32\vm_control.sln 70 CriScript\samples\vm_control\mkwin32\vm_control.vcproj 71 CriScript\samples\build_all\criscriptsamples.sln 66 72 67 73 //TOOL inc/cilBuiltinObject.h
r110 r138 634 634 bool init(); 635 635 protected: 636 //Override TokenFound637 //void TokenFound( const int32_t iToken, const int32_t iLine, const int32_t iColumm);636 //Override tokenFound 637 //void tokenFound( const int32_t iToken, const int32_t iLine, const int32_t iColumm); 638 638 }; 639 639 inc/cilCodegen.h
r110 r138 145 145 */ 146 146 TARGET_ENDIANNESS getTargetEndianness(); 147 /*EN< Gets 'target' endianess setting.147 /*EN< gets 'target' endianess setting. 148 148 */ 149 149 TARGET_ENDIANNESS getCurrentEndianness(); 150 /*EN< Gets 'current' platform's endianess setting.150 /*EN< gets 'current' platform's endianess setting. 151 151 CRIScript can work for cross platform development 152 152 so the endianness of current platform and target platform can differ. … … 290 290 CCgNodeData* unaryIncOperator( CCgNodeData*, bool bDup ); 291 291 CCgNodeData* unaryDecOperator( CCgNodeData*, bool bDup ); 292 CCgNodeData* unary bitwiseNotOperator( CCgNodeData* );293 CCgNodeData* unary logicalNotOperator( CCgNodeData* );292 CCgNodeData* unaryBitwiseNotOperator( CCgNodeData* ); 293 CCgNodeData* unaryLogicalNotOperator( CCgNodeData* ); 294 294 CCgNodeData* unaryVoidOperator( CCgNodeData* ); 295 295 CCgNodeData* unaryDeleteOperator( CCgNodeData* ); … … 368 368 //Code gen functions 369 369 //--------------------------------------------------------------------------- 370 CCgNodeData* EmitVariableDeclaration( CCgNodeData* nodetree,370 CCgNodeData* emitVariableDeclaration( CCgNodeData* nodetree, 371 371 const OPERAND_TYPE type = OPERAND_UNDEFINED, 372 372 const OPERAND_FLAG flag = OPERAND_FLAG_NONE, 373 const RID ridConstraintType = 0 ); // Emit CIL code374 CCgNodeData* EmitTypedVariableDeclaration( CCgNodeData* nodetree ); //Emit CIL code375 CCgNodeData* EmitVariableAssignment( CCgNodeData* nodetree ); //Emit CIL code376 CCgNodeData* EmitAddOperator( CCgNodeData* nodetree ); //Emit CIL code377 CCgNodeData* EmitSubtractOperator( CCgNodeData* nodetree ); //Emit CIL code378 CCgNodeData* EmitMultiplyOperator( CCgNodeData* nodetree ); //Emit CIL code379 CCgNodeData* EmitDivisionOperator( CCgNodeData* nodetree ); //Emit CIL code380 CCgNodeData* EmitReminderOperator( CCgNodeData* nodetree ); //Emit CIL code381 382 CCgNodeData* EmitbitwiseAndOperator( CCgNodeData* nodetree ); //Emit CIL code383 CCgNodeData* EmitbitwiseOrOperator( CCgNodeData* nodetree ); //Emit CIL code384 CCgNodeData* EmitlogicalAndOperator( CCgNodeData* nodetree ); //Emit CIL code385 CCgNodeData* EmitlogicalOrOperator( CCgNodeData* nodetree ); //Emit CIL code386 CCgNodeData* EmitbitwiseXorOperator( CCgNodeData* nodetree ); //Emit CIL code387 CCgNodeData* EmitshiftLeftOperator( CCgNodeData* nodetree ); //Emit CIL code388 CCgNodeData* EmitshiftRightOperator( CCgNodeData* nodetree ); //Emit CIL code389 CCgNodeData* EmitshiftRightUnsignedOperator( CCgNodeData* nodetree ); //Emit CIL code390 391 CCgNodeData* EmitunaryPlusOperator( CCgNodeData* nodetree ); //Emit CIL code392 CCgNodeData* EmitunaryMinusOperator( CCgNodeData* nodetree ); //Emit CIL code393 CCgNodeData* EmitunaryIncOperator( CCgNodeData* nodetree, bool bDup ); //Emit CIL code394 CCgNodeData* EmitunaryDecOperator( CCgNodeData* nodetree, bool bDup ); //Emit CIL code395 CCgNodeData* EmitunarybitwiseNotOperator( CCgNodeData* nodetree ); //Emit CIL code396 CCgNodeData* EmitunarylogicalNotOperator( CCgNodeData* nodetree ); //Emit CIL code397 CCgNodeData* EmitunaryVoidOperator( CCgNodeData* nodetree ); //Emit CIL code398 CCgNodeData* EmitunaryDeleteOperator( CCgNodeData* nodetree ); //Emit CIL code399 CCgNodeData* EmitunaryTypeofOperator( CCgNodeData* nodetree ); //Emit CIL code400 401 CCgNodeData* EmitCmpOperator( CCgNodeData* nodetree, uint32_t iOpCode ); //Emit CIL code402 CCgNodeData* EmitStrictCmpOperator( CCgNodeData* nodetree, uint32_t iOpCode );403 CCgNodeData* EmitcallExpression( CCgNodeData* nodetree );404 CCgNodeData* EmitArgumentList( CCgNodeData* nodetree, uint32_t& iNumArgumentparsed );405 CCgNodeData* EmitAccessPropertyById( CCgNodeData* nodetree, CCgNodeData* parentnode );406 CCgNodeData* EmitAccessPropertyByExp( CCgNodeData* nodetree, CCgNodeData* parentnode );407 CCgNodeData* EmitobjectLiteral( CCgNodeData* nodetree );408 CCgNodeData* EmitarrayLiteral( CCgNodeData* nodetree );409 CCgNodeData* EmitConditionalExpression( CCgNodeData* conditionalnode );410 CCgNodeData* EmitnewOperator( CCgNodeData* nodetree );411 CCgNodeData* EmitinOperator( CCgNodeData* nodetree );412 CCgNodeData* EmitinstanceOfOperator( CCgNodeData* nodetree );413 414 CCgNodeData* EmitLoadStack( CCgNodeData* ptr );415 416 void EmitLoadInteger( const int64_t value);417 void EmitLoadBoolean( const bool value);418 void EmitLoadFloat( const double value);419 void EmitLoadStringObject( const RID ridString );420 void EmitLoadRegexObject( CCgNodeData* nodetree );421 422 void EmitLoadArgument( CG_SYMBOL_INFORMATION* pInfo );423 void EmitStoreArgument( CG_SYMBOL_INFORMATION* pInfo );424 void EmitLoadLocal( CG_SYMBOL_INFORMATION* pInfo );425 void EmitStoreLocal( CG_SYMBOL_INFORMATION* pInfo );373 const RID ridConstraintType = 0 ); //emit CIL code 374 CCgNodeData* emitTypedVariableDeclaration( CCgNodeData* nodetree ); //emit CIL code 375 CCgNodeData* emitVariableAssignment( CCgNodeData* nodetree ); //emit CIL code 376 CCgNodeData* emitAddOperator( CCgNodeData* nodetree ); //emit CIL code 377 CCgNodeData* emitSubtractOperator( CCgNodeData* nodetree ); //emit CIL code 378 CCgNodeData* emitMultiplyOperator( CCgNodeData* nodetree ); //emit CIL code 379 CCgNodeData* emitDivisionOperator( CCgNodeData* nodetree ); //emit CIL code 380 CCgNodeData* emitReminderOperator( CCgNodeData* nodetree ); //emit CIL code 381 382 CCgNodeData* emitBitwiseAndOperator( CCgNodeData* nodetree ); //emit CIL code 383 CCgNodeData* emitBitwiseOrOperator( CCgNodeData* nodetree ); //emit CIL code 384 CCgNodeData* emitLogicalAndOperator( CCgNodeData* nodetree ); //emit CIL code 385 CCgNodeData* emitLogicalOrOperator( CCgNodeData* nodetree ); //emit CIL code 386 CCgNodeData* emitBitwiseXorOperator( CCgNodeData* nodetree ); //emit CIL code 387 CCgNodeData* emitShiftLeftOperator( CCgNodeData* nodetree ); //emit CIL code 388 CCgNodeData* emitShiftRightOperator( CCgNodeData* nodetree ); //emit CIL code 389 CCgNodeData* emitShiftRightUnsignedOperator( CCgNodeData* nodetree ); //emit CIL code 390 391 CCgNodeData* emitUnaryPlusOperator( CCgNodeData* nodetree ); //emit CIL code 392 CCgNodeData* emitUnaryMinusOperator( CCgNodeData* nodetree ); //emit CIL code 393 CCgNodeData* emitUnaryIncOperator( CCgNodeData* nodetree, bool bDup ); //emit CIL code 394 CCgNodeData* emitUnaryDecOperator( CCgNodeData* nodetree, bool bDup ); //emit CIL code 395 CCgNodeData* emitUnaryBitwiseNotOperator( CCgNodeData* nodetree ); //emit CIL code 396 CCgNodeData* emitUnaryLogicalNotOperator( CCgNodeData* nodetree ); //emit CIL code 397 CCgNodeData* emitUnaryVoidOperator( CCgNodeData* nodetree ); //emit CIL code 398 CCgNodeData* emitUnaryDeleteOperator( CCgNodeData* nodetree ); //emit CIL code 399 CCgNodeData* emitUnaryTypeofOperator( CCgNodeData* nodetree ); //emit CIL code 400 401 CCgNodeData* emitCmpOperator( CCgNodeData* nodetree, uint32_t iOpCode ); //emit CIL code 402 CCgNodeData* emitStrictCmpOperator( CCgNodeData* nodetree, uint32_t iOpCode ); 403 CCgNodeData* emitCallExpression( CCgNodeData* nodetree ); 404 CCgNodeData* emitArgumentList( CCgNodeData* nodetree, uint32_t& iNumArgumentparsed ); 405 CCgNodeData* emitAccessPropertyById( CCgNodeData* nodetree, CCgNodeData* parentnode ); 406 CCgNodeData* emitAccessPropertyByExp( CCgNodeData* nodetree, CCgNodeData* parentnode ); 407 CCgNodeData* emitObjectLiteral( CCgNodeData* nodetree ); 408 CCgNodeData* emitArrayLiteral( CCgNodeData* nodetree ); 409 CCgNodeData* emitConditionalExpression( CCgNodeData* conditionalnode ); 410 CCgNodeData* emitNewOperator( CCgNodeData* nodetree ); 411 CCgNodeData* emitInOperator( CCgNodeData* nodetree ); 412 CCgNodeData* emitInstanceOfOperator( CCgNodeData* nodetree ); 413 414 CCgNodeData* emitLoadStack( CCgNodeData* ptr ); 415 416 void emitLoadInteger( const int64_t value); 417 void emitLoadBoolean( const bool value); 418 void emitLoadFloat( const double value); 419 void emitLoadStringObject( const RID ridString ); 420 void emitLoadRegexObject( CCgNodeData* nodetree ); 421 422 void emitLoadArgument( CG_SYMBOL_INFORMATION* pInfo ); 423 void emitStoreArgument( CG_SYMBOL_INFORMATION* pInfo ); 424 void emitLoadLocal( CG_SYMBOL_INFORMATION* pInfo ); 425 void emitStoreLocal( CG_SYMBOL_INFORMATION* pInfo ); 426 426 427 427 //--------------------------------------------------------------------------- … … 436 436 //Argumentlist 437 437 //--------------------------------------------------------------------------- 438 void PushArgumentList( const uint32_t iParam );439 void EmitArgumentList( void );438 void pushArgumentList( const uint32_t iParam ); 439 void emitArgumentList( void ); 440 440 vector< uint32_t > m_vecArgumentListStack; 441 441 … … 443 443 //Scope name related staff 444 444 //--------------------------------------------------------------------------- 445 bool IsInGlobalScope( void );446 wstring& GetCurrentScopeName( void );447 ILFRAGMENTINFO* GetCurrentScopeInformation( void );448 void EnterNewScope( wstring& strScopedFunctionName, RID ridMethod );449 void LeaveScope();445 bool isInGlobalScope( void ); 446 wstring& getCurrentScopeName( void ); 447 ILFRAGMENTINFO* getCurrentScopeInformation( void ); 448 void enterNewScope( wstring& strScopedFunctionName, RID ridMethod ); 449 void leaveScope(); 450 450 451 451 int32_t m_iCurrentEHNestLevel; /*EN<Current Exception Handler Nesting Level*/ … … 465 465 // Helper 466 466 //--------------------------------------------------------------------------- 467 void InitializeConstantPools();468 bool IsValue( CCgNodeData* object );469 bool IsFloat( CCgNodeData* object );470 bool IsString( CCgNodeData* object );471 void Emit( uint32_t i );472 void Emit( OP_CODE opcode );473 void Emit( OP_CODE opcode, int8_t iParam );474 void Emit( OP_CODE opcode, uint8_t iParam );475 void Emit( OP_CODE opcode, int32_t iParam );476 void Emit( OP_CODE opcode, uint32_t iParam );477 void Emit( OP_CODE opcode, float iParam );478 void Emit( OP_CODE opcode, double iParam );479 void Emit( OP_CODE opcode, int64_t iParam );480 void Emit( OP_CODE opcode, RID ridMethod, RID ridArg, int32_t iIndex );481 void EmitArglist( OP_CODE opcode, uint8_t iParam );482 void EmitArglist( OP_CODE opcode, uint32_t iParam );483 484 void Emit( ILFRAGMENTINFO* pIL, OP_CODE opcode, int8_t iParam );485 void Emit( ILFRAGMENTINFO* pIL, OP_CODE opcode, int32_t iParam );467 void initializeConstantPools(); 468 bool isValue( CCgNodeData* object ); 469 bool isFloat( CCgNodeData* object ); 470 bool isString( CCgNodeData* object ); 471 void emit( uint32_t i ); 472 void emit( OP_CODE opcode ); 473 void emit( OP_CODE opcode, int8_t iParam ); 474 void emit( OP_CODE opcode, uint8_t iParam ); 475 void emit( OP_CODE opcode, int32_t iParam ); 476 void emit( OP_CODE opcode, uint32_t iParam ); 477 void emit( OP_CODE opcode, float iParam ); 478 void emit( OP_CODE opcode, double iParam ); 479 void emit( OP_CODE opcode, int64_t iParam ); 480 void emit( OP_CODE opcode, RID ridMethod, RID ridArg, int32_t iIndex ); 481 void emitArglist( OP_CODE opcode, uint8_t iParam ); 482 void emitArglist( OP_CODE opcode, uint32_t iParam ); 483 484 void emit( ILFRAGMENTINFO* pIL, OP_CODE opcode, int8_t iParam ); 485 void emit( ILFRAGMENTINFO* pIL, OP_CODE opcode, int32_t iParam ); 486 486 void UpdateILOffsetCache( void ); 487 void ClearILOffsetCache( void );488 void AdjustEvalStack( ILFRAGMENTINFO* pIL, OPCODE_TABLEENTRY* opcodeparam, int32_t iParam );489 void AdjustEvalStack( int32_t i );487 void clearILOffsetCache( void ); 488 void adjustEvalStack( ILFRAGMENTINFO* pIL, OPCODE_TABLEENTRY* opcodeparam, int32_t iParam ); 489 void adjustEvalStack( int32_t i ); 490 490 491 491 CCgNodeData* parseNodeTreeSub( CCgNodeData* Formula, 492 492 CCgNodeData* parentnode, 493 493 bool bStackAdjustment ); //Node tree parser 494 uint32_t GetCurrentILOffset();495 ILFRAGMENTINFO& GetCurrentILInfo() { return m_ILPool[ m_iCurrentILPoolIndex ]; }496 int32_t GetILOffsetValue( int32_t iTarget, int32_t iCurrent, int32_t iSizeOfInstruction ) { return iTarget - iCurrent + iSizeOfInstruction; }494 uint32_t getCurrentILOffset(); 495 ILFRAGMENTINFO& getCurrentILInfo() { return m_ILPool[ m_iCurrentILPoolIndex ]; } 496 int32_t getILOffsetValue( int32_t iTarget, int32_t iCurrent, int32_t iSizeOfInstruction ) { return iTarget - iCurrent + iSizeOfInstruction; } 497 497 498 498 //--------------------------------------------------------------------------- 499 499 //CodeGen management 500 500 //--------------------------------------------------------------------------- 501 void CheckCurrentEndianness( void);501 void checkCurrentEndianness( void); 502 502 503 503 //--------------------------------------------------------------------------- 504 504 //Symbol information/Debug line information 505 505 //--------------------------------------------------------------------------- 506 RID LookUpSymbolInformation( wstring& strScopedVariableName );507 RID LookUpSymbolInformation( wstring& strScopedVariableName, CG_SYMBOL_INFORMATION**ppInfo );508 RID LookUpSymbolInformationSub( wstring& strScopedVariableName, CG_SYMBOL_INFORMATION**ppInfo );509 RID LookUpSymbolInformationInCurrentScope( wstring& strScopedVariableName );510 RID LookUpSymbolInformationInCurrentScope( wstring& strScopedVariableName, CG_SYMBOL_INFORMATION**ppInfo );506 RID lookUpSymbolInformation( wstring& strScopedVariableName ); 507 RID lookUpSymbolInformation( wstring& strScopedVariableName, CG_SYMBOL_INFORMATION**ppInfo ); 508 RID lookUpSymbolInformationSub( wstring& strScopedVariableName, CG_SYMBOL_INFORMATION**ppInfo ); 509 RID lookUpSymbolInformationInCurrentScope( wstring& strScopedVariableName ); 510 RID lookUpSymbolInformationInCurrentScope( wstring& strScopedVariableName, CG_SYMBOL_INFORMATION**ppInfo ); 511 511 uint32_t tagTheLine(); 512 512 … … 514 514 //Label management 515 515 //--------------------------------------------------------------------------- 516 uint32_t CreateNewLabelID();517 uint32_t CreateNewLabelIDAndInsertTag();518 void InsertLabelTag( uint32_t iLabelID );516 uint32_t createNewLabelID(); 517 uint32_t createNewLabelIDAndInsertTag(); 518 void insertLabelTag( uint32_t iLabelID ); 519 519 uint32_t m_iNumLabel; 520 void SetBranchTargetInformation( const int32_t iLabel );521 const BRANCH_TARGET_INFO& GetBranchTargetInformation( int32_t iLabel );520 void setBranchTargetInformation( const int32_t iLabel ); 521 const BRANCH_TARGET_INFO& getBranchTargetInformation( int32_t iLabel ); 522 522 523 523 /*EN branch target information table*/ … … 527 527 //Temporary variable management 528 528 //--------------------------------------------------------------------------- 529 RID ReserveTemporaryVariable( CG_SYMBOL_FLAG VariableTypeToReserve );530 void ReleaseTemporaryVariable( RID ridToRelease );529 RID reserveTemporaryVariable( CG_SYMBOL_FLAG VariableTypeToReserve ); 530 void releaseTemporaryVariable( RID ridToRelease ); 531 531 multimap< CG_SYMBOL_FLAG, RID> m_mapFreeTemporaryVariables; 532 532 map< RID, CG_SYMBOL_FLAG > m_mapReservedTemporaryVariables; … … 572 572 //Linkage 573 573 //--------------------------------------------------------------------------- 574 bool LinkPass1( V_ILFRAGMENTINFO& vecILPool, ILFRAGMENTINFO& ILResolvedPool );575 bool LinkPass2( ILFRAGMENTINFO& SourceILPool, ILFRAGMENTINFO& ILResolvedPool );576 bool LinkFinalPass( ILFRAGMENTINFO& SourceILPool, ILFRAGMENTINFO& ILResolvedPool );577 bool ResolveMethodRID();578 void AdjustJumpTargetAddresses( uint32_t iAddress, int32_t iOffset );574 bool linkPass1( V_ILFRAGMENTINFO& vecILPool, ILFRAGMENTINFO& ILResolvedPool ); 575 bool linkPass2( ILFRAGMENTINFO& SourceILPool, ILFRAGMENTINFO& ILResolvedPool ); 576 bool linkFinalPass( ILFRAGMENTINFO& SourceILPool, ILFRAGMENTINFO& ILResolvedPool ); 577 bool resolveMethodRID(); 578 void adjustJumpTargetAddresses( uint32_t iAddress, int32_t iOffset ); 579 579 map< uint32_t, uint32_t > m_mapLabelID2ILAddress; 580 580 map< uint32_t, uint32_t > m_mapAddress2LabelID; 581 void PutPinToCurrentAddress( uint32_t iAddress, uint32_t iTargetLabelID );582 uint8_t GetCharFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex );583 uint32_t GetIntFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex );584 585 bool ResolveLoadArgument( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex );586 bool ResolveStoreArgument( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex );587 bool ResolveLoadLocal( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex );588 589 bool ResolveStoreLocal( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex );581 void putPinToCurrentAddress( uint32_t iAddress, uint32_t iTargetLabelID ); 582 uint8_t getCharFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex ); 583 uint32_t getIntFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex ); 584 585 bool resolveLoadArgument( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex ); 586 bool resolveStoreArgument( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex ); 587 bool resolveLoadLocal( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex ); 588 589 bool resolveStoreLocal( ILFRAGMENTINFO* ilinfo, RID ridMethod, RID ridArglist, uint32_t iIndex ); 590 590 591 591 //--------------------------------------------------------- inc/cilDebugger.h
r110 r138 43 43 void terminate() {}; 44 44 45 void Execute();46 int32_t PutBreakPoint();47 void RemoveBreakPoint( int32_t i);48 int32_t StepOver();49 int32_t StepInto();45 void execute(); 46 int32_t putBreakPoint(); 47 void removeBreakPoint( int32_t i); 48 int32_t stepOver(); 49 int32_t stepInto(); 50 50 51 bool Attach( CCilVm * pVM );52 bool Detach();53 void SetSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo );54 void SetMetaData( CMetaData& MetaData ) { m_pMetaData = &MetaData; }51 bool attach( CCilVm * pVM ); 52 bool detach(); 53 void setSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo ); 54 void setMetaData( CMetaData& MetaData ) { m_pMetaData = &MetaData; } 55 55 56 56 //---------------------------------------------------------------------- 57 57 //Debug functions 58 58 //---------------------------------------------------------------------- 59 void DebugDumpStats( void );60 void DebugDumpStaticFields( uint32_t );61 void DebugDumpObjects( uint32_t );59 void debugDumpStats( void ); 60 void debugDumpStaticFields( uint32_t ); 61 void debugDumpObjects( uint32_t ); 62 62 private: 63 63 CCilVm* m_pVM; … … 84 84 void terminate() {}; 85 85 86 void DumpDisasm();87 void SetMetaData( CMetaData& MetaData );88 void SetSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo);89 void SetDumpByteCode( bool b ) { m_bDumpByteCode = b;}90 void SetDumpByteCodeData( bool b ) { m_bDumpByteCodeData = b;}91 void SetDumpSymbolInfo( bool b ) { m_bDumpSymbolInfo = b;}92 void SetILStream( ILFRAGMENT& ILStream);86 void dumpDisasm(); 87 void setMetaData( CMetaData& MetaData ); 88 void setSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo); 89 void setDumpByteCode( bool b ) { m_bDumpByteCode = b;} 90 void setDumpByteCodeData( bool b ) { m_bDumpByteCodeData = b;} 91 void setDumpSymbolInfo( bool b ) { m_bDumpSymbolInfo = b;} 92 void setILStream( ILFRAGMENT& ILStream); 93 93 94 94 private: 95 uint8_t GetCharFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex );96 uint32_t GetIntFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex );95 uint8_t getCharFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex ); 96 uint32_t getIntFromILPool( ILFRAGMENTINFO& SourceILPool, uint32_t& iIndex ); 97 97 98 void DumpTemporaryLabel( uint32_t iLabelID );99 void DumpLabel( wstring& string );100 void DumpTab( void );101 void DumpBranch( OPCODE_TABLEENTRY* pInfo, uint32_t iLabelID );102 void DumpInstruction( OPCODE_TABLEENTRY* pInfo, int32_t iParamIndex );98 void dumpTemporaryLabel( uint32_t iLabelID ); 99 void dumpLabel( wstring& string ); 100 void dumpTab( void ); 101 void dumpBranch( OPCODE_TABLEENTRY* pInfo, uint32_t iLabelID ); 102 void dumpInstruction( OPCODE_TABLEENTRY* pInfo, int32_t iParamIndex ); 103 103 104 104 inc/cilOpcode.h
r110 r138 65 65 #define RidFromToken(tk) ((RID) ((tk) & 0x00ffffff)) 66 66 #define TypeFromToken(tk) ((ULONG32)((tk) & 0xff000000)) 67 #define IsNilToken(tk) ((RidFromToken(tk)) == 0)68 #define IsBuiltinRid(tk) ((tk) & 0x800000)67 #define isNilToken(tk) ((RidFromToken(tk)) == 0) 68 #define isBuiltinRid(tk) ((tk) & 0x800000) 69 69 #define IndexFromBuiltinRid(tk) (int32_t)(-(int32_t)((tk) | 0xff000000) - 1) 70 70 inc/cilVm.h
r110 r138 92 92 */ 93 93 enum VM_STATUS_TYPE { 94 VM_EXECUTE_DONE, /*EN< Byte code execution is finished successfully*/ 95 VM_EXECUTE_SUPEND, /*EN< VM suspended by resume() call. Not implemented yet*/ 96 VM_EXECUTE_SWAPOUT, /*EN< VM time slice is ended and current context is swapped out. not implemented yet.*/ 97 VM_EXECUTE_ERROR, /*EN< VM is in the error state*/ 94 VM_EXECUTE_INITIALIZING, /*EN< VM instance is created but still not initialized yet*/ 95 VM_EXECUTE_INITIALIZED, /*EN< VM instance is initialized but still not executed yet*/ 96 VM_EXECUTE_EXECUTING, /*EN< VM instance is initialized but still not executed yet*/ 97 VM_EXECUTE_DONE, /*EN< Byte code execution is finished successfully*/ 98 VM_EXECUTE_SUSPENDED, /*EN< VM suspended by resume() call. Not implemented yet*/ 99 VM_EXECUTE_SWAPPEDOUT, /*EN< VM time slice is ended and current context is swapped out. not implemented yet.*/ 100 VM_EXECUTE_ERROR, /*EN< VM is in the error state*/ 98 101 }; 102 103 /*************************************************************************** 104 * VM reset Type 105 ***************************************************************************/ 106 /*EN VM reset type 107 \ingroup MDL_LIB_VM 108 */ 109 enum VM_RESET_TYPE { 110 VM_RESET_DEFAULT, /*EN< Reset VM to the initialized status 111 All the fields values, objects statuses are reset.*/ 112 }; 113 99 114 100 115 /*************************************************************************** … … 177 192 { 178 193 RET ret = ((RET (*)( void ) )pMethodBody)(); 179 pVm-> PushEvalStack( ret );194 pVm->pushEvalStack( ret ); 180 195 181 196 return; … … 210 225 211 226 RET ret = ((RET (*)( P1 ) )pMethodBody)( param1 ); 212 pVm-> PushEvalStack( ret );227 pVm->pushEvalStack( ret ); 213 228 214 229 return; … … 246 261 247 262 RET ret = ((RET (*)( P1, P2 ) )pMethodBody)( param1, param2 ); 248 pVm-> PushEvalStack( ret );263 pVm->pushEvalStack( ret ); 249 264 250 265 return; … … 285 300 286 301 RET ret = ((RET (*)( P1, P2, P3 ) )pMethodBody)( param1, param2, param3 ); 287 pVm-> PushEvalStack( ret );302 pVm->pushEvalStack( ret ); 288 303 289 304 return; … … 327 342 328 343 RET ret = ((RET (*)( P1, P2, P3, P4 ) )pMethodBody)( param1, param2, param3, param4 ); 329 pVm-> PushEvalStack( ret );344 pVm->pushEvalStack( ret ); 330 345 331 346 return; … … 372 387 373 388 RET ret = ((RET (*)( P1, P2, P3, P4, P5 ) )pMethodBody)( param1, param2, param3, param4, param5 ); 374 pVm-> PushEvalStack( ret );389 pVm->pushEvalStack( ret ); 375 390 376 391 return; … … 396 411 { 397 412 ((void (*)( void ) )pMethodBody)(); 398 pVm-> PushEvalStackUndefined();413 pVm->pushEvalStackUndefined(); 399 414 400 415 return; … … 429 444 430 445 ((void (*)( P1 ) )pMethodBody)( param1 ); 431 pVm-> PushEvalStackUndefined();446 pVm->pushEvalStackUndefined(); 432 447 433 448 return; … … 466 481 467 482 ((void (*)( P1, P2 ) )pMethodBody)( param1, param2 ); 468 pVm-> PushEvalStackUndefined();483 pVm->pushEvalStackUndefined(); 469 484 470 485 return; … … 505 520 506 521 ((void (*)( P1, P2, P3 ) )pMethodBody)( param1, param2, param3 ); 507 pVm-> PushEvalStackUndefined();522 pVm->pushEvalStackUndefined(); 508 523 509 524 return; … … 547 562 548 563 ((void (*)( P1, P2, P3, P4 ) )pMethodBody)( param1, param2, param3, param4 ); 549 pVm-> PushEvalStackUndefined();564 pVm->pushEvalStackUndefined(); 550 565 551 566 return; … … 592 607 593 608 ((void (*)( P1, P2, P3, P4, P5 ) )pMethodBody)( param1, param2, param3, param4, param5 ); 594 pVm-> PushEvalStackUndefined();609 pVm->pushEvalStackUndefined(); 595 610 596 611 return; … … 618 633 619 634 RET ret = ((RET (*)( CVariable* ) )pMethodBody)( pVar ); 620 pVm-> PushEvalStack( ret );635 pVm->pushEvalStack( ret ); 621 636 622 637 return; … … 651 666 652 667 RET ret = ((RET (*)( CVariable*, P1 ) )pMethodBody)( pVar, param1 ); 653 pVm-> PushEvalStack( ret );668 pVm->pushEvalStack( ret ); 654 669 655 670 return; … … 687 702 688 703 RET ret = ((RET (*)( CVariable*, P1, P2 ) )pMethodBody)( pVar, param1, param2 ); 689 pVm-> PushEvalStack( ret );704 pVm->pushEvalStack( ret ); 690 705 691 706 return; … … 726 741 727 742 RET ret = ((RET (*)( CVariable*, P1, P2, P3 ) )pMethodBody)( pVar, param1, param2, param3 ); 728 pVm-> PushEvalStack( ret );743 pVm->pushEvalStack( ret ); 729 744 730 745 return; … … 768 783 769 784 RET ret = ((RET (*)( CVariable*, P1, P2, P3, P4 ) )pMethodBody)( pVar, param1, param2, param3, param4 ); 770 pVm-> PushEvalStack( ret );785 pVm->pushEvalStack( ret ); 771 786 772 787 return; … … 813 828 814 829 RET ret = ((RET (*)( CVariable*, P1, P2, P3, P4, P5 ) )pMethodBody)( pVar, param1, param2, param3, param4, param5 ); 815 pVm-> PushEvalStack( ret );830 pVm->pushEvalStack( ret ); 816 831 817 832 return; … … 840 855 841 856 ((void (*)( CVariable* ) )pMethodBody)( pVar ); 842 pVm-> PushEvalStackUndefined();857 pVm->pushEvalStackUndefined(); 843 858 844 859 return; … … 874 889 875 890 ((void (*)( CVariable*, P1 ) )pMethodBody)( pVar, param1 ); 876 pVm-> PushEvalStackUndefined();891 pVm->pushEvalStackUndefined(); 877 892 878 893 return; … … 911 926 912 927 ((void (*)( CVariable*, P1, P2 ) )pMethodBody)( pVar, param1, param2 ); 913 pVm-> PushEvalStackUndefined();928 pVm->pushEvalStackUndefined(); 914 929 915 930 return; … … 950 965 951 966 ((void (*)( CVariable*, P1, P2, P3 ) )pMethodBody)( pVar, param1, param2, param3 ); 952 pVm-> PushEvalStackUndefined();967 pVm->pushEvalStackUndefined(); 953 968 954 969 return; … … 992 1007 993 1008 ((void (*)( CVariable*, P1, P2, P3, P4 ) )pMethodBody)( pVar, param1, param2, param3, param4 ); 994 pVm-> PushEvalStackUndefined();1009 pVm->pushEvalStackUndefined(); 995 1010 996 1011 return; … … 1037 1052 1038 1053 ((void (*)( CVariable*, P1, P2, P3, P4, P5 ) )pMethodBody)( pVar, param1, param2, param3, param4, param5 ); 1039 pVm-> PushEvalStackUndefined();1054 pVm->pushEvalStackUndefined(); 1040 1055 1041 1056 return; … … 1070 1085 \return current reference count value 1071 1086 */ 1072 int32_t AddRef();1087 int32_t addRef(); 1073 1088 1074 1089 /*EN Decrements a reference count of the object. 1075 1090 \return current reference count value 1076 1091 */ 1077 int32_t Release();1092 int32_t release(); 1078 1093 1079 1094 /*EN Enforce to set a reference count of the object. 1080 1095 \param iCount new reference count value to be set 1081 1096 */ 1082 void SetRefCount( int32_t iCount ) { m_iRefCount = iCount; }1097 void setRefCount( int32_t iCount ) { m_iRefCount = iCount; } 1083 1098 1084 1099 /*EN Retrieves a reference count of the object. 1085 1100 \return areference count value 1086 1101 */ 1087 int32_t GetRefCount() { return m_iRefCount; }1102 int32_t getRefCount() { return m_iRefCount; } 1088 1103 1089 1104 /*EN Clears a reference count value to 0. 1090 1105 */ 1091 void ClearRefCount( void );1106 void clearRefCount( void ); 1092 1107 /*EN Sets a prototype object. 1093 1108 \param pPrototype A pointer to the prototype VM Object … … 1095 1110 \param flag flags 1096 1111 */ 1097 void SetPrototypeObject( CVmObject* const pPrototype,1112 void setPrototypeObject( CVmObject* const pPrototype, 1098 1113 const OPERAND_TYPE type = OPERAND_OBJECTREF, 1099 1114 const OPERAND_FLAG flag = OPERAND_FLAG( OPERAND_FLAG_DONTDELETE … … 1108 1123 A prototype object has a chain and finally goes to the Object prototype object. 1109 1124 */ 1110 CVmObject* GetPrototypeObject( void ) { return m_varPrototype.refObject; }1125 CVmObject* getPrototypeObject( void ) { return m_varPrototype.refObject; } 1111 1126 1112 1127 /*EN Looks up the property with the given name … … 1115 1130 \return A pointers to a value of the property. Returns NULL if a requested property does not exist. 1116 1131 */ 1117 CVariable* LookupProperty( const wstring& str );1132 CVariable* lookupProperty( const wstring& str ); 1118 1133 1119 1134 /*EN Retrieves an iterator tothe property with the given name … … 1122 1137 \return An iterator of the property. Returns invalid iterator when the property does not exist. 1123 1138 */ 1124 hash_map< wstring, CVariable >::iterator LookupPropertyIterator( const wstring& str );1139 hash_map< wstring, CVariable >::iterator lookupPropertyIterator( const wstring& str ); 1125 1140 1126 1141 /*EN Sets the property value with the given name … … 1129 1144 \param value value of the property 1130 1145 */ 1131 void SetProperty( const wstring& str, CVariable& value );1146 void setProperty( const wstring& str, CVariable& value ); 1132 1147 1133 1148 /*EN Looks up the property with the given name. … … 1137 1152 \return A pointers to a value of the property. Returns NULL if a requested property does not exist. 1138 1153 */ 1139 CVariable* LookupProperty( CCilVm* const pVm, const wstring& str, CVariable* const pThis = NULL );1154 CVariable* lookupProperty( CCilVm* const pVm, const wstring& str, CVariable* const pThis = NULL ); 1140 1155 1141 1156 /*EN Sets the property value with the given name … … 1146 1161 \param value value of the property 1147 1162 */ 1148 void SetProperty( CCilVm* const pVm, const wstring& str, CVariable& value );1163 void setProperty( CCilVm* const pVm, const wstring& str, CVariable& value ); 1149 1164 1150 1165 /*EN Sets the method property with the given name … … 1154 1169 \param iLength A number of parameters that the method can accept. This value is set to method.length property. 1155 1170 */ 1156 void SetProperty( CCilVm* const pVm,1171 void setProperty( CCilVm* const pVm, 1157 1172 const wstring& name, 1158 1173 const RID ridMethod, … … 1162 1177 \param name A name of the property to be removed 1163 1178 */ 1164 void RemoveProperty( const wstring& name );1179 void removeProperty( const wstring& name ); 1165 1180 1166 1181 /*EN Sets a property accessor. … … 1168 1183 \param pAccessro A pointer of the accessor callback 1169 1184 */ 1170 void SetPropertyAccessor( const wstring& name, PACCESSORMETHOD pAccessor );1185 void setPropertyAccessor( const wstring& name, PACCESSORMETHOD pAccessor ); 1171 1186 1172 1187 /*EN Retrieves a value of the object. 1173 1188 \return value of the object 1174 1189 */ 1175 CVariable& GetValue( void )1190 CVariable& getValue( void ) 1176 1191 { 1177 1192 return m_varValue; … … 1181 1196 \param var an object value 1182 1197 */ 1183 void SetValue( CVariable& var )1198 void setValue( CVariable& var ) 1184 1199 { 1185 1200 var.moveTo( m_varValue ); … … 1190 1205 \return value of the object 1191 1206 */ 1192 CVariable& GetParentVariable( void ) { return m_varParent; }1207 CVariable& getParentVariable( void ) { return m_varParent; } 1193 1208 1194 1209 /*EN Set a parent value of the object. 1195 1210 \param variable a parent value of the object value 1196 1211 */ 1197 void SetParentVariable( const CVariable& variable ) { m_varParent = variable; }1212 void setParentVariable( const CVariable& variable ) { m_varParent = variable; } 1198 1213 1199 1214 }; … … 1223 1238 \return true when the verification succeeded. 1224 1239 */ 1225 bool verify (); 1240 bool verify(); 1241 1242 /*EN reset VM status to Initilized status 1243 \param iResetType VM reset type 1244 \return true when the reset succeeded. 1245 */ 1246 bool reset( const VM_RESET_TYPE iResetType ); 1226 1247 1227 1248 /*EN Retrieve Version Number of the VM */ 1228 const CRISCRIPT_VERSIONS& GetVersions(void) { return criscript_version_struct; }1249 const CRISCRIPT_VERSIONS& getVersions(void) { return criscript_version_struct; } 1229 1250 1230 1251 //---------------------------------------------------------------------- 1231 1252 //VM Management 1232 1253 //---------------------------------------------------------------------- 1233 /*EN Execute the byte code.1254 /*EN execute the byte code. 1234 1255 \return current execution status. 1235 1256 */ 1236 VM_STATUS_TYPE Execute();1257 VM_STATUS_TYPE execute(); 1237 1258 1238 1259 /*EN Retrieves an exit code of the script. … … 1240 1261 An exit code is set from the script variable 'System.Environment.ExitCode' . 1241 1262 */ 1242 int32_t GetExitCode();1263 int32_t getExitCode(); 1243 1264 1244 1265 //---------------------------------------------------------------------- … … 1250 1271 \param pCallBack a callback pointer 1251 1272 */ 1252 VM_HANDLER_CALLBACK RegisterHandler( VM_HANDLER_TYPE handlertype, VM_HANDLER_CALLBACK pCallBack );1273 VM_HANDLER_CALLBACK registerHandler( VM_HANDLER_TYPE handlertype, VM_HANDLER_CALLBACK pCallBack ); 1253 1274 1254 1275 //---------------------------------------------------------------------- … … 1258 1279 return: true when succeeded. 1259 1280 */ 1260 bool SetILPool( const vector< uint8_t >& vecIL); 1281 bool setILPool( const vector< uint8_t >& vecIL); 1282 1261 1283 /*EN Attaches a metadata for corresponding IL(intermediate language) stream to the VM. 1262 1284 \return true when succeeded. 1263 1285 */ 1264 bool SetMetaData( CMetaData& MetaData );1286 bool setMetaData( CMetaData& MetaData ); 1265 1287 1266 1288 /*EN Retrieves currently set metadata. … … 1275 1297 \return true when the binding succeeded, false otherwise. 1276 1298 */ 1277 bool BindBuiltinMethod( const wstring& strQualifiedName,1299 bool bindBuiltinMethod( const wstring& strQualifiedName, 1278 1300 PMETHOD const pMethod, 1279 1301 const int32_t iLength ); … … 1285 1307 \return true when the binding succeeded, false otherwise. 1286 1308 */ 1287 bool BindBuiltinMethod( const wstring& strQualifiedName,1309 bool bindBuiltinMethod( const wstring& strQualifiedName, 1288 1310 PMETHOD const pMethod, PMETHOD const pMethodBody ); 1289 1311 … … 1293 1315 \return true when the binding succeeded, false otherwise. 1294 1316 */ 1295 bool BindBuiltinVariable( const wstring& strQualifiedName,1317 bool bindBuiltinVariable( const wstring& strQualifiedName, 1296 1318 CVariable* const pvar ); 1297 1319 … … 1303 1325 \return variable that with given RID 1304 1326 */ 1305 CVariable& GetStaticField( const RID rid );1327 CVariable& getStaticField( const RID rid ); 1306 1328 1307 1329 /*EN Set a static field value with given RID. … … 1310 1332 \return true when the value is set successfully, false otherwise. 1311 1333 */ 1312 bool SetStaticField( const RID rid, const CVariable& value );1334 bool setStaticField( const RID rid, const CVariable& value ); 1313 1335 1314 1336 /*EN Set a static field value with given RID. … … 1318 1340 \return true when the value is set successfully, false otherwise. 1319 1341 */ 1320 bool SetStaticField( const RID rid, const CVariable& value, bool bForce );1342 bool setStaticField( const RID rid, const CVariable& value, bool bForce ); 1321 1343 1322 1344 //---------------------------------------------------------------------- … … 1327 1349 \return true when the debugger successfully attached. false otherwise. 1328 1350 */ 1329 bool AttachDebugger( CCilDebugger* const pDebugger ) { m_pDebugger = pDebugger; return true; }1351 bool attachDebugger( CCilDebugger* const pDebugger ) { m_pDebugger = pDebugger; return true; } 1330 1352 1331 1353 /*EN Dettaches a debugger interface from the VM. 1332 1354 \return true when the debugger successfully dettached. false otherwise. 1333 1355 */ 1334 bool DetachDebugger() { m_pDebugger = NULL; }1356 bool detachDebugger() { m_pDebugger = NULL; } 1335 1357 1336 1358 /*EN Sets a map of symbol information. … … 1339 1361 \return true when the symbol information map successfully set. false otherwise. 1340 1362 */ 1341 bool SetSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo);1363 bool setSymbolInformation( hash_map<wstring, CG_SYMBOL_INFORMATION>& symbolinfo); 1342 1364 1343 1365 /*EN Query a symbol information … … 1345 1367 \return Information related to hte symbol 1346 1368 */ 1347 CG_SYMBOL_INFORMATION& QuerySymbolInformation( const wstring& symbolName );1348 1349 /*EN Dump current VM status including variables and IL stream to stdout. This API is for Debug purpose.1350 */ 1351 void DebugDumpStats( void );1369 CG_SYMBOL_INFORMATION& querySymbolInformation( const wstring& symbolName ); 1370 1371 /*EN dump current VM status including variables and IL stream to stdout. This API is for Debug purpose. 1372 */ 1373 void debugDumpStats( void ); 1352 1374 1353 1375 //---------------------------------------------------------------------- … … 1361 1383 \param pArguments A pointer to the argument array 1362 1384 */ 1363 CVariable* InvokeMethod( const RID ridMethod, const int32_t iNumArg,1385 CVariable* invokeMethod( const RID ridMethod, const int32_t iNumArg, 1364 1386 CVariable* pArguments ); 1365 1387 … … 1370 1392 \return A reference to the object pool. An object pool is a implemented with STL::list 1371 1393 */ 1372 list< CVmObject >& GetObjectPool() { return m_ObjectPool; }1394 list< CVmObject >& getObjectPool() { return m_ObjectPool; } 1373 1395 1374 1396 /*EN Retrieves a prototype object for given RID 1375 1397 \return A reference to the prototype object. 1376 1398 */ 1377 CVmObject& GetPrototypeObject( const RID ridPrototype );1399 CVmObject& getPrototypeObject( const RID ridPrototype ); 1378 1400 1379 1401 //---------------------------------------------------------------------- … … 1383 1405 \param errObject a pointer to the error object. 1384 1406 */ 1385 void ThrowException( CVariable* errObject );1407 void throwException( CVariable* errObject ); 1386 1408 /*EN Throws an exception from inside of built-in functions. 1387 1409 \param pstrMessage A pointer to an error description … … 1389 1411 \param iNumber A pointer to an error number 1390 1412 */ 1391 void ThrowException( wstring* pstrMessage, wstring* pstrName = NULL , int32_t iNumber = -1 );1413 void throwException( wstring* pstrMessage, wstring* pstrName = NULL , int32_t iNumber = -1 ); 1392 1414 1393 1415 //---------------------------------------------------------------------- … … 1400 1422 \return RID of created prototype object 1401 1423 */ 1402 RID CreatePrototypeObject( const RID ridObject,1424 RID createPrototypeObject( const RID ridObject, 1403 1425 const RID ridObjectName, 1404 1426 const RID ridPrototype ); … … 1408 1430 \return A pointer to the created object. An object resides in a object pool and has reference count for Garbage collector, 1409 1431 */ 1410 VMOBJECTREF CreateObject( const RID ridObject );1432 VMOBJECTREF createObject( const RID ridObject ); 1411 1433 1412 1434 /*EN Retrieve an object from the variable. If the variable is not an object, a prototype object reference is returned. … … 1414 1436 \return A pointer to the object or prototype object that corresponds to the variable type 1415 1437 */ 1416 VMOBJECTREF GetObjectPointer( CVariable& var );1438 VMOBJECTREF getObjectPointer( CVariable& var ); 1417 1439 1418 1440 //---------------------------------------------------------------------- … … 1422 1444 \return RID of the Object prototype object 1423 1445 */ 1424 static RID GetObjectRID() { return m_ridObject; }1446 static RID getObjectRID() { return m_ridObject; } 1425 1447 /*EN Retrieves Array prototype object RID 1426 1448 \return RID of the Array prototype object 1427 1449 */ 1428 static RID GetArrayObjectRID() { return m_ridArrayObject; }1450 static RID getArrayObjectRID() { return m_ridArrayObject; } 1429 1451 /*EN Retrieves String prototype object RID 1430 1452 \return RID of the String prototype object 1431 1453 */ 1432 static RID GetStringObjectRID() { return m_ridStringObject; }1454 static RID getStringObjectRID() { return m_ridStringObject; } 1433 1455 /*EN Retrieves Function prototype object RID 1434 1456 \return RID of the Function prototype object 1435 1457 */ 1436 static RID GetFunctionObjectRID() { return m_ridFunctionObject; }1458 static RID getFunctionObjectRID() { return m_ridFunctionObject; } 1437 1459 /*EN Retrieves System prototype object RID 1438 1460 \return RID of the System prototype object 1439 1461 */ 1440 static RID GetSystemObjectRID() { return m_ridSystemObject; }1462 static RID getSystemObjectRID() { return m_ridSystemObject; } 1441 1463 /*EN Retrieves Boolean prototype object RID 1442 1464 \return RID of the Boolean prototype object 1443 1465 */ 1444 static RID GetBooleanObjectRID() { return m_ridBooleanObject; }1466 static RID getBooleanObjectRID() { return m_ridBooleanObject; } 1445 1467 /*EN Retrieves Number prototype object RID 1446 1468 \return RID of the Number prototype object 1447 1469 */ 1448 static RID GetNumberObjectRID() { return m_ridNumberObject; }1470 static RID getNumberObjectRID() { return m_ridNumberObject; } 1449 1471 /*EN Retrieves Date prototype object RID 1450 1472 \return RID of the Date prototype object 1451 1473 */ 1452 static RID GetDateObjectRID() { return m_ridDateObject; }1474 static RID getDateObjectRID() { return m_ridDateObject; } 1453 1475 /*EN Retrieves Regex prototype object RID 1454 1476 \return RID of the Regex prototype object 1455 1477 */ 1456 static RID GetRegexObjectRID() { return m_ridRegexObject; }1478 static RID getRegexObjectRID() { return m_ridRegexObject; } 1457 1479 /*EN Retrieves Error prototype object RID 1458 1480 \return RID of the Error prototype object 1459 1481 */ 1460 static RID GetErrorObjectRID() { return m_ridErrorObject; }1482 static RID getErrorObjectRID() { return m_ridErrorObject; } 1461 1483 /*EN Retrieves Math prototype object RID 1462 1484 \return RID of the Math prototype object 1463 1485 */ 1464 static RID GetMathObjectRID() { return m_ridMathObject; }1486 static RID getMathObjectRID() { return m_ridMathObject; } 1465 1487 1466 1488 //---------------------------------------------------------------------- … … 1468 1490 //Those need to be exposed for built in/user supplied functions 1469 1491 //---------------------------------------------------------------------- 1470 void PushEvalStack( const CVariable& operand );1471 void PushEvalStack( const int32_t i );1472 void PushEvalStack( const int64_t i );1473 void PushEvalStack( const float f );1474 void PushEvalStack( const double d );1475 void PushEvalStack( const bool b );1476 void PushEvalStackUndefined();1477 void PushEvalStackNaN();1478 void PushEvalStackInfinity();1479 void PushEvalStackNull();1480 void PushEvalStackObjectRef( const VMOBJECTREF refObject );1481 void PushEvalStackVariable( const CVariable& var );1482 void PushEvalStackString( const wchar_t* );1483 void PushEvalStackString( const wstring* str );1484 void PushEvalStackStringPointer( wstring* str ); //Pointer is stored directory and should not be deleted1492 void pushEvalStack( const CVariable& operand ); 1493 void pushEvalStack( const int32_t i ); 1494 void pushEvalStack( const int64_t i ); 1495 void pushEvalStack( const float f ); 1496 void pushEvalStack( const double d ); 1497 void pushEvalStack( const bool b ); 1498 void pushEvalStackUndefined(); 1499 void pushEvalStackNaN(); 1500 void pushEvalStackInfinity(); 1501 void pushEvalStackNull(); 1502 void pushEvalStackObjectRef( const VMOBJECTREF refObject ); 1503 void pushEvalStackVariable( const CVariable& var ); 1504 void pushEvalStackString( const wchar_t* ); 1505 void pushEvalStackString( const wstring* str ); 1506 void pushEvalStackStringPointer( wstring* str ); //Pointer is stored directory and should not be deleted 1485 1507 1486 1508 //---------------------------------------------------------------------- 1487 1509 //Eval stack helpers 1488 1510 //---------------------------------------------------------------------- 1489 void PopPushEvalStack( const int32_t i ) { PopEvalStack(); PopEvalStack(); PushEvalStack( i ); };1490 void PopPushEvalStack( const int64_t i ) { PopEvalStack(); PopEvalStack(); PushEvalStack( i ); };1491 void PopPushEvalStack( const float f ) { PopEvalStack(); PopEvalStack(); PushEvalStack( f ); };1492 void PopPushEvalStack( const double d ) { PopEvalStack(); PopEvalStack(); PushEvalStack( d ); };1493 void PopPushEvalStack( const bool b ) { PopEvalStack(); PopEvalStack(); PushEvalStack( b ); };1494 void PopPushEvalStackUndefined() { PopEvalStack(); PopEvalStack(); PushEvalStackUndefined(); };1495 void PopPushEvalStackNaN() { PopEvalStack(); PopEvalStack(); PushEvalStackNaN(); };1496 void PopPushEvalStackNull() { PopEvalStack(); PopEvalStack(); PushEvalStackNull(); };1497 void PopPushEvalStackInfinity() { PopEvalStack(); PopEvalStack(); PushEvalStackInfinity(); };1498 void PopThrowTypeError() { PopEvalStack();1499 PopEvalStack();1500 PushEvalStackNaN();1511 void popPushEvalStack( const int32_t i ) { popEvalStack(); popEvalStack(); pushEvalStack( i ); }; 1512 void popPushEvalStack( const int64_t i ) { popEvalStack(); popEvalStack(); pushEvalStack( i ); }; 1513 void popPushEvalStack( const float f ) { popEvalStack(); popEvalStack(); pushEvalStack( f ); }; 1514 void popPushEvalStack( const double d ) { popEvalStack(); popEvalStack(); pushEvalStack( d ); }; 1515 void popPushEvalStack( const bool b ) { popEvalStack(); popEvalStack(); pushEvalStack( b ); }; 1516 void popPushEvalStackUndefined() { popEvalStack(); popEvalStack(); pushEvalStackUndefined(); }; 1517 void popPushEvalStackNaN() { popEvalStack(); popEvalStack(); pushEvalStackNaN(); }; 1518 void popPushEvalStackNull() { popEvalStack(); popEvalStack(); pushEvalStackNull(); }; 1519 void popPushEvalStackInfinity() { popEvalStack(); popEvalStack(); pushEvalStackInfinity(); }; 1520 void popThrowTypeError() { popEvalStack(); 1521 popEvalStack(); 1522 pushEvalStackNaN(); 1501 1523 ThrowExceptionFromVm( &wstring( ERRORSTRING_TYPEERROR_STORESTATICFIELD ), 1502 1524 &wstring( NAME_BUILTIN_ERROR_OBJECT ), … … 1504 1526 }; 1505 1527 1506 void PopEvalStack( void ); 1507 void PopEvalStackFast( void ); 1508 bool IsEvalStackEmpty(); 1509 void DupEvalStack( void ); 1510 size_t GetEvalStackSize(); 1511 CVariable& GetEvalStackFirstEntry(); 1512 CVariable& GetEvalStackSecondEntry(); 1513 CVariable& GetEvalStackNewEntry(); 1514 1515 void ClearEvalStack(); /*EN< Clear eval stack*/ 1516 void ClearLocalVariableList(); /*EN< Clear local variable list*/ 1517 void ClearArgList(); /*EN< Clear argument list*/ 1528 void popEvalStack( void ); 1529 void popEvalStackFast( void ); 1530 bool isEvalStackEmpty(); 1531 void dupEvalStack( void ); 1532 size_t getEvalStackSize(); 1533 CVariable& getEvalStackFirstEntry(); 1534 CVariable& getEvalStackSecondEntry(); 1535 CVariable& getEvalStackNewEntry(); 1536 1537 void clearEvalStack(); /*EN< Clear eval stack*/ 1538 void clearLocalVariableList(); /*EN< Clear local variable list*/ 1539 void clearArgList(); /*EN< Clear argument list*/ 1540 void clearCallStack(); /*EN< Clear call stack*/ 1541 void clearStaticFields(); /*EN< Clear static field*/ 1518 1542 1519 1543 //---------------------------------------------------------------------- … … 1524 1548 \return reference of the array list 1525 1549 */ 1526 CVariable* GetArgumentList() { return m_ArgList; };1550 CVariable* getArgumentList() { return m_ArgList; }; 1527 1551 1528 1552 /*EN Retrieve a local variable list 1529 1553 \return reference of the local list 1530 1554 */ 1531 CVariable* GetLocalList() { return m_LocalVariableList; };1555 CVariable* getLocalList() { return m_LocalVariableList; }; 1532 1556 1533 1557 /*EN Takes a variable from the eval stack and stores it to the static field with given RID 1534 1558 \param rid RID of the static field that the value to be stored in. 1535 1559 */ 1536 void StoreStaticField( const RID rid );1560 void storeStaticField( const RID rid ); 1537 1561 1538 1562 /*EN Takes a variable from static field with given RID and put the variable to the eval stack 1539 1563 \param rid RID of the static field that the value is to be loaded from. 1540 1564 */ 1541 void LoadStaticField( const RID rid );1565 void loadStaticField( const RID rid ); 1542 1566 1543 1567 /*EN Takes a variable from the eval stack and stores it to the local variable with given index 1544 1568 \param iIndex An index of a local variable. Negative index means a local variable in the enclosing scope. 1545 1569 */ 1546 void StoreLocalVariable( const int32_t iIndex );1570 void storeLocalVariable( const int32_t iIndex ); 1547 1571 1548 1572 /*EN Takes a variable of the local variable with given index and push it to the eval stack. 1549 1573 \param iIndex An index of a local variable. Negative index means a local variable in the enclosing scope. 1550 1574 */ 1551 void LoadLocalVariable( const int32_t iIndex );1575 void loadLocalVariable( const int32_t iIndex ); 1552 1576 1553 1577 /*EN Takes a variable from the eval stack and stores it to the argument list with given index 1554 1578 \param iIndex An index of an argument list. 0 means this pointer, Negative index means a local variable in the enclosing scope. 1555 1579 */ 1556 void StoreArgument( const int32_t iIndex );1580 void storeArgument( const int32_t iIndex ); 1557 1581 1558 1582 /*EN Takes a variable from the argument list with given index and push it to the eval stack. 1559 1583 \param iIndex An index of an argument list. 0 means this pointer, Negative index means a local variable in the enclosing scope. 1560 1584 */ 1561 void LoadArgument( const int32_t iIndex );1585 void loadArgument( const int32_t iIndex ); 1562 1586 1563 1587 /*EN Retrieves a table of the static field vector 1564 1588 \return A vector of the static field variables 1565 1589 */ 1566 CVariable* GetStaticFieldTable() { return m_pStaticFieldTable; }1590 CVariable* getStaticFieldTable() { return m_pStaticFieldTable; } 1567 1591 1568 1592 /*EN Takes a variable from the eval stack and stores it to the destination variable with a respect of a type constraint. 1569 1593 \param varDest A reference of a variable that the value from an eval stack is stored in. 1570 1594 */ 1571 void StoreAsRestrictedType( CVariable& varDest );1595 void storeAsRestrictedType( CVariable& varDest ); 1572 1596 1573 1597 /*EN Calls given RID, invoked from Function.apply*/ … … 1576 1600 const bool bConstructor = false ); 1577 1601 /*EN Stores a variable to argument list by hand. Invoked from Function.apply*/ 1578 void StoreArgumentList( const CVariable& var );1602 void storeArgumentList( const CVariable& var ); 1579 1603 1580 1604 /*EN Generates 'arguments' property based on current callstack and arguments list information on the fly. 1581 1605 */ 1582 CVariable* GenerateArgumentsProperty();1606 CVariable* generateArgumentsProperty(); 1583 1607 1584 1608 /*EN Generates 'restArguments' argument if the method signature requires it. 1585 1609 This helper should be called immediate before function call. 1586 1610 */ 1587 void GenerateRestArguments( int32_t iNumArgsToStore );1611 void generateRestArguments( int32_t iNumArgsToStore ); 1588 1612 1589 1613 /*EN Generates 'caller' property based on current callstack and arguments list information on the fly. 1590 1614 */ 1591 CVariable* GenerateCallerProperty();1615 CVariable* generateCallerProperty(); 1592 1616 1593 1617 /*EN Disposes arguments given to the API explicitly*/ 1594 void DisposeArgumentList();1618 void disposeArgumentList(); 1595 1619 1596 1620 /*EN Resets number of arguments in the list*/ 1597 void ResetArgumentList();1621 void resetArgumentList(); 1598 1622 1599 1623 /*EN Returns exception handler nesting level … … 1601 1625 Return non zero if current code is inside an exception handler clause. 1602 1626 */ 1603 int32_t GetExectipnHandlerNestingLevel() { return m_ExceptionHandlerNestingLevel; }1627 int32_t getExectipnHandlerNestingLevel() { return m_ExceptionHandlerNestingLevel; } 1604 1628 1605 1629 … … 1609 1633 /*EN Flush print() buffer if some strings are in the buffer, otherwise, do nothing.. 1610 1634 */ 1611 void FlushPrintBuffer() { wprintf( m_strPrintBuffer.data() ); m_strPrintBuffer.clear(); }1635 void flushPrintBuffer() { wprintf( m_strPrintBuffer.data() ); m_strPrintBuffer.clear(); } 1612 1636 1613 1637 /*EN Retrieves print() buffer if some strings are in the buffer, otherwise, do nothing.. 1614 1638 \return A reference for the wstring that is used for print() intermedeiate buffer 1615 1639 */ 1616 wstring& GetPrintBuffer() { return m_strPrintBuffer; }1640 wstring& getPrintBuffer() { return m_strPrintBuffer; } 1617 1641 1618 1642 /*EN Retrieves print() buffer if some strings are in the buffer, otherwise, do nothing.. 1619 1643 \param str wstring that will be printed. 1620 1644 */ 1621 void AppendPrintBuffer( wstring& str ) { m_strPrintBuffer.append( str ); }1645 void appendPrintBuffer( wstring& str ) { m_strPrintBuffer.append( str ); } 1622 1646 1623 1647 private: … … 1625 1649 //Initialize engines 1626 1650 //---------------------------------------------------------------------- 1627 bool SetStaticFieldTypeTable( vector< OPERAND_TYPE_FLAG >& vecSFType );1628 void InitializePrototypeObjects();1651 bool setStaticFieldTypeTable( vector< OPERAND_TYPE_FLAG >& vecSFType ); 1652 void initializePrototypeObjects(); 1629 1653 1630 1654 /*EN Set a static field value with a function object with given method RID. … … 1634 1658 \return true when the value is set successfully, false otherwise. 1635 1659 */ 1636 bool SetStaticFieldFunctionObject( const RID rid, const RID ridMethod );1660 bool setStaticFieldFunctionObject( const RID rid, const RID ridMethod ); 1637 1661 1638 1662 //---------------------------------------------------------------------- 1639 1663 //Garbage collector helper 1640 1664 //---------------------------------------------------------------------- 1641 void ClearRefCount();1642 void CleanObjectPool();1665 void clearRefCount(); 1666 void cleanObjectPool(); 1643 1667 1644 1668 //---------------------------------------------------------------------- … … 1650 1674 //Byte code stream accesser 1651 1675 //---------------------------------------------------------------------- 1652 uint8_t GetNextBytecode( void ); /*EN< Retrieve next byte code from an attached byte code stream*/1653 RID GetNextToken( void ); /*EN< Retrieve next Token from an attached byte code stream*/1654 int32_t GetNextInt32( void ); /*EN< Retrieve next int32_t value from an attached byte code stream*/1655 int64_t GetNextInt64( void ); /*EN< Retrieve next int64_t value from an attached byte code stream*/1656 int8_t GetNextInt8( void ); /*EN< Retrieve next int8_t value from an attached byte code stream*/1657 uint8_t GetNextUint8( void ); /*EN< Retrieve next uint8_t value from an attached byte code stream*/1658 float GetNextFloat( void ); /*EN< Retrieve next float value from an attached byte code stream*/1659 double GetNextDouble( void ); /*EN< Retrieve next double value from an attached byte code stream*/1676 uint8_t getNextBytecode( void ); /*EN< Retrieve next byte code from an attached byte code stream*/ 1677 RID getNextToken( void ); /*EN< Retrieve next Token from an attached byte code stream*/ 1678 int32_t getNextInt32( void ); /*EN< Retrieve next int32_t value from an attached byte code stream*/ 1679 int64_t getNextInt64( void ); /*EN< Retrieve next int64_t value from an attached byte code stream*/ 1680 int8_t getNextInt8( void ); /*EN< Retrieve next int8_t value from an attached byte code stream*/ 1681 uint8_t getNextUint8( void ); /*EN< Retrieve next uint8_t value from an attached byte code stream*/ 1682 float getNextFloat( void ); /*EN< Retrieve next float value from an attached byte code stream*/ 1683 double getNextDouble( void ); /*EN< Retrieve next double value from an attached byte code stream*/ 1660 1684 1661 1685 //---------------------------------------------------------------------- 1662 1686 //Private Field accessor 1663 1687 //---------------------------------------------------------------------- 1664 CVariable& GetLocalVariable( const int32_t iIndex );1665 bool SetLocalVariable( const int32_t iIndex, const CVariable& value );1666 CVariable& GetArgument( const int32_t iIndex );1667 bool SetArgument( const int32_t iIndex, const CVariable& value );1688 CVariable& getLocalVariable( const int32_t iIndex ); 1689 bool setLocalVariable( const int32_t iIndex, const CVariable& value ); 1690 CVariable& getArgument( const int32_t iIndex ); 1691 bool setArgument( const int32_t iIndex, const CVariable& value ); 1668 1692 1669 1693 //---------------------------------------------------------------------- … … 1674 1698 \return A pointer to the callstack top entry 1675 1699 */ 1676 VM_CALLSTACK* GetCurrentCallStack() { return &m_CallStack.back(); }1700 VM_CALLSTACK* getCurrentCallStack() { return &m_CallStack.back(); } 1677 1701 1678 1702 /*EN Search and retrieves a callstack entries with given argument criteria matches … … 1681 1705 \return A pointer to the callstack entry that matches an arguments criateria 1682 1706 */ 1683 VM_CALLSTACK* GetCurrentCallStack( const VM_CALLSTACK_TYPE type, int iLevel = 1 )1707 VM_CALLSTACK* getCurrentCallStack( const VM_CALLSTACK_TYPE type, int iLevel = 1 ) 1684 1708 { 1685 1709 vector< VM_CALLSTACK >::reverse_iterator it = m_CallStack.rbegin(); … … 1702 1726 void multiplyOperator(); 1703 1727 void divisionOperator(); 1704 void NegOperator();1728 void negOperator(); 1705 1729 void reminderOperator(); 1706 void IncStaticFieldOperator( const RID rid );1707 void IncOperator();1708 void DecOperator();1730 void incStaticFieldOperator( const RID rid ); 1731 void incOperator(); 1732 void decOperator(); 1709 1733 1710 1734 void bitwiseAndOperator(); … … 1753 1777 void FinallyOperator(); 1754 1778 1755 void ConvertToBoolean();1779 void convertToBoolean(); 1756 1780 1757 1781 //---------------------------------------------------------------------- 1758 1782 //Local variables 1759 1783 //---------------------------------------------------------------------- 1760 void ReserveLocalVariables( const RID ridLocalsToReserve );1761 void DisposeLocalVariables( const uint32_t iLocalsToDispose );1762 uint32_t GetCurrentLocalVariableIndex( void ) { return (uint32_t)m_iLocalVariableListIndex; }1784 void reserveLocalVariables( const RID ridLocalsToReserve ); 1785 void disposeLocalVariables( const uint32_t iLocalsToDispose ); 1786 uint32_t getCurrentLocalVariableIndex( void ) { return (uint32_t)m_iLocalVariableListIndex; } 1763 1787 1764 1788 //---------------------------------------------------------------------- 1765 1789 //Argument list 1766 1790 //---------------------------------------------------------------------- 1767 void StoreArgumentListWithThisPointer( const uint32_t iArgToStore );1768 void StoreArgumentListWithoutThisPointer( const uint32_t iArgToStore );1769 void DisposeArgumentList( const uint32_t iArgToDispose );1770 uint32_t GetCurrentArgumentListIndex( void ) { return (uint32_t)m_iArgListIndex; }1771 void PushArgumentListUndefined( void );1772 void PopArgumentList( void );1791 void storeArgumentListWithThisPointer( const uint32_t iArgToStore ); 1792 void storeArgumentListWithoutThisPointer( const uint32_t iArgToStore ); 1793 void disposeArgumentList( const uint32_t iArgToDispose ); 1794 uint32_t getCurrentArgumentListIndex( void ) { return (uint32_t)m_iArgListIndex; } 1795 void pushArgumentListUndefined( void ); 1796 void popArgumentList( void ); 1773 1797 1774 1798 //---------------------------------------------------------------------- … … 1807 1831 uint32_t m_iMaxArgListIndex; 1808 1832 1809 void UpdateEvalStackIndex() {1833 void updateEvalStackIndex() { 1810 1834 m_pCurrentEvalStack++; 1811 1835 #ifdef VM_TRACK_MAXSTACKUSAGE … … 1814 1838 #endif 1815 1839 } 1816 void UpdateLocalVariableListIndex() {1840 void updateLocalVariableListIndex() { 1817 1841 m_iLocalVariableListIndex++; 1818 1842 #ifdef VM_TRACK_MAXSTACKUSAGE … … 1821 1845 #endif 1822 1846 } 1823 void UpdateArgListIndex() {1847 void updateArgListIndex() { 1824 1848 m_iArgListIndex++; 1825 1849 #ifdef VM_TRACK_MAXSTACKUSAGE inc/error.h
r110 r138 194 194 \param strOtherInfo Supplemental information 195 195 */ 196 void Report( int32_t iErrorCode, int32_t iLineNumber, int32_t iColumnNumber,196 void report( int32_t iErrorCode, int32_t iLineNumber, int32_t iColumnNumber, 197 197 wstring & strFileName, wstring & strLine, wstring & strOtherInfo ); 198 198 199 /*EN Dumps the errors to stdout*/200 void DumpError();199 /*EN dumps the errors to stdout*/ 200 void dumpError(); 201 201 202 202 /*EN Sets the error table … … 204 204 \param iSize Number of table entries 205 205 */ 206 void SetErrorTable( const ERROR_DEF pErrorTable[], size_t iSize );206 void setErrorTable( const ERROR_DEF pErrorTable[], size_t iSize ); 207 207 208 208 /*EN Suppresses error line output for Eclipse usage which does not need error line 209 209 \param b true: Suppress error line output False:Output error line 210 210 */ 211 void SuppressErrorLine( bool b ) { m_bSuppressErrorLine = b; }211 void suppressErrorLine( const bool b ) { m_bsuppressErrorLine = b; } 212 212 213 213 /*EN Check if there was compile error 214 214 \return True when compile error happened otherwise false. 215 215 */ 216 bool HasError( void );216 bool hasError( void ); 217 217 218 218 /*EN Check if there was compile information 219 219 \return True when compile information generated otherwise false. 220 220 */ 221 bool HasInformation( void );221 bool hasInformation( void ); 222 222 223 223 private: … … 227 227 vector< parserError > m_ErrorList; 228 228 const ERROR_DEF* m_pErrorTable; 229 bool GetErrorLevel( int32_t iErrorCode );229 bool getErrorLevel( int32_t iErrorCode ); 230 230 231 231 int32_t m_iNumErrors[ NUM_ERROR_LEVELS ]; 232 232 map< int32_t,const ERROR_DEF * > m_mapErrorCode; 233 bool m_b SuppressErrorLine;233 bool m_bsuppressErrorLine; 234 234 }; 235 235 inc/icodegen.h
r110 r138 366 366 \param value a value of the property 367 367 */ 368 void AddProperty( const wstring& name, const CVariable& value );368 void addProperty( const wstring& name, const CVariable& value ); 369 369 370 370 /*EN Retrieves RID of the Object name 371 371 \return Object name's RID 372 372 */ 373 RID GetObjectName( void );373 RID getObjectName( void ); 374 374 375 375 /*EN Retrieves RID of the Object 376 376 \return Object's RID 377 377 */ 378 RID GetRID( void ) { return m_ridObject; }378 RID getRID( void ) { return m_ridObject; } 379 379 380 380 /*EN Retrieves RID of the Object constructor 381 381 \return An object constructor's RID 382 382 */ 383 RID GetConstructor( void ) { return m_ridConstructor; }383 RID getConstructor( void ) { return m_ridConstructor; } 384 384 385 385 /*EN Retrieves RID of the Object call attribute 386 386 \return Object call attribute's RID 387 387 */ 388 RID GetCall( void ) { return m_ridCall; }388 RID getCall( void ) { return m_ridCall; } 389 389 390 390 /*EN Sets RID of the Object 391 391 \param rid Object's RID 392 392 */ 393 void SetRID( const RID rid );393 void setRID( const RID rid ); 394 394 395 395 /*EN Sets RID of the Object name 396 396 \param rid Object name's RID 397 397 */ 398 void SetObjectName( const RID rid );398 void setObjectName( const RID rid ); 399 399 400 400 /*EN Sets RID of the Object call attribute 401 401 \param rid Object call attribute's RID 402 402 */ 403 void SetCallProperty( const RID rid ) { m_ridCall = rid; }403 void setCallProperty( const RID rid ) { m_ridCall = rid; } 404 404 405 405 /*EN Sets RID of the Object ctor attribute 406 406 \param rid Object ctor attribute's RID 407 407 */ 408 void SetConstructorProperty( const RID rid ) { m_ridConstructor = rid; }408 void setConstructorProperty( const RID rid ) { m_ridConstructor = rid; } 409 409 410 410 /*EN Retrieves a reference of the property map of the object. 411 411 \return Reference of the object proeprty./ 412 412 */ 413 hash_map< wstring, CVariable >& GetPropertyMap() { return m_mapProperty; }413 hash_map< wstring, CVariable >& getPropertyMap() { return m_mapProperty; } 414 414 private: 415 415 protected: … … 470 470 471 471 /*EN Initializes the metadata class*/ 472 void Initialize( void );472 void initialize( void ); 473 473 474 474 /*EN Teminates the metadata class*/ … … 478 478 \return Reference of the static fields table 479 479 */ 480 vector< OPERAND_TYPE_FLAG >& GetStaticFieldTypeTable() { return m_StaticFieldTypeTable; }480 vector< OPERAND_TYPE_FLAG >& getStaticFieldTypeTable() { return m_StaticFieldTypeTable; } 481 481 482 482 /*EN Retrieves a table of methods 483 483 \return Reference of the methods table 484 484 */ 485 vector< METHOD_DEF >& GetMethodTable() { return m_MethodTable; }485 vector< METHOD_DEF >& getMethodTable() { return m_MethodTable; } 486 486 487 487 /*EN Retrieves a table of builtin methods 488 488 \return Reference of the builtin methods 489 489 */ 490 vector< METHOD_DEF >& GetBuiltinMethodTable() { return m_BuiltinMethodTable; }490 vector< METHOD_DEF >& getBuiltinMethodTable() { return m_BuiltinMethodTable; } 491 491 492 492 /*EN Retrieves a table of parameter list 493 493 \return Reference of the parameter list 494 494 */ 495 vector< vector< OPERAND_TYPE_FLAG > >& GetParamListTable() { return m_ParamListTable; }495 vector< vector< OPERAND_TYPE_FLAG > >& getParamListTable() { return m_ParamListTable; } 496 496 497 497 /*EN Retrieves a table of parameter list of built in function. 498 498 \return Reference of the parameter list of built in function 499 499 */ 500 vector< vector< OPERAND_TYPE_FLAG > >& GetBuiltinParamListTable() { return m_BuiltinParamListTable; }500 vector< vector< OPERAND_TYPE_FLAG > >& getBuiltinParamListTable() { return m_BuiltinParamListTable; } 501 501 502 502 /*EN Retrieves a table of an object list 503 503 \return Reference of the object list 504 504 */ 505 vector< CObjectTypeInfo >& GetObjectTable() { return m_ObjectTable; }505 vector< CObjectTypeInfo >& getObjectTable() { return m_ObjectTable; } 506 506 507 507 /*EN Retrieves a table of a builtin object list 508 508 \return Reference of the builtint object list 509 509 */ 510 vector< CObjectTypeInfo >& GetBuiltinObjectTable() { return m_BuiltinObjectTable; }510 vector< CObjectTypeInfo >& getBuiltinObjectTable() { return m_BuiltinObjectTable; } 511 511 512 512 /*EN Retrieves a table of string constants 513 513 \return Reference of the table of string constants 514 514 */ 515 vector< wstring >& GetStringConstantPool() { return m_StringConstantPool; }515 vector< wstring >& getStringConstantPool() { return m_StringConstantPool; } 516 516 517 517 /*EN Retrieves a table of builtin string constants 518 518 \return Reference of the table of builtin string constants 519 519 */ 520 vector< wstring >& GetBuiltinStringConstantPool() { return m_BuiltinStringConstantPool; }520 vector< wstring >& getBuiltinStringConstantPool() { return m_BuiltinStringConstantPool; } 521 521 522 522 //--------------------------------------------------------------------------- … … 527 527 \return String value that has given RID value 528 528 */ 529 wstring& GetStringConstant( const RID rid );529 wstring& getStringConstant( const RID rid ); 530 530 531 531 /*EN Retrieves a method informationthat has given RID … … 533 533 \return Method information that has given RID value 534 534 */ 535 METHOD_DEF& GetMethod( const RID rid );535 METHOD_DEF& getMethod( const RID rid ); 536 536 537 537 /*EN Retrieves an object informationthat has given RID … … 539 539 \return Object information that has given RID value 540 540 */ 541 CObjectTypeInfo& GetObject( const RID rid );541 CObjectTypeInfo& getObject( const RID rid ); 542 542 543 543 /*EN Retrieves an object name RID has given Object RID … … 545 545 \return Object name RID that has given Object RID value 546 546 */ 547 RID GetObjectNameRID( const RID ObjectRID );547 RID getObjectNameRID( const RID ObjectRID ); 548 548 549 549 /*EN Queries an object RID that has specific qualified name … … 551 551 \return RID that has given Object name 552 552 */ 553 RID QueryBuiltinObjectRid( const wstring& strQualifiedName );553 RID queryBuiltinObjectRid( const wstring& strQualifiedName ); 554 554 555 555 /*EN Queries an stgring RID that has specific qualified name … … 557 557 \return RID of given string 558 558 */ 559 RID QueryBuiltinStringRid( const wstring& strName );559 RID queryBuiltinStringRid( const wstring& strName ); 560 560 561 561 /*EN Queries an method RID that has specific qualified name … … 563 563 \return RID of given method 564 564 */ 565 RID QueryBuiltinMethodRid( const wstring& strQualifiedName );565 RID queryBuiltinMethodRid( const wstring& strQualifiedName ); 566 566 567 567 /*EN Verifies object map information 568 568 \return true if the object info that is attached is correct, false otherwise. 569 569 */ 570 bool VerifyObjectMap();570 bool verifyObjectMap(); 571 571 572 572 //--------------------------------------------------------------------------- … … 581 581 //RID manipulation 582 582 //--------------------------------------------------------------------------- 583 RID ReserveBuiltinStringConstantRID( const RID ridBuiltinStringConstant, const wstring& s = wstring( L"" ) );584 RID GenerateUserStringConstantRID( const wstring& s = wstring( L"" ) );585 586 RID GenerateUserObjectRID();587 RID GenerateBuiltinObjectRID();588 RID GenerateBuiltinStringConstantRID();589 RID GenerateBuiltinMethodRID();590 591 RID GenerateStaticFieldRID( const OPERAND_TYPE type = OPERAND_UNDEFINED,583 RID reserveBuiltinStringConstantRID( const RID ridBuiltinStringConstant, const wstring& s = wstring( L"" ) ); 584 RID generateUserStringConstantRID( const wstring& s = wstring( L"" ) ); 585 586 RID generateUserObjectRID(); 587 RID generateBuiltinObjectRID(); 588 RID generateBuiltinStringConstantRID(); 589 RID generateBuiltinMethodRID(); 590 591 RID generateStaticFieldRID( const OPERAND_TYPE type = OPERAND_UNDEFINED, 592 592 const OPERAND_FLAG flag = OPERAND_FLAG_NONE, 593 593 const RID ridConstraintType = 0 ); 594 RID GenerateMethodRID( const METHOD_TYPE type,594 RID generateMethodRID( const METHOD_TYPE type, 595 595 const RID ridScope, 596 596 const RID ridArg, 597 597 const RID ridLocalVariable ); 598 RID GenerateEhRID( const METHOD_TYPE type,598 RID generateEhRID( const METHOD_TYPE type, 599 599 const RID ridScope, 600 600 const RID ridArg, 601 601 const RID ridLocalVariable ); 602 602 603 RID GenerateParamListRID();604 RID GeneratePropertyRID();605 int32_t AddParamListEntry( const RID ridParamList,603 RID generateParamListRID(); 604 RID generatePropertyRID(); 605 int32_t addParamListEntry( const RID ridParamList, 606 606 const OPERAND_TYPE op, 607 607 const OPERAND_FLAG flag = OPERAND_FLAG_NONE, 608 608 const RID ridConstraintType = 0 ); 609 size_t GetParamListSize( const RID ridParamList );610 611 RID ReserveBuiltinParamListRID( const RID ridBuiltinObjectParamList );612 RID ReserveBuiltinMethodRID( const RID ridBuiltinMethod,609 size_t getParamListSize( const RID ridParamList ); 610 611 RID reserveBuiltinParamListRID( const RID ridBuiltinObjectParamList ); 612 RID reserveBuiltinMethodRID( const RID ridBuiltinMethod, 613 613 const METHOD_TYPE type, 614 614 PMETHOD const pFunction, … … 617 617 const RID ridLocalVariable ); 618 618 619 bool SetBuiltinString( const RID ridObjectName,619 bool setBuiltinString( const RID ridObjectName, 620 620 const wstring& strString ); 621 621 private: … … 623 623 //RID manipulation 624 624 //--------------------------------------------------------------------------- 625 RID ReserveBuiltinObjectRID( const RID ridBuiltinObject );625 RID reserveBuiltinObjectRID( const RID ridBuiltinObject ); 626 626 627 627 //--------------------------------------------------------------------------- 628 628 //High level helpers 629 629 //--------------------------------------------------------------------------- 630 bool SetBuiltinObject( const RID ridObject,630 bool setBuiltinObject( const RID ridObject, 631 631 const RID ridObjectName, 632 632 const RID ridCtor = (RID)0, 633 633 const RID ridCall = (RID)0 ); 634 bool SetBuiltinMethod( const RID ridMethod,634 bool setBuiltinMethod( const RID ridMethod, 635 635 const METHOD_TYPE methodType, 636 636 const PMETHOD pMethod, … … 668 668 hash_map< wstring, CVariable > m_ObjectMap; 669 669 //Helper function 670 CVariable* RegisterVariable( hash_map< wstring, CVariable >& map, const wstring& strName );671 CVariable* QueryVariable( hash_map< wstring, CVariable >& map, const wstring& strName );670 CVariable* registerVariable( hash_map< wstring, CVariable >& map, const wstring& strName ); 671 CVariable* queryVariable( hash_map< wstring, CVariable >& map, const wstring& strName ); 672 672 673 673 }; … … 746 746 virtual CCgNodeData* unaryIncOperator( CCgNodeData*, bool bDup ) = 0; 747 747 virtual CCgNodeData* unaryDecOperator( CCgNodeData*, bool bDup ) = 0; 748 virtual CCgNodeData* unary bitwiseNotOperator( CCgNodeData* ) = 0;749 virtual CCgNodeData* unary logicalNotOperator( CCgNodeData* ) = 0;748 virtual CCgNodeData* unaryBitwiseNotOperator( CCgNodeData* ) = 0; 749 virtual CCgNodeData* unaryLogicalNotOperator( CCgNodeData* ) = 0; 750 750 virtual CCgNodeData* unaryVoidOperator( CCgNodeData* ) = 0; 751 751 virtual CCgNodeData* unaryDeleteOperator( CCgNodeData* ) = 0; inc/lexer.h
r110 r138 33 33 extern int32_t yychar; 34 34 35 #define AUTOSEMICOLON if( cri::CParser:: Getparser()->GetLexer()->IsAutoSemicolonAllowed() )\35 #define AUTOSEMICOLON if( cri::CParser::getparser()->getLexer()->isAutoSemicolonAllowed() )\ 36 36 {\ 37 37 yychar = ';';\ 38 cri::CParser:: Getparser()->GetLexer()->DuplicateToken();\38 cri::CParser::getparser()->getLexer()->duplicateToken();\ 39 39 } 40 40 … … 64 64 //Virtual functions 65 65 /*EN pure virtual function to reset a token stream */ 66 virtual bool ResetStream () = 0;66 virtual bool resetStream () = 0; 67 67 68 68 /*EN pure virtual function to retrieve current compiling line */ 69 virtual wstring& GetCurrentLineString() = 0;69 virtual wstring& getCurrentLineString() = 0; 70 70 71 71 /*EN pure virtual function to retrieve a specific line */ 72 virtual wstring& GetLineString( const uint32_t iLineNumber ) = 0;73 //m_bInitialized needs to be set inside SetStream() API72 virtual wstring& getLineString( const uint32_t iLineNumber ) = 0; 73 //m_bInitialized needs to be set inside setStream() API 74 74 75 75 /*EN Initializes the lexer */ … … 102 102 103 103 /*EN Processes a token stream 104 \par Token stream need to be attached prior Process() call104 \par Token stream need to be attached prior process() call 105 105 \return 0:Success 106 106 */ 107 int32_t Process( void );108 109 int32_t GetToken( void );110 void DuplicateToken();111 bool IsAutoSemicolonAllowed();112 void DebugRecentlyReduced(uint32_t iLineNumber )107 int32_t process( void ); 108 109 int32_t getToken( void ); 110 void duplicateToken(); 111 bool isAutoSemicolonAllowed(); 112 void debugRecentlyReduced( const uint32_t iLineNumber ) 113 113 { 114 114 #ifdef _DEBUG … … 116 116 #endif 117 117 } 118 void AllowRegexLiteral(bool b ) { m_AllowRegexLiteral = b; }118 void allowRegexLiteral( const bool b ) { m_AllowRegexLiteral = b; } 119 119 //--------------------------------------------------------- 120 120 //Retrieve values 121 121 //--------------------------------------------------------- 122 wstring& GetIdentifier( void )122 wstring& getIdentifier( void ) 123 123 { 124 124 assert( m_bInitialized == true ); … … 126 126 } 127 127 128 int64_t GetIntegerTokenValue( void )128 int64_t getIntegerTokenValue( void ) 129 129 { 130 130 assert( m_bInitialized == true ); … … 132 132 } 133 133 134 double GetDecimalTokenValue( void )134 double getDecimalTokenValue( void ) 135 135 { 136 136 assert( m_bInitialized == true ); 137 137 return m_dValue; 138 138 } 139 YYSTYPE GetTokenValue( void );139 YYSTYPE getTokenValue( void ); 140 140 141 141 //--------------------------------------------------------- … … 146 146 \param b True:The target is Big Endian False: The target is Little Endian 147 147 */ 148 void SetEndianness(bool b ) { m_bBigEndianSource = b; }149 /*EN Gets target endianness setting148 void setEndianness( const bool b ) { m_bBigEndianSource = b; } 149 /*EN gets target endianness setting 150 150 \return Target endian setting 151 151 */ 152 bool GetEndianness() { return m_bBigEndianSource; }153 154 wstring& GetCurrentStreamName() { return m_strFileName; }155 void SetCurrentStreamName( wstring& str ) { m_strFileName = str; }156 157 int32_t GetLineNumber( void )152 bool getEndianness() { return m_bBigEndianSource; } 153 154 wstring& getCurrentStreamName() { return m_strFileName; } 155 void setCurrentStreamName( wstring& str ) { m_strFileName = str; } 156 157 int32_t getLineNumber( void ) 158 158 { 159 159 assert( m_bInitialized == true ); … … 161 161 } 162 162 163 void SetLineNumber(int32_t iLineNumber )163 void setLineNumber( const int32_t iLineNumber ) 164 164 { 165 165 assert( m_bInitialized == true ); … … 168 168 } 169 169 170 int32_t GetColumn( void ) {170 int32_t getColumn( void ) { 171 171 assert( m_bInitialized == true ); 172 172 return m_iCurrentTokenColumn; 173 173 } 174 174 175 int32_t GetLastTokenColumn( void ) {175 int32_t getLastTokenColumn( void ) { 176 176 assert( m_bInitialized == true ); 177 177 return m_iLastTokenColumn; 178 178 } 179 179 180 int32_t GetLastTokenLine( void ) {180 int32_t getLastTokenLine( void ) { 181 181 assert( m_bInitialized == true ); 182 182 return m_iLastTokenLine; 183 183 } 184 184 185 void SetErrorHandler( CErrorPool * pError )185 void setErrorHandler( CErrorPool * pError ) 186 186 { 187 187 m_pError = pError; … … 190 190 } 191 191 192 void SetErrorOutput( bool bEnable )192 void setErrorOutput( bool bEnable ) 193 193 { 194 194 m_bEnableErrorOutput = bEnable; 195 195 } 196 196 197 wstring& GetErrorInfo() { return m_strErrorInfo;}198 199 bool GetTokenDuplication() { return m_bDuplicateToken; }200 void SetTokenDuplication(bool b) { m_bDuplicateToken = b; return; }197 wstring& getErrorInfo() { return m_strErrorInfo;} 198 199 bool getTokenDuplication() { return m_bDuplicateToken; } 200 void setTokenDuplication( const bool b ) { m_bDuplicateToken = b; return; } 201 201 202 202 protected: … … 207 207 virtual void reportError( int32_t iErrorCoed, const wstring& strErrorInfo ); 208 208 209 virtual wchar_t GetNextInt8( void ) = 0;210 virtual wchar_t FetchNextChar( void ) = 0;211 virtual void UngetChar(wchar_t c ) = 0;212 213 virtual void TokenFound( const int32_t iToken, const int32_t iLine, const int32_t iColumm);209 virtual wchar_t getNextInt8( void ) = 0; 210 virtual wchar_t fetchNextChar( void ) = 0; 211 virtual void ungetChar( const wchar_t c ) = 0; 212 213 virtual void tokenFound( const int32_t iToken, const int32_t iLine, const int32_t iColumm); 214 214 215 215 //--------------------------------------------------------- 216 216 //Helpers 217 217 //--------------------------------------------------------- 218 bool IsDigit(wchar_t c );219 bool IsHex(wchar_t c );220 bool IsOctal(wchar_t c );221 bool IsOctalStart(wchar_t c );222 int32_t GetHexValue(wchar_t c );223 int32_t GetDigitValue(wchar_t c );224 bool IsLowerCase(wchar_t c );225 bool IsUpperCase(wchar_t c );226 bool IsWhiteSpace(wchar_t c );227 bool IsAlphabet( wchar_t c ) { return IsLowerCase(c) || IsUpperCase(c); };228 bool IsIdentifierStart(wchar_t c );229 bool IsIdentifier(wchar_t c );230 bool IsAtIdentifierStart(wchar_t c );231 bool IsLineTerminator(wchar_t c );232 int32_t ProcessEscapeSequence( wstring &s );233 int32_t ProcessRegExpEscapeSequence( wstring &s );234 void UpdateLine( const int32_t iLine, const int32_t iColumn );235 236 static const LEX_WORD_ITEM ReservedWordTable[];237 static const LEX_WORD_ITEM KeywordTable[];238 static const LEX_WORD_ITEM_EX LiteralTable[];239 static const LEX_WORD_ITEM OperatorTable[];218 bool isDigit( const wchar_t c ); 219 bool isHex( const wchar_t c ); 220 bool isOctal( const wchar_t c ); 221 bool isOctalStart( const wchar_t c ); 222 int32_t getHexValue( const wchar_t c ); 223 int32_t getDigitValue( const wchar_t c ); 224 bool isLowerCase( const wchar_t c ); 225 bool isUpperCase( const wchar_t c ); 226 bool isWhiteSpace( const wchar_t c ); 227 bool isAlphabet( const wchar_t c ) { return isLowerCase(c) || isUpperCase(c); }; 228 bool isIdentifierStart( const wchar_t c ); 229 bool isIdentifier( const wchar_t c ); 230 bool isAtIdentifierStart( const wchar_t c ); 231 bool isLineTerminator( const wchar_t c ); 232 int32_t processEscapeSequence( wstring &s ); 233 int32_t processRegExpEscapeSequence( wstring &s ); 234 void updateLine( const int32_t iLine, const int32_t iColumn ); 235 236 static const LEX_WORD_ITEM s_ReservedWordTable[]; 237 static const LEX_WORD_ITEM s_KeywordTable[]; 238 static const LEX_WORD_ITEM_EX s_LiteralTable[]; 239 static const LEX_WORD_ITEM s_OperatorTable[]; 240 240 241 241 hash_map< wstring, int32_t > m_mapReservedWord; … … 311 311 \return 0:Success 312 312 */ 313 bool SetStream( istream *pstream, const wstring* pFilename = NULL );313 bool setStream( istream *pstream, const wstring* pFilename = NULL ); 314 314 315 315 /*EN Resets the streamistream pointer to the lexer … … 317 317 \return 0:Success 318 318 */ 319 bool ResetStream ();320 321 wstring& GetCurrentLineString();322 wstring& GetLineString( const uint32_t iLineNumber );319 bool resetStream (); 320 321 wstring& getCurrentLineString(); 322 wstring& getLineString( const uint32_t iLineNumber ); 323 323 private: 324 wchar_t GetNextInt8( void );325 wchar_t FetchNextChar( void );326 void UngetChar(wchar_t c );327 void UpdateLine( const int32_t iLine, const int32_t iColumn );324 wchar_t getNextInt8( void ); 325 wchar_t fetchNextChar( void ); 326 void ungetChar( const wchar_t c ); 327 void updateLine( const int32_t iLine, const int32_t iColumn ); 328 328 329 329 //--------------------------------------------------------- … … 351 351 }; 352 352 353 bool SetStream ( wstring* pString );354 bool ResetStream ();355 356 wstring& GetCurrentLineString();357 wstring& GetLineString( const uint32_t iLineNumber );353 bool setStream ( wstring* pString ); 354 bool resetStream (); 355 356 wstring& getCurrentLineString(); 357 wstring& getLineString( const uint32_t iLineNumber ); 358 358 private: 359 wchar_t GetNextInt8( void );360 wchar_t FetchNextChar( void );361 void UngetChar(wchar_t c );362 void UpdateLine( const int32_t iLine, const int32_t iColumn );359 wchar_t getNextInt8( void ); 360 wchar_t fetchNextChar( void ); 361 void ungetChar( const wchar_t c ); 362 void updateLine( const int32_t iLine, const int32_t iColumn ); 363 363 364 364 //--------------------------------------------------------- inc/parser.h
r110 r138 60 60 61 61 /*EN Retrieve Version Number of the parser*/ 62 const CRISCRIPT_VERSIONS& GetVersions(void) { return criscript_version_struct; }62 const CRISCRIPT_VERSIONS& getVersions(void) { return criscript_version_struct; } 63 63 64 64 bool init( CLexer* pCLexer, ICodeGen* pCodeGen, CErrorPool * pError ); … … 85 85 \return true: success, false: failuree 86 86 */ 87 int32_t Process( void );87 int32_t process( void ); 88 88 /*EN< Processes the attached script stream 89 89 \return 0: success … … 94 94 */ 95 95 96 ICodeGen* GetCodeGen(void) { assert( m_bInitialized ); return m_pCodeGen; }96 ICodeGen* getCodeGen(void) { assert( m_bInitialized ); return m_pCodeGen; } 97 97 /*EN< Retrieves an interface 98 98 \return Pointer to ICodeGen interface set to the parser 99 99 */ 100 CLexer* GetLexer(void) { assert( m_bInitialized ); return m_pLex; }100 CLexer* getLexer(void) { assert( m_bInitialized ); return m_pLex; } 101 101 /*EN< Retrieves an interface 102 102 \return Pointer to CLexer interface set to the parser … … 122 122 */ 123 123 124 /*EN Get a singleton instance of the parser */125 static CParser* Getparser() {124 /*EN get a singleton instance of the parser */ 125 static CParser* getparser() { 126 126 assert( m_pparser ); 127 127 return m_pparser; 128 128 }; 129 129 130 int32_t ProcessToken( void );131 int32_t GetToken( void );132 YYSTYPE GetTokenValue( void );130 int32_t processToken( void ); 131 int32_t getToken( void ); 132 YYSTYPE getTokenValue( void ); 133 133 private: 134 134 static CParser* m_pparser; inc/variable.h
r110 r138 312 312 \return flags 313 313 */ 314 OPERAND_FLAG GetFlag() { return (OPERAND_FLAG)iOperandFlag; }314 OPERAND_FLAG getFlag() { return (OPERAND_FLAG)iOperandFlag; } 315 315 316 316 /*EN Retrieves a stricted type of VM Object ref. inc/win32/StopWatch.h
r1 r138 37 37 void Stop(); 38 38 void Reset(); 39 float GetResult();39 float getResult(); 40 40 }; 41 41 samples/basic_native_userapi_bind/basic_native_userapi_bind.cpp
r110 r138 45 45 46 46 //Push a value to EvalStack 47 pVm-> PushEvalStack( var.fValue * 2.0f );47 pVm->pushEvalStack( var.fValue * 2.0f ); 48 48 return; 49 49 } … … 82 82 //Set filestream to the lexer 83 83 //---------------------------------------------------------------- 84 lex-> SetStream( & in );84 lex->setStream( & in ); 85 85 86 86 //---------------------------------------------------------------- 87 87 //Compile the script 88 88 //---------------------------------------------------------------- 89 iRet = parser-> Process();89 iRet = parser->process(); 90 90 91 if( error-> HasError() )91 if( error->hasError() ) 92 92 { 93 error-> DumpError();93 error->dumpError(); 94 94 iRet = 1; 95 95 } 96 96 else 97 97 { 98 if( error-> HasInformation() )99 error-> DumpError();98 if( error->hasInformation() ) 99 error->dumpError(); 100 100 101 101 //---------------------------------------------------------------- … … 107 107 //Bind IL and meta data 108 108 //---------------------------------------------------------------- 109 vm-> SetILPool( parser->getILPool() );109 vm->setILPool( parser->getILPool() ); 110 110 111 vm-> SetSymbolInformation( parser->getSymbolInformation() );112 vm-> SetMetaData( parser->getMetaData() );111 vm->setSymbolInformation( parser->getSymbolInformation() ); 112 vm->setMetaData( parser->getMetaData() ); 113 113 114 114 //---------------------------------------------------------------- … … 118 118 //API binding should be done after binding Metadata. 119 119 //Since the binding information is in the Metadata 120 vm-> BindBuiltinMethod( wstring( L"TestAPI" ),120 vm->bindBuiltinMethod( wstring( L"TestAPI" ), 121 121 (cri::PMETHOD)Test, 122 122 cri::RID_BUILTINPARAM_DEFAULT_ONE … … 124 124 125 125 //---------------------------------------------------------------- 126 // Execute the script126 //execute the script 127 127 //---------------------------------------------------------------- 128 iRet = vm-> Execute();129 iRet = vm-> GetExitCode();128 iRet = vm->execute(); 129 iRet = vm->getExitCode(); 130 130 131 131 delete( vm ); samples/basic_userapi_bind/basic_userapi_bind.cpp
r110 r138 84 84 //Set filestream to the lexer 85 85 //---------------------------------------------------------------- 86 lex-> SetStream( &in );86 lex->setStream( &in ); 87 87 88 88 //---------------------------------------------------------------- 89 89 //Compile the script 90 90 //---------------------------------------------------------------- 91 iRet = parser-> Process();91 iRet = parser->process(); 92 92 93 if( error-> HasError() )93 if( error->hasError() ) 94 94 { 95 error-> DumpError();95 error->dumpError(); 96 96 iRet = 1; 97 97 } 98 98 else 99 99 { 100 if( error-> HasInformation() )101 error-> DumpError();100 if( error->hasInformation() ) 101 error->dumpError(); 102 102 103 103 //---------------------------------------------------------------- … … 109 109 //Bind IL and meta data 110 110 //---------------------------------------------------------------- 111 vm-> SetILPool( parser->getILPool() );111 vm->setILPool( parser->getILPool() ); 112 112 113 vm-> SetSymbolInformation( parser->getSymbolInformation() );114 vm-> SetMetaData( parser->getMetaData() );113 vm->setSymbolInformation( parser->getSymbolInformation() ); 114 vm->setMetaData( parser->getMetaData() ); 115 115 116 116 //---------------------------------------------------------------- … … 120 120 //API binding should be done after binding Metadata. 121 121 //Since the binding information is in the Metadata 122 vm-> BindBuiltinMethod( wstring( L"TestAPI" ),122 vm->bindBuiltinMethod( wstring( L"TestAPI" ), 123 123 (cri::PMETHOD)cri::MakeWrapperStdP1< VMRET_FLOAT, VMARG_FLOAT >, 124 124 (cri::PMETHOD)Test ); 125 125 126 vm-> BindBuiltinMethod( wstring( L"TestAPINoReturn" ),126 vm->bindBuiltinMethod( wstring( L"TestAPINoReturn" ), 127 127 (cri::PMETHOD)cri::MakeWrapperStdVoidP1< VMARG_FLOAT >, 128 128 (cri::PMETHOD)TestNoReturn ); 129 129 130 130 //---------------------------------------------------------------- 131 // Execute the script131 //execute the script 132 132 //---------------------------------------------------------------- 133 iRet = vm-> Execute();134 iRet = vm-> GetExitCode();133 iRet = vm->execute(); 134 iRet = vm->getExitCode(); 135 135 136 136 delete( vm ); samples/helloworld/helloworld.cpp
r50 r138 47 47 cri::CCilCodeGen *codegen = new cri::CCilCodeGen; 48 48 cri::CErrorPool *error = new cri::CErrorPool; 49 parser-> Init( lex, codegen, error );49 parser->init( lex, codegen, error ); 50 50 51 51 //---------------------------------------------------------------- 52 52 //Set filestream to the lexer 53 53 //---------------------------------------------------------------- 54 lex-> SetStream( & in );54 lex->setStream( & in ); 55 55 56 56 //---------------------------------------------------------------- 57 57 //Compile the script 58 58 //---------------------------------------------------------------- 59 iRet = parser-> Process(); //Compile the script59 iRet = parser->process(); //Compile the script 60 60 61 if( error-> HasError() )61 if( error->hasError() ) 62 62 { 63 error-> DumpError();63 error->dumpError(); 64 64 iRet = 1; 65 65 } 66 66 else 67 67 { 68 if( error-> HasInformation() )69 error-> DumpError();68 if( error->hasInformation() ) 69 error->dumpError(); 70 70 71 71 //---------------------------------------------------------------- … … 74 74 cri::CCilVm *vm = new cri::CCilVm; 75 75 76 vm-> SetILPool( parser->GetILPool() ); //Set compiled byte code stream76 vm->setILPool( parser->getILPool() ); //Set compiled byte code stream 77 77 78 78 //Set metadata and debug information to VM 79 vm-> SetSymbolInformation( parser->GetSymbolInformation() );80 vm-> SetMetaData( parser->GetMetaData() );79 vm->setSymbolInformation( parser->getSymbolInformation() ); 80 vm->setMetaData( parser->getMetaData() ); 81 81 82 82 //---------------------------------------------------------------- 83 83 //Execute the script 84 84 //---------------------------------------------------------------- 85 iRet = vm-> Execute(); //execute the script86 iRet = vm-> GetExitCode(); //retrieve an exit code85 iRet = vm->execute(); //execute the script 86 iRet = vm->getExitCode(); //retrieve an exit code 87 87 88 88 delete( vm ); //delete VM instance samples/invoke_script_function/invoke_script_function.cpp
r110 r138 57 57 //Set filestream to the lexer 58 58 //---------------------------------------------------------------- 59 lex-> SetStream( (istream*)&in );59 lex->setStream( (istream*)&in ); 60 60 61 61 //---------------------------------------------------------------- 62 62 //Compile the script 63 63 //---------------------------------------------------------------- 64 iRet = parser-> Process();64 iRet = parser->process(); 65 65 66 if( error-> HasError() )66 if( error->hasError() ) 67 67 { 68 error-> DumpError();68 error->dumpError(); 69 69 iRet = 1; 70 70 } 71 71 else 72 72 { 73 if( error-> HasInformation() )74 error-> DumpError();73 if( error->hasInformation() ) 74 error->dumpError(); 75 75 76 76 //---------------------------------------------------------------- … … 82 82 //Bind IL and meta data 83 83 //---------------------------------------------------------------- 84 vm-> SetILPool( parser->getILPool() );85 vm-> SetSymbolInformation( parser->getSymbolInformation() );86 vm-> SetMetaData( parser->getMetaData() );84 vm->setILPool( parser->getILPool() ); 85 vm->setSymbolInformation( parser->getSymbolInformation() ); 86 vm->setMetaData( parser->getMetaData() ); 87 87 88 88 //---------------------------------------------------------------- 89 // Execute the script89 //execute the script 90 90 //---------------------------------------------------------------- 91 iRet = vm-> Execute();92 iRet = vm-> GetExitCode();91 iRet = vm->execute(); 92 iRet = vm->getExitCode(); 93 93 94 94 //---------------------------------------------------------------- 95 95 //Invoke the Script method 96 96 //---------------------------------------------------------------- 97 CG_SYMBOL_INFORMATION info = vm-> QuerySymbolInformation( wstring( L"Test" ) );97 CG_SYMBOL_INFORMATION info = vm->querySymbolInformation( wstring( L"Test" ) ); 98 98 CVariable var; 99 vm-> InvokeMethod( info.rid, 0, &var );99 vm->invokeMethod( info.rid, 0, &var ); 100 100 101 vm-> InvokeMethod( info.rid, 0, &var );101 vm->invokeMethod( info.rid, 0, &var ); 102 102 103 vm-> InvokeMethod( info.rid, 0, &var );103 vm->invokeMethod( info.rid, 0, &var ); 104 104 105 105 delete( vm ); samples/property_bind/property_bind.cpp
r110 r138 54 54 //Set filestream to the lexer 55 55 //---------------------------------------------------------------- 56 lex-> SetStream( (istream*)&in );56 lex->setStream( (istream*)&in ); 57 57 58 58 //---------------------------------------------------------------- 59 59 //Compile the script 60 60 //---------------------------------------------------------------- 61 iRet = parser-> Process();61 iRet = parser->process(); 62 62 63 if( error-> HasError() )63 if( error->hasError() ) 64 64 { 65 error-> DumpError();65 error->dumpError(); 66 66 iRet = 1; 67 67 } 68 68 else 69 69 { 70 if( error-> HasInformation() )71 error-> DumpError();70 if( error->hasInformation() ) 71 error->dumpError(); 72 72 73 73 //---------------------------------------------------------------- … … 79 79 //Bind IL and meta data 80 80 //---------------------------------------------------------------- 81 vm-> SetILPool( parser->getILPool() );82 vm-> SetSymbolInformation( parser->getSymbolInformation() );83 vm-> SetMetaData( parser->getMetaData() );81 vm->setILPool( parser->getILPool() ); 82 vm->setSymbolInformation( parser->getSymbolInformation() ); 83 vm->setMetaData( parser->getMetaData() ); 84 84 85 85 //---------------------------------------------------------------- … … 87 87 //---------------------------------------------------------------- 88 88 CVariable var( 8960 ); 89 vm-> BindBuiltinVariable( wstring( L"System.MyProperty" ), &var );89 vm->bindBuiltinVariable( wstring( L"System.MyProperty" ), &var ); 90 90 91 91 //---------------------------------------------------------------- 92 // Execute the script92 //execute the script 93 93 //---------------------------------------------------------------- 94 iRet = vm-> Execute();95 iRet = vm-> GetExitCode();94 iRet = vm->execute(); 95 iRet = vm->getExitCode(); 96 96 97 97 //---------------------------------------------------------------- … … 101 101 //Need to know RID of the field. 102 102 //To get the RID, currently need to invoke the debugger API 103 CG_SYMBOL_INFORMATION info = vm-> QuerySymbolInformation( wstring( L"scriptVar" ) );104 CVariable varScript = vm-> GetStaticField( info.rid );103 CG_SYMBOL_INFORMATION info = vm->querySymbolInformation( wstring( L"scriptVar" ) ); 104 CVariable varScript = vm->getStaticField( info.rid ); 105 105 106 106 delete( vm ); source-archive-win32.txt
r111 r138 79 79 CriScript\samples\property_bind\mkwin32\property_bind.sln 80 80 CriScript\samples\property_bind\mkwin32\property_bind.vcproj 81 CriScript\samples\vm_control\vm_control.cpp 82 CriScript\samples\vm_control\stdafx.cpp 83 CriScript\samples\vm_control\stdafx.h 84 CriScript\samples\vm_control\mkwin32\vm_control.sln 85 CriScript\samples\vm_control\mkwin32\vm_control.vcproj 86 CriScript\samples\build_all\criscriptsamples.sln 81 87 82 88 //Sources src/BuiltInObject/cil/cilBuiltinArrayObject.cpp
r110 r138 106 106 107 107 //Initialize Global 'Array' object ref 108 RID rid = CodeGen.getMetaData(). GenerateStaticFieldRID( OPERAND_OBJECTREF,108 RID rid = CodeGen.getMetaData().generateStaticFieldRID( OPERAND_OBJECTREF, 109 109 OPERAND_FLAG( OPERAND_FLAG_DONTDELETE 110 110 | OPERAND_FLAG_DONTENUM … … 137 137 bool CArrayObject::InitializeVm( CCilVm& vm ) 138 138 { 139 int32_t iIndex = IndexFromBuiltinRid( vm. GetArrayObjectRID() );140 RID ridObjectName = vm.getMetaData(). GetBuiltinObjectTable()[ iIndex ].GetObjectName();139 int32_t iIndex = IndexFromBuiltinRid( vm.getArrayObjectRID() ); 140 RID ridObjectName = vm.getMetaData().getBuiltinObjectTable()[ iIndex ].getObjectName(); 141 141 assert( ridObjectName != RID_NOTDEFINED ); 142 142 143 RID rid = vm. CreatePrototypeObject( vm.GetArrayObjectRID(),143 RID rid = vm.createPrototypeObject( vm.getArrayObjectRID(), 144 144 ridObjectName, 145 vm. GetObjectRID() );146 assert( rid == vm. GetArrayObjectRID() );145 vm.getObjectRID() ); 146 assert( rid == vm.getArrayObjectRID() ); 147 147 148 148 //--------------------------------------------------------------------------- 149 149 //Bind global object 150 150 //--------------------------------------------------------------------------- 151 CVmObject* pObj = vm. CreateObject( vm.GetArrayObjectRID() );151 CVmObject* pObj = vm.createObject( vm.getArrayObjectRID() ); 152 152 CVariable obj( pObj, OPERAND_FLAG( OPERAND_FLAG_DONTDELETE 153 153 | OPERAND_FLAG_DONTENUM … … 155 155 156 156 //Set true as an object value.. 157 pObj-> SetValue( CVariable( true ) );158 159 CG_SYMBOL_INFORMATION info = vm. QuerySymbolInformation( NAME_BUILTIN_ARRAY_OBJECT );160 vm. SetStaticField( info.rid, obj, true ); //Force over write it157 pObj->setValue( CVariable( true ) ); 158 159 CG_SYMBOL_INFORMATION info = vm.querySymbolInformation( NAME_BUILTIN_ARRAY_OBJECT ); 160 vm.setStaticField( info.rid, obj, true ); //Force over write it 161 161 162 162 //--------------------------------------------------------------------------- … … 167 167 int32_t iParams; 168 168 iParams = (int32_t)RidFromToken( initParams[ i ].ridParam ); 169 if( IsBuiltinRid( initParams[ i ].ridParam ) )169 if( isBuiltinRid( initParams[ i ].ridParam ) ) 170 170 { 171 171 iParams = RidFromToken( -iParams ) - 1; … … 175 175 //Register methods 176 176 //----------------------------------------------------------------------- 177 bool b = vm. BindBuiltinMethod(177 bool b = vm.bindBuiltinMethod( 178 178 wstring( initParams[ i ].pStrSymbol ), 179 179 initParams[ i ].pMethod, … … 205 205 206 206 //Set prototype: Array prototype object 207 var.refObject-> SetPrototypeObject(208 &pVm-> GetPrototypeObject( pVm->GetArrayObjectRID() ) );209 210 // SetProperty Accessor211 var.refObject-> SetPropertyAccessor( STRING_INTERNAL_LENGTH,207 var.refObject->setPrototypeObject( 208 &pVm->getPrototypeObject( pVm->getArrayObjectRID() ) ); 209 210 //setProperty Accessor 211 var.refObject->setPropertyAccessor( STRING_INTERNAL_LENGTH, 212 212 lengthAccessor ); 213 // SetProperty Accessor214 var.refObject-> SetPropertyAccessor( STRING_PROPERTY_INTERNAL_ANY,213 //setProperty Accessor 214 var.refObject->setPropertyAccessor( STRING_PROPERTY_INTERNAL_ANY, 215 215 anyAccessor ); 216 216 … … 228 228 { 229 229 //Throw TypeError 230 pVm-> ThrowException( &wstring( ERRORSTRING_OUTOFMEMORY ),230 pVm->throwException( &wstring( ERRORSTRING_OUTOFMEMORY ), 231 231 &wstring( NAME_BUILTIN_ERROR_OBJECT ), 232 232 ERROR_OUT_OF_MEMORY ); … … 237 237 { 238 238 //Throw TypeError 239 pVm-> ThrowException( &wstring( ERRORSTRING_ARRAY_LENGTH ),239 pVm->throwException( &wstring( ERRORSTRING_ARRAY_LENGTH ), 240 240 &wstring( NAME_BUILTIN_ERROR_OBJECT ), 241 241 ERROR_ARRAY_LENGTH ); … … 254 254 //Argument: 1) value of the property 255 255 swprintf( strBuffer, 22, L"%d", i ); 256 var.refObject-> SetProperty( strBuffer, *pArguments );256 var.refObject->setProperty( strBuffer, *pArguments ); 257 257 pArguments++; 258 258 } … … 261 261 //Just set length 262 262 //Set to ".lengh" 263 var.refObject-> SetProperty( STRING_PROPERTY_INTERNAL_LENGTH,263 var.refObject->setProperty( STRING_PROPERTY_INTERNAL_LENGTH, 264 264 CVariable( (int32_t)iArrayLength, 265 265 OPERAND_FLAG( OPERAND_FLAG_DONTDELETE | OPERAND_FLAG_DONTENUM ) ) ); … … 274 274 //Argument: 1) value of the property 275 275 swprintf( strBuffer, 22, L"%d", i ); 276 var.refObject-> SetProperty( strBuffer, *pArguments );276 var.refObject->setProperty( strBuffer, *pArguments ); 277 277 pArguments++; 278 278 } 279 279 280 280 //Set to ".lengh" 281 var.refObject-> SetProperty( STRING_PROPERTY_INTERNAL_LENGTH,281 var.refObject->setProperty( STRING_PROPERTY_INTERNAL_LENGTH, 282 282 CVariable( (int32_t)iNumArguments - 1, 283 283 OPERAND_FLAG( OPERAND_FLAG_DONTDELETE | OPERAND_FLAG_DONTENUM ) ) … … 299 299 300 300 if( OperandType( pArguments->iOperandType ) != OPERAND_OBJECTREF 301 || pArguments->refObject-> GetRID() != pVm->GetArrayObjectRID() )301 || pArguments->refObject->getRID() != pVm->getArrayObjectRID() ) 302 302 { 303 303 //Throw TypeError 304 pVm-> ThrowException( &wstring( ERRORSTRING_TYPEERROR_ARRAY_TOSTRING ),304 pVm->throwException( &wstring( ERRORSTRING_TYPEERROR_ARRAY_TOSTRING ), 305 305 &wstring( NAME_BUILTIN_ERROR_OBJECT ), 306 306 ERROR_TYPEERROR_ARRAY_TOSTRING ); … … 337 337 338 338 //Initialize destination variable in the eval stack 339 pVm-> PushEvalStackUndefined();339 pVm->pushEvalStackUndefined(); 340 340 341 CVariable& var = pVm-> GetEvalStackFirstEntry();341 CVariable& var = pVm->getEvalStackFirstEntry(); 342 342 var.iOperandType = OPERAND_STRING; 343 343 var.pString = new wstring(L""); … … 345 345 uint32_t iIndex = 0; 346 346 uint32_t iLength = 0; 347 hash_map< wstring, CVariable >::iterator itStart = varThis.refObject-> GetPropertyMap().begin();348 hash_map< wstring, CVariable >::iterator itEnd = varThis.refObject-> GetPropertyMap().end();347 hash_map< wstring, CVariable >::iterator itStart = varThis.refObject->getPropertyMap().begin(); 348 hash_map< wstring, CVariable >::iterator itEnd = varThis.refObject->getPropertyMap().end(); 349 349 while( itStart != itEnd ) 350 350 { … … 361 361 swprintf( strIndex, 16, L"%d", iIndex ); 362 362 CVariable* pvar; 363 pvar = varThis.refObject-> LookupProperty( strIndex );363 pvar = varThis.refObject->lookupProperty( strIndex ); 364 364 if( iIndex ) 365 365 var.pString->append( sSeparator ); … … 398 398 399 399 if( OperandType( pArguments->iOperandType ) != OPERAND_OBJECTREF 400 || pArguments->refObject-> GetRID() != pVm->GetArrayObjectRID() )400 || pArguments->refObject->getRID() != pVm->getArrayObjectRID() ) 401 401 { 402 402 //Throw TypeError 403 pVm-> ThrowException( &wstring( ERRORSTRING_TYPEERROR_ARRAY_TOSTRING ),403 pVm->throwException( &wstring( ERRORSTRING_TYPEERROR_ARRAY_TOSTRING ), 404 404 &wstring( NAME_BUILTIN_ERROR_OBJECT ), 405 405 ERROR_TYPEERROR_ARRAY_TOSTRING ); … … 408 408 } 409 409 410 hash_map< wstring, CVariable >& map = varThis.refObject-> GetPropertyMap();410 hash_map< wstring, CVariable >& map = varThis.refObject->getPropertyMap(); 411 411 412 412 hash_map< wstring, CVariable >::iterator itBegin = map.begin(); … … 439 439 pArguments++; 440 440 if( pArguments->iOperandType == OPERAND_OBJECTREF 441 && pArguments->refObject-> GetCall() )441 && pArguments->refObject->getCall() ) 442 442 { 443 443 //Cmp function is given as 1st argument 444 g_ridPredicater = pArguments->refObject-> GetCall();444 g_ridPredicater = pArguments->refObject->getCall(); 445 445 g_pVm = pVm; 446 446 std::sort( itVecBegin, itVecEnd, CilPredicater ); … … 479 479 } 480 480 481 pVm-> PushEvalStack( varThis );481 pVm->pushEvalStack( varThis ); 482 482 return; 483 483 } … … 494 494 vars[ 2 ] = elem2; 495 495 496 CVariable* pResult = g_pVm-> InvokeMethod( g_ridPredicater,496 CVariable* pResult = g_pVm->invokeMethod( g_ridPredicater, 497 497 3, 498 498 vars ); … … 589 589 { 590 590 //Getter implementation 591 return pObject-> LookupProperty( STRING_PROPERTY_INTERNAL_LENGTH );591 return pObject->lookupProperty( STRING_PROPERTY_INTERNAL_LENGTH ); 592 592 } 593 593 else … … 597 597 598 598 //Check existing length 599 CVariable* pCurrentLengthVar = pObject-> LookupProperty( STRING_PROPERTY_INTERNAL_LENGTH );599 CVariable* pCurrentLengthVar = pObject->lookupProperty( STRING_PROPERTY_INTERNAL_LENGTH ); 600 600 601 601 if( pCurrentLengthVar != NULL ) … … 607 607 608 608 //Just expanding the array, nothing to do 609 pObject-> SetProperty( STRING_PROPERTY_INTERNAL_LENGTH,609 pObject->setProperty( STRING_PROPERTY_INTERNAL_LENGTH, 610 610 CVariable( iGivenIndex, 611 611 OPERAND_FLAG( OPERAND_FLAG_DONTDELETE | OPERAND_FLAG_DONTENUM ) ) ); … … 617 617 618 618 hash_map< wstring, CVariable >::iterator itStart = 619 pObject-> GetPropertyMap().begin();619 pObject->getPropertyMap().begin(); 620 620 hash_map< wstring, CVariable >::iterator itEnd = 621 pObject-> GetPropertyMap().end();621 pObject->getPropertyMap().end(); 622 622 while( itStart != itEnd && iNumToEliminate ) 623 623 { … … 633 633 if( _wtoi( String.data() ) >= iGivenIndex ) 634 634 { 635 pObject-> RemoveProperty( String );635 pObject->removeProperty( String ); 636 636 iNumToEliminate--; 637 637 } … … 662 662 else 663 663 { 664 pObject-> SetProperty( *pName, *pVar );664 pObject->setProperty( *pName, *pVar ); 665 665 666 666 //Setter implementation … … 668 668 669 669 //Check existing length 670 CVariable* pCurrentLengthVar = pObject-> LookupProperty( STRING_PROPERTY_INTERNAL_LENGTH );670 CVariable* pCurrentLengthVar = pObject->lookupProperty( STRING_PROPERTY_INTERNAL_LENGTH ); 671 671 672 672 if( pCurrentLengthVar != NULL ) … … 679 679 if( iGivenIndex > iLength ) 680 680 { 681 pObject-> SetProperty( STRING_PROPERTY_INTERNAL_LENGTH,681 pObject->setProperty( STRING_PROPERTY_INTERNAL_LENGTH, 682 682 CVariable( iGivenIndex, OPERAND_FLAG( OPERAND_FLAG_DONTDELETE | OPERAND_FLAG_DONTENUM ) ) ); 683 683 } src/BuiltInObject/cil/cilBuiltinBooleanObject.cpp
r110 r138 79 79 80 80 //Initialize Global 'Boolean' object ref 81 RID rid = CodeGen.getMetaData(). GenerateStaticFieldRID( OPERAND_OBJECTREF,81 RID rid = CodeGen.getMetaData().generateStaticFieldRID( OPERAND_OBJECTREF, 82 82 OPERAND_FLAG( 83 83 OPERAND_FLAG_DONTDELETE … … 111 111 bool CBooleanObject::InitializeVm( CCilVm& vm ) 112 112 { 113 RID rid = vm. CreatePrototypeObject( vm.GetBooleanObjectRID(),114 vm.getMetaData(). GetObjectNameRID( vm.GetBooleanObjectRID() ),115 vm. GetObjectRID() );116 117 assert( rid == vm. GetBooleanObjectRID() );113 RID rid = vm.createPrototypeObject( vm.getBooleanObjectRID(), 114 vm.getMetaData().getObjectNameRID( vm.getBooleanObjectRID() ), 115 vm.getObjectRID() ); 116 117 assert( rid == vm.getBooleanObjectRID() ); 118 118 119 119 //--------------------------------------------------------------------------- 120 120 //Bind global object 121 121 //--------------------------------------------------------------------------- 122 CVmObject* pObj = vm. CreateObject( vm.GetBooleanObjectRID() );122 CVmObject* pObj = vm.createObject( vm.getBooleanObjectRID() ); 123 123 CVariable obj( pObj, OPERAND_FLAG( OPERAND_FLAG_DONTDELETE 124 124 | OPERAND_FLAG_DONTENUM … … 126 126 127 127 //Set true as an object value.. 128 pObj-> SetValue( CVariable( true ) );129 130 CG_SYMBOL_INFORMATION info = vm. QuerySymbolInformation( NAME_BUILTIN_BOOLEAN_OBJECT );131 vm. SetStaticField( info.rid, obj, true ); //Force over write it128 pObj->setValue( CVariable( true ) ); 129 130 CG_SYMBOL_INFORMATION info = vm.querySymbolInformation( NAME_BUILTIN_BOOLEAN_OBJECT ); 131 vm.setStaticField( info.rid, obj, true ); //Force over write it 132 132 133 133 //Add properties of prototype object here … … 139 139 int32_t iParams; 140 140 iParams = (int32_t)RidFromToken( initParams[ i ].ridParam ); 141 if( IsBuiltinRid( initParams[ i ].ridParam ) )141 if( isBuiltinRid( initParams[ i ].ridParam ) ) 142 142 { 143 143 iParams = RidFromToken( -iParams ) - 1; … … 147 147 //Register methods 148 148 //----------------------------------------------------------------------- 149 bool b = vm. BindBuiltinMethod(149 bool b = vm.bindBuiltinMethod( 150 150 wstring( initParams[ i ].pStrSymbol ), 151 151 initParams[ i ].pMethod, … … 170 170 assert( OperandType(thisobj.iOperandType) == OPERAND_OBJECTREF ); 171 171 172 thisobj.refObject-> SetRID( pVm->GetBooleanObjectRID() );172 thisobj.refObject->setRID( pVm->getBooleanObjectRID() ); 173 173 174 174 //Set prototype: String prototype object 175 thisobj.refObject-> SetPrototypeObject(176 &pVm-> GetPrototypeObject( pVm->GetBooleanObjectRID() ) );175 thisobj.refObject->setPrototypeObject( 176 &pVm->getPrototypeObject( pVm->getBooleanObjectRID() ) ); 177 177 178 178 if( iNumArguments > 1 ) … … 188 188 case OPERAND_DOUBLE: 189 189 case OPERAND_BOOLEAN: 190 thisobj.refObject-> SetValue( *pArguments );190 thisobj.refObject->setValue( *pArguments ); 191 191 break; 192 192 case OPERAND_STRING: … … 194 194 case OPERAND_NULL: 195 195 case OPERAND_OBJECTREF: 196 thisobj.refObject-> SetValue( CVariable( pArguments->toBoolean() ) );196 thisobj.refObject->setValue( CVariable( pArguments->toBoolean() ) ); 197 197 break; 198 198 default: … … 213 213 assert( iNumArguments >= 1 ); 214 214 CVariable varRet( 0 ); 215 pVm-> PushEvalStackVariable( varRet );215 pVm->pushEvalStackVariable( varRet ); 216 216 217 217 if( iNumArguments > 1 ) … … 228 228 case OPERAND_DOUBLE: 229 229 case OPERAND_BOOLEAN: 230 var.moveTo( pVm-> GetEvalStackFirstEntry() );230 var.moveTo( pVm->getEvalStackFirstEntry() ); 231 231 break; 232 232 case OPERAND_UNDEFINED: … … 268 268 { 269 269 CVmObject* pObj = pArguments->refObject; 270 b = pObj-> GetValue().toBoolean();270 b = pObj->getValue().toBoolean(); 271 271 } 272 272 break; … … 275 275 } 276 276 if( b ) 277 pVm-> PushEvalStackString( STRING_INTERNAL_TRUE );277 pVm->pushEvalStackString( STRING_INTERNAL_TRUE ); 278 278 else 279 pVm-> PushEvalStackString( STRING_INTERNAL_FALSE );279 pVm->pushEvalStackString( STRING_INTERNAL_FALSE ); 280 280 return; 281 281 } src/BuiltInObject/cil/cilBuiltinDateObject.cpp
r110 r138 197 197 198 198 //Initialize Global 'Date' object ref 199 RID rid = CodeGen.getMetaData(). GenerateStaticFieldRID( OPERAND_OBJECTREF,199 RID rid = CodeGen.getMetaData().generateStaticFieldRID( OPERAND_OBJECTREF, 200 200 OPERAND_FLAG( 201 201 OPERAND_FLAG_DONTDELETE … … 229 229 bool CDateObject::InitializeVm( CCilVm& vm ) 230 230 { 231 RID rid = vm. CreatePrototypeObject( vm.GetDateObjectRID(),232 vm.getMetaData(). GetObjectNameRID( vm.GetDateObjectRID() ),233 vm. GetObjectRID() );234 235 assert( rid == vm. GetDateObjectRID() );231 RID rid = vm.createPrototypeObject( vm.getDateObjectRID(), 232 vm.getMetaData().getObjectNameRID( vm.g
