1 #ifndef _SCDOC_PARSER_H 2 #define _SCDOC_PARSER_H 3 #include <stdarg.h> 4 #include <stdint.h> 5 #include <stdio.h> 6 7 struct parser { 8 FILE *input, *output; 9 int line, col; 10 int qhead; 11 uint32_t queue[32]; 12 uint32_t flags; 13 const char *str; 14 int fmt_line, fmt_col; 15 }; 16 17 enum formatting { 18 FORMAT_BOLD = 1, 19 FORMAT_UNDERLINE = 2, 20 FORMAT_LAST = 4, 21 }; 22 23 void parser_fatal(struct parser *parser, const char *err); 24 uint32_t parser_getch(struct parser *parser); 25 void parser_pushch(struct parser *parser, uint32_t ch); 26 void parser_pushstr(struct parser *parser, const char *str); 27 int roff_macro(struct parser *p, char *cmd, ...); 28 void *xcalloc(size_t n, size_t s); 29 void *xrealloc(void *p, size_t s); 30 31 #endif 32