1226048Sobrien/* tables.h - tables serialization code 2159764Sobrien * 3330569Sgordon * Copyright (c) 1990 The Regents of the University of California. 4159764Sobrien * All rights reserved. 5159764Sobrien * 6159764Sobrien * This code is derived from software contributed to Berkeley by 7159764Sobrien * Vern Paxson. 8159764Sobrien * 9159764Sobrien * The United States Government has rights in this work pursuant 10159764Sobrien * to contract no. DE-AC03-76SF00098 between the United States 11159764Sobrien * Department of Energy and the University of California. 12159764Sobrien * 13186690Sobrien * This file is part of flex. 14159764Sobrien * 15330569Sgordon * Redistribution and use in source and binary forms, with or without 16330569Sgordon * modification, are permitted provided that the following conditions 17159764Sobrien * are met: 18330569Sgordon * 19159764Sobrien * 1. Redistributions of source code must retain the above copyright 20330569Sgordon * notice, this list of conditions and the following disclaimer. 21330569Sgordon * 2. Redistributions in binary form must reproduce the above copyright 22159764Sobrien * notice, this list of conditions and the following disclaimer in the 23330569Sgordon * documentation and/or other materials provided with the distribution. 24159764Sobrien * 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* */ 40extern "C" { 41/* *INDENT-ON* */ 42#endif 43 44/* Tables serialization API declarations. */ 45#include "tables_shared.h" 46struct yytbl_writer { 47 FILE *out; 48 flex_uint32_t 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 */ 62extern bool tablesext, tablesverify,gentables; 63extern char *tablesfilename, *tablesname; 64extern struct yytbl_writer tableswr; 65 66int yytbl_writer_init (struct yytbl_writer *, FILE *); 67int yytbl_hdr_init (struct yytbl_hdr *th, const char *version_str, 68 const char *name); 69int yytbl_data_init (struct yytbl_data *tbl, enum yytbl_id id); 70int yytbl_data_destroy (struct yytbl_data *td); 71int yytbl_hdr_fwrite (struct yytbl_writer *wr, 72 const struct yytbl_hdr *th); 73int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td); 74void yytbl_data_compress (struct yytbl_data *tbl); 75struct 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