version 1.78, 2010/06/26 16:07:08 |
version 1.83, 2010/07/18 17:00:26 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
* purpose with or without fee is hereby granted, provided that the above |
* purpose with or without fee is hereby granted, provided that the above |
|
|
#include <string.h> |
#include <string.h> |
|
|
#include "mandoc.h" |
#include "mandoc.h" |
#include "regs.h" |
|
#include "libman.h" |
#include "libman.h" |
#include "libmandoc.h" |
#include "libmandoc.h" |
|
|
Line 54 static void man_node_free(struct man_node *); |
|
Line 53 static void man_node_free(struct man_node *); |
|
static void man_node_unlink(struct man *, |
static void man_node_unlink(struct man *, |
struct man_node *); |
struct man_node *); |
static int man_ptext(struct man *, int, char *, int); |
static int man_ptext(struct man *, int, char *, int); |
static int man_pmacro(struct man *, |
static int man_pmacro(struct man *, int, char *, int); |
const struct regset *regs, |
|
int, char *, int); |
|
static void man_free1(struct man *); |
static void man_free1(struct man *); |
static void man_alloc1(struct man *); |
static void man_alloc1(struct man *); |
static int macrowarn(struct man *, int, const char *, int); |
static int macrowarn(struct man *, int, const char *, int); |
Line 97 man_free(struct man *man) |
|
Line 94 man_free(struct man *man) |
|
|
|
|
|
struct man * |
struct man * |
man_alloc(void *data, int pflags, mandocmsg msg) |
man_alloc(struct regset *regs, void *data, |
|
int pflags, mandocmsg msg) |
{ |
{ |
struct man *p; |
struct man *p; |
|
|
Line 107 man_alloc(void *data, int pflags, mandocmsg msg) |
|
Line 105 man_alloc(void *data, int pflags, mandocmsg msg) |
|
p->data = data; |
p->data = data; |
p->pflags = pflags; |
p->pflags = pflags; |
p->msg = msg; |
p->msg = msg; |
|
p->regs = regs; |
|
|
man_alloc1(p); |
man_alloc1(p); |
return(p); |
return(p); |
Line 127 man_endparse(struct man *m) |
|
Line 126 man_endparse(struct man *m) |
|
|
|
|
|
int |
int |
man_parseln(struct man *m, const struct regset *regs, |
man_parseln(struct man *m, int ln, char *buf, int offs) |
int ln, char *buf, int offs) |
|
{ |
{ |
|
|
if (MAN_HALT & m->flags) |
if (MAN_HALT & m->flags) |
return(0); |
return(0); |
|
|
return(('.' == buf[offs] || '\'' == buf[offs]) ? |
return(('.' == buf[offs] || '\'' == buf[offs]) ? |
man_pmacro(m, regs, ln, buf, offs) : |
man_pmacro(m, ln, buf, offs) : |
man_ptext(m, ln, buf, offs)); |
man_ptext(m, ln, buf, offs)); |
} |
} |
|
|
Line 411 man_ptext(struct man *m, int line, char *buf, int offs |
|
Line 409 man_ptext(struct man *m, int line, char *buf, int offs |
|
*/ |
*/ |
|
|
assert(i); |
assert(i); |
if (mandoc_eos(buf, (size_t)i)) |
if (mandoc_eos(buf, (size_t)i, 0)) |
m->last->flags |= MAN_EOS; |
m->last->flags |= MAN_EOS; |
|
|
descope: |
descope: |
Line 451 macrowarn(struct man *m, int ln, const char *buf, int |
|
Line 449 macrowarn(struct man *m, int ln, const char *buf, int |
|
|
|
|
|
int |
int |
man_pmacro(struct man *m, const struct regset *regs, |
man_pmacro(struct man *m, int ln, char *buf, int offs) |
int ln, char *buf, int offs) |
|
{ |
{ |
int i, j, ppos; |
int i, j, ppos; |
enum mant tok; |
enum mant tok; |
Line 577 man_pmacro(struct man *m, const struct regset *regs, |
|
Line 574 man_pmacro(struct man *m, const struct regset *regs, |
|
/* Call to handler... */ |
/* Call to handler... */ |
|
|
assert(man_macros[tok].fp); |
assert(man_macros[tok].fp); |
if ( ! (*man_macros[tok].fp)(m, regs, tok, ln, ppos, &i, buf)) |
if ( ! (*man_macros[tok].fp)(m, tok, ln, ppos, &i, buf)) |
goto err; |
goto err; |
|
|
out: |
out: |