=================================================================== RCS file: /cvs/texi2mdoc/extern.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -p -r1.10 -r1.11 --- texi2mdoc/extern.h 2015/02/23 15:09:09 1.10 +++ texi2mdoc/extern.h 2015/02/23 22:50:11 1.11 @@ -1,4 +1,4 @@ -/* $Id: extern.h,v 1.10 2015/02/23 15:09:09 kristaps Exp $ */ +/* $Id: extern.h,v 1.11 2015/02/23 22:50:11 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -87,6 +87,8 @@ enum texicmd { TEXICMD_DIRENTRY, TEXICMD_DISPLAY, TEXICMD_DMN, + TEXICMD_DOCUMENTDESCRPITION, + TEXICMD_DOCUMENTENCODING, TEXICMD_DOTS, TEXICMD_EMAIL, TEXICMD_EMPH, @@ -229,15 +231,21 @@ enum texicmd { TEXICMD__MAX }; +enum texisrc { + TEXISRC_FILE, + TEXISRC_STDIN +}; + /* * The file currently being parsed. * This keeps track of our location within that file. */ struct texifile { + enum texisrc type; /* type of file */ const char *name; /* name of the file */ size_t line; /* current line (from zero) */ size_t col; /* current column in line (from zero) */ - char *map; /* mmap'd file */ + char *map; /* mmap'd file OR allocated buffer */ size_t mapsz; /* size of mmap */ }; @@ -258,6 +266,10 @@ struct texitok { size_t len; /* strlen(tok) */ }; +/* + * These values instruct us on whether a list (or table) of some type is + * currently being parsed. + */ enum texilist { TEXILIST_NONE = 0, TEXILIST_ITEM, @@ -265,16 +277,24 @@ enum texilist { TEXILIST_TABLE }; +/* + * Hold values assigned with @set and retrieved with @value. + * These values can contain arbitrary Texinfo. + */ struct texivalue { - char *key; - char *value; + char *key; /* the nil-terminated value name */ + char *value; /* the nil-terminated value */ }; +/* + * Macros are (possibly-recursive) Texinfo sequences created with @macro + * and filled in by arguments when invoked. + */ struct teximacro { - char *key; - char *value; - char **args; - size_t argsz; + char *key; /* nil-terminated macro name */ + char *value; /* nil-terminated value */ + char **args; /* array of argument names (or NULL) */ + size_t argsz; /* array size */ }; /* @@ -296,8 +316,8 @@ struct texi { size_t indexsz; /* entries in indexs */ struct texivalue *vals; /* @value entries */ size_t valsz; /* entries in vals */ - struct teximacro *macros; - size_t macrosz; + struct teximacro *macros; /* @macro entries */ + size_t macrosz; /* entries in macros */ /* * The following control what we output to the screen. * The complexity is required to accomodate for mdoc(7). @@ -325,6 +345,7 @@ char **argparse(struct texi *, const char *, size_t, int parsearg(struct texi *, const char *, size_t, size_t *, size_t); void parsebracket(struct texi *, const char *, size_t, size_t *); +void parsestdin(struct texi *); void parsefile(struct texi *, const char *, int); int parselinearg(struct texi *, const char *, size_t, size_t *); void parseeof(struct texi *, const char *, size_t);