+unsigned warning_count = 0;
+bool show_column = true;
+bool diagnostics_show_option = true;
+
+static const position_t *curr_pos = NULL;
+
+/**
+ * prints an additional source position
+ */
+static void print_position(FILE *out, const position_t *pos)
+{
+ fprintf(out, "at line %u", pos->lineno);
+ if (show_column)
+ fprintf(out, ":%u", (unsigned)pos->colno);
+ if (curr_pos == NULL || curr_pos->input_name != pos->input_name)
+ fprintf(out, " of \"%s\"", pos->input_name);
+}
+
+static void fpututf32(utf32 const c, FILE *const out)
+{
+ if (c < 0x80U) {
+ fputc(c, out);
+ } else if (c < 0x800) {
+ fputc(0xC0 | (c >> 6), out);
+ fputc(0x80 | (c & 0x3F), out);
+ } else if (c < 0x10000) {
+ fputc(0xE0 | ( c >> 12), out);
+ fputc(0x80 | ((c >> 6) & 0x3F), out);
+ fputc(0x80 | ( c & 0x3F), out);
+ } else {
+ fputc(0xF0 | ( c >> 18), out);
+ fputc(0x80 | ((c >> 12) & 0x3F), out);
+ fputc(0x80 | ((c >> 6) & 0x3F), out);
+ fputc(0x80 | ( c & 0x3F), out);
+ }
+}