1228072Sbapt#ifdef FLEX_SCANNER
2228072Sbapt/*
3228072Sbaptdnl   tables_shared.c - tables serialization code
4228072Sbaptdnl
5228072Sbaptdnl   Copyright (c) 1990 The Regents of the University of California.
6228072Sbaptdnl   All rights reserved.
7228072Sbaptdnl
8228072Sbaptdnl   This code is derived from software contributed to Berkeley by
9228072Sbaptdnl   Vern Paxson.
10228072Sbaptdnl
11228072Sbaptdnl   The United States Government has rights in this work pursuant
12228072Sbaptdnl   to contract no. DE-AC03-76SF00098 between the United States
13228072Sbaptdnl   Department of Energy and the University of California.
14228072Sbaptdnl
15228072Sbaptdnl   This file is part of flex.
16228072Sbaptdnl
17228072Sbaptdnl   Redistribution and use in source and binary forms, with or without
18228072Sbaptdnl   modification, are permitted provided that the following conditions
19228072Sbaptdnl   are met:
20228072Sbaptdnl
21228072Sbaptdnl   1. Redistributions of source code must retain the above copyright
22228072Sbaptdnl      notice, this list of conditions and the following disclaimer.
23228072Sbaptdnl   2. Redistributions in binary form must reproduce the above copyright
24228072Sbaptdnl      notice, this list of conditions and the following disclaimer in the
25228072Sbaptdnl      documentation and/or other materials provided with the distribution.
26228072Sbaptdnl
27228072Sbaptdnl   Neither the name of the University nor the names of its contributors
28228072Sbaptdnl   may be used to endorse or promote products derived from this software
29228072Sbaptdnl   without specific prior written permission.
30228072Sbaptdnl
31228072Sbaptdnl   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
32228072Sbaptdnl   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
33228072Sbaptdnl   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34228072Sbaptdnl   PURPOSE.
35228072Sbaptdnl
36228072Sbapt*/
37228072Sbapt
38228072Sbapt/* This file is meant to be included in both the skeleton and the actual
39228072Sbapt * flex code (hence the name "_shared").
40228072Sbapt */
41228072Sbapt#ifndef yyskel_static
42228072Sbapt#define yyskel_static static
43228072Sbapt#endif
44228072Sbapt#else
45228072Sbapt#include "flexdef.h"
46228072Sbapt#include "tables.h"
47228072Sbapt#ifndef yyskel_static
48228072Sbapt#define yyskel_static
49228072Sbapt#endif
50228072Sbapt#endif
51228072Sbapt
52228072Sbapt
53228072Sbapt/** Get the number of integers in this table. This is NOT the
54228072Sbapt *  same thing as the number of elements.
55228072Sbapt *  @param td the table
56228072Sbapt *  @return the number of integers in the table
57228072Sbapt */
58228072Sbaptyyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
59228072Sbapt{
60228072Sbapt	flex_int32_t n;
61228072Sbapt
62228072Sbapt	/* total number of ints */
63228072Sbapt	n = tbl->td_lolen;
64228072Sbapt	if (tbl->td_hilen > 0)
65228072Sbapt		n *= tbl->td_hilen;
66228072Sbapt
67228072Sbapt	if (tbl->td_id == YYTD_ID_TRANSITION)
68228072Sbapt		n *= 2;
69228072Sbapt	return n;
70228072Sbapt}
71