=================================================================== RCS file: /cvs/texi2mdoc/extern.h,v retrieving revision 1.11 retrieving revision 1.18 diff -u -p -r1.11 -r1.18 --- texi2mdoc/extern.h 2015/02/23 22:50:11 1.11 +++ texi2mdoc/extern.h 2015/02/28 00:03:20 1.18 @@ -1,4 +1,4 @@ -/* $Id: extern.h,v 1.11 2015/02/23 22:50:11 kristaps Exp $ */ +/* $Id: extern.h,v 1.18 2015/02/28 00:03:20 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -17,15 +17,34 @@ #ifndef EXTERN_H #define EXTERN_H +#if !defined(__BEGIN_DECLS) +# ifdef __cplusplus +# define __BEGIN_DECLS extern "C" { +# else +# define __BEGIN_DECLS +# endif +#endif +#if !defined(__END_DECLS) +# ifdef __cplusplus +# define __END_DECLS } +# else +# define __END_DECLS +# endif +#endif + /* * This defines each one of the Texinfo commands that we understand. * Obviously this only refers to native commands; overriden names are a * different story. */ enum texicmd { + TEXICMD_A4PAPER, + TEXICMD_AA, + TEXICMD_AASMALL, TEXICMD_ACRONYM, TEXICMD_ACUTE, - TEXICMD_A4PAPER, + TEXICMD_AE, + TEXICMD_AESMALL, TEXICMD_ANCHOR, TEXICMD_APPENDIX, TEXICMD_APPENDIXSEC, @@ -83,12 +102,17 @@ enum texicmd { TEXICMD_DEFVRX, TEXICMD_DETAILMENU, TEXICMD_DFN, + TEXICMD_DH, + TEXICMD_DHSMALL, TEXICMD_DIRCATEGORY, TEXICMD_DIRENTRY, TEXICMD_DISPLAY, TEXICMD_DMN, TEXICMD_DOCUMENTDESCRPITION, TEXICMD_DOCUMENTENCODING, + TEXICMD_DOCUMENTLANGUAGE, + TEXICMD_DOTACCENT, + TEXICMD_DOTLESS, TEXICMD_DOTS, TEXICMD_EMAIL, TEXICMD_EMPH, @@ -98,17 +122,31 @@ enum texicmd { TEXICMD_ENV, TEXICMD_EQUIV, TEXICMD_ERROR, + TEXICMD_EURO, TEXICMD_EXAMPLE, + TEXICMD_EXCLAMDOWN, TEXICMD_EXDENT, TEXICMD_EXPANSION, TEXICMD_FILE, TEXICMD_FINALOUT, TEXICMD_FINDEX, + TEXICMD_FLUSHLEFT, + TEXICMD_FLUSHRIGHT, + TEXICMD_FIRSTPARAGRAPHINDENT, TEXICMD_FOOTNOTE, + TEXICMD_FOOTNOTESTYLE, TEXICMD_FTABLE, TEXICMD_FORMAT, + TEXICMD_GEQ, TEXICMD_GRAVE, TEXICMD_GROUP, + TEXICMD_GUILLEMETLEFT, + TEXICMD_GUILLEMETRIGHT, + TEXICMD_GUILLEMOTLEFT, + TEXICMD_GUILLEMOTRIGHT, + TEXICMD_GUILSINGLLEFT, + TEXICMD_GUILSINGLRIGHT, + TEXICMD_H, TEXICMD_HEADING, TEXICMD_HEADINGS, TEXICMD_HEADITEM, @@ -133,6 +171,7 @@ enum texicmd { TEXICMD_IMAGE, TEXICMD_INCLUDE, TEXICMD_INDENTBLOCK, + TEXICMD_INDICATEURL, TEXICMD_INFOREF, TEXICMD_INSERTCOPYING, TEXICMD_ITEM, @@ -141,9 +180,13 @@ enum texicmd { TEXICMD_KBD, TEXICMD_KEY, TEXICMD_KINDEX, + TEXICMD_L, TEXICMD_LATEX, + TEXICMD_LEQ, TEXICMD_LOWERSECTIONS, + TEXICMD_LSMALL, TEXICMD_MACRO, + TEXICMD_MACRON, TEXICMD_MATH, TEXICMD_MENU, TEXICMD_MINUS, @@ -152,20 +195,37 @@ enum texicmd { TEXICMD_NEWLINE, TEXICMD_NODE, TEXICMD_NOINDENT, + TEXICMD_O, + TEXICMD_OE, + TEXICMD_OESMALL, + TEXICMD_OGONEK, TEXICMD_OPTION, - TEXICMD_PXREF, - TEXICMD_QUESTIONMARK, - TEXICMD_QUOTATION, + TEXICMD_ORDF, + TEXICMD_ORDM, + TEXICMD_OSMALL, TEXICMD_PAGE, TEXICMD_PARINDENT, TEXICMD_PERIOD, TEXICMD_PINDEX, + TEXICMD_POUNDS, TEXICMD_PRINTINDEX, + TEXICMD_PXREF, + TEXICMD_QUESTIONDOWN, + TEXICMD_QUESTIONMARK, + TEXICMD_QUOTATION, + TEXICMD_QUOTEDBLBASE, + TEXICMD_QUOTEDBLLEFT, + TEXICMD_QUOTEDBLRIGHT, + TEXICMD_QUOTESINGLBASE, + TEXICMD_QUOTELEFT, + TEXICMD_QUOTERIGHT, TEXICMD_R, TEXICMD_RAISESECTIONS, TEXICMD_REF, TEXICMD_REFILL, + TEXICMD_REGISTEREDSYMBOL, TEXICMD_RESULT, + TEXICMD_RINGACCENT, TEXICMD_SAMP, TEXICMD_SANSSERIF, TEXICMD_SC, @@ -203,13 +263,20 @@ enum texicmd { TEXICMD_TABLE, TEXICMD_TEX, TEXICMD_TEXSYM, + TEXICMD_TEXTDEGREE, + TEXICMD_TH, + TEXICMD_THSMALL, TEXICMD_TIE, + TEXICMD_TIEACCENT, TEXICMD_TILDE, TEXICMD_TINDEX, TEXICMD_TITLE, TEXICMD_TITLEFONT, TEXICMD_TITLEPAGE, TEXICMD_TOP, + TEXICMD_U, + TEXICMD_UBARACCENT, + TEXICMD_UDOTACCENT, TEXICMD_UMLAUT, TEXICMD_UNNUMBERED, TEXICMD_UNNUMBEREDSEC, @@ -218,6 +285,7 @@ enum texicmd { TEXICMD_UREF, TEXICMD_URL, TEXICMD_USER_INDEX, + TEXICMD_V, TEXICMD_VALUE, TEXICMD_VAR, TEXICMD_VERB, @@ -245,8 +313,11 @@ struct texifile { 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 OR allocated buffer */ - size_t mapsz; /* size of mmap */ + char *map; /* allocated file buffer */ + size_t mapsz; /* size of map */ + size_t mapmaxsz; /* full size of map */ + size_t insplice; /* how many bytes left in splice */ + size_t depth; /* pasted macro recursive depth */ }; struct texi; @@ -254,8 +325,7 @@ struct texi; /* * Callback for functions implementing texi commands. */ -typedef void (*texicmdfp)(struct texi *, - enum texicmd, const char *, size_t, size_t *); +typedef void (*texicmdfp)(struct texi *, enum texicmd, size_t *); /* * Describes Texinfo commands, whether native or overriden. @@ -330,6 +400,9 @@ struct texi { int literal; /* if >0, literal context */ }; +#define BUF(_p) ((_p)->files[(_p)->filepos - 1].map) +#define BUFSZ(_p) ((_p)->files[(_p)->filepos - 1].mapsz) + #define isws(_x) \ (' ' == (_x) || '\t' == (_x)) #define ismspace(_x) \ @@ -337,28 +410,24 @@ struct texi { __BEGIN_DECLS -void advance(struct texi *, const char *, size_t *); -size_t advanceeoln(struct texi *, const char *, size_t, size_t *, int); -void advanceto(struct texi *, const char *, size_t *, size_t); +void advance(struct texi *, size_t *); +size_t advanceeoln(struct texi *, size_t *, int); +void advanceto(struct texi *, size_t *, size_t); -char **argparse(struct texi *, const char *, size_t, size_t *, size_t *, size_t); +char **argparse(struct texi *, size_t *, size_t *, size_t); -int parsearg(struct texi *, const char *, size_t, size_t *, size_t); -void parsebracket(struct texi *, const char *, size_t, size_t *); +int parsearg(struct texi *, size_t *, size_t); +void parsebracket(struct texi *, 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); -void parsemembuf(struct texi *, const char *, size_t); -void parseeoln(struct texi *, const char *, size_t, size_t *); -void parsesingle(struct texi *, const char *, size_t, size_t *); -void parseto(struct texi *, const char *, size_t, size_t *, const char *); +int parselinearg(struct texi *, size_t *); +void parseeoln(struct texi *, size_t *); +void parseto(struct texi *, size_t *, const char *); void texiabort(struct texi *, const char *) __attribute__((noreturn)); enum texicmd - texicmd(struct texi *, const char *, size_t, size_t, - size_t *, struct teximacro **); + texicmd(struct texi *, size_t, size_t *, struct teximacro **); void texierr(struct texi *, const char *, ...) __attribute__((format(printf, 2, 3))) __attribute__((noreturn)); @@ -367,20 +436,21 @@ void texifilepop(struct texi *); void teximacro(struct texi *, const char *); void teximacroclose(struct texi *); void teximacroopen(struct texi *, const char *); -void texipunctuate(struct texi *, const char *, size_t, size_t *); -void texiputbuf(struct texi *p, const char *, size_t, size_t); +void texipunctuate(struct texi *, size_t *); +void texiputbuf(struct texi *p, size_t, size_t); void texiputchar(struct texi *p, char); void texiputchars(struct texi *, const char *); void texivspace(struct texi *); void texiwarn(const struct texi *, const char *, ...) __attribute__((format(printf, 2, 3))); +void texisplice(struct texi *, const char *, size_t, size_t *); void valueadd(struct texi *, char *, char *); const char * - valueblookup(struct texi *, const char *, size_t, size_t *); -void valuelclear(struct texi *, const char *, size_t, size_t *); + valueblookup(struct texi *, size_t *); +void valuelclear(struct texi *, size_t *); const char * - valuellookup(struct texi *, const char *, size_t, size_t *); + valuellookup(struct texi *, size_t *); extern const struct texitok *const texitoks;