std::string _json_token::to_string( __in_opt bool verbose ) { std::stringstream result; TRACE_ENTRY(); SERIALIZE_CALL_RECUR(m_lock); if(verbose) { result << json_uuid_class::to_string() << " "; } result << "[0x" << VALUE_AS_HEX(type_t, m_type); if(m_subtype != INVALID_TOKEN_TYPE) { result << ", 0x" << VALUE_AS_HEX(type_t, m_subtype); } result << "]"; if(!m_text.empty()) { result << " \'" << m_text << "\' (" << m_text.size() << ")"; } if(!m_source.empty()) { result << " (\'" << m_source << "\' (" << m_line << "))"; } result << " Value: " << m_value; TRACE_EXIT("Return Value: 0x%x", 0); return result.str(); }
int main( __in int argc, __in const char **argv ) { neserr_t result = NES_ERR_NONE; #ifndef NDEBUG std::stringstream stream; size_t failure, inconclusive, success; #else nes_context context = { 0 }; #endif // NDEBUG try { std::cout << "NES " << nes_version() << std::endl; #ifndef NDEBUG if(!nes::run_tests(stream, success, failure, inconclusive)) { std::cout << "---" << std::endl << stream.str() << std::endl; } #else if(argc < USAGE_ARG_MIN) { std::cerr << "USAGE: " << argv[0] << USAGE_ARG_STR << std::endl; result = NES_ERR_INVALID_ARGUMENT; } else { result = nes_initialize(&context); if(!NES_SUCCESS(result)) { std::cerr << "nes_initialize failed, status 0x" << VALUE_AS_HEX(neserr_t, result) << std::endl; } else { result = nes_run(&context, argv[1], std::atoi(argv[2])); if(!NES_SUCCESS(result)) { std::cerr << "nes_run failed, status 0x" << VALUE_AS_HEX(neserr_t, result) << std::endl; } result = nes_uninitialize(&context); if(!NES_SUCCESS(result)) { std::cerr << "nes_uninitialize failed, status 0x" << VALUE_AS_HEX(neserr_t, result) << std::endl; } } } #endif // NDEBUG } catch(nes_exception &exc) { std::cerr << exc.to_string(true) << std::endl; result = NES_ERR_FAILURE; } catch(std::exception &exc) { std::cerr << exc.what() << std::endl; result = NES_ERR_FAILURE; } return result; }
std::string _lexer_base::to_string( __in_opt bool verbose ) { char current_character; std::stringstream stream; TRACE_ENTRY(); SERIALIZE_CALL_RECURSIVE(m_lexer_base_lock); current_character = lexer_base::get_character(); if(verbose) { stream << "[" << CHARACTER_TYPE_STRING(m_character_type) << "] "; } if(isprint(current_character)) { stream << "\'" << current_character << "\' "; } stream << "(" << VALUE_AS_HEX(uint8_t, current_character) << ") (pos. " << m_character_position << ", col. " << m_character_column << ", row. " << m_character_row << ")"; TRACE_EXIT(); return stream.str(); }
std::string _nes_rom::to_string( __in_opt bool verbose ) { nes_rom_header head; std::stringstream result; ATOMIC_CALL_RECUR(m_lock); result << "<" << NES_ROM_HEADER << "> (" << (m_initialized ? INITIALIZED : UNINITIALIZED) << ", " << (m_loaded ? "LOADED" : "UNLOADED"); if(verbose) { result << "ptr. 0x" << VALUE_AS_HEX(nes_rom_ptr, this); } result << ")"; if(m_initialized && m_loaded) { header(head); result << ", SZ: " << (m_block.size() / BYTES_PER_KBYTE) << " KB (" << m_block.size() << " BTYES)" << std::endl << nes_rom::header_as_string(head, verbose); } return result.str(); }
std::wstring _daijoubu_node_factory::to_string( __in_opt bool verbose ) { std::wstringstream result; std::map<daijoubu_uid, std::pair<daijoubu_node, size_t>>::iterator iter; SERIALIZE_CALL_RECUR(m_lock); result << DAIJOUBU_NODE_HEADER << L" [" << (m_initialized ? L"INITIALIZED" : L"UNINITIALIZED") << L"] (" << VALUE_AS_HEX(uintptr_t, this) << L"), COUNT: " << m_node_map.size(); if(verbose) { for(iter = m_node_map.begin(); iter != m_node_map.end(); ++iter) { result << std::endl << L"{" << VALUE_AS_HEX(daijoubu_uid, iter->first) << L"}, REFERENCES: " << iter->second.second << L", " << iter->second.first.to_string(true); } } return CHECK_STRING(result.str()); }
std::wstring _daijoubu_node::node_as_string( __in const _daijoubu_node &node, __in_opt bool verbose ) { uint8_t flag = 0; std::wstringstream result; if(verbose) { result << L"(" << VALUE_AS_HEX(daijoubu_uid, node.m_uid) << L") "; } result << CHECK_STRING(daijoubu::acquire()->acquire_token_factory()->at( node.m_token).to_string(verbose)) << L" [" << node.m_children.size() << L"]"; if(node.m_children.empty()) { flag |= DAIJOUBU_LEAF_NODE; } if(node.m_parent == INVALID_NODE_PARENT) { flag |= DAIJOUBU_ROOT_NODE; } if(verbose && flag) { result << L" ("; if(flag & DAIJOUBU_ROOT_NODE) { result << L"ROOT"; if(flag & DAIJOUBU_LEAF_NODE) { result << L", LEAF"; } } else if(flag & DAIJOUBU_LEAF_NODE) { result << L"LEAF"; } result << L")"; } return CHECK_STRING(result.str()); }
std::string _nes_ppu::to_string( __in_opt bool verbose ) { std::stringstream result; ATOMIC_CALL_RECUR(m_lock); result << "<" << NES_PPU_HEADER << "> (" << (m_initialized ? INITIALIZED : UNINITIALIZED); if(verbose) { result << "ptr. 0x" << VALUE_AS_HEX(nes_ppu_ptr, this); } result << ")"; if(m_initialized) { result << ", CYC: " << m_cycles; } return result.str(); }