version 1.84, 2010/06/12 10:09:19 |
version 1.96, 2010/07/01 22:56:17 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> |
* Copyright (c) 2008, 2009 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 |
|
|
|
|
/* What follows is a list of ALL possible macro arguments. */ |
/* What follows is a list of ALL possible macro arguments. */ |
|
|
|
/* FIXME: make this into an enum. */ |
#define MDOC_Split 0 |
#define MDOC_Split 0 |
#define MDOC_Nosplit 1 |
#define MDOC_Nosplit 1 |
#define MDOC_Ragged 2 |
#define MDOC_Ragged 2 |
Line 248 struct mdoc_arg { |
|
Line 249 struct mdoc_arg { |
|
unsigned int refcnt; |
unsigned int refcnt; |
}; |
}; |
|
|
|
enum mdoc_endbody { |
|
ENDBODY_NOT = 0, |
|
ENDBODY_SPACE, |
|
ENDBODY_NOSPACE, |
|
}; |
|
|
enum mdoc_list { |
enum mdoc_list { |
LIST__NONE = 0, |
LIST__NONE = 0, |
LIST_bullet, |
LIST_bullet, |
Line 272 enum mdoc_disp { |
|
Line 279 enum mdoc_disp { |
|
DISP_literal |
DISP_literal |
}; |
}; |
|
|
|
struct mdoc_bd { |
|
const char *offs; /* -offset */ |
|
enum mdoc_disp type; /* -ragged, etc. */ |
|
int comp; /* -compact */ |
|
}; |
|
|
|
struct mdoc_bl { |
|
const char *width; /* -width */ |
|
const char *offs; /* -offset */ |
|
enum mdoc_list type; /* -tag, -enum, etc. */ |
|
int comp; /* -compact */ |
|
}; |
|
|
/* Node in AST. */ |
/* Node in AST. */ |
struct mdoc_node { |
struct mdoc_node { |
struct mdoc_node *parent; /* parent AST node */ |
struct mdoc_node *parent; /* parent AST node */ |
Line 287 struct mdoc_node { |
|
Line 307 struct mdoc_node { |
|
#define MDOC_ACTED (1 << 1) /* has been acted upon */ |
#define MDOC_ACTED (1 << 1) /* has been acted upon */ |
#define MDOC_EOS (1 << 2) /* at sentence boundary */ |
#define MDOC_EOS (1 << 2) /* at sentence boundary */ |
#define MDOC_LINE (1 << 3) /* first macro/text on line */ |
#define MDOC_LINE (1 << 3) /* first macro/text on line */ |
|
#define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting */ |
|
#define MDOC_ENDED (1 << 5) /* rendering has been ended */ |
enum mdoc_type type; /* AST node type */ |
enum mdoc_type type; /* AST node type */ |
enum mdoc_sec sec; /* current named section */ |
enum mdoc_sec sec; /* current named section */ |
|
/* FIXME: these can be union'd to shave a few bytes. */ |
struct mdoc_arg *args; /* BLOCK/ELEM */ |
struct mdoc_arg *args; /* BLOCK/ELEM */ |
#ifdef UGLY |
|
struct mdoc_node *pending; /* BLOCK */ |
struct mdoc_node *pending; /* BLOCK */ |
#endif |
|
struct mdoc_node *head; /* BLOCK */ |
struct mdoc_node *head; /* BLOCK */ |
struct mdoc_node *body; /* BLOCK */ |
struct mdoc_node *body; /* BLOCK */ |
struct mdoc_node *tail; /* BLOCK */ |
struct mdoc_node *tail; /* BLOCK */ |
char *string; /* TEXT */ |
char *string; /* TEXT */ |
|
enum mdoc_endbody end; /* BODY */ |
|
|
union { |
union { |
enum mdoc_list list; /* `Bl' nodes */ |
struct mdoc_bl *Bl; |
enum mdoc_disp disp; /* `Bd' nodes */ |
struct mdoc_bd *Bd; |
} data; |
} data; |
}; |
}; |
|
|
|
|
/* See mdoc.3 for documentation. */ |
/* See mdoc.3 for documentation. */ |
|
|
void mdoc_free(struct mdoc *); |
void mdoc_free(struct mdoc *); |
struct mdoc *mdoc_alloc(void *, int, mandocmsg); |
struct mdoc *mdoc_alloc(struct regset *, void *, int, mandocmsg); |
void mdoc_reset(struct mdoc *); |
void mdoc_reset(struct mdoc *); |
int mdoc_parseln(struct mdoc *, int, char *, int); |
int mdoc_parseln(struct mdoc *, int, char *, int); |
const struct mdoc_node *mdoc_node(const struct mdoc *); |
const struct mdoc_node *mdoc_node(const struct mdoc *); |