-/* $Id: macro.c,v 1.25 2009/01/07 15:53:00 kristaps Exp $ */
+/* $Id: macro.c,v 1.26 2009/01/07 15:57:14 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
return(0);
flushed = 1;
}
- if ( ! mdoc_macro(mdoc, c, lastarg, pos, buf))
+ if ( ! mdoc_macro(mdoc, c, line, lastarg, pos, buf))
return(0);
break;
}
return(0);
}
mdoc_argv_free(argc, argv);
- if ( ! mdoc_macro(mdoc, c, lastarg, pos, buf))
+ if ( ! mdoc_macro(mdoc, c, line, lastarg, pos, buf))
return(0);
if (ppos > 1)
return(1);
continue;
}
- if ( ! mdoc_macro(mdoc, c, lastarg, pos, buf))
+ if ( ! mdoc_macro(mdoc, c, line, lastarg, pos, buf))
return(0);
break;
}
continue;
}
- if ( ! mdoc_macro(mdoc, c, lastarg, pos, buf))
+ if ( ! mdoc_macro(mdoc, c, line, lastarg, pos, buf))
return(0);
break;
}
mdoc_body_alloc(mdoc, ppos, tok);
mdoc->next = MDOC_NEXT_CHILD;
}
- if ( ! mdoc_macro(mdoc, c, lastarg, pos, buf))
+ if ( ! mdoc_macro(mdoc, c, line, lastarg, pos, buf))
return(0);
break;
}
if ( ! flushed && ! rewind_elem(mdoc, ppos, tok))
return(0);
flushed = 1;
- if ( ! mdoc_macro(mdoc, c, lastarg, pos, buf))
+ if ( ! mdoc_macro(mdoc, c, line, lastarg, pos, buf))
return(0);
break;
}
-/* $Id: mdoc.c,v 1.20 2009/01/07 15:53:00 kristaps Exp $ */
+/* $Id: mdoc.c,v 1.21 2009/01/07 15:57:14 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
while (buf[i] && isspace(buf[i]))
i++;
- if ( ! mdoc_macro(mdoc, c, 1, &i, buf)) {
+ if ( ! mdoc_macro(mdoc, c, line, 1, &i, buf)) {
mdoc->flags |= MDOC_HALT;
return(0);
}
int
-mdoc_macro(struct mdoc *mdoc, int tok, int ppos, int *pos, char *buf)
+mdoc_macro(struct mdoc *mdoc, int tok,
+ int line, int ppos, int *pos, char *buf)
{
if ( ! (MDOC_PROLOGUE & mdoc_macros[tok].flags) &&
return(0);
}
- return((*mdoc_macros[tok].fp)(mdoc, tok, ppos, pos, buf));
+ return((*mdoc_macros[tok].fp)(mdoc, tok, line, ppos, pos, buf));
}
-/* $Id: private.h,v 1.57 2009/01/07 15:53:00 kristaps Exp $ */
+/* $Id: private.h,v 1.58 2009/01/07 15:57:14 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
enum mdoc_sec sec_last;
};
+
+#define MACRO_PROT_ARGS struct mdoc *mdoc, int tok, int line, \
+ int ppos, int *pos, char *buf
+
struct mdoc_macro {
- int (*fp)(struct mdoc *, int, int, int *, char *);
+ int (*fp)(MACRO_PROT_ARGS);
int flags;
#define MDOC_CALLABLE (1 << 0)
#define MDOC_PARSED (1 << 1)
extern const struct mdoc_macro *const mdoc_macros;
-#define MACRO_PROT_ARGS struct mdoc *mdoc, int tok, \
- int ppos, int *pos, char *buf
-
__BEGIN_DECLS
int mdoc_err(struct mdoc *, int, int, enum mdoc_err);
int mdoc_warn(struct mdoc *, int, int, enum mdoc_warn);
void mdoc_msg(struct mdoc *, int, const char *, ...);
-int mdoc_macro(struct mdoc *, int, int, int *, char *);
+int mdoc_macro(MACRO_PROT_ARGS);
int mdoc_find(const struct mdoc *, const char *);
void mdoc_word_alloc(struct mdoc *, int, const char *);
void mdoc_elem_alloc(struct mdoc *, int, int,
-/* $Id: prologue.c,v 1.4 2009/01/05 17:57:08 kristaps Exp $ */
+/* $Id: prologue.c,v 1.5 2009/01/07 15:57:14 kristaps Exp $ */
/*
* Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se>
*
return(0);
if (0 == j) {
- if (xstrcmp("$Mdocdate: January 5 2009 $", args[j])) {
+ if (xstrcmp("$Mdocdate: January 7 2009 $", args[j])) {
mdoc->meta.date = time(NULL);
goto again;
} else if (xstrcmp("$Mdocdate:", args[j]))
switch (tok) {
case (MDOC_Dt):
- return(prologue_dt(mdoc, tok, ppos, pos, buf));
+ return(prologue_dt(mdoc, tok, line, ppos, pos, buf));
case (MDOC_Dd):
- return(prologue_dd(mdoc, tok, ppos, pos, buf));
+ return(prologue_dd(mdoc, tok, line, ppos, pos, buf));
case (MDOC_Os):
- return(prologue_os(mdoc, tok, ppos, pos, buf));
+ return(prologue_os(mdoc, tok, line, ppos, pos, buf));
default:
break;
}