`ostream output` C++ Examples
60 C++ code examples are found related to "ostream output".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: get_source_location.cpp From HSCC with GNU General Public License v2.0 | 7 votes |
static void output(ADDRINT address, ostream* printTo, INS ins = INS_Invalid()) { string filename; // This will hold the source file name. INT32 line = 0; // This will hold the line number within the file. // In this example, we don't print the column number so there is no reason to obtain it. // Simply pass a NULL pointer instead. Also, acquiring the client lock is not required in // instrumentation functions, only in analysis functions. // PIN_GetSourceLocation(address, NULL, &line, &filename); // Prepare the output strings. string asmOrFuncName; if (INS_Valid(ins)) { asmOrFuncName = INS_Disassemble(ins); // For an instruction, get the disassembly. } else {
Example 2
Source File: PrintSeeds.cpp From redex with MIT License | 6 votes |
void print_field_seeds(std::ostream& output, const ProguardMap& pg_map, const std::string& class_name, const Container& fields, const bool allowshrinking_filter, const bool allowobfuscation_filter) { for (DexField* field : fields) { if (!impl::KeepState::has_keep(field) || (allowshrinking_filter && !impl::KeepState::allowshrinking(field)) || (allowobfuscation_filter && !impl::KeepState::allowobfuscation(field))) { return; } redex::print_field(output, pg_map, class_name, field); }; }
Example 3
Source File: wf_types.cc From verona with MIT License | 6 votes |
void visit_signature(FnSignature* signature, std::ostream& output) { visit_generics(signature->generics.get(), output); if (signature->receiver) visit_type( signature->types.receiver, signature->receiver->type_expression->source_range, output); for (const auto& [ty, param] : safe_zip(signature->types.arguments, signature->parameters)) { visit_type(ty, param->type_expression->source_range, output); } if (signature->return_type_expression) visit_type( signature->types.return_type, signature->return_type_expression->source_range, output); }
Example 4
Source File: IzkExample.cpp From CARLsim4 with MIT License | 6 votes |
void run(const ParameterInstances ¶meters, std::ostream &outputStream) const { if (printTimeSeries) // Only works in the two-input case. printf("input, ms, p1_spike, p2_spike, h1_voltage, h2_voltage, h1_spike, h2_spike, o_voltage, o_spike\n"); // Generate a set of inputs to test the network with. const std::vector< std::vector<bool> > inputInstances = getInputPermutations(numInputs); // Build a network and execute it on each input individually. for (int i = 0; i < parameters.getNumInstances(); i++) { const std::vector<double> weights = parameters.getInstance(i); double numCorrect = 0; for (int j = 0; j < inputInstances.size(); j++) { // Run the network const double result = runSingleSimulation(inputInstances[j], weights); // Compare the result to an n-arity exclusive OR function. const bool expected = nXor(inputInstances[j]); numCorrect += 1.0 - fabs(expected - result); } const double fitness = static_cast<double>(numCorrect)/inputInstances.size(); outputStream << fitness << std::endl; } }
Example 5
Source File: GenerateTypedPropertyEnums.cpp From OSVR-Vive with Apache License 2.0 | 6 votes |
bool processEnumValues(Json::Value const &values, std::ostream &output) { std::vector<std::string> names; for (auto &enumVal : values) { auto name = enumVal["name"].asString(); auto d = NameDecomp{name}; if (shouldIgnoreType(d.typeSuffix) || (d.typeSuffix.length() == 0)) { continue; } names.push_back(name); #if 0 std::cout << "Name: " << name << " Clean name: " << d.cleanName << " Value type: " << d.typeSuffix << std::endl; #endif if (g_cleanNames.contains(d.cleanName)) { std::cerr << "Ambiguous clean name found! " << d.cleanName << " (second type was " << d.typeSuffix << ")" << std::endl; g_ambiguousNames.insert(d.cleanName); } else { g_cleanNames.insert(d.cleanName); } g_typeSuffixes.insert(d.typeSuffix); g_fullNameToTypeSuffix.emplace_back(name, d.typeSuffix); }
Example 6
Source File: NullnessDomain.cpp From redex with MIT License | 6 votes |
std::ostream& operator<<(std::ostream& output, const Nullness& nullness) { switch (nullness) { case NN_BOTTOM: { output << "BOTTOM"; break; } case UNINITIALIZED: { output << "UNINIT"; break; } case IS_NULL: { output << "NULL"; break; } case NOT_NULL: { output << "NOTNULL"; break; } case NN_TOP: { output << "NULLABLE"; break; } } return output; }
Example 7
Source File: PrintSeeds.cpp From redex with MIT License | 6 votes |
void print_method_seeds(std::ostream& output, const ProguardMap& pg_map, const std::string& class_name, const Container& methods, const bool allowshrinking_filter, const bool allowobfuscation_filter) { for (DexMethod* method : methods) { if (impl::KeepState::has_keep(method) || (allowshrinking_filter && !impl::KeepState::allowshrinking(method)) || (allowobfuscation_filter && !impl::KeepState::allowobfuscation(method))) { return; } redex::print_method(output, pg_map, class_name, method); } }
Example 8
Source File: compile.cpp From nncase with Apache License 2.0 | 6 votes |
void dump_graph(TGraph &graph, std::ostream &output) { graph.assign_names(); output << "digraph \"graph\" {\n"; output << "node [shape=\"record\"]\n"; for (auto &&node : graph.nodes()) output << "\"" << node->name() << "\" [label=\"{" << node_opcode_names(node->runtime_opcode()) << "}\"]\n"; for (auto &&node : graph.nodes()) { for (auto &&out : node->outputs()) { auto shape = to_string(out.shape()); for (auto &&conn : out.connections()) { output << "\"" << node->name() << "\"->\"" << conn->owner().name() << "\" [label=\"" << shape << "\"]\n"; } } } output << "}" << std::endl; }
Example 9
Source File: syscalls_test_driver.cc From asylo with Apache License 2.0 | 6 votes |
void PrintTo(const struct stat &stat_buffer, std::ostream *output_stream) { *output_stream << absl::StrCat( "struct stat { st_dev = ", stat_buffer.st_dev, " , st_ino = ", stat_buffer.st_ino, " , st_mode = ", stat_buffer.st_mode, " , st_nlink = ", stat_buffer.st_nlink, " , st_uid = ", stat_buffer.st_uid, " , st_gid = ", stat_buffer.st_gid, " , st_rdev = ", stat_buffer.st_rdev, " , st_size = ", stat_buffer.st_size, " , st_atime = ", stat_buffer.st_atime, " , st_mtime = ", stat_buffer.st_mtime, " , st_ctime = ", stat_buffer.st_ctime, " , st_blksize = ", stat_buffer.st_blksize, " , st_blocks = ", stat_buffer.st_blocks, " }"); }
Example 10
Source File: obfuscate.cc From verible with Apache License 2.0 | 6 votes |
absl::Status ObfuscateVerilogCode(absl::string_view content, std::ostream* output, IdentifierObfuscator* subst) { VLOG(1) << __FUNCTION__; std::ostringstream buffer; ObfuscateVerilogCodeInternal(content, &buffer, subst); // Always verify equivalence. const auto eq_status = VerifyEquivalence(content, buffer.str()); if (!eq_status.ok()) return eq_status; // Always verify decoding. const auto verify_status = VerifyDecoding(content, buffer.str(), *subst); if (!verify_status.ok()) return verify_status; *output << buffer.str(); return absl::OkStatus(); }
Example 11
Source File: logger_kernel_1.cpp From android-face-landmarks with MIT License | 6 votes |
void set_all_logging_output_streams ( std::ostream& out_ ) { logger::global_data& gd = logger::get_global_data(); auto_mutex M(gd.m); gd.loggers.reset(); while (gd.loggers.move_next()) { gd.loggers.element()->out.rdbuf(out_.rdbuf()); gd.loggers.element()->hook.clear(); } gd.set_output_stream("",out_); // set the default hook to be an empty member function pointer logger::hook_mfp hook; gd.set_output_hook("",hook); }
Example 12
Source File: process_utils.cpp From rdsn with MIT License | 5 votes |
int pipe_execute(const char *command, std::ostream &output) { std::array<char, 256> buffer; int retcode = 0; { std::shared_ptr<FILE> command_pipe(popen(command, "r"), [&retcode](FILE *p) { retcode = pclose(p); }); while (!feof(command_pipe.get())) { if (fgets(buffer.data(), 256, command_pipe.get()) != NULL) output << buffer.data(); } } return retcode; }
Example 13
Source File: dispatch.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
console_result dispatch(int argc, const char* argv[], std::istream& input, std::ostream& output, std::ostream& error) { if (argc == 1) { display_usage(output); return console_result::okay; } auto ret = dispatch_command(argc - 1, &argv[1], input, output, error); output<<std::endl; //error<<std::endl; // once \n is okay return ret; }
Example 14
Source File: AbortExample.cpp From CARLsim3 with GNU General Public License v3.0 | 5 votes |
void run(const ParameterInstances ¶meters, std::ostream &outputStream) const { for(unsigned int i = 0; i < parameters.getNumInstances() - 5; i++) { for (unsigned int j = 0; j < parameters.getNumParameters(); j++) { const float p = parameters.getParameter(i, j); outputStream << p << "\t"; } outputStream << endl; } std::cerr << "Abort!" << endl; }
Example 15
Source File: PrintSeeds.cpp From redex with MIT License | 5 votes |
void show_class(std::ostream& output, const DexClass* cls, const std::string& name, const bool allowshrinking_filter, const bool allowobfuscation_filter) { if (allowshrinking_filter) { if (impl::KeepState::allowshrinking(cls)) { output << name << std::endl; } return; } if (allowobfuscation_filter) { if (impl::KeepState::allowobfuscation(cls)) { output << name << std::endl; } return; } output << name << std::endl; }
Example 16
Source File: account_info.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const account_info& self_ref) { account_info& tmp_self_ref = const_cast<account_info&>(self_ref); tmp_self_ref.encrypt(); //output << base16(self_ref.to_data()); output << base16(self_ref.data_); return output; }
Example 17
Source File: dispatch.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
static std::ostream& get_command_output(command& command, std::ostream& output) { #ifdef _MSC_VER if (command.requires_raw_output()) { bc::set_binary_stdout(); return std::cout; } bc::set_utf8_stdout(); #endif return output; }
Example 18
Source File: sodium.cpp From beam with Apache License 2.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const sodium& argument) { std::string decoded; // Z85 requires four byte alignment (hash_digest is 32). /* bool */ encode_base85(decoded, argument.value_); output << decoded; return output; }
Example 19
Source File: endpoint.cpp From beam with Apache License 2.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const endpoint& argument) { if (!argument.scheme().empty()) output << argument.scheme() << "://"; output << argument.host(); if (argument.port() != 0) output << ":" << argument.port(); return output; }
Example 20
Source File: Workflow.cpp From paragraph with Apache License 2.0 | 5 votes |
static void dumpOutput(const std::string& output, std::ostream& os, const std::string& file) { os << output; if (!os) { error("ERROR: Failed to write output to '%s' error: '%s'", file.c_str(), std::strerror(errno)); } }
Example 21
Source File: bound_match.cpp From tstop with GNU General Public License v3.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const Matching& m) { output << "Matching: " << m.AToB.size() << " pairs ("; if (!m.isPerfect()) { output << "not"; } output << " perfect)" << std::endl; for(auto atob : m.AToB) { output << atob.first << " <-> " << atob.second << " distance: " << distLInf(atob.first, atob.second) << std::endl; } return output; }
Example 22
Source File: basic_defs.cpp From tstop with GNU General Public License v3.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const PointSet& ps) { output << "{ "; for(auto& p : ps) { output << p << ", "; } output << "\b\b }"; return output; }
Example 23
Source File: utility.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
std::ostream &write_stream(std::ostream &output, const Json::Value &tree, encoding_engine engine) { switch (engine) { case encoding_engine::json: output << tree.toStyledString(); break; default: output << tree.toStyledString(); break; } return output; }
Example 24
Source File: sodium.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
std::ostream &operator<<(std::ostream &output, const sodium &argument) { std::string decoded; // Z85 requires four byte alignment (hash_digest is 32). /* bool */ encode_base85(decoded, argument.value_); output << decoded; return output; }
Example 25
Source File: header.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
std::ostream &operator<<(std::ostream &output, const header &argument) { const auto bytes = argument.value_.to_data(false); // header base16 is a private encoding in bx, used to pass between commands. output << base16(bytes); return output; }
Example 26
Source File: cert_key.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
std::ostream &operator<<(std::ostream &output, const cert_key &argument) { std::string decoded; // Z85 is unusual in that it requires four byte alignment. // We have already guarded construction against this, so we can ignore here. /* bool */ encode_base85(decoded, argument.value_); output << decoded; return output; }
Example 27
Source File: dispatch.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
console_result dispatch_command(int argc, const char *argv[], std::istream &input, std::ostream &output, std::ostream &error) { const std::string target(argv[0]); const auto command = find(target); if (!command) { const std::string superseding(formerly(target)); display_invalid_command(error, target, superseding); return console_result::failure; } auto &in = get_command_input(*command, input); auto &err = get_command_error(*command, error); auto &out = get_command_output(*command, output); parser metadata(*command); std::string error_message; if (!metadata.parse(error_message, in, argc, argv)) { display_invalid_parameter(error, error_message); return console_result::failure; } if (metadata.help()) { command->write_help(output); return console_result::okay; } return command->invoke(out, err); }
Example 28
Source File: endpoint.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
std::ostream &operator<<(std::ostream &output, const endpoint &argument) { if (!argument.scheme().empty()) output << argument.scheme() << "://"; output << argument.host(); if (argument.port() != 0) output << ":" << argument.port(); return output; }
Example 29
Source File: wallet_info.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
std::ostream &operator<<(std::ostream &output, const wallet_info &self_ref) { wallet_info &tmp_self_ref = const_cast<wallet_info &>(self_ref); tmp_self_ref.encrypt(); //output << base16(self_ref.to_data()); output << base16(self_ref.data_); return output; }
Example 30
Source File: logging.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
void initialize_logging(bc::ofstream &debug, bc::ofstream &error, std::ostream &output_stream, std::ostream &error_stream, std::string level) { using namespace std::placeholders; auto debug_log_level = log::level::debug; if (level == "INFO" || level == "info") debug_log_level = log::level::info; else if
Example 31
Source File: dispatch.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
console_result dispatch(int argc, const char *argv[], std::istream &input, std::ostream &output, std::ostream &error) { if (argc == 1) { display_usage(output); return console_result::okay; } auto ret = dispatch_command(argc - 1, &argv[1], input, output, error); output << std::endl; //error<<std::endl; // once \n is okay return ret; }
Example 32
Source File: dispatch.cpp From uchain-fullnode with GNU Affero General Public License v3.0 | 5 votes |
static std::ostream &get_command_output(command &command, std::ostream &output) { #ifdef _MSC_VER if (command.requires_raw_output()) { bc::set_binary_stdout(); return std::cout; } bc::set_utf8_stdout(); #endif return output; }
Example 33
Source File: bit_stream_kernel_1.cpp From android-face-landmarks with MIT License | 5 votes |
void bit_stream_kernel_1:: set_output_stream ( std::ostream& os ) { osp = &os; write_mode = true; buffer_size = 0; }
Example 34
Source File: buffer.cpp From cppkafka with BSD 2-Clause "Simplified" License | 5 votes |
ostream& operator<<(ostream& output, const Buffer& rhs) { for (const uint8_t value : rhs) { if (value >= 0x20 && value < 0x7f) { output << value; } else { output << "\\x"; if (value < 16) { output << '0'; } output << hex << static_cast<int>(value) << dec; } }
Example 35
Source File: token_info.cc From verible with Apache License 2.0 | 5 votes |
std::ostream& TokenInfo::ToStream(std::ostream& output_stream, const Context& context) const { output_stream << "(#"; context.token_enum_translator(output_stream, token_enum_); output_stream << " @" << left(context.base) << '-' << right(context.base) << ": \"" << text_ << "\")"; const auto dist = std::distance(context.base.end(), text_.end()); CHECK(IsSubRange(text_, context.base)) << "text.end() is off by " << dist; return output_stream; }
Example 36
Source File: obfuscate.cc From verible with Apache License 2.0 | 5 votes |
static void ObfuscateVerilogCodeInternal(absl::string_view content, std::ostream* output, IdentifierObfuscator* subst) { VLOG(1) << __FUNCTION__; verilog::VerilogLexer lexer(content); while (true) { const verible::TokenInfo& token(lexer.DoNextToken()); if (token.isEOF()) break; switch (token.token_enum()) { case verilog_tokentype::SymbolIdentifier: case verilog_tokentype::PP_Identifier: *output << (*subst)(token.text()); break; // Preserve all $ID calls, including system task/function calls, and VPI // calls case verilog_tokentype::SystemTFIdentifier: *output << token.text(); break; // The following identifier types start with a special character that // needs to be preserved. case verilog_tokentype::MacroIdentifier: case verilog_tokentype::MacroCallId: // TODO(fangism): verilog_tokentype::EscapedIdentifier *output << token.text()[0] << (*subst)(token.text().substr(1)); break; // The following tokens are un-lexed, so they need to be lexed // recursively. case verilog_tokentype::MacroArg: case verilog_tokentype::PP_define_body: ObfuscateVerilogCodeInternal(token.text(), output, subst); break; default: // This also covers lexical error tokens. *output << token.text(); } } VLOG(1) << "end of " << __FUNCTION__; }
Example 37
Source File: logging.cpp From tinychain with GNU General Public License v2.0 | 5 votes |
void initialize_logging(std::ofstream& debug, std::ofstream& error, std::ostream& output_stream, std::ostream& error_stream, std::string level) { using namespace std::placeholders; auto debug_log_level = log::level::debug; if (level == "INFO" || level == "info") debug_log_level = log::level::info; else if
Example 38
Source File: printers.cpp From binlog with Apache License 2.0 | 5 votes |
void printSortedEvents(std::istream& input, std::ostream& output, const std::string& format, const std::string& dateFormat) { binlog::IstreamEntryStream entryStream(input); binlog::EventStream eventStream; binlog::PrettyPrinter pp(format, dateFormat); using Pair = std::pair<std::uint64_t /* clock */, std::string /* pretty printed event */>; std::vector<Pair> buffer; std::ostringstream stream; // buffer every event in input while (const binlog::Event* event = eventStream.nextEvent(entryStream)) { stream.str({}); // reset stream pp.printEvent(stream, *event, eventStream.writerProp(), eventStream.clockSync()); buffer.emplace_back(event->clockValue, stream.str()); } // sort and print the the buffer const auto cmpClock = [](const Pair& p1, const Pair& p2) { return p1.first < p2.first; }; std::stable_sort(buffer.begin(), buffer.end(), cmpClock); for (const Pair& p : buffer) { output << p.second; } }
Example 39
Source File: printers.cpp From binlog with Apache License 2.0 | 5 votes |
void printEvents(std::istream& input, std::ostream& output, const std::string& format, const std::string& dateFormat) { binlog::IstreamEntryStream entryStream(input); binlog::EventStream eventStream; binlog::PrettyPrinter pp(format, dateFormat); while (const binlog::Event* event = eventStream.nextEvent(entryStream)) { pp.printEvent(output, *event, eventStream.writerProp(), eventStream.clockSync()); } }
Example 40
Source File: ExecStats.cpp From lux with GNU Affero General Public License v3.0 | 5 votes |
void output(char const* _name, std::ostream& _os) { auto avg = tot / count; _os << std::setfill(' ') << std::setw(12) << std::left << _name << std::setw(10) << std::right << std::chrono::duration_cast<unit>(tot).count() << std::setw(10) << std::right << std::chrono::duration_cast<unit>(avg).count() << std::setw(10) << std::right << std::chrono::duration_cast<unit>(min).count() << std::setw(10) << std::right << std::chrono::duration_cast<unit>(max).count() << std::endl; }
Example 41
Source File: Mat3D.cxx From quicksilver with Apache License 2.0 | 5 votes |
::writeASCII(std::ostream& output) const { output << a[0] << " " << a[1] << " " << a[2] << '\n' // Don't want to use endl << a[3] << " " << a[4] << " " << a[5] << '\n' // because that flushes the << a[6] << " " << a[7] << " " << a[8]; // buffer. return output; }
Example 42
Source File: y4m_writer.cc From xvc with GNU Lesser General Public License v2.1 | 5 votes |
void Y4mWriter::WriteHeader(const xvc_dec_pic_stats &stats, std::ostream *output) { if (!global_header_written_) { WriteGlobalHeader(stats, output); global_header_written_ = true; } (*output) << "FRAME\n"; }
Example 43
Source File: Profiler.cc From hoomd-blue with BSD 3-Clause "New" or "Revised" License | 5 votes |
void ProfileDataElem::output_line(std::ostream &o, const std::string &name, double sec, double perc, double flops, double bytes, unsigned int name_width) const { o << setiosflags(ios::fixed); o << name << ": "; assert(name_width >= name.size()); for (unsigned int i = 0; i < name_width - name.size(); i++) o << " "; o << setw(7) << setprecision(4) << sec << "s"; o << " | " << setprecision(3) << setw(6) << perc << "% "; //If sec is zero, the values to be printed are garbage. Thus, we skip it all together. if (sec == 0) { o << "n/a" << endl; return; } o << setprecision(5); // output flops with intelligent units if (flops > 0) { o << setw(6); if (flops < 1e6) o << flops << " FLOP/s "; else if (flops < 1e9) o << flops/1e6 << " MFLOP/s "; else
Example 44
Source File: dlist.cc From tts-tutorial with Apache License 2.0 | 5 votes |
WNode *wgn_build_dlist(float &score,ostream *output) { WDlist *dlist; dlist = wagon_decision_list(); *output << *dlist; if (wgn_test_dataset.width() > 0) // load in test data do_dlist_summary(dlist,wgn_test_dataset); else
Example 45
Source File: tokenize.cpp From cplusplus11.Examples with The Unlicense | 5 votes |
void outputToken(std::ostream &out, const lex::Token &token) { if(token.getToken() == "quit") { out << "Quit token read from stream exiting...\n"; exit(0); } if(!token.isKeyword()) { out << "Token: [" << token.getToken() << "] of Type: [" << token.getType() << "]\n"; } else {
Example 46
Source File: logging.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
void initialize_logging(bc::ofstream& debug, bc::ofstream& error, std::ostream& output_stream, std::ostream& error_stream, std::string level) { using namespace std::placeholders; auto debug_log_level = log::level::debug; if (level == "INFO" || level == "info") debug_log_level = log::level::info; else if
Example 47
Source File: wf_types.cc From verona with MIT License | 5 votes |
void visit_entity_type( const EntityTypePtr& ty, SourceManager::SourceRange source_range, std::ostream& solver_output) final { RecursiveTypeVisitor::visit_entity_type(ty, source_range, solver_output); const Entity* definition = ty->definition; Instantiation instantiation(ty->arguments); for (const auto& [generic, argument] : safe_zip(definition->generics->types, ty->arguments)) { // We need to substitute the type arguments in the bounds themselves // (using the Instantiation) in order to support F-bounded polymorphism. TypePtr bound = instantiation.apply(context_, generic->bound); Constraint constraint(argument, bound, 0, context_); Solver solver(context_, solver_output); Solver::SolutionSet solutions = solver.solve_one(constraint, SolverMode::Verify); solver.print_stats(solutions); if (solutions.empty()) { report( context_, source_range, DiagnosticKind::Error, Diagnostic::TypeArgumentDoesNotSatisfyBound, *argument, definition->name, *generic->bound); } } }
Example 48
Source File: wf_types.cc From verona with MIT License | 5 votes |
void visit_generics(Generics* generics, std::ostream& output) { for (auto& param : generics->types) { if (param->bound_expression) visit_type( param->bound, param->bound_expression->source_range, output); } }
Example 49
Source File: wf_types.cc From verona with MIT License | 5 votes |
void visit_match_expr(MatchExpr& e, std::ostream& output) final { RecursiveExprVisitor::visit_match_expr(e, output); for (auto& arm : e.arms) { visit_type(arm->type, arm->type_expression->source_range, output); } }
Example 50
Source File: BitVector.cpp From libscapi with MIT License | 5 votes |
void BitVector::output(ostream& s,bool human) const { if (human) { s << nbits << " " << hex; for (unsigned int i = 0; i < nbytes; i++) { s << int(bytes[i]) << " "; } s << dec << endl; } else {
Example 51
Source File: ExecStats.cpp From bcos with GNU General Public License v3.0 | 5 votes |
void output(char const* _name, std::ostream& _os) { auto avg = tot / count; _os << std::setfill(' ') << std::setw(12) << std::left << _name << std::setw(10) << std::right << std::chrono::duration_cast<unit>(tot).count() << std::setw(10) << std::right << std::chrono::duration_cast<unit>(avg).count() << std::setw(10) << std::right << std::chrono::duration_cast<unit>(min).count() << std::setw(10) << std::right << std::chrono::duration_cast<unit>(max).count() << std::endl; }
Example 52
Source File: GEO.cpp From SPlisHSPlasH with MIT License | 5 votes |
void writeString(std::ostream& output,const char* s){ const char* p=s; output<<"\""; while(*p != 0){ if(*p=='\\' || *p=='"') output<<'\\'; output<<*p; p++; } output<<"\""; }
Example 53
Source File: utility.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
std::ostream& write_stream(std::ostream& output, const Json::Value& tree, encoding_engine engine) { switch (engine) { case encoding_engine::json: output << tree.toStyledString(); break; default: output << tree.toStyledString(); break; } return output; }
Example 54
Source File: header.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const header& argument) { const auto bytes = argument.value_.to_data(false); // header base16 is a private encoding in bx, used to pass between commands. output << base16(bytes); return output; }
Example 55
Source File: cert_key.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
std::ostream& operator<<(std::ostream& output, const cert_key& argument) { std::string decoded; // Z85 is unusual in that it requires four byte alignment. // We have already guarded construction against this, so we can ignore here. /* bool */ encode_base85(decoded, argument.value_); output << decoded; return output; }
Example 56
Source File: dispatch.cpp From metaverse with GNU Affero General Public License v3.0 | 5 votes |
console_result dispatch_command(int argc, const char* argv[], std::istream& input, std::ostream& output, std::ostream& error) { const std::string target(argv[0]); const auto command = find(target); if (!command) { const std::string superseding(formerly(target)); display_invalid_command(error, target, superseding); return console_result::failure; } auto& in = get_command_input(*command, input); auto& err = get_command_error(*command, error); auto& out = get_command_output(*command, output); parser metadata(*command); std::string error_message; if (!metadata.parse(error_message, in, argc, argv)) { display_invalid_parameter(error, error_message); return console_result::failure; } if (metadata.help()) { command->write_help(output); return console_result::okay; } return command->invoke(out, err); }
Example 57
Source File: TypeInference.cpp From redex with MIT License | 4 votes |
std::ostream& operator<<(std::ostream& output, const IRType& type) { switch (type) { case BOTTOM: { output << "BOTTOM"; break; } case ZERO: { output << "ZERO"; break; } case CONST: { output << "CONST"; break; } case CONST1: { output << "CONST1"; break; } case CONST2: { output << "CONST2"; break; } case REFERENCE: { output << "REF"; break; } case INT: { output << "INT"; break; } case FLOAT: { output << "FLOAT"; break; } case LONG1: { output << "LONG1"; break; } case LONG2: { output << "LONG2"; break; } case DOUBLE1: { output << "DOUBLE1"; break; } case DOUBLE2: { output << "DOUBLE2"; break; } case SCALAR: { output << "SCALAR"; break; } case SCALAR1: { output << "SCALAR1"; break; } case SCALAR2: { output << "SCALAR2"; break; } case TOP: { output << "TOP"; break; } } return output; }
Example 58
Source File: Decomp.cpp From rellic with Apache License 2.0 | 4 votes |
static bool GeneratePseudocode(llvm::Module& module, llvm::raw_ostream& output) { InitOptPasses(); clang::CompilerInstance ins; rellic::InitCompilerInstance(ins, module.getTargetTriple()); auto& ast_ctx = ins.getASTContext(); rellic::IRToASTVisitor gen(ast_ctx); llvm::legacy::PassManager ast; ast.add(rellic::createGenerateASTPass(ast_ctx, gen)); ast.add(rellic::createDeadStmtElimPass(ast_ctx, gen)); ast.run(module); // Simplifier to use during condition-based refinement auto cbr_simplifier = new rellic::Z3CondSimplify(ast_ctx, gen); cbr_simplifier->SetZ3Simplifier( // Simplify boolean structure with AIGs z3::tactic(cbr_simplifier->GetZ3Context(), "aig") & // Cheap local simplifier z3::tactic(cbr_simplifier->GetZ3Context(), "simplify")); llvm::legacy::PassManager cbr; cbr.add(cbr_simplifier); cbr.add(rellic::createNestedCondPropPass(ast_ctx, gen)); cbr.add(rellic::createNestedScopeCombinerPass(ast_ctx, gen)); cbr.add(rellic::createCondBasedRefinePass(ast_ctx, gen)); cbr.add(rellic::createReachBasedRefinePass(ast_ctx, gen)); while (cbr.run(module)) ; llvm::legacy::PassManager loop; loop.add(rellic::createLoopRefinePass(ast_ctx, gen)); loop.add(rellic::createNestedScopeCombinerPass(ast_ctx, gen)); while (loop.run(module)) ; // Simplifier to use during final refinement auto fin_simplifier = new rellic::Z3CondSimplify(ast_ctx, gen); fin_simplifier->SetZ3Simplifier( // Simplify boolean structure with AIGs z3::tactic(fin_simplifier->GetZ3Context(), "aig") & // Propagate bounds over bit-vectors z3::tactic(fin_simplifier->GetZ3Context(), "propagate-bv-bounds") & // Eliminate conjunctions using De Morgan laws z3::tactic(fin_simplifier->GetZ3Context(), "elim-and") & // Tseitin transformation z3::tactic(fin_simplifier->GetZ3Context(), "tseitin-cnf") & // Contextual simplification z3::tactic(fin_simplifier->GetZ3Context(), "ctx-simplify")); llvm::legacy::PassManager fin; fin.add(fin_simplifier); fin.add(rellic::createNestedCondPropPass(ast_ctx, gen)); fin.add(rellic::createNestedScopeCombinerPass(ast_ctx, gen)); fin.add(rellic::createExprCombinePass(ast_ctx, gen)); fin.run(module); ast_ctx.getTranslationUnitDecl()->print(output); // ast_ctx.getTranslationUnitDecl()->dump(output); return true; }