130da1778Schristos #ifdef FLEX_SCANNER 230da1778Schristos /* 330da1778Schristos dnl tables_shared.c - tables serialization code 430da1778Schristos dnl 530da1778Schristos dnl Copyright (c) 1990 The Regents of the University of California. 630da1778Schristos dnl All rights reserved. 730da1778Schristos dnl 830da1778Schristos dnl This code is derived from software contributed to Berkeley by 930da1778Schristos dnl Vern Paxson. 1030da1778Schristos dnl 1130da1778Schristos dnl The United States Government has rights in this work pursuant 1230da1778Schristos dnl to contract no. DE-AC03-76SF00098 between the United States 1330da1778Schristos dnl Department of Energy and the University of California. 1430da1778Schristos dnl 1530da1778Schristos dnl This file is part of flex. 1630da1778Schristos dnl 1730da1778Schristos dnl Redistribution and use in source and binary forms, with or without 1830da1778Schristos dnl modification, are permitted provided that the following conditions 1930da1778Schristos dnl are met: 2030da1778Schristos dnl 2130da1778Schristos dnl 1. Redistributions of source code must retain the above copyright 2230da1778Schristos dnl notice, this list of conditions and the following disclaimer. 2330da1778Schristos dnl 2. Redistributions in binary form must reproduce the above copyright 2430da1778Schristos dnl notice, this list of conditions and the following disclaimer in the 2530da1778Schristos dnl documentation and/or other materials provided with the distribution. 2630da1778Schristos dnl 2730da1778Schristos dnl Neither the name of the University nor the names of its contributors 2830da1778Schristos dnl may be used to endorse or promote products derived from this software 2930da1778Schristos dnl without specific prior written permission. 3030da1778Schristos dnl 3130da1778Schristos dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 3230da1778Schristos dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 3330da1778Schristos dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 3430da1778Schristos dnl PURPOSE. 3530da1778Schristos dnl 3630da1778Schristos */ 3730da1778Schristos 3830da1778Schristos /* This file is meant to be included in both the skeleton and the actual 3930da1778Schristos * flex code (hence the name "_shared"). 4030da1778Schristos */ 4130da1778Schristos #ifndef yyskel_static 4230da1778Schristos #define yyskel_static static 4330da1778Schristos #endif 4430da1778Schristos #else 4530da1778Schristos #include "flexdef.h" 4630da1778Schristos #include "tables.h" 4730da1778Schristos #ifndef yyskel_static 4830da1778Schristos #define yyskel_static 4930da1778Schristos #endif 5030da1778Schristos #endif 5130da1778Schristos 5230da1778Schristos 5330da1778Schristos /** Get the number of integers in this table. This is NOT the 5430da1778Schristos * same thing as the number of elements. 5530da1778Schristos * @param tbl the table 5630da1778Schristos * @return the number of integers in the table 5730da1778Schristos */ yytbl_calc_total_len(const struct yytbl_data * tbl)5830da1778Schristosyyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl) 5930da1778Schristos { 60*56bd8546Schristos flex_uint32_t n; 6130da1778Schristos 6230da1778Schristos /* total number of ints */ 6330da1778Schristos n = tbl->td_lolen; 6430da1778Schristos if (tbl->td_hilen > 0) 6530da1778Schristos n *= tbl->td_hilen; 6630da1778Schristos 6730da1778Schristos if (tbl->td_id == YYTD_ID_TRANSITION) 6830da1778Schristos n *= 2; 69*56bd8546Schristos return (flex_int32_t) n; 7030da1778Schristos } 71