コード例 #1
0
static void
print_annotations (FILE *stream, JCF *jcf, int level)
{
  uint16 num = JCF_readu2 (jcf);
  while (num--)
    print_annotation (stream, jcf, level);
}
コード例 #2
0
void
KeySet::KeyPart::print (std::ostream& os) const
{
    Version const ver(version());

    size_t const size(ver != EMPTY ? base_size(ver, data_, 1) : 0);

    os << '(' << int(exclusive()) << ',' << ver_str[ver] << ')'
       << gu::Hexdump(data_, size);

    if (annotated(ver))
    {
        os << "=";
        print_annotation (os, data_ + size);
    }
}
コード例 #3
0
static void
print_element_value (FILE *stream, JCF *jcf, int level)
{
  uint8 tag = JCF_readu (jcf);
  indent (stream, level);
  switch (tag)
    {
    case 'B':
    case 'C':
    case 'S':
    case 'Z':
    case 'I':
      {
	uint16 cindex = JCF_readu2 (jcf);
	print_constant_terse_with_index (stream, jcf, cindex,
					 CONSTANT_Integer);
      }
      break;
    case 'D':
      {
	uint16 cindex = JCF_readu2 (jcf);
	print_constant_terse_with_index (stream, jcf, cindex,
					 CONSTANT_Double);
      }
      break;
    case 'F':
      {
	uint16 cindex = JCF_readu2 (jcf);
	print_constant_terse_with_index (stream, jcf, cindex,
					 CONSTANT_Float);
      }
      break;
    case 'J':
      {
	uint16 cindex = JCF_readu2 (jcf);
	print_constant_terse_with_index (stream, jcf, cindex,
					 CONSTANT_Long);
      }
      break;
    case 's':
      {
	uint16 cindex = JCF_readu2 (jcf);
	/* Despite what the JVM spec says, compilers generate a Utf8
	   constant here, not a String.  */
	print_constant_terse_with_index (stream, jcf, cindex,
					 CONSTANT_Utf8);
      }
      break;

    case 'e':
      {
	uint16 type_name_index = JCF_readu2 (jcf);
	uint16 const_name_index = JCF_readu2 (jcf);
	fprintf (stream, "enum class: ");
	print_constant_terse_with_index (stream, jcf, type_name_index,
					 CONSTANT_Utf8);
	fprintf (stream, "\n");
	indent (stream, level);
	fprintf (stream, "Field: ");
	print_constant_terse_with_index (stream, jcf, const_name_index,
					 CONSTANT_Utf8);
      }
      break;
    case 'c':
      {
	uint16 class_info_index = JCF_readu2 (jcf);
	print_constant_terse_with_index (stream, jcf, class_info_index,
					 CONSTANT_Utf8);
      }
      break;
    case '@':
      {
	fprintf (stream, "Annotation:\n");
	print_annotation (stream, jcf, level + 1);
      }
      break;
    case '[':
      {
	uint16 n_array_elts = JCF_readu2 (jcf);
	fprintf (stream, "array[%d]: [\n", (int) n_array_elts);
	while (n_array_elts--)
	  print_element_value (stream, jcf, level + 1);
	indent (stream, level);
	fprintf (stream, "]");
      }
      break;
    default:
      fprintf (stream, "Unexpected tag value: %d", (int) tag);
      break;
    }
  fputc ('\n', stream);
}