- print_pos_tabs(pos);
- if (!integer_declaration->signedness) {
- fprintf(pos->fp, "%" PRIu64" (0x%" PRIX64 ")\n",
- integer_definition->value._unsigned,
- integer_definition->value._unsigned);
- } else {
- fprintf(pos->fp, "%" PRId64" (0x%" PRIX64 ")\n",
- integer_definition->value._signed,
- integer_definition->value._signed);
+
+ if (pos->field_nr++ != 0)
+ fprintf(pos->fp, ",");
+ fprintf(pos->fp, " ");
+ if (pos->print_names)
+ fprintf(pos->fp, "%s = ",
+ rem_(g_quark_to_string(definition->name)));
+
+ if (pos->string
+ && (integer_declaration->encoding == CTF_STRING_ASCII
+ || integer_declaration->encoding == CTF_STRING_UTF8)) {
+
+ if (!integer_declaration->signedness) {
+ g_string_append_c(pos->string,
+ (int) integer_definition->value._unsigned);
+ } else {
+ g_string_append_c(pos->string,
+ (int) integer_definition->value._signed);
+ }
+ return 0;
+ }
+
+ switch (integer_declaration->base) {
+ case 0: /* default */
+ case 10:
+ if (!integer_declaration->signedness) {
+ fprintf(pos->fp, "%" PRIu64,
+ integer_definition->value._unsigned);
+ } else {
+ fprintf(pos->fp, "%" PRId64,
+ integer_definition->value._signed);
+ }
+ break;
+ case 2:
+ {
+ int bitnr;
+ uint64_t v;
+
+ if (!integer_declaration->signedness)
+ v = integer_definition->value._unsigned;
+ else
+ v = (uint64_t) integer_definition->value._signed;
+
+ fprintf(pos->fp, "0b");
+ v = _bt_piecewise_lshift(v, 64 - integer_declaration->len);
+ for (bitnr = 0; bitnr < integer_declaration->len; bitnr++) {
+ fprintf(pos->fp, "%u", (v & (1ULL << 63)) ? 1 : 0);
+ v = _bt_piecewise_lshift(v, 1);
+ }
+ break;