diff options
Diffstat (limited to 'common.h')
-rw-r--r-- | common.h | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -1,6 +1,9 @@ /* See LICENSE file for copyright and license details. */ +#include <locale.h> + #include <libsimple.h> #include <libsimple-arg.h> +#include <grapheme.h> #define EXIT_STYLE 1 #define EXIT_WARNING 2 @@ -15,12 +18,15 @@ X(WC_MAKEFILE, "makefile", INFORM)\ X(WC_EXTRA_MAKEFILE, "extra-makefile", WARN)\ X(WC_CMDLINE, "cmdline", WARN)\ - X(WC_TEXT, "text", WARN) + X(WC_TEXT, "text", WARN)\ + X(WC_ENCODING, "encoding", WARN)\ + X(WC_LONG_LINE, "long-line", WARN_STYLE) enum action { IGNORE, INFORM, + WARN_STYLE, WARN }; @@ -41,16 +47,30 @@ struct line { size_t len; const char *path; size_t lineno; + int eof; + int nest_level; +}; + +struct style { + size_t max_line_length; }; extern int exit_status; +extern struct style style; + + +/* text.c */ +struct line *load_text_file(int fd, const char *fname, int nest_level, size_t *nlinesp); +void check_utf8_encoding(struct line *line); +void check_column_count(struct line *line); /* ui.c */ extern struct warning_class_data warning_classes[]; void xprintwarningf(enum warning_class class, int severity, const char *fmt, ...); -#define printinfof(CLASS, ...) xprintwarningf(CLASS, EXIT_STYLE, __VA_ARGS__) +#define printinfof(CLASS, ...) xprintwarningf(CLASS, 0, __VA_ARGS__) +#define warnf_style(CLASS, ...) xprintwarningf(CLASS, EXIT_STYLE, __VA_ARGS__) #define warnf_warning(CLASS, ...) xprintwarningf(CLASS, EXIT_WARNING, __VA_ARGS__) #define warnf_unspecified(CLASS, ...) xprintwarningf(CLASS, EXIT_UNSPECIFIED, __VA_ARGS__) #define warnf_undefined(CLASS, ...) xprintwarningf(CLASS, EXIT_UNDEFINED, __VA_ARGS__) |