xref: /minix3/external/bsd/flex/dist/tables.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: tables.h,v 1.2 2014/10/29 18:28:36 christos Exp $	*/
2357f1050SThomas Veerman 
3357f1050SThomas Veerman /*  tables.h - tables serialization code
4357f1050SThomas Veerman  *
5357f1050SThomas Veerman  *  Copyright (c) 1990 The Regents of the University of California.
6357f1050SThomas Veerman  *  All rights reserved.
7357f1050SThomas Veerman  *
8357f1050SThomas Veerman  *  This code is derived from software contributed to Berkeley by
9357f1050SThomas Veerman  *  Vern Paxson.
10357f1050SThomas Veerman  *
11357f1050SThomas Veerman  *  The United States Government has rights in this work pursuant
12357f1050SThomas Veerman  *  to contract no. DE-AC03-76SF00098 between the United States
13357f1050SThomas Veerman  *  Department of Energy and the University of California.
14357f1050SThomas Veerman  *
15357f1050SThomas Veerman  *  This file is part of flex.
16357f1050SThomas Veerman  *
17357f1050SThomas Veerman  *  Redistribution and use in source and binary forms, with or without
18357f1050SThomas Veerman  *  modification, are permitted provided that the following conditions
19357f1050SThomas Veerman  *  are met:
20357f1050SThomas Veerman  *
21357f1050SThomas Veerman  *  1. Redistributions of source code must retain the above copyright
22357f1050SThomas Veerman  *     notice, this list of conditions and the following disclaimer.
23357f1050SThomas Veerman  *  2. Redistributions in binary form must reproduce the above copyright
24357f1050SThomas Veerman  *     notice, this list of conditions and the following disclaimer in the
25357f1050SThomas Veerman  *     documentation and/or other materials provided with the distribution.
26357f1050SThomas Veerman  *
27357f1050SThomas Veerman  *  Neither the name of the University nor the names of its contributors
28357f1050SThomas Veerman  *  may be used to endorse or promote products derived from this software
29357f1050SThomas Veerman  *  without specific prior written permission.
30357f1050SThomas Veerman  *
31357f1050SThomas Veerman  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
32357f1050SThomas Veerman  *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
33357f1050SThomas Veerman  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34357f1050SThomas Veerman  *  PURPOSE.
35357f1050SThomas Veerman  */
36357f1050SThomas Veerman 
37357f1050SThomas Veerman #ifndef TABLES_H
38357f1050SThomas Veerman #define TABLES_H
39357f1050SThomas Veerman 
40357f1050SThomas Veerman #ifdef __cplusplus
41357f1050SThomas Veerman /* *INDENT-OFF* */
42357f1050SThomas Veerman extern  "C" {
43357f1050SThomas Veerman /* *INDENT-ON* */
44357f1050SThomas Veerman #endif
45357f1050SThomas Veerman 
46357f1050SThomas Veerman /* Tables serialization API declarations. */
47357f1050SThomas Veerman #include "tables_shared.h"
48357f1050SThomas Veerman struct yytbl_writer {
49357f1050SThomas Veerman 	FILE   *out;
50357f1050SThomas Veerman 	flex_uint32_t total_written;
51357f1050SThomas Veerman 			    /**< bytes written so far */
52357f1050SThomas Veerman 	fpos_t  th_ssize_pos;
53357f1050SThomas Veerman 			    /**< position of th_ssize */
54357f1050SThomas Veerman };
55357f1050SThomas Veerman 
56357f1050SThomas Veerman /* These are used by main.c, gen.c, etc.
57357f1050SThomas Veerman  * tablesext - if true, create external tables
58357f1050SThomas Veerman  * tablesfilename - filename for external tables
59357f1050SThomas Veerman  * tablesname - name that goes in serialized data, e.g., "yytables"
60357f1050SThomas Veerman  * tableswr -  writer for external tables
61357f1050SThomas Veerman  * tablesverify - true if tables-verify option specified
62357f1050SThomas Veerman  * gentables - true if we should spit out the normal C tables
63357f1050SThomas Veerman  */
64357f1050SThomas Veerman extern bool tablesext, tablesverify,gentables;
65357f1050SThomas Veerman extern char *tablesfilename, *tablesname;
66357f1050SThomas Veerman extern struct yytbl_writer tableswr;
67357f1050SThomas Veerman 
68357f1050SThomas Veerman int     yytbl_writer_init (struct yytbl_writer *, FILE *);
69357f1050SThomas Veerman int     yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str,
70357f1050SThomas Veerman 			const char *name);
71357f1050SThomas Veerman int     yytbl_data_init (struct yytbl_data *tbl, enum yytbl_id id);
72357f1050SThomas Veerman int     yytbl_data_destroy (struct yytbl_data *td);
73357f1050SThomas Veerman int     yytbl_hdr_fwrite (struct yytbl_writer *wr,
74357f1050SThomas Veerman 			  const struct yytbl_hdr *th);
75357f1050SThomas Veerman int     yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td);
76357f1050SThomas Veerman void    yytbl_data_compress (struct yytbl_data *tbl);
77357f1050SThomas Veerman struct yytbl_data *mkftbl (void);
78357f1050SThomas Veerman 
79357f1050SThomas Veerman 
80357f1050SThomas Veerman #ifdef __cplusplus
81357f1050SThomas Veerman /* *INDENT-OFF* */
82357f1050SThomas Veerman }
83357f1050SThomas Veerman /* *INDENT-ON* */
84357f1050SThomas Veerman #endif
85357f1050SThomas Veerman #endif
86357f1050SThomas Veerman 
87357f1050SThomas Veerman /* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
88