static void
dump_conv_types(FILE *fp,
               struct lp_type src_type,
               struct lp_type dst_type)
{
   fprintf(fp, "src_type=");
   dump_type(fp, src_type);

   fprintf(fp, " dst_type=");
   dump_type(fp, dst_type);

   fprintf(fp, " ...\n");
   fflush(fp);
}
Example #2
0
static void dump(const struct blob *blob)
{
	uint32_t i;

	printf("header: package_count=%d\n",
	       dtohl(blob->header->data.package_count));
	printf("string pool (resource values): string_count=%d\n",
	       dtohl(blob->sp_values->data.string_count));
	for (i = 0; i < dtohl(blob->header->data.package_count); i++) {
		const struct package *pkg = &blob->packages[i];
		size_t j;

		printf("package: id=0x%02x spec_count=%zd\n",
		       dtohl(pkg->package->data.id), pkg->spec_count);
		printf("string pool (type names): string_count=%d\n",
		       dtohl(pkg->sp_type_names->data.string_count));
		printf("string pool (resource names): string_count=%d\n",
		       dtohl(pkg->sp_resource_names->data.string_count));
		for (j = 0; j < pkg->spec_count; j++) {
			const struct type_spec *spec = &pkg->specs[j];
			size_t k;

			printf("type spec: id=0x%02x type_count=%zd\n",
			       dtohs(spec->spec->data.id), spec->type_count);
			for (k = 0; k < spec->type_count; k++) {
				const struct arsc_type *type = spec->types[k];
				dump_type(type);
			}
		}
	}
}
static void
write_tsv_row(FILE *fp,
              struct lp_type src_type,
              struct lp_type dst_type,
              double cycles,
              boolean success)
{
   fprintf(fp, "%s\t", success ? "pass" : "fail");

   fprintf(fp, "%.1f\t", cycles / MAX2(src_type.length, dst_type.length));

   dump_type(fp, src_type);
   fprintf(fp, "\t");

   dump_type(fp, dst_type);
   fprintf(fp, "\n");

   fflush(fp);
}
Example #4
0
void dump_desc_expr_newline(
		dump *ctx, const char *desc, const struct expr *e,
		int newline)
{
	dump_desc_colour_newline(ctx, desc, e, &e->where,
			maybe_colour(ctx->fout, col_desc_expr), 0);

	if(e->tree_type)
		dump_type(ctx, e->tree_type);

	dump_newline(ctx, newline);
}
Example #5
0
void
dump_mbi (PMEMORY_BASIC_INFORMATION mbi)
{
  fprintf (fp, "0x%08x ", mbi->AllocationBase);
  dump_protect_flags (mbi->AllocationProtect);
  fprintf (fp, "0x%08x ", mbi->BaseAddress);
  fprintf (fp, "0x%08x ", mbi->RegionSize);
  dump_state (mbi->State);
  dump_protect_flags (mbi->Protect);
  dump_type (mbi->Type);
  fprintf (fp, "\n");
}
Example #6
0
static int svgx_all(svgx_opt_t opt, svg_list_t *list)
{
  /* coerce explicit */

  if (svg_list_iterate(list, svg_explicit2, NULL) != 0)
    {
      btrace("failed coerce explicit");
      return 1;
    }

  /* coerce flat */

  if (flatten_type(opt.type))
    {
      if (svg_list_iterate(list, 
			   (int (*)(svg_t*, void*))svg_flatten2, 
			   &(opt.format.alpha)) != 0)
	{
	  btrace("failed coerce explicit");
	  return 1;
	}
    }

  int (*dump)(svg_t*, void*);

  if ((dump = (int (*)(svg_t*, void*))dump_type(opt.type)) == NULL) 
    return 1;

  if (opt.verbose)
    printf("converting all gradients:\n");

  if (svg_list_iterate(list, dump, &opt) != 0)
    {
      btrace("failed writing all gradients");
      return 1;
    }

  return 0;
}
Example #7
0
static int svgx_single(svgx_opt_t opt, svg_t *svg)
{
  const char *file;

  if (svg_explicit(svg) != 0)
    {
      btrace("failed adding explicit stops");
      return 1;
    }

  file = opt.output.file;

  if (flatten_type(opt.type))
    {
      if (svg_flatten(svg, opt.format.alpha) != 0)
	{
	  btrace("failed to flatten transparency");
	  return 1;
	}
    }

  dump_f dump;

  if ((dump = dump_type(opt.type)) == NULL)
    return 1;

  if (dump(svg, &opt) != 0)
    {
      btrace("failed conversion");
      return 1;
    }

  if (opt.verbose)
    printf("wrote %s to %s\n",
	   (opt.name ? opt.name : "gradient"),
	   (file ? file : "<stdout>"));
  
  return 0;
}
Example #8
0
static void dump_fields(region r, const char *prefix, field_declaration fields)
{
  while (fields)
    {
      if (fields->name) /* skip anon fields */
	{
	  type t = fields->type;

	  printf("  %s%s ", prefix, fields->name);
	  while (type_array(t))
	    {
	      type base = type_array_of(t);
	      expression size = type_array_size(t);

	      printf("[%lu]", (unsigned long)constant_uint_value(size->cst));
	      t = base;
	    }
	  dump_type(t);

	  assert(cval_isinteger(fields->offset));
	  printf(" %lu %lu\n", (unsigned long)cval_uint_value(fields->offset),
		 (unsigned long)
		 (!cval_istop(fields->bitwidth) ?
		  cval_uint_value(fields->bitwidth) :
		  BITSPERBYTE * cval_uint_value(type_size(t))));

	  if (type_aggregate(t))
	    {
	      tag_declaration tdecl = type_tag(t);
	      char *newprefix = rarrayalloc(r, strlen(prefix) + strlen(fields->name) + 2, char);

	      sprintf(newprefix, "%s%s.", prefix, fields->name);
	      dump_fields(r, newprefix, tdecl->fieldlist);
	      printf("  %s%s AX\n", prefix, fields->name);
	    }
	}
      fields = fields->next;
    }
Example #9
0
void dump_decl(decl *d, dump *ctx, const char *desc)
{
	const int is_func = !!type_is(d->ref, type_func);
	type *ty;

	if(!desc){
		if(d->spel){
			desc = is_func ? "function" : "variable";
		}else{
			desc = "type";
		}
	}

	dump_desc_colour_newline(ctx, desc, d, &d->where,
			maybe_colour(ctx->fout, col_desc_decl), 0);

	if(d->proto)
		dump_printf_indent(ctx, 0, " prev %p", (void *)d->proto);

	if(d->spel)
		dump_printf_indent(ctx, 0, " %s", d->spel);

	dump_type(ctx, d->ref);

	if(d->store)
		dump_printf_indent(ctx, 0, " %s", decl_store_to_str(d->store));

	dump_printf_indent(ctx, 0, "\n");

	if(!is_func){
		type *tof = type_skip_non_tdefs(d->ref);
		if(tof->type == type_tdef && !tof->bits.tdef.decl){
			/* show typeof expr */
			dump_inc(ctx);
			dump_expr(tof->bits.tdef.type_of, ctx);
			dump_dec(ctx);
		}

		if(d->bits.var.field_width){
			dump_inc(ctx);
			dump_expr(d->bits.var.field_width, ctx);
			dump_dec(ctx);
		}

		if(!d->spel){
			dump_sue(ctx, d->ref);
		}else if(d->bits.var.init.dinit){
			dump_inc(ctx);
			dump_init(ctx, d->bits.var.init.dinit);
			dump_dec(ctx);
		}
	}

	dump_inc(ctx);
	dump_attributes(d->attr, ctx);
	ty = type_skip_non_attr(d->ref);
	if(ty && ty->type == type_attr)
		dump_attributes(ty->bits.attr, ctx);
	dump_dec(ctx);

	if(is_func && d->bits.func.code){
		funcargs *fa = type_funcargs(d->ref);

		dump_inc(ctx);
		dump_args(fa, ctx);
		dump_stmt(d->bits.func.code, ctx);
		dump_dec(ctx);
	}
}