| dnl Reference: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html | dnl Reference: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html | ||||
| dnl ================================================================ | dnl ================================================================ | ||||
| AX_CHECK_COMPILE_FLAG([-Wmissing-prototypes], [CFLAGS="-Wmissing-prototypes $CFLAGS"]) | |||||
| AX_CHECK_COMPILE_FLAG([-Wreturn-type], [CFLAGS="-Wreturn-type $CFLAGS"]) | AX_CHECK_COMPILE_FLAG([-Wreturn-type], [CFLAGS="-Wreturn-type $CFLAGS"]) | ||||
| dnl ================================================================ | dnl ================================================================ |
| } | } | ||||
| #endif | #endif | ||||
| void fput_utf8c(FILE *out, codepoint_t c) | |||||
| static void fput_utf8c(FILE *out, codepoint_t c) | |||||
| { | { | ||||
| if (c < 0x80) | if (c < 0x80) | ||||
| fputc((uint8_t)c, out); | fputc((uint8_t)c, out); | ||||
| } | } | ||||
| } | } | ||||
| int fget_utf8c(FILE *in, codepoint_t *c) | |||||
| static int fget_utf8c(FILE *in, codepoint_t *c) | |||||
| { | { | ||||
| int ch = EOF; | int ch = EOF; | ||||
| if ((ch = fgetc(in)) == EOF) return 0; | if ((ch = fgetc(in)) == EOF) return 0; | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| void uprintf_codepoint(FILE *out, codepoint_t c, char mode) | |||||
| static void uprintf_codepoint(FILE *out, codepoint_t c, char mode) | |||||
| { | { | ||||
| switch (mode) | switch (mode) | ||||
| { | { | ||||
| } | } | ||||
| } | } | ||||
| void uprintf_is(FILE *out, codepoint_t c, char mode) | |||||
| static void uprintf_is(FILE *out, codepoint_t c, char mode) | |||||
| { | { | ||||
| switch (mode) | switch (mode) | ||||
| { | { | ||||
| } | } | ||||
| } | } | ||||
| void uprintf(FILE *out, codepoint_t c, const char *format) | |||||
| static void uprintf(FILE *out, codepoint_t c, const char *format) | |||||
| { | { | ||||
| while (*format) switch (*format) | while (*format) switch (*format) | ||||
| { | { | ||||
| } | } | ||||
| } | } | ||||
| void print_file(FILE *in, const char *format) | |||||
| static void print_file(FILE *in, const char *format) | |||||
| { | { | ||||
| codepoint_t c = 0; | codepoint_t c = 0; | ||||
| while (fget_utf8c(in, &c)) | while (fget_utf8c(in, &c)) |
| #include <string.h> | #include <string.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| void fput_utf8c(FILE *out, codepoint_t c) | |||||
| static void fput_utf8c(FILE *out, codepoint_t c) | |||||
| { | { | ||||
| if (c < 0x80) | if (c < 0x80) | ||||
| fputc((uint8_t)c, out); | fputc((uint8_t)c, out); | ||||
| } | } | ||||
| } | } | ||||
| int fget_utf8c(FILE *in, codepoint_t *c) | |||||
| static int fget_utf8c(FILE *in, codepoint_t *c) | |||||
| { | { | ||||
| int ch = EOF; | int ch = EOF; | ||||
| if ((ch = fgetc(in)) == EOF) return 0; | if ((ch = fgetc(in)) == EOF) return 0; | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| void uprintf_codepoint(FILE *out, codepoint_t c, char mode) | |||||
| static void uprintf_codepoint(FILE *out, codepoint_t c, char mode) | |||||
| { | { | ||||
| switch (mode) | switch (mode) | ||||
| { | { | ||||
| } | } | ||||
| } | } | ||||
| void uprintf_is(FILE *out, codepoint_t c, char mode) | |||||
| static void uprintf_is(FILE *out, codepoint_t c, char mode) | |||||
| { | { | ||||
| switch (mode) | switch (mode) | ||||
| { | { | ||||
| } | } | ||||
| } | } | ||||
| void uprintf(FILE *out, codepoint_t c, const char *format) | |||||
| static void uprintf(FILE *out, codepoint_t c, const char *format) | |||||
| { | { | ||||
| while (*format) switch (*format) | while (*format) switch (*format) | ||||
| { | { | ||||
| } | } | ||||
| } | } | ||||
| void print_file(FILE *in, const char *format) | |||||
| static void print_file(FILE *in, const char *format) | |||||
| { | { | ||||
| codepoint_t c = 0; | codepoint_t c = 0; | ||||
| while (fget_utf8c(in, &c)) | while (fget_utf8c(in, &c)) |