GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  TBL (3)

NAME

tbl_alloc, tbl_read, tbl_restart, tbl_span, tbl_end, tbl_free - roff table parser library for mandoc

CONTENTS

Synopsis
Description
     Data structures
     Interface functions
     Private functions
See Also
Authors

SYNOPSIS


.In mandoc.h
.In libmandoc.h
.In libroff.h struct tbl_node *
.Fo tbl_alloc int pos int line struct mparse *parse
.Fc enum rofferr
.Fo tbl_read struct tbl_node *tbl int ln const char *p int offs
.Fc void
.Fo tbl_restart int line int pos struct tbl_node *tbl
.Fc const struct tbl_span *
.Fo tbl_span struct tbl_node *tbl
.Fc void
.Fo tbl_end struct tbl_node **tblp
.Fc void
.Fo tbl_free struct tbl_node *tbl
.Fc

DESCRIPTION

This library is tightly integrated into the mandoc(1) utility and not designed for stand-alone use. The present manual is intended as a reference for developers working on mandoc(1).

    Data structures

Unless otherwise noted, all of the following data structures are defined in
.In mandoc.h and are deleted in tbl_free.
Vt struct tbl_node
  This structure describes a complete table. It is defined in
.In libroff.h , created in tbl_alloc, and stored in the members first_tbl, last_tbl, and tbl of
.Vt struct roff Bq Pa roff.c .

The first_span, current_span, last_span, and next members may be NULL. The first_row and last_row members may be NULL, but if there is a span, the function tbl_layout guarantees that these pointers are not NULL. The function tbl_alloc guarantees that the parse member is not NULL.

Vt struct tbl_opts
  This structure describes the options of one table. It is used as a substructure of
.Vt struct tbl_node and thus created and deleted together with it. It is filled in tbl_options.
Vt struct tbl_row
  This structure describes one layout line in a table by maintaining a list of all the cells in that line. It is allocated and filled in row[tbl_layout.c] and referenced from the layout member of
.Vt struct tbl_node .

The next member may be NULL. The function tbl_layout guarantees that the first and last members are not NULL.

Vt struct tbl_cell
  This structure describes one layout cell in a table, in particular its alignment, membership in spans, and usage for lines. It is allocated and filled in cell_alloc[tbl_layout.c] and referenced from the first and last members of
.Vt struct tbl_row .

The next member may be NULL.

Vt struct tbl_span
  This structure describes one data line in a table by maintaining a list of all data cells in that line or by specifying that it is a horizontal line. It is allocated and filled in newspan[tbl_data.c] which is called from tbl_data and referenced from the first_span, current_span, and last_span members of
.Vt struct tbl_node , and from the span members of
.Vt struct man_node and
.Vt struct mdoc_node from
.In man.h and
.In mdoc.h .

The first, last, prev, and next members may be NULL. The function newspan[tbl_data.c] guarantees that the opts and layout members are not NULL.

Vt struct tbl_dat
  This structure describes one data cell in a table by specifying whether it contains a line or data, whether it spans additional layout cells, and by storing the data. It is allocated and filled in tbl_data and referenced from the first and last members of
.Vt struct tbl_span .

The string and next members may be NULL. The function getdata guarantees that the layout member is not NULL.

    Interface functions

The following functions are implemented in tbl.c, and all callers in roff.c.
tbl_alloc
  Allocates, initializes, and returns a new
.Vt struct tbl_node . Called from roff_TS.
tbl_read
  Dispatches to tbl_option, tbl_layout, tbl_cdata, and tbl_data, see below. Called from roff_parseln.
tbl_restart
  Resets the part member of
.Vt struct tbl_node to TBL_PART_LAYOUT. Called from roff_T_.
tbl_span
  On the first call, return the first
.Vt struct tbl_span ; for later calls, return the next one or NULL. Called from roff_span.
tbl_end
  Flags the last span as TBL_SPAN_LAST and clears the pointer passed as an argment. Called from roff_TE and roff_endparse.
tbl_free
  Frees the specified
.Vt struct tbl_node and all the tbl_row, tbl_cell, tbl_span, and tbl_dat structures referenced from it. Called from roff_free and roff_reset.

    Private functions

int tbl_options struct tbl_node *tbl int ln const char *p
  Parses the options line into
.Vt struct tbl_opts . Implemented in tbl_opts.c, called from tbl_read.
int tbl_layout struct tbl_node *tbl int ln const char *p
  Allocates and fills one
.Vt struct tbl_row for each layout line and one
.Vt struct tbl_cell for each layout cell. Implemented in tbl_layout.c, called from tbl_read.
int tbl_data struct tbl_node *tbl int ln const char *p
  Allocates one
.Vt struct tbl_span for each data line and calls getdata for each data cell. Implemented in tbl_data.c, called from tbl_read.
int tbl_cdata struct tbl_node *tbl int ln const char *p
  Continues parsing a data line: When finding 'T}', switches back to TBL_PART_DATA mode and calls getdata if there are more data cells on the line. Otherwise, appends the data to the current data cell. Implemented in tbl_data.c, called from tbl_read.
int
.Fo getdata struct tbl_node *tbl struct tbl_span *dp int ln const char *p int *pos
.Fc
  Parses one data cell into one
.Vt struct tbl_dat . Implemented in tbl_data.c, called from tbl_data and tbl_cdata.

SEE ALSO

mandoc(1), mandoc(3), tbl(7)

AUTHORS


.An -nosplit The tbl library was written by
.An Kristaps Dzonsons Aq Mt kristaps@bsd.lv with contributions from
.An Ingo Schwarze Aq Mt schwarze@openbsd.org .
Search for    or go to Top of page |  Section 3 |  Main Index


Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.