1*544c191cSchristos /* Id: tbl_int.h,v 1.2 2018/12/14 06:33:14 schwarze Exp */ 2*544c191cSchristos /* 3*544c191cSchristos * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 4*544c191cSchristos * Copyright (c) 2011,2013,2015,2017,2018 Ingo Schwarze <schwarze@openbsd.org> 5*544c191cSchristos * 6*544c191cSchristos * Permission to use, copy, modify, and distribute this software for any 7*544c191cSchristos * purpose with or without fee is hereby granted, provided that the above 8*544c191cSchristos * copyright notice and this permission notice appear in all copies. 9*544c191cSchristos * 10*544c191cSchristos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES 11*544c191cSchristos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12*544c191cSchristos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR 13*544c191cSchristos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14*544c191cSchristos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15*544c191cSchristos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16*544c191cSchristos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17*544c191cSchristos * 18*544c191cSchristos * Internal interfaces of the tbl(7) parser. 19*544c191cSchristos * For use inside the tbl(7) parser only. 20*544c191cSchristos */ 21*544c191cSchristos 22*544c191cSchristos enum tbl_part { 23*544c191cSchristos TBL_PART_OPTS, /* In the first line, ends with semicolon. */ 24*544c191cSchristos TBL_PART_LAYOUT, /* In the layout section, ends with full stop. */ 25*544c191cSchristos TBL_PART_DATA, /* In the data section, ends with TE. */ 26*544c191cSchristos TBL_PART_CDATA /* In a T{ block, ends with T} */ 27*544c191cSchristos }; 28*544c191cSchristos 29*544c191cSchristos struct tbl_node { 30*544c191cSchristos struct tbl_opts opts; /* Options for the whole table. */ 31*544c191cSchristos struct tbl_node *next; /* Next table. */ 32*544c191cSchristos struct tbl_row *first_row; /* First layout row. */ 33*544c191cSchristos struct tbl_row *last_row; /* Last layout row. */ 34*544c191cSchristos struct tbl_span *first_span; /* First data row. */ 35*544c191cSchristos struct tbl_span *current_span; /* Data row being parsed. */ 36*544c191cSchristos struct tbl_span *last_span; /* Last data row. */ 37*544c191cSchristos int line; /* Line number in input file. */ 38*544c191cSchristos int pos; /* Column number in input file. */ 39*544c191cSchristos enum tbl_part part; /* Table section being parsed. */ 40*544c191cSchristos }; 41*544c191cSchristos 42*544c191cSchristos 43*544c191cSchristos void tbl_option(struct tbl_node *, int, const char *, int *); 44*544c191cSchristos void tbl_layout(struct tbl_node *, int, const char *, int); 45*544c191cSchristos void tbl_data(struct tbl_node *, int, const char *, int); 46*544c191cSchristos void tbl_cdata(struct tbl_node *, int, const char *, int); 47*544c191cSchristos void tbl_reset(struct tbl_node *); 48