summaryrefslogtreecommitdiff
path: root/src/tables_shared.c
diff options
context:
space:
mode:
authorWill Estes <westes575@gmail.com>2014-02-14 07:52:31 -0500
committerWill Estes <westes575@gmail.com>2014-02-16 09:19:51 -0500
commit269620b90047cf95cc8f65c98ca599d4fe18e779 (patch)
tree3fe9f5c8153e91d652284ae5af934ece646274d9 /src/tables_shared.c
parent638d8a1448fa3d2241c71aff016d323c8654373c (diff)
move flex program sources into src/ directory
The *.[chly] sources are now in the src directory. This implies a bunch of changes in Makefile.am and friends to account for the new location. The .gitignore files are now more local to places where various object files and generated source files occur.
Diffstat (limited to 'src/tables_shared.c')
-rw-r--r--src/tables_shared.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/src/tables_shared.c b/src/tables_shared.c
new file mode 100644
index 0000000..b962666
--- /dev/null
+++ b/src/tables_shared.c
@@ -0,0 +1,70 @@
+#ifdef FLEX_SCANNER
+/*
+dnl tables_shared.c - tables serialization code
+dnl
+dnl Copyright (c) 1990 The Regents of the University of California.
+dnl All rights reserved.
+dnl
+dnl This code is derived from software contributed to Berkeley by
+dnl Vern Paxson.
+dnl
+dnl The United States Government has rights in this work pursuant
+dnl to contract no. DE-AC03-76SF00098 between the United States
+dnl Department of Energy and the University of California.
+dnl
+dnl This file is part of flex.
+dnl
+dnl Redistribution and use in source and binary forms, with or without
+dnl modification, are permitted provided that the following conditions
+dnl are met:
+dnl
+dnl 1. Redistributions of source code must retain the above copyright
+dnl notice, this list of conditions and the following disclaimer.
+dnl 2. Redistributions in binary form must reproduce the above copyright
+dnl notice, this list of conditions and the following disclaimer in the
+dnl documentation and/or other materials provided with the distribution.
+dnl
+dnl Neither the name of the University nor the names of its contributors
+dnl may be used to endorse or promote products derived from this software
+dnl without specific prior written permission.
+dnl
+dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+dnl PURPOSE.
+dnl
+*/
+
+/* This file is meant to be included in both the skeleton and the actual
+ * flex code (hence the name "_shared").
+ */
+#ifndef yyskel_static
+#define yyskel_static static
+#endif
+#else
+#include "flexdef.h"
+#include "tables.h"
+#ifndef yyskel_static
+#define yyskel_static
+#endif
+#endif
+
+
+/** Get the number of integers in this table. This is NOT the
+ * same thing as the number of elements.
+ * @param td the table
+ * @return the number of integers in the table
+ */
+yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
+{
+ flex_int32_t n;
+
+ /* total number of ints */
+ n = tbl->td_lolen;
+ if (tbl->td_hilen > 0)
+ n *= tbl->td_hilen;
+
+ if (tbl->td_id == YYTD_ID_TRANSITION)
+ n *= 2;
+ return n;
+}