[BACK]Return to tbl.3 CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/tbl.3 between version 1.1 and 1.5

version 1.1, 2013/06/01 05:44:39 version 1.5, 2018/12/13 02:06:07
Line 1 
Line 1 
 .\"     $Id$  .\"     $Id$
 .\"  .\"
 .\" Copyright (c) 2013 Ingo Schwarze <schwarze@openbsd.org>  .\" Copyright (c) 2013, 2015, 2018 Ingo Schwarze <schwarze@openbsd.org>
 .\"  .\"
 .\" 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
Line 26 
Line 26 
 .Nm tbl_free  .Nm tbl_free
 .Nd roff table parser library for mandoc  .Nd roff table parser library for mandoc
 .Sh SYNOPSIS  .Sh SYNOPSIS
 .In mandoc.h  .In sys/types.h
 .In libmandoc.h  .In tbl.h
 .In libroff.h  .In tbl_parse.h
 .Ft struct tbl_node *  .Ft struct tbl_node *
 .Fo tbl_alloc  .Fo tbl_alloc
 .Fa "int pos"  .Fa "int pos"
 .Fa "int line"  .Fa "int line"
 .Fa "struct mparse *parse"  .Fa "struct mparse *parse"
 .Fc  .Fc
 .Ft enum rofferr  .Ft void
 .Fo tbl_read  .Fo tbl_read
 .Fa "struct tbl_node *tbl"  .Fa "struct tbl_node *tbl"
 .Fa "int ln"  .Fa "int ln"
Line 67  utility and not designed for stand-alone use.
Line 67  utility and not designed for stand-alone use.
 The present manual is intended as a reference for developers working on  The present manual is intended as a reference for developers working on
 .Xr mandoc 1 .  .Xr mandoc 1 .
 .Ss Data structures  .Ss Data structures
 Unless otherwise noted, all of the following data structures are defined in  Unless otherwise noted, all of the following data structures are declared in
 .In mandoc.h  .In tbl.h
 and are deleted in  and are deleted in
 .Fn tbl_free .  .Fn tbl_free .
 .Bl -tag -width Ds  .Bl -tag -width Ds
 .It Vt struct tbl_node  .It Vt struct tbl_node
 This structure describes a complete table.  This structure describes a complete table.
 It is defined in  It is declared in
 .In libroff.h ,  .In tbl_int.h ,
 created in  created in
 .Fn tbl_alloc ,  .Fn tbl_alloc ,
 and stored in the members  and stored in the members
 .Va first_tbl ,  .Fa first_tbl ,
 .Va last_tbl ,  .Fa last_tbl ,
 and  and
 .Va tbl  .Fa tbl
 of  of
 .Vt struct roff Bq Pa roff.c .  .Vt struct roff Bq Pa roff.c .
   .Pp
   The
   .Fa first_span ,
   .Fa current_span ,
   .Fa last_span ,
   and
   .Fa next
   members may be
   .Dv NULL .
   The
   .Fa first_row
   and
   .Fa last_row
   members may be
   .Dv NULL ,
   but if there is a span, the function
   .Fn tbl_layout
   guarantees that these pointers are not
   .Dv NULL .
   The function
   .Fn tbl_alloc
   guarantees that the
   .Fa parse
   member is not
   .Dv NULL .
 .It Vt struct tbl_opts  .It Vt struct tbl_opts
 This structure describes the options of one table.  This structure describes the options of one table.
 It is used as a substructure of  It is used as a substructure of
Line 92  It is used as a substructure of
Line 117  It is used as a substructure of
 and thus created and deleted together with it.  and thus created and deleted together with it.
 It is filled in  It is filled in
 .Fn tbl_options .  .Fn tbl_options .
 .It Vt struct tbl_head  
 This structure describes one layout column in a table,  
 in particular the vertical line to its left.  
 It is allocated and filled in  
 .Fn cell_alloc Bq Pa tbl_layout.c  
 and referenced from the  
 .Va first_head  
 and  
 .Va last_head  
 members of  
 .Vt struct tbl_node .  
 .It Vt struct tbl_row  .It Vt struct tbl_row
 This structure describes one layout line in a table  This structure describes one layout line in a table
 by maintaining a list of all the cells in that line.  by maintaining a list of all the cells in that line.
 It is allocated and filled in  It is allocated and filled in
 .Fn row Bq Pa tbl_layout.c  .Fn row Bq Pa tbl_layout.c
 and referenced from the  and referenced from the
 .Va layout  .Fa layout
 member of  member of
 .Vt struct tbl_node .  .Vt struct tbl_node .
   .Pp
   The
   .Fa next
   member may be
   .Dv NULL .
   The function
   .Fn tbl_layout
   guarantees that the
   .Fa first
   and
   .Fa last
   members are not NULL.
 .It Vt struct tbl_cell  .It Vt struct tbl_cell
 This structure describes one layout cell in a table,  This structure describes one layout cell in a table,
 in particular its alignment, membership in spans, and  in particular its alignment, membership in spans, and
Line 119  usage for lines.
Line 145  usage for lines.
 It is allocated and filled in  It is allocated and filled in
 .Fn cell_alloc Bq Pa tbl_layout.c  .Fn cell_alloc Bq Pa tbl_layout.c
 and referenced from the  and referenced from the
 .Va first  .Fa first
 and  and
 .Va last  .Fa last
 members of  members of
 .Vt struct tbl_row .  .Vt struct tbl_row .
   .Pp
   The
   .Fa next
   member may be
   .Dv NULL .
 .It Vt struct tbl_span  .It Vt struct tbl_span
 This structure describes one data line in a table  This structure describes one data line in a table
 by maintaining a list of all data cells in that line  by maintaining a list of all data cells in that line
Line 133  It is allocated and filled in
Line 164  It is allocated and filled in
 which is called from  which is called from
 .Fn tbl_data  .Fn tbl_data
 and referenced from the  and referenced from the
 .Va first_span ,  .Fa first_span ,
 .Va current_span ,  .Fa current_span ,
 and  and
 .Va last_span  .Fa last_span
 members of  members of
 .Vt struct tbl_node ,  .Vt struct tbl_node ,
 and from the  and from the
 .Va span  .Fa span
 members of  members of
 .Vt struct man_node  .Vt struct man_node
 and  and
Line 149  from
Line 180  from
 .In man.h  .In man.h
 and  and
 .In mdoc.h .  .In mdoc.h .
   .Pp
   The
   .Fa first ,
   .Fa last ,
   .Fa prev ,
   and
   .Fa next
   members may be
   .Dv NULL .
   The function
   .Fn newspan Bq Pa tbl_data.c
   guarantees that the
   .Fa opts
   and
   .Fa layout
   members are not
   .Dv NULL .
 .It Vt struct tbl_dat  .It Vt struct tbl_dat
 This structure describes one data cell in a table by specifying  This structure describes one data cell in a table by specifying
 whether it contains a line or data, whether it spans additional  whether it contains a line or data, whether it spans additional
 layout cells, and by storing the data.  layout cells, and by storing the data.
 It is allocated and filled in  It is allocated and filled in
 .Fn data  .Fn tbl_data
 and referenced from the  and referenced from the
 .Va first  .Fa first
 and  and
 .Va last  .Fa last
 members of  members of
 .Vt struct tbl_span .  .Vt struct tbl_span .
   .Pp
   The
   .Fa string
   and
   .Fa next
   members may be
   .Dv NULL .
   The function
   .Fn getdata
   guarantees that the
   .Fa layout
   member is not
   .Dv NULL .
 .El  .El
 .Ss Interface functions  .Ss Interface functions
 The following functions are implemented in  The following functions are implemented in
 .Pa tbl.c ,  .Pa tbl.c ,
 and all callers in  and all callers are in
 .Pa roff.c .  .Pa roff.c .
 .Bl -tag -width Ds  .Bl -tag -width Ds
 .It Fn tbl_alloc  .It Fn tbl_alloc
Line 185  Called from
Line 246  Called from
 .Fn roff_parseln .  .Fn roff_parseln .
 .It Fn tbl_restart  .It Fn tbl_restart
 Resets the  Resets the
 .Va part  .Fa part
 member of  member of
 .Vt struct tbl_node  .Vt struct tbl_node
 to  to
Line 210  and
Line 271  and
 .It Fn tbl_free  .It Fn tbl_free
 Frees the specified  Frees the specified
 .Vt struct tbl_node  .Vt struct tbl_node
 and all the tbl_row, tbl_cell, tbl_span, tbl_dat and tbl_head structures  and all the tbl_row, tbl_cell, tbl_span, and tbl_dat structures
 referenced from it.  referenced from it.
 Called from  Called from
 .Fn roff_free  .Fn roff_free
Line 218  and
Line 279  and
 .Fn roff_reset .  .Fn roff_reset .
 .El  .El
 .Ss Private functions  .Ss Private functions
   The following functions are declared in
   .In tbl_int.h .
 .Bl -tag -width Ds  .Bl -tag -width Ds
 .It Ft int Fn tbl_options "struct tbl_node *tbl" "int ln" "const char *p"  .It Ft int Fn tbl_options "struct tbl_node *tbl" "int ln" "const char *p"
 Parses the options line into  Parses the options line into
Line 228  called from
Line 291  called from
 .Fn tbl_read .  .Fn tbl_read .
 .It Ft int Fn tbl_layout "struct tbl_node *tbl" "int ln" "const char *p"  .It Ft int Fn tbl_layout "struct tbl_node *tbl" "int ln" "const char *p"
 Allocates and fills one  Allocates and fills one
 .Vt struct tbl_head  
 for each layout column, one  
 .Vt struct tbl_row  .Vt struct tbl_row
 for each layout line, and one  for each layout line and one
 .Vt struct tbl_cell  .Vt struct tbl_cell
 for each layout cell.  for each layout cell.
 Implemented in  Implemented in
Line 242  called from
Line 303  called from
 Allocates one  Allocates one
 .Vt struct tbl_span  .Vt struct tbl_span
 for each data line and calls  for each data line and calls
 .Fn data  .Fn getdata
 on that line.  for each data cell.
 Implemented in  Implemented in
 .Pa tbl_data.c ,  .Pa tbl_data.c ,
 called from  called from
Line 255  When finding
Line 316  When finding
 switches back to  switches back to
 .Dv TBL_PART_DATA  .Dv TBL_PART_DATA
 mode and calls  mode and calls
 .Fn data  .Fn getdata
 if there are more data cells on the line.  if there are more data cells on the line.
 Otherwise, appends the data to the current data cell.  Otherwise, appends the data to the current data cell.
 Implemented in  Implemented in
Line 264  called from
Line 325  called from
 .Fn tbl_read .  .Fn tbl_read .
 .It Xo  .It Xo
 .Ft int  .Ft int
 .Fo data  .Fo getdata
 .Fa "struct tbl_node *tbl"  .Fa "struct tbl_node *tbl"
 .Fa "struct tbl_span *dp"  .Fa "struct tbl_span *dp"
 .Fa "int ln"  .Fa "int ln"

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.5

CVSweb