C++ (Cpp) vm_stack Example

Introduction

The c++ (cpp) vm_stack example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: C++ (Cpp)

Class/type: vm_stack

Example#1
File: gameswf_avm2.cppProject: Badcreature/sagcg

tu_string as_3_function::get_multiname ( int index, vm_stack &stack ) const
{
    multiname::kind kind = ( multiname::kind ) m_abc->get_multiname_type ( index );

    switch ( kind )
    {
    case multiname::CONSTANT_MultinameL :
        assert ( stack.top ( 0 ).is_string() || stack.top ( 0 ).is_number() );
        return stack.pop().to_string();
        break;

    case multiname::CONSTANT_Multiname:
    case multiname::CONSTANT_QName:
        return m_abc->get_multiname ( index );

    default:
        assert ( !"todo" );
        return "";
    }
}

Example#2
File: fn.hppProject: AnthonyNystrom/r17

 inline static size_t call(vm_stack &stk, size_t else_offset) {
   dt::boolean cond; stk.pop(cond); return cond ? 1 : else_offset;
 }