Blame src/tables_shared.c

Packit f00812
#ifdef FLEX_SCANNER
Packit f00812
/*
Packit f00812
dnl   tables_shared.c - tables serialization code
Packit f00812
dnl 
Packit f00812
dnl   Copyright (c) 1990 The Regents of the University of California.
Packit f00812
dnl   All rights reserved.
Packit f00812
dnl 
Packit f00812
dnl   This code is derived from software contributed to Berkeley by
Packit f00812
dnl   Vern Paxson.
Packit f00812
dnl 
Packit f00812
dnl   The United States Government has rights in this work pursuant
Packit f00812
dnl   to contract no. DE-AC03-76SF00098 between the United States
Packit f00812
dnl   Department of Energy and the University of California.
Packit f00812
dnl 
Packit f00812
dnl   This file is part of flex.
Packit f00812
dnl 
Packit f00812
dnl   Redistribution and use in source and binary forms, with or without
Packit f00812
dnl   modification, are permitted provided that the following conditions
Packit f00812
dnl   are met:
Packit f00812
dnl 
Packit f00812
dnl   1. Redistributions of source code must retain the above copyright
Packit f00812
dnl      notice, this list of conditions and the following disclaimer.
Packit f00812
dnl   2. Redistributions in binary form must reproduce the above copyright
Packit f00812
dnl      notice, this list of conditions and the following disclaimer in the
Packit f00812
dnl      documentation and/or other materials provided with the distribution.
Packit f00812
dnl 
Packit f00812
dnl   Neither the name of the University nor the names of its contributors
Packit f00812
dnl   may be used to endorse or promote products derived from this software
Packit f00812
dnl   without specific prior written permission.
Packit f00812
dnl 
Packit f00812
dnl   THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
Packit f00812
dnl   IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
Packit f00812
dnl   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
Packit f00812
dnl   PURPOSE.
Packit f00812
dnl 
Packit f00812
*/
Packit f00812

Packit f00812
/* This file is meant to be included in both the skeleton and the actual
Packit f00812
 * flex code (hence the name "_shared"). 
Packit f00812
 */
Packit f00812
#ifndef yyskel_static
Packit f00812
#define yyskel_static static
Packit f00812
#endif
Packit f00812
#else
Packit f00812
#include "flexdef.h"
Packit f00812
#include "tables.h"
Packit f00812
#ifndef yyskel_static
Packit f00812
#define yyskel_static
Packit f00812
#endif
Packit f00812
#endif
Packit f00812
Packit f00812
Packit f00812
/** Get the number of integers in this table. This is NOT the
Packit f00812
 *  same thing as the number of elements.
Packit f00812
 *  @param tbl the table
Packit f00812
 *  @return the number of integers in the table
Packit f00812
 */
Packit f00812
yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
Packit f00812
{
Packit f00812
	flex_int32_t n;
Packit f00812
Packit f00812
	/* total number of ints */
Packit f00812
	n = tbl->td_lolen;
Packit f00812
	if (tbl->td_hilen > 0)
Packit f00812
		n *= tbl->td_hilen;
Packit f00812
Packit f00812
	if (tbl->td_id == YYTD_ID_TRANSITION)
Packit f00812
		n *= 2;
Packit f00812
	return n;
Packit f00812
}