xref: /freebsd/contrib/flex/src/tables.h (revision 7e38239042df09edbbdc443ccb4825f9155c6bb7)
1*7e382390SJung-uk Kim /*  tables.h - tables serialization code
2*7e382390SJung-uk Kim  *
3*7e382390SJung-uk Kim  *  Copyright (c) 1990 The Regents of the University of California.
4*7e382390SJung-uk Kim  *  All rights reserved.
5*7e382390SJung-uk Kim  *
6*7e382390SJung-uk Kim  *  This code is derived from software contributed to Berkeley by
7*7e382390SJung-uk Kim  *  Vern Paxson.
8*7e382390SJung-uk Kim  *
9*7e382390SJung-uk Kim  *  The United States Government has rights in this work pursuant
10*7e382390SJung-uk Kim  *  to contract no. DE-AC03-76SF00098 between the United States
11*7e382390SJung-uk Kim  *  Department of Energy and the University of California.
12*7e382390SJung-uk Kim  *
13*7e382390SJung-uk Kim  *  This file is part of flex.
14*7e382390SJung-uk Kim  *
15*7e382390SJung-uk Kim  *  Redistribution and use in source and binary forms, with or without
16*7e382390SJung-uk Kim  *  modification, are permitted provided that the following conditions
17*7e382390SJung-uk Kim  *  are met:
18*7e382390SJung-uk Kim  *
19*7e382390SJung-uk Kim  *  1. Redistributions of source code must retain the above copyright
20*7e382390SJung-uk Kim  *     notice, this list of conditions and the following disclaimer.
21*7e382390SJung-uk Kim  *  2. Redistributions in binary form must reproduce the above copyright
22*7e382390SJung-uk Kim  *     notice, this list of conditions and the following disclaimer in the
23*7e382390SJung-uk Kim  *     documentation and/or other materials provided with the distribution.
24*7e382390SJung-uk Kim  *
25*7e382390SJung-uk Kim  *  Neither the name of the University nor the names of its contributors
26*7e382390SJung-uk Kim  *  may be used to endorse or promote products derived from this software
27*7e382390SJung-uk Kim  *  without specific prior written permission.
28*7e382390SJung-uk Kim  *
29*7e382390SJung-uk Kim  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
30*7e382390SJung-uk Kim  *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
31*7e382390SJung-uk Kim  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32*7e382390SJung-uk Kim  *  PURPOSE.
33*7e382390SJung-uk Kim  */
34*7e382390SJung-uk Kim 
35*7e382390SJung-uk Kim #ifndef TABLES_H
36*7e382390SJung-uk Kim #define TABLES_H
37*7e382390SJung-uk Kim 
38*7e382390SJung-uk Kim #ifdef __cplusplus
39*7e382390SJung-uk Kim /* *INDENT-OFF* */
40*7e382390SJung-uk Kim extern  "C" {
41*7e382390SJung-uk Kim /* *INDENT-ON* */
42*7e382390SJung-uk Kim #endif
43*7e382390SJung-uk Kim 
44*7e382390SJung-uk Kim /* Tables serialization API declarations. */
45*7e382390SJung-uk Kim #include "tables_shared.h"
46*7e382390SJung-uk Kim struct yytbl_writer {
47*7e382390SJung-uk Kim 	FILE   *out;
48*7e382390SJung-uk Kim 	int total_written;
49*7e382390SJung-uk Kim 			    /**< bytes written so far */
50*7e382390SJung-uk Kim 	fpos_t  th_ssize_pos;
51*7e382390SJung-uk Kim 			    /**< position of th_ssize */
52*7e382390SJung-uk Kim };
53*7e382390SJung-uk Kim 
54*7e382390SJung-uk Kim /* These are used by main.c, gen.c, etc.
55*7e382390SJung-uk Kim  * tablesext - if true, create external tables
56*7e382390SJung-uk Kim  * tablesfilename - filename for external tables
57*7e382390SJung-uk Kim  * tablesname - name that goes in serialized data, e.g., "yytables"
58*7e382390SJung-uk Kim  * tableswr -  writer for external tables
59*7e382390SJung-uk Kim  * tablesverify - true if tables-verify option specified
60*7e382390SJung-uk Kim  * gentables - true if we should spit out the normal C tables
61*7e382390SJung-uk Kim  */
62*7e382390SJung-uk Kim extern bool tablesext, tablesverify,gentables;
63*7e382390SJung-uk Kim extern char *tablesfilename, *tablesname;
64*7e382390SJung-uk Kim extern struct yytbl_writer tableswr;
65*7e382390SJung-uk Kim 
66*7e382390SJung-uk Kim int     yytbl_writer_init (struct yytbl_writer *, FILE *);
67*7e382390SJung-uk Kim int     yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str,
68*7e382390SJung-uk Kim 			const char *name);
69*7e382390SJung-uk Kim int     yytbl_data_init (struct yytbl_data *tbl, enum yytbl_id id);
70*7e382390SJung-uk Kim int     yytbl_data_destroy (struct yytbl_data *td);
71*7e382390SJung-uk Kim int     yytbl_hdr_fwrite (struct yytbl_writer *wr,
72*7e382390SJung-uk Kim 			  const struct yytbl_hdr *th);
73*7e382390SJung-uk Kim int     yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td);
74*7e382390SJung-uk Kim void    yytbl_data_compress (struct yytbl_data *tbl);
75*7e382390SJung-uk Kim struct yytbl_data *mkftbl (void);
76*7e382390SJung-uk Kim 
77*7e382390SJung-uk Kim 
78*7e382390SJung-uk Kim #ifdef __cplusplus
79*7e382390SJung-uk Kim /* *INDENT-OFF* */
80*7e382390SJung-uk Kim }
81*7e382390SJung-uk Kim /* *INDENT-ON* */
82*7e382390SJung-uk Kim #endif
83*7e382390SJung-uk Kim #endif
84*7e382390SJung-uk Kim 
85*7e382390SJung-uk Kim /* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
86