1228072Sbapt/*  tables.h - tables serialization code
2228072Sbapt *
3228072Sbapt *  Copyright (c) 1990 The Regents of the University of California.
4228072Sbapt *  All rights reserved.
5228072Sbapt *
6228072Sbapt *  This code is derived from software contributed to Berkeley by
7228072Sbapt *  Vern Paxson.
8228072Sbapt *
9228072Sbapt *  The United States Government has rights in this work pursuant
10228072Sbapt *  to contract no. DE-AC03-76SF00098 between the United States
11228072Sbapt *  Department of Energy and the University of California.
12228072Sbapt *
13228072Sbapt *  This file is part of flex.
14228072Sbapt *
15228072Sbapt *  Redistribution and use in source and binary forms, with or without
16228072Sbapt *  modification, are permitted provided that the following conditions
17228072Sbapt *  are met:
18228072Sbapt *
19228072Sbapt *  1. Redistributions of source code must retain the above copyright
20228072Sbapt *     notice, this list of conditions and the following disclaimer.
21228072Sbapt *  2. Redistributions in binary form must reproduce the above copyright
22228072Sbapt *     notice, this list of conditions and the following disclaimer in the
23228072Sbapt *     documentation and/or other materials provided with the distribution.
24228072Sbapt *
25228072Sbapt *  Neither the name of the University nor the names of its contributors
26228072Sbapt *  may be used to endorse or promote products derived from this software
27228072Sbapt *  without specific prior written permission.
28228072Sbapt *
29228072Sbapt *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
30228072Sbapt *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
31228072Sbapt *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
32228072Sbapt *  PURPOSE.
33228072Sbapt */
34228072Sbapt
35228072Sbapt#ifndef TABLES_H
36228072Sbapt#define TABLES_H
37228072Sbapt
38228072Sbapt#ifdef __cplusplus
39228072Sbapt/* *INDENT-OFF* */
40228072Sbaptextern  "C" {
41228072Sbapt/* *INDENT-ON* */
42228072Sbapt#endif
43228072Sbapt
44228072Sbapt/* Tables serialization API declarations. */
45228072Sbapt#include "tables_shared.h"
46228072Sbaptstruct yytbl_writer {
47228072Sbapt	FILE   *out;
48228072Sbapt	flex_uint32_t total_written;
49228072Sbapt			    /**< bytes written so far */
50228072Sbapt	fpos_t  th_ssize_pos;
51228072Sbapt			    /**< position of th_ssize */
52228072Sbapt};
53228072Sbapt
54228072Sbapt/* These are used by main.c, gen.c, etc.
55228072Sbapt * tablesext - if true, create external tables
56228072Sbapt * tablesfilename - filename for external tables
57228072Sbapt * tablesname - name that goes in serialized data, e.g., "yytables"
58228072Sbapt * tableswr -  writer for external tables
59228072Sbapt * tablesverify - true if tables-verify option specified
60228072Sbapt * gentables - true if we should spit out the normal C tables
61228072Sbapt */
62228072Sbaptextern bool tablesext, tablesverify,gentables;
63228072Sbaptextern char *tablesfilename, *tablesname;
64228072Sbaptextern struct yytbl_writer tableswr;
65228072Sbapt
66228072Sbaptint     yytbl_writer_init (struct yytbl_writer *, FILE *);
67228072Sbaptint     yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str,
68228072Sbapt			const char *name);
69228072Sbaptint     yytbl_data_init (struct yytbl_data *tbl, enum yytbl_id id);
70228072Sbaptint     yytbl_data_destroy (struct yytbl_data *td);
71228072Sbaptint     yytbl_hdr_fwrite (struct yytbl_writer *wr,
72228072Sbapt			  const struct yytbl_hdr *th);
73228072Sbaptint     yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td);
74228072Sbaptvoid    yytbl_data_compress (struct yytbl_data *tbl);
75228072Sbaptstruct yytbl_data *mkftbl (void);
76228072Sbapt
77228072Sbapt
78228072Sbapt#ifdef __cplusplus
79228072Sbapt/* *INDENT-OFF* */
80228072Sbapt}
81228072Sbapt/* *INDENT-ON* */
82228072Sbapt#endif
83228072Sbapt#endif
84228072Sbapt
85228072Sbapt/* vim:set expandtab cindent tabstop=4 softtabstop=4 shiftwidth=4 textwidth=0: */
86