void print_procedure(FILE* dest, struct ast_node_t* node, int padding, int wrap) { ast_node_t* name = node->value.child; ast_node_t* params = name->next; ast_node_t* body = params->next; int new_pad = padding + 1; fprintf(dest, "("); fprintf(dest, "lambda"); print_separator(dest, new_pad, 0); fprintf(dest, "("); ast_node_t* param = params->value.child; while (param) { if (!is_meta(param->type)) { print_single_node(dest, param->value.child, new_pad, 0); print_separator(dest, new_pad, 0); } param = param->next; } fprintf(dest, ")"); print_separator(dest, new_pad, 1); print_single_node(dest, body, new_pad, 1); fprintf(dest, ")"); }
void p_stats(void) { print_separator(stdout, "STATISTICS", TRUE); printf("\nFor domain size %d.\n\n",Domain_size); printf("Current CPU time: %.2f seconds ", clock_seconds(Mace4_clock)); printf("(total CPU time: %.2f seconds).\n",user_seconds()); printf("Ground clauses: seen=%u, kept=%u.\n", Mstats.ground_clauses_seen, Mstats.ground_clauses_kept); printf("Selections=%u, assignments=%u, propagations=%u, current_models=%u.\n", Mstats.selections, Mstats.assignments, Mstats.propagations, Mstats.current_models); printf("Rewrite_terms=%u, rewrite_bools=%u, indexes=%u.\n", Mstats.rewrite_terms, Mstats.rewrite_bools, Mstats.indexes); printf("Rules_from_neg_clauses=%u, cross_offs=%d.\n", Mstats.rules_from_neg, Mstats.cross_offs); #if 0 printf("Negative propagation:\n"); printf(" attempts agone egone\n"); printf("Neg_elim %10u %10u %10u\n", Mstats.neg_elim_attempts, Mstats.neg_elim_agone, Mstats.neg_elim_egone); printf("Neg_assign %10u %10u %10u\n", Mstats.neg_assign_attempts, Mstats.neg_assign_agone, Mstats.neg_assign_egone); printf("Neg_near_elim %10u %10u %10u\n", Mstats.neg_near_elim_attempts, Mstats.neg_near_elim_agone, Mstats.neg_near_elim_egone); printf("Neg_near_assign %10u %10u %10u\n", Mstats.neg_near_assign_attempts, Mstats.neg_near_assign_agone, Mstats.neg_near_assign_egone); #endif print_separator(stdout, "end of statistics", TRUE); } /* p_stats */
void print_model_standard(FILE *fp, BOOL print_head) { int syms_printed; Symbol_data s; if (print_head) print_separator(fp, "MODEL", TRUE); fprintf(fp, "\ninterpretation( %d, [number=%d, seconds=%d], [\n", Domain_size, Total_models, (int) user_seconds()); syms_printed = 0; for (s = Symbols; s != NULL; s = s->next) { if (s->attribute != EQUALITY_SYMBOL) { int i, n; if (syms_printed > 0) fprintf(fp, ",\n"); fprintf(fp, "\n %s(%s%s", s->type == FUNCTION ? "function" : "relation", sn_to_str(s->sn), s->arity == 0 ? "" : "(_"); for (i = 1; i < s->arity; i++) fprintf(fp, ",_"); fprintf(fp,"%s, [%s", s->arity == 0 ? "" : ")", s->arity >= 2 ? "\n\t\t\t " : ""); n = int_power(Domain_size, s->arity); for (i = 0; i < n; i++) { int id = s->base + i; if (Cells[id].value == NULL) fprintf(fp, "-"); else fprintf(fp, "%2d", VARNUM(Cells[id].value)); if (i < n-1) fprintf(fp, ",%s", (i+1) % Domain_size == 0 ? "\n\t\t\t " : ""); else fprintf(fp, " ])"); } syms_printed++; } } fprintf(fp, "\n]).\n"); if (print_head) print_separator(fp, "end of model", TRUE); } /* print_model_standard */
int print_variable_decl(FILE* dest, struct ast_node_t* node, int padding, int wrap) { ast_node_t* ident = node->value.child; ast_node_t* value = node->value.child->next; int new_pad = padding + 1; int is_global = (padding == 0); fprintf(dest, "("); if (is_global) { fprintf(dest, "define"); } else { fprintf(dest, "let"); } print_separator(dest, new_pad, 0); if (!is_global) { fprintf(dest, "("); fprintf(dest, "("); } print_single_node(dest, ident, new_pad, 0); print_separator(dest, new_pad, 0); if (value && !is_meta(value->type)) { print_single_node(dest, value, new_pad, 0); } else { fprintf(dest, "'undefined"); } int completed; if (!is_global) { fprintf(dest, ")"); fprintf(dest, ")"); print_separator(dest, new_pad, 1); print_naked_list(dest, node->next, new_pad, wrap); completed = 1; } else { completed = 0; } fprintf(dest, ")"); return completed; }
void print_proccal(FILE* dest, struct ast_node_t* node, int padding, int wrap) { ast_node_t* child = node->value.child; int new_pad = padding + 1; fprintf(dest, "("); print_single_node(dest, child, new_pad, 0); print_separator(dest, new_pad, 0); print_naked_list(dest, child->next->value.child, new_pad, 0); fprintf(dest, ")"); print_separator(dest, new_pad, wrap); //FIXME ? }
// // print() functions // void Formula::print(FILE *output_file) { if(myChildren.empty()) { if(node_type()==Op_Relation || node_type()==Op_Or) fprintf(output_file, "FALSE"); else if(node_type()==Op_And) fprintf(output_file, "TRUE"); else { assert(0); } } for(List_Iterator<Formula*> c(myChildren); c;) { if (node_type() == Op_Exists || node_type() == Op_Forall || (*c)->priority() < priority()) fprintf(output_file, "( "); (*c)->print(output_file); if (node_type() == Op_Exists || node_type() == Op_Forall || (*c)->priority() < priority()) fprintf(output_file, " )"); c++; if(c.live()) print_separator(output_file); } }
BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info() { std::cout << "\n\n"; print_separator(); std::cout << "Regex library build configuration:\n\n"; regex_lib_main2(); }
int main(void) { char *s = malloc(16348); char *sep = malloc(24); print_separator(sep); char **conky_array = malloc(256); char **acpi_array = malloc(256); load_conky(conky_array); load_acpi(acpi_array); // MODULES------------------------- module_wireless(s); separator(s, sep); //module_volume(s); separator(s, sep); module_battery(s, acpi_array); separator(s, sep); module_cpu_temp(s, conky_array[1]); separator(s, sep); module_cpu_load(s, conky_array[0]); separator(s, sep); module_time(s); // END MODULES--------------------- // print result puts(s); free(s); free(sep); free(conky_array); free(acpi_array); return 0; }
int main() { run_tests<IVDA>(); print_separator(std::cout); run_tests<CDRVDA>(); return 0; }
int main(int argc, char *argv[]) { test_setup_logging(LOG_INFO); test_terminal_urlify(); test_cat_files(); print_separator(); return 0; }
/* PUBLIC */ void picker_report(void) { int i; print_separator(stdout, "PICKER REPORT", TRUE); printf("%16s %6s %10s %8s %6s %11s %6s\n", "Picker","Size","Median_wt","Deleted","(Low)","Displaced","(Low)"); for (i = 0; i < NUM_PICKERS; i++) { Picker p = &(Pickers[i]); Topform c = avl_item_at_position(p->idx, 0.5); printf("%16s %6d %10d %8d %6d %11d %6d\n", p->name, avl_size(p->idx), c ? c->weight : -1, p->number_deleted, p->low_delete == INT_MAX ? -1 : p->low_delete, p->number_displaced, p->low_displace == INT_MAX ? -1 : p->low_displace); } print_separator(stdout, "end of picker report", FALSE); fflush(stdout); } /* picker_report */
static void print_header(std::stringstream& ss) { if (show_wss) { ss << ::android::base::StringPrintf("%7s %7s %7s %7s %7s %7s %7s %s\n", "WRss", "WPss", "WUss", "WShCl", "WShDi", "WPrCl", "WPrDi", "Name"); } else { ss << ::android::base::StringPrintf("%7s %7s %7s %7s %7s %7s %7s %7s %s\n", "Vss", "Rss", "Pss", "Uss", "ShCl", "ShDi", "PrCl", "PrDi", "Name"); } print_separator(ss); }
int main() { std::cout << std::boolalpha; print_is_same<int, int>(); // true print_is_same<int, int*>(); // false print_is_same<int, int**>(); // false print_separator(); print_is_same<int, std::remove_pointer<int>::type>(); // true print_is_same<int, std::remove_pointer<int*>::type>(); // true print_is_same<int, std::remove_pointer<int**>::type>(); // false print_separator(); print_is_same<int, std::remove_pointer<int* const>::type>(); // true print_is_same<int, std::remove_pointer<int* volatile>::type>(); // true print_is_same<int, std::remove_pointer<int* const volatile>::type>(); // true return 0; }
int main(int argc, char **argv) { struct mace_options opt; Plist clauses; Mace_results results; /* Following says whether to ignore unregognized set/clear/assigns. */ BOOL prover_compatability_mode = member_args(argc, argv, "-c"); init_standard_ladr(); init_mace_options(&opt); /* We must do this before calling usage_message. */ init_attrs(); if (member_args(argc, argv, "help") || member_args(argc, argv, "-help")) { usage_message(stderr, &opt); exit(1); } print_banner(argc, argv, PROGRAM_NAME, PROGRAM_VERSION, PROGRAM_DATE, FALSE); set_program_name(PROGRAM_NAME); /* for conditional input */ signal(SIGINT, mace4_sig_handler); signal(SIGUSR1, mace4_sig_handler); signal(SIGSEGV, mace4_sig_handler); clauses = read_mace4_input(argc, argv, prover_compatability_mode, &opt); print_separator(stdout, "CLAUSES FOR SEARCH", TRUE); fwrite_clause_list(stdout, clauses, "mace4_clauses", CL_FORM_BARE); print_separator(stdout, "end of clauses for search", TRUE); results = mace4(clauses, &opt); mace4_exit(results->return_code); /* print messages and exit */ exit(0); /* won't happen */ } /* main */
void print_naked_list(FILE* dest, struct ast_node_t* node, int padding, int wrap) { while (node) { int skip = print_single_node(dest, node, padding, wrap); if (skip) { break; } node = node->next; if (node) { print_separator(dest, padding, wrap); } } }
int main(void) { int failed = 0; learner_initialize(); run_test(test_vector); run_test(test_sparse_vector); run_test(test_paged_file); print_separator(); if(failed > 0) { printf("Test suite failed: %i tests\n", failed); return 1; } else { printf("Test suite passed\n"); return 0; } }
/* Prints the matrix using some ANSI escape sequences to distinguish the originally known numbers. */ void print_matrix(void) { for (int i = 0; i < 9; ++i) { if ((i % 3) == 0) { print_separator(); } for (int j = 0; j < 9; j++) { int cell = matrix[i][j]; if ((j % 3) == 0) { printf("\e[1;34m|\e[0m "); } else { printf(" "); } if (known[i][j]) { printf("\e[1;34m%d\e[0m ", cell); } else {
void print_labeled_scheme_list(FILE* dest, const char* head, struct ast_node_t* node, int padding, int wrap) { fprintf(dest, "("); if (head) { fprintf(dest, "%s", head); if (node) { print_separator(dest, padding, wrap); } } print_naked_list(dest, node, padding, wrap); fprintf(dest, ")"); }
static int show(const MemUsage& proc_stats, const std::vector<Vma>& maps) { std::stringstream ss; print_header(ss); for (auto& vma : maps) { const MemUsage& vma_stats = vma.usage; if (hide_zeroes && vma_stats.rss == 0) { continue; } print_stats(ss, vma_stats); ss << vma.name << std::endl; } print_separator(ss); print_stats(ss, proc_stats); ss << "TOTAL" << std::endl; std::cout << ss.str(); return 0; }
static Plist read_mace4_input(int argc, char **argv, BOOL allow_unknown_things, Mace_options opt) { Plist wild_formulas, goals; Plist distinct_lists, distinct_forms; Plist wild_terms, hints; /* we won't use these */ /* Tell the top_input package what lists to accept and where to put them. */ /* Accept hints, but they will not be used. */ accept_list("hints", FORMULAS, TRUE, &hints); /* Accept goals; these are negated individually (each must be falsified) */ accept_list("goals", FORMULAS, FALSE, &goals); /* Accept lists of distinct items */ accept_list("distinct", TERMS, FALSE, &distinct_lists); /* Accept any other clauses and formulas. Each must be true. */ accept_list("", FORMULAS, FALSE, &wild_formulas); /* Accept any terms. These will not be used. */ accept_list("", TERMS, FALSE, &wild_terms); /* Read commands such as set, clear, op, lex. */ /* Read lists, filling in variables given to the accept_list calls. */ print_separator(stdout, "INPUT", TRUE); read_all_input(argc, argv, stdout, TRUE, allow_unknown_things ? WARN_UNKNOWN : KILL_UNKNOWN); if (wild_terms) printf("%% term list(s) ignored\n"); if (hints) printf("%% hints list(s) ignored\n"); process_command_line_args(argc, argv, opt); print_separator(stdout, "end of input", TRUE); if (!option_dependencies_state()) { /* This might be needed in the future. */ printf("\n%% Enabling option dependencies (ignore applies only on input).\n"); enable_option_dependencies(); } distinct_forms = process_distinct_terms(distinct_lists); wild_formulas = plist_cat(wild_formulas, distinct_forms); wild_formulas = embed_formulas_in_topforms(wild_formulas, TRUE); goals = embed_formulas_in_topforms(goals, FALSE); /* Clausify */ print_separator(stdout, "PROCESS NON-CLAUSAL FORMULAS", TRUE); printf("\n%% Formulas that are not ordinary clauses:\n"); wild_formulas = process_input_formulas(wild_formulas, TRUE); goals = process_goal_formulas(goals, TRUE); /* negates goals */ print_separator(stdout, "end of process non-clausal formulas", TRUE); wild_formulas = plist_cat(wild_formulas, goals); return wild_formulas; } /* read_mace4_input */
void p_model(BOOL print_head) { Symbol_data p; int n = Domain_size; if (print_head) { print_separator(stdout, "MODEL", TRUE); printf("\n%% Model %d at %.2f seconds.\n", Total_models, user_seconds()); } for (p = Symbols; p != NULL; p = p->next) { char *name = sn_to_str(p->sn); if (p->attribute != EQUALITY_SYMBOL) { /* This prints both relations and functions. */ if (p->arity == 0) { int v = f0_val(p->base); if (v < 0) printf("\n %s : -\n", name); else printf("\n %s : %d\n", name, v); } else if (p->arity == 1) { char *s1 = n <= 10 ? "%2d" : "%3d"; char *s2 = n <= 10 ? "--" : "---"; char *s3 = n <= 10 ? " -" : " -"; int i; for (i = 0; i < n; i++) { printf("\n %s :\n", name); printf(" "); for (i = 0; i < n; i++) printf(s1, i); printf("\n ---"); for (i = 0; i < n; i++) printf(s2); printf("\n "); for (i = 0; i < n; i++) { int v = f1_val(p->base, i); if (v < 0) printf(s3); else printf(s1, v); } printf("\n"); } } else if (p->arity == 2) { char *s1 = n <= 10 ? "%2d" : "%3d"; char *s2 = n <= 10 ? "--" : "---"; char *s3 = n <= 10 ? " -" : " -"; int i, j; printf("\n %s :\n", name); printf(" |"); for (i = 0; i < n; i++) printf(s1, i); printf("\n --+"); for (i = 0; i < n; i++) printf(s2); printf("\n"); for (i = 0; i < n; i++) { printf("%5d |", i); for (j = 0; j < n; j++) { int v = f2_val(p->base, i, j); if (v < 0) printf(s3); else printf(s1, v); } printf("\n"); } } else { int n = int_power(Domain_size, p->arity); int i; Variable_style save_style = variable_style(); set_variable_style(INTEGER_STYLE); for (i = 0; i < n; i++) { int id = p->base + i; fwrite_term(stdout, Cells[id].eterm); if (Cells[id].value == NULL) printf(" = -.\n"); else printf(" = %d.\n", VARNUM(Cells[id].value)); } set_variable_style(save_style); } } } if (print_head) print_separator(stdout, "end of model", TRUE); } /* p_model */
int managed_find_word(const char *word, const regimen_t regimen, const char *dicts_list) { FILE *dict_fp; char dict_name[PATH_MAX]; int retcode = 0; bool no_translate_flag = true; bool no_dicts_flag = true; extern settings_t settings; print_begin_page(word); while ( true ) { if ( dicts_list == NULL ) dict_fp = next_dict_from_dir(dict_name); else dict_fp = next_dict_from_list(dict_name, dicts_list); if ( dict_fp == NULL ) break; if ( !no_translate_flag ) print_newline(); if ( (retcode = find_word(word, regimen, dict_name, dict_fp)) > 0 ) { no_translate_flag = false; retcode = 0; } if ( fclose(dict_fp) != 0 ) fprintf(stderr, "Cannot close dict file \"%s\": %s\n", dict_name, strerror(errno)); no_dicts_flag = false; } if ( no_translate_flag && regimen == usually_regimen && !no_dicts_flag ) { while ( true ) { if ( dicts_list == NULL ) dict_fp = next_dict_from_dir(dict_name); else dict_fp = next_dict_from_list(dict_name, dicts_list); if ( dict_fp == NULL ) break; if ( !no_translate_flag ) print_newline(); if ( (retcode = find_word(word, first_concurrence_regimen, dict_name, dict_fp)) > 0 ) { no_translate_flag = false; retcode = 0; } if ( fclose(dict_fp) != 0 ) fprintf(stderr, "Cannot close dict file \"%s\": %s\n", dict_name, strerror(errno)); } } if ( no_translate_flag ) { switch ( settings.output_format ) { case html_output_format : fprintf(stderr, "\t<font class=\"info_font\">This word is not found</font><br>\n"); break; case text_output_format : case native_output_format : fprintf(stderr, "This word is not found\n"); break; } } if ( no_dicts_flag ) { switch ( settings.output_format ) { case html_output_format : fprintf(stderr, "\t<font class=\"info_font\">No dict is connected</font><br>"); break; case text_output_format : case native_output_format : fprintf(stderr, "No dict is connected\n"); break; } } if ( !no_translate_flag && !no_dicts_flag ) print_separator(); print_end_page(); return retcode; }