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