source: trunk/flex/tables_shared.c@ 3032

Last change on this file since 3032 was 3031, checked in by bird, 18 years ago

flex 2.5.33.

File size: 2.2 KB
Line 
1#ifdef FLEX_SCANNER
2/*
3dnl tables_shared.c - tables serialization code
4dnl
5dnl Copyright (c) 1990 The Regents of the University of California.
6dnl All rights reserved.
7dnl
8dnl This code is derived from software contributed to Berkeley by
9dnl Vern Paxson.
10dnl
11dnl The United States Government has rights in this work pursuant
12dnl to contract no. DE-AC03-76SF00098 between the United States
13dnl Department of Energy and the University of California.
14dnl
15dnl This file is part of flex.
16dnl
17dnl Redistribution and use in source and binary forms, with or without
18dnl modification, are permitted provided that the following conditions
19dnl are met:
20dnl
21dnl 1. Redistributions of source code must retain the above copyright
22dnl notice, this list of conditions and the following disclaimer.
23dnl 2. Redistributions in binary form must reproduce the above copyright
24dnl notice, this list of conditions and the following disclaimer in the
25dnl documentation and/or other materials provided with the distribution.
26dnl
27dnl Neither the name of the University nor the names of its contributors
28dnl may be used to endorse or promote products derived from this software
29dnl without specific prior written permission.
30dnl
31dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
32dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
33dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34dnl PURPOSE.
35dnl
36*/
37
38
39/* This file is meant to be included in both the skeleton and the actual
40 * flex code (hence the name "_shared").
41 */
42#ifndef yyskel_static
43#define yyskel_static static
44#endif
45#else
46#include "flexdef.h"
47#include "tables.h"
48#ifndef yyskel_static
49#define yyskel_static
50#endif
51#endif
52
53
54/** Get the number of integers in this table. This is NOT the
55 * same thing as the number of elements.
56 * @param td the table
57 * @return the number of integers in the table
58 */
59yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
60{
61 flex_int32_t n;
62
63 /* total number of ints */
64 n = tbl->td_lolen;
65 if (tbl->td_hilen > 0)
66 n *= tbl->td_hilen;
67
68 if (tbl->td_id == YYTD_ID_TRANSITION)
69 n *= 2;
70 return n;
71}
Note: See TracBrowser for help on using the repository browser.