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