/* * Initialize stack then install all these operations */ void init_smt_tstack(tstack_t *stack) { init_tstack(stack, NUM_BASE_OPCODES); tstack_add_op(stack, MK_EQ, false, smt_eval_mk_eq, smt_check_mk_eq); tstack_add_op(stack, MK_BV_CONST, false, smt_eval_mk_bv_const, smt_check_mk_bv_const); tstack_add_op(stack, MK_BV_ROTATE_LEFT, false, smt_eval_mk_bv_rotate_left, smt_check_mk_bv_rotate_left); tstack_add_op(stack, MK_BV_ROTATE_RIGHT, false, smt_eval_mk_bv_rotate_right, smt_check_mk_bv_rotate_right); tstack_add_op(stack, MK_BV_REPEAT, false, smt_eval_mk_bv_repeat, smt_check_mk_bv_repeat); tstack_add_op(stack, MK_BV_SIGN_EXTEND, false, smt_eval_mk_bv_sign_extend, smt_check_mk_bv_sign_extend); tstack_add_op(stack, MK_BV_ZERO_EXTEND, false, smt_eval_mk_bv_zero_extend, smt_check_mk_bv_zero_extend); }
void T_init_tstack(void) { #ifdef __DEBUG_SIZE_0_ __print_title("Initalize Stack"); _G_stack = init_tstack(0); if ( !_G_stack.top || !_G_stack.bottom) { fprintf(stderr, "[x] Initalize stack fail. \n"); } else { fprintf(stderr, "[x] Initialize stack successfully. Stack size is %d \n", _G_stack.size); } #endif /* __DEBUG_SIZE_0_ */ #ifdef __DEBUG_SIZE_50_ __print_title("Initalize Stack"); _G_stack = init_tstack(50); if ( !_G_stack.top || !_G_stack.bottom) { fprintf(stderr, "[x] Initalize stack fail. \n"); } else { fprintf(stderr, "[x] Initialize stack successfully. Stack size is %d \n", _G_stack.size); } #endif /* __DEBUG_SIZE_50_ */ }
int main(int argc, char *argv[]) { bool interactive; int32_t code; FILE *dump; double memused; process_command_line(argc, argv); yices_init(); init_tstack(&stack, NUM_BASE_OPCODES); interactive = false; if (input_filename == NULL) { init_yices_stdin_lexer(&lexer); interactive = true; } else { if (init_yices_file_lexer(&lexer, input_filename) < 0) { perror(input_filename); exit(YICES_EXIT_FILE_NOT_FOUND); } } init_parser(&parser, &lexer, &stack); while (current_token(&lexer) != TK_EOS) { if (interactive) { printf("yices> "); fflush(stdout); } code = parse_yices_command(&parser, stderr); if (code < 0) { flush_lexer(&lexer); } } delete_parser(&parser); close_lexer(&lexer); delete_tstack(&stack); memused = mem_size() / (1024 * 1024); if (memused > 0) { fprintf(stderr, "Memory used: %.2f MB\n", memused); } if (dump_requested) { if (dump_filename == NULL) { dump = stdout; } else { dump = fopen(dump_filename, "w"); if (dump == NULL) { perror(dump_filename); exit(YICES_EXIT_FILE_NOT_FOUND); } } fprintf(dump, "\n==== ALL TYPES ====\n"); print_type_table(dump, __yices_globals.types); fflush(dump); fprintf(dump, "\n==== ALL TERMS ====\n"); print_term_table(dump, __yices_globals.terms); fflush(dump); if (dump_filename != NULL) { if (fclose(dump) != 0) { fprintf(stderr, "Error while closing dump file: "); perror(dump_filename); } } } yices_exit(); return 0; }