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