Esempio n. 1
0
void IRPrinter::visit(const Pipeline *op) {


    do_indent();
    stream << "produce " << op->name << " {" << endl;
    indent += 2;
    print(op->produce);
    indent -= 2;

    if (op->update.defined()) {
        do_indent();
        stream << "} update {" << endl;
        indent += 2;
        print(op->update);
        indent -= 2;
    }

    do_indent();
    stream << "} consume {" << endl;
    indent += 2;
    print(op->consume);
    indent -= 2;

    do_indent();
    stream << "}" << endl;
}
Esempio n. 2
0
static void
debug_each_source_column()
{
  do_indent ();
  fprintf (ipf->output_fp, "<s_col %d cindex=%d text=\"%s\" ",
	   iterate_source_column->index,
	   iterate_source_column->cindex,
	   iterate_source_column->filler_flag ? (Uchar*)"<filler>" : iterate_source_column->text);
  if (!iterate_source_column->index && *iterate_line->altsig)
    fprintf (ipf->output_fp, "(aka `%s') ", iterate_line->altsig);
  fprintf (ipf->output_fp, "cols=%d viswidth=%d zero=%s space=%s phant=%s", 
	   iterate_source_column->columns_occupied,
	   iterate_source_column->visible_width,
	   t_or_f(iterate_composite_column->zero_flag),
	   t_or_f(iterate_composite_column->space_flag),
	   t_or_f(iterate_source_column->needs_phantom));
  fprintf (ipf->output_fp, "\n");
  do_indent ();
  fprintf (ipf->output_fp, "\tcomposite = %p; composite_end = %p\n", 
	   iterate_source_column->composite,
	   iterate_source_column->composite_end);
  do_indent ();
  fprintf (ipf->output_fp, "  complex = %p ", iterate_source_column->complex);
  if (iterate_source_column->complex_text)
    {
      fprintf (ipf->output_fp, "complex_has_variant=%s complex_text = `%s'>\n", 
	       t_or_f(iterate_source_column->complex_has_variant),
	       print_escaped(iterate_source_column->complex_text));
    }
  else
    fprintf (ipf->output_fp, ">\n");
}
Esempio n. 3
0
static void json_line_open_windows(FILE *f, int indent, const char *key,
        const List<SettingsFileOpenWindow> &open_windows)
{
    do_indent(f, indent);
    fprintf(f, "%s: ", key);
    json_line_indent(f, &indent, "[");

    for (int i = 0; i < open_windows.length(); i += 1) {
        const SettingsFileOpenWindow *open_window = &open_windows.at(i);

        do_indent(f, indent);
        json_line_indent(f, &indent, "{");

        json_line_comment(f, indent, "which perspective this window uses");
        json_line_int(f, indent, "perspective", open_window->perspective_index);
        fprintf(f, "\n");

        json_line_comment(f, indent, "position of the window on the screen");
        json_line_int(f, indent, "left", open_window->left);
        json_line_int(f, indent, "top", open_window->top);
        json_line_int(f, indent, "width", open_window->width);
        json_line_int(f, indent, "height", open_window->height);
        json_line_bool(f, indent, "maximized", open_window->maximized);
        fprintf(f, "\n");

        json_line_comment(f, indent, "whether to show dockable pane tabs when there is only one");
        json_line_bool(f, indent, "always_show_tabs", open_window->always_show_tabs);
        fprintf(f, "\n");

        json_line_outdent(f, &indent, "},");
    }
    json_line_outdent(f, &indent, "],");
}
Esempio n. 4
0
static void
debug_each_composite_column()
{
  List *vlist;

  do_indent ();
  fprintf (ipf->output_fp, 
	   "<comp_col %d text=\"%s\" delim=\"%s\" viswidth=%d maxwidth=%d zero=%s space=%s\n", 
	   iterate_composite_column->index,
	   iterate_composite_column->text,
	   print_escaped(iterate_composite_column->delim),
	   iterate_composite_column->visible_width,
	   iterate_composite_column->maxwidth,
	   t_or_f(iterate_composite_column->zero_flag),
	   t_or_f(iterate_composite_column->space_flag));
  do_indent ();
  fprintf (ipf->output_fp, 
	   "\tcomplex_index=%d complex_columns=%d complex_has_variant=%s s_l_d=%s phant=%s>\n",
	   iterate_composite_column->complex_index,
	   iterate_composite_column->complex_columns,
	   t_or_f(iterate_composite_column->complex->complex_has_variant),
	   t_or_f(iterate_composite_column->short_line_divider),
	   t_or_f(iterate_composite_column->needs_phantom));
  do_indent ();
  fprintf (ipf->output_fp, "\tcomplex = %p\n", iterate_composite_column);
  vlist = vars_lookup2(iterate_line->name, iterate_composite_column->index);
  if (list_len(vlist))
    {
      indent += 2;
      vars_normalize_length(vlist);
      list_exec (vlist, debug_print_variant);
      indent -= 2;
    }
}
Esempio n. 5
0
static void json_line_dock(FILE *f, int indent, const char *key, const SettingsFileDock *dock) {
    assert(dock);

    do_indent(f, indent);
    fprintf(f, "%s: ", key);
    json_line_indent(f, &indent, "{");

    json_line_str(f, indent, "dock_type", dock_type_to_str(dock->dock_type));

    switch (dock->dock_type) {
        case SettingsFileDockTypeTabs:
            do_indent(f, indent);
            fprintf(f, "tabs: [");
            for (int i = 0; i < dock->tabs.length(); i += 1) {
                json_inline_str(f, dock->tabs.at(i).encode());
                if (i < dock->tabs.length() - 1)
                    fprintf(f, ", ");
            }
            fprintf(f, "],\n");
            break;
        case SettingsFileDockTypeHoriz:
        case SettingsFileDockTypeVert:
            json_line_float(f, indent, "split_ratio", dock->split_ratio);
            json_line_dock(f, indent, "child_a", dock->child_a);
            json_line_dock(f, indent, "child_b", dock->child_b);
            break;
    }

    json_line_outdent(f, &indent, "},");
}
Esempio n. 6
0
void IRPrinter::visit(const Allocate *op) {
    do_indent();
    stream << "allocate " << op->name << "[" << op->type << " * ";
    print(op->size);
    stream << "]" << endl;
    print(op->body);

    do_indent();
    stream << "free " << op->name << endl;
}
Esempio n. 7
0
static void json_line_str_list(FILE *f, int indent, const char *key, const List<ByteBuffer> &value) {
    do_indent(f, indent);
    fprintf(f, "%s: ", key);
    json_line_indent(f, &indent, "[");
    for (int i = 0; i < value.length(); i += 1) {
        do_indent(f, indent);
        json_inline_str(f, value.at(i));
        fprintf(f, ",\n");
    }
    json_line_outdent(f, &indent, "],\n");
}
Esempio n. 8
0
void xmlt::output(std::ostream &out, unsigned indent) const
{
  // 'name' needs to be set, or we produce mal-formed
  // XML.
  
  if(name=="") return;

  do_indent(out, indent);

  out << '<' << name;

  for(attributest::const_iterator
      it=attributes.begin();
      it!=attributes.end();
      it++)
  {
    // it->first needs to be non-empty
    if(it->first=="") continue;
    out << ' ' << it->first
        << '=' << '"';
    escape_attribute(it->second, out);
    out << '"';
  }

  if(elements.empty() && data.empty())
  {
    out << "/>" << "\n";
    return;
  }

  out << '>';

  if(elements.empty())
    escape(data, out);
  else
  {
    out << "\n";

    for(elementst::const_iterator
        it=elements.begin();
        it!=elements.end();
        it++)
      it->output(out, indent+2);

    do_indent(out, indent);
  }

  out << '<' << '/' << name << '>' << "\n";
}
Esempio n. 9
0
static void
debug_before_block()
{
  do_indent ();
  fprintf (ipf->output_fp, "<block %d>\n", iterate_block->index);
  indent += 2;
}
Esempio n. 10
0
static void
debug_after_reconstructed()
{
  indent -= 2;
  do_indent ();
  fprintf (ipf->output_fp, "</reconstructed %d>\n", iterate_line->index);
}
Esempio n. 11
0
static void
debug_after_source()
{
  indent -= 2;
  do_indent ();
  fprintf (ipf->output_fp, "</source %d>\n", iterate_line->index);
}
Esempio n. 12
0
void IRPrinter::visit(const For *op) {

    do_indent();
    stream << op->for_type << " (" << op->name << ", ";
    print(op->min);
    stream << ", ";
    print(op->extent);
    stream << ") {" << endl;

    indent += 2;
    print(op->body);
    indent -= 2;

    do_indent();
    stream << "}" << endl;
}
Esempio n. 13
0
static void
debug_after_block()
{
  indent -= 2;
  do_indent ();
  fprintf (ipf->output_fp, "</block %d>\n", iterate_block->index);
}
Esempio n. 14
0
static void
debug_after_outers()
{
  indent -= 2;
  do_indent ();
  fprintf (ipf->output_fp, "</outer %d>\n", iterate_outer->index);
}
Esempio n. 15
0
void scope_logger::do_log_exit()
{
	const int ticks = SDL_GetTicks() - ticks_;
	--indent;
	do_indent();
	if (timestamp) (*output_) << get_timestamp(time(nullptr));
	(*output_) << "} END: " << str_ << " (took " << ticks << "ms)\n";
}
Esempio n. 16
0
static void
debug_each_reconstructed_column()
{
  do_indent ();
  fprintf (ipf->output_fp, "<recons_col %d text=\"%s\" delim=\"%s\" maxwidth=%d\n", 
	   iterate_reconstructed_column->index,
	   iterate_reconstructed_column->text,
	   print_escaped(iterate_reconstructed_column->delim),
	   iterate_reconstructed_column->maxwidth);
  do_indent ();
  fprintf (ipf->output_fp, "\tcomplex_index=%d complex_columns=%d zero=%s space=%s phant=%s>\n",
	   iterate_reconstructed_column->complex_index,
	   iterate_reconstructed_column->complex_columns,
	   t_or_f(iterate_reconstructed_column->zero_flag),
	   t_or_f(iterate_reconstructed_column->space_flag),
	   t_or_f(iterate_reconstructed_column->needs_phantom));
}
Esempio n. 17
0
static void
debug_each_outer ()
{
  indent -= 2;
  do_indent ();
  fprintf (ipf->output_fp, "<outer %d>\n", iterate_outer->index);
  indent += 2;
}
Esempio n. 18
0
void IRPrinter::visit(const LetStmt *op) {
    do_indent();
    stream << "let " << op->name << " = ";
    print(op->value);
    stream << endl;

    print(op->body);
}
Esempio n. 19
0
void scope_logger::do_log_exit()
{
	const long ticks = (boost::posix_time::microsec_clock::local_time() - ticks_).total_milliseconds();
	--indent;
	do_indent();
	if (timestamp) (*output_) << get_timestamp(time(nullptr));
	(*output_) << "} END: " << str_ << " (took " << ticks << "ms)\n";
}
Esempio n. 20
0
void IRPrinter::visit(const Store *op) {
    do_indent();
    stream << op->name << "[";
    print(op->index);
    stream << "] = ";
    print(op->value);
    stream << endl;
}
Esempio n. 21
0
int settings_file_commit(SettingsFile *sf) {
    OsTempFile tmp_file;
    int err = os_create_temp_file(os_path_dirname(sf->path).raw(), &tmp_file);
    if (err)
        return err;

    FILE *f = tmp_file.file;

    int indent = 0;
    json_line_comment(f, indent, "Genesis DAW configuration file");
    json_line_comment(f, indent, "This config file format is a superset of JSON. See");
    json_line_comment(f, indent, "https://github.com/andrewrk/liblaxjson for more details.");
    json_line_comment(f, indent, "WARNING: This file is sporadically overwritten while Genesis is running.");
    do_indent(f, indent);
    json_line_indent(f, &indent, "{");

    json_line_comment(f, indent, "your display name");
    json_line_str(f, indent, "user_name", sf->user_name.encode());
    fprintf(f, "\n");

    json_line_comment(f, indent, "your user id");
    json_line_uint256(f, indent, "user_id", sf->user_id);
    fprintf(f, "\n");

    json_line_comment(f, indent, "extra directories to search for samples.");
    json_line_comment(f, indent, "note: ~/.genesis/samples/ is always searched.");
    json_line_str_list(f, indent, "sample_dirs", sf->sample_dirs);
    fprintf(f, "\n");

    json_line_comment(f, indent, "open this project on startup");
    json_line_uint256(f, indent, "open_project_id", sf->open_project_id);
    fprintf(f, "\n");

    json_line_comment(f, indent, "these perspectives are available for the user to choose from");
    json_line_perspectives(f, indent, "perspectives", sf->perspectives);
    fprintf(f, "\n");

    json_line_comment(f, indent, "open these windows on startup");
    json_line_open_windows(f, indent, "open_windows", sf->open_windows);
    fprintf(f, "\n");

    json_line_comment(f, indent, "how many seconds long should audio buffers be");
    json_line_comment(f, indent, "a shorter value makes genesis respond to events faster");
    json_line_comment(f, indent, "a larger value guards against buffer underruns");
    json_line_double(f, indent, "latency", sf->latency);
    fprintf(f, "\n");

    json_line_outdent(f, &indent, "}");

    if (fclose(f))
        return GenesisErrorFileAccess;

    err = os_rename_clobber(tmp_file.path.raw(), sf->path.raw());
    if (err)
        return err;

    return 0;
}
Esempio n. 22
0
File: xml.cpp Progetto: danpoe/cbmc
void xmlt::output(std::ostream &out, unsigned indent) const
{
  // 'name' needs to be set, or we produce mal-formed
  // XML.

  if(name=="")
    return;

  do_indent(out, indent);

  out << '<' << name;

  for(const auto &attribute : attributes)
  {
    // it.first needs to be non-empty
    if(attribute.first.empty())
      continue;
    out << ' ' << attribute.first
        << '=' << '"';
    escape_attribute(attribute.second, out);
    out << '"';
  }

  if(elements.empty() && data.empty())
  {
    out << "/>" << "\n";
    return;
  }

  out << '>';

  if(elements.empty())
    escape(data, out);
  else
  {
    out << "\n";

    for(const auto &element : elements)
      element.output(out, indent+2);

    do_indent(out, indent);
  }

  out << '<' << '/' << name << '>' << "\n";
}
Esempio n. 23
0
void
json_document_end (json_ctx_t *ctx)
{
  ctx->indent_level--;

  do_indent (ctx);

  fputs ("\n}", ctx->fp);
}
Esempio n. 24
0
static void
debug_before_reconstructed()
{
  do_indent ();
  fprintf (ipf->output_fp, "<reconstructed %d name=%s>\n", 
	   iterate_line->index,
	   iterate_line->name);
  indent += 2;
}
Esempio n. 25
0
static void
debug_before_composite()
{
  do_indent ();
  fprintf (ipf->output_fp, "<composite %d name=%s>\n", 
	   iterate_line->index,
	   iterate_line->name);
  indent += 2;
}
Esempio n. 26
0
void IRPrinter::visit(const PrintStmt *op) {
    do_indent();
    stream << "print(" << op->prefix;
    for (size_t i = 0; i < op->args.size(); i++) {
        stream << ", ";
        print(op->args[i]);
    }
    stream << ")" << endl;
}
Esempio n. 27
0
void
json_document_begin (json_ctx_t *ctx)
{
  do_indent (ctx);

  fputs ("{\n", ctx->fp);

  ctx->indent_level++;
  ctx->first_element = true;
}
Esempio n. 28
0
static void
debug_print_variant (void *v)
{
  Variant *vp = v;
  do_indent ();
  fprintf (ipf->output_fp, "<variant %s has \"%s\" for \"%s\">\n",
	   vp->siglum_name,
	   vars_get_expanded_variant_text (vp),
	   vars_get_main_text (vp));
}
Esempio n. 29
0
static void
dump (FILE *stream, int indent, const char *format, ...)
{
  va_list list;

  do_indent (stream, indent);

  va_start (list, format);
  vfprintf (stream, format, list);
  va_end (list);
}
Esempio n. 30
0
void IRPrinter::visit(const Realize *op) {
    do_indent();
    stream << "realize " << op->name << "(";
    for (size_t i = 0; i < op->bounds.size(); i++) {
        stream << "[";
        print(op->bounds[i].min);
        stream << ", ";
        print(op->bounds[i].extent);
        stream << "]";
        if (i < op->bounds.size() - 1) stream << ", ";
    }
    stream << ") {" << endl;

    indent += 2;
    print(op->body);
    indent -= 2;

    do_indent();
    stream << "}" << endl;
}