Exemplo n.º 1
0
void print_egraph_congruence_roots(FILE *f, egraph_t *egraph) {
  uint32_t i, n;
  pvector_t v;

  init_pvector(&v, 10);
  collect_congruence_roots(&egraph->ctable, &v);
  n = v.size;
  if (n > 0) {
    fputs("--- Congruence roots ---\n", f);
    for (i=0; i<n; i++) {
      print_congruence_root(f, v.data[i]);
    }
  } else {
    fputs("--- Empty congruence table ---\n", f);
  }

  delete_pvector(&v);
}
Exemplo n.º 2
0
/*
 * Initialize the printer p:
 * - file = output stream to use
 * - converter = converter API
 * - area = descriptor of the print area
 * - mode = initial print mode
 * - indent = initial indentation
 */
static void init_printer(printer_t *p, FILE *file, pp_token_converter_t *converter,
                         pp_area_t *area, pp_print_mode_t mode, uint32_t indent) {
  uint32_t next_width;

  p->file = file;
  p->area = *area;      // make an internal copy
  p->conv = *converter; // internal copy too

  // Force HMODE if the print area is too small for the
  // specified mode and indent.
  next_width = line_width_for_indent(area, indent + area->offset);
  if (area->height == 1 || (p->area.truncate && next_width < 4)) {
    mode = PP_HMODE;
    indent = 0;
    next_width = line_width_for_indent(area, area->offset);
    assert(!p->area.truncate || next_width >= 4);
  }

  // control parameters: no break, no space on the first line
  init_pp_stack(&p->stack, mode, indent);
  p->mode = mode;
  p->indent = indent + area->offset;
  p->next_margin = next_width;
  p->no_break = true;
  p->no_space = true;
  p->full_line = false;
  p->overfull_count = 0;

  // print line: initial width = area->width
  p->line = 0;
  p->col = 0;
  p->margin = area->width;

  // error codes
  p->print_failed = false;
  p->pp_errno = 0;

  // pending tokens: empty
  p->pending_col = 0;
  init_pvector(&p->pending_tokens, 0);
}