=================================================================== RCS file: /cvs/texi2mdoc/extern.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -p -r1.14 -r1.15 --- texi2mdoc/extern.h 2015/02/24 21:06:52 1.14 +++ texi2mdoc/extern.h 2015/02/25 14:37:17 1.15 @@ -1,4 +1,4 @@ -/* $Id: extern.h,v 1.14 2015/02/24 21:06:52 kristaps Exp $ */ +/* $Id: extern.h,v 1.15 2015/02/25 14:37:17 kristaps Exp $ */ /* * Copyright (c) 2015 Kristaps Dzonsons * @@ -298,8 +298,9 @@ 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 */ }; struct texi; @@ -307,8 +308,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. @@ -383,6 +383,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) \ @@ -390,27 +393,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, + texicmd(struct texi *, size_t, size_t *, struct teximacro **); void texierr(struct texi *, const char *, ...) __attribute__((format(printf, 2, 3))) @@ -420,20 +420,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;