=================================================================== RCS file: /cvs/mandoc/main.c,v retrieving revision 1.85 retrieving revision 1.92 diff -u -p -r1.85 -r1.92 --- mandoc/main.c 2010/06/07 20:57:09 1.85 +++ mandoc/main.c 2010/06/27 15:52:41 1.92 @@ -1,6 +1,6 @@ -/* $Id: main.c,v 1.85 2010/06/07 20:57:09 kristaps Exp $ */ +/* $Id: main.c,v 1.92 2010/06/27 15:52:41 kristaps Exp $ */ /* - * Copyright (c) 2008, 2009 Kristaps Dzonsons + * Copyright (c) 2008, 2009 Kristaps Dzonsons * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -30,10 +30,11 @@ #include #include "mandoc.h" +#include "regs.h" +#include "main.h" #include "mdoc.h" #include "man.h" #include "roff.h" -#include "main.h" #define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) @@ -87,6 +88,7 @@ struct curparse { struct man *man; /* man parser */ struct mdoc *mdoc; /* mdoc parser */ struct roff *roff; /* roff parser (!NULL) */ + struct regset regs; /* roff registers */ enum outt outtype; /* which output to use */ out_mdoc outmdoc; /* mdoc output ptr */ out_man outman; /* man output ptr */ @@ -109,6 +111,7 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "unterminated quoted string", "argument requires the width argument", "superfluous width argument", + "ignoring argument", "bad date argument", "bad width argument", "unknown manual section", @@ -143,12 +146,13 @@ static const char * const mandocerrs[MANDOCERR_MAX] = "macro requires argument(s)", "no title in document", "missing list type", + "missing display type", "line argument(s) will be lost", "body argument(s) will be lost", "column syntax is inconsistent", "missing font type", - "missing display type", "displays may not be nested", + "unsupported display type", "no scope to rewind: syntax violated", "scope broken, syntax violated", "line scope broken, syntax violated", @@ -295,7 +299,7 @@ man_init(struct curparse *curp) if (curp->fflags & FL_NIGN_ESCAPE) pflags &= ~MAN_IGN_ESCAPE; - return(man_alloc(curp, pflags, mmsg)); + return(man_alloc(&curp->regs, curp, pflags, mmsg)); } @@ -303,7 +307,7 @@ static struct roff * roff_init(struct curparse *curp) { - return(roff_alloc(mmsg, curp)); + return(roff_alloc(&curp->regs, mmsg, curp)); } @@ -323,7 +327,7 @@ mdoc_init(struct curparse *curp) if (curp->fflags & FL_NIGN_MACRO) pflags &= ~MDOC_IGN_MACRO; - return(mdoc_alloc(curp, pflags, mmsg)); + return(mdoc_alloc(&curp->regs, curp, pflags, mmsg)); } @@ -452,6 +456,7 @@ fdesc(struct curparse *curp) man = NULL; mdoc = NULL; roff = NULL; + memset(&ln, 0, sizeof(struct buf)); /* @@ -591,9 +596,11 @@ fdesc(struct curparse *curp) break; case (OUTT_ASCII): curp->outdata = ascii_alloc(curp->outopts); + curp->outfree = ascii_free; break; case (OUTT_PS): curp->outdata = ps_alloc(); + curp->outfree = ps_free; break; default: break; @@ -616,7 +623,6 @@ fdesc(struct curparse *curp) case (OUTT_PS): curp->outman = terminal_man; curp->outmdoc = terminal_mdoc; - curp->outfree = terminal_free; break; default: break; @@ -631,6 +637,7 @@ fdesc(struct curparse *curp) (*curp->outmdoc)(curp->outdata, mdoc); cleanup: + memset(&curp->regs, 0, sizeof(struct regset)); if (mdoc) mdoc_reset(mdoc); if (man)