established.
int todo_head, todo_next;
struct yytbl_data *yynxt_tbl = 0;
- int32_t *yynxt_data = 0, yynxt_curr = 0;
+ flex_int32_t *yynxt_data = 0, yynxt_curr = 0;
/* Note that the following are indexed by *equivalence classes*
* and not by characters. Since equivalence classes are indexed
yynxt_tbl->td_hilen = 1;
yynxt_tbl->td_lolen = num_full_table_rows;
yynxt_tbl->td_data = yynxt_data =
- (int32_t *) calloc (yynxt_tbl->td_lolen *
+ (flex_int32_t *) calloc (yynxt_tbl->td_lolen *
yynxt_tbl->td_hilen,
- sizeof (int32_t));
+ sizeof (flex_int32_t));
yynxt_curr = 0;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
- long_align ? "int32_t" : "int16_t");
+ long_align ? "flex_int32_t" : "flex_int16_t");
/* Unless -Ca, declare it "short" because it's a real
* long-shot that that won't be large enough.
if (gentables)
out_str_dec
("static yyconst %s yy_nxt[][%d] =\n {\n",
- long_align ? "int32_t" : "int16_t",
+ long_align ? "flex_int32_t" : "flex_int16_t",
num_full_table_rows);
else {
out_dec ("#undef YY_NXT_LOLEN\n#define YY_NXT_LOLEN (%d)\n", num_full_table_rows);
out_str ("static yyconst %s *yy_nxt =0;\n",
- long_align ? "int32_t" : "int16_t");
+ long_align ? "flex_int32_t" : "flex_int16_t");
}
/* Each time we hit here, it's another td_hilen, so we realloc. */
yynxt_tbl->td_hilen++;
yynxt_tbl->td_data = yynxt_data =
- (int32_t *) realloc (yynxt_data,
+ (flex_int32_t *) realloc (yynxt_data,
yynxt_tbl->td_hilen *
yynxt_tbl->td_lolen *
- sizeof (int32_t));
+ sizeof (flex_int32_t));
if (gentables)
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
+typedef int8_t flex_int8_t;
+typedef uint8_t flex_uint8_t;
+typedef int16_t flex_int16_t;
+typedef uint16_t flex_uint16_t;
+typedef int32_t flex_int32_t;
+typedef uint32_t flex_uint32_t;
#endif
#ifndef FLEX_NEED_INTEGRAL_TYPE_DEFINITIONS
#include <sys/types.h>
static const char *get_int16_decl (void)
{
return (gentables)
- ? "static yyconst int16_t %s[%d] =\n { 0,\n"
- : "static yyconst int16_t * %s = 0;\n";
+ ? "static yyconst flex_int16_t %s[%d] =\n { 0,\n"
+ : "static yyconst flex_int16_t * %s = 0;\n";
}
static const char *get_int32_decl (void)
{
return (gentables)
- ? "static yyconst int32_t %s[%d] =\n { 0,\n"
- : "static yyconst int32_t * %s = 0;\n";
+ ? "static yyconst flex_int32_t %s[%d] =\n { 0,\n"
+ : "static yyconst flex_int32_t * %s = 0;\n";
}
static const char *get_state_decl (void)
static struct yytbl_data *mkeoltbl (void)
{
int i;
- int8_t *tdata = 0;
+ flex_int8_t *tdata = 0;
struct yytbl_data *tbl;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
tbl->td_flags = YYTD_DATA8;
tbl->td_lolen = num_rules + 1;
tbl->td_data = tdata =
- (int8_t *) calloc (tbl->td_lolen, sizeof (int8_t));
+ (flex_int8_t *) calloc (tbl->td_lolen, sizeof (flex_int8_t));
for (i = 1; i <= num_rules; i++)
tdata[i] = rule_has_nl[i] ? 1 : 0;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_RULE_CAN_MATCH_EOL, (void**)&yy_rule_can_match_eol, sizeof(%s)},\n",
- "int32_t");
+ "flex_int32_t");
return tbl;
}
{
register int i;
struct yytbl_data *tbl = 0;
- int32_t *tdata = 0, curr = 0;
+ flex_int32_t *tdata = 0, curr = 0;
int end_of_buffer_action = num_rules + 1;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_TRANSITION, (void**)&yy_transition, sizeof(%s)},\n",
((tblend + numecs + 1) >= INT16_MAX
- || long_align) ? "int32_t" : "int16_t");
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_TRANSITION);
tbl->td_lolen = tblend + numecs + 1; /* number of structs */
tbl->td_data = tdata =
- (int32_t *) calloc (tbl->td_lolen * 2, sizeof (int32_t));
+ (flex_int32_t *) calloc (tbl->td_lolen * 2, sizeof (flex_int32_t));
/* We want the transition to be represented as the offset to the
* next state, not the actual state number, which is what it currently
static struct yytbl_data *mkssltbl (void)
{
struct yytbl_data *tbl = 0;
- int32_t *tdata = 0;
- int32_t i;
+ flex_int32_t *tdata = 0;
+ flex_int32_t i;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_START_STATE_LIST);
tbl->td_lolen = lastsc * 2 + 1;
tbl->td_data = tdata =
- (int32_t *) calloc (tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t));
for (i = 0; i <= lastsc * 2; ++i)
tdata[i] = base[i];
{
register int i;
struct yytbl_data *tbl = 0;
- int32_t *tdata = 0;
+ flex_int32_t *tdata = 0;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_EC);
tbl->td_lolen = csize;
tbl->td_data = tdata =
- (int32_t *) calloc (tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t));
for (i = 1; i < csize; ++i) {
if (caseins && isupper (i))
buf_prints (&yydmap_buf,
"\t{YYTD_ID_EC, (void**)&yy_ec, sizeof(%s)},\n",
- "int32_t");
+ "flex_int32_t");
return tbl;
}
register int i;
int end_of_buffer_action = num_rules + 1;
struct yytbl_data *tbl;
- int32_t *tdata = 0;
+ flex_int32_t *tdata = 0;
tbl = (struct yytbl_data *) calloc (1, sizeof (struct yytbl_data));
yytbl_data_init (tbl, YYTD_ID_ACCEPT);
tbl->td_lolen = lastdfa + 1;
tbl->td_data = tdata =
- (int32_t *) calloc (tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (tbl->td_lolen, sizeof (flex_int32_t));
dfaacc[end_of_buffer_state].dfaacc_state = end_of_buffer_action;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
- long_align ? "int32_t" : "int16_t");
+ long_align ? "flex_int32_t" : "flex_int16_t");
return tbl;
}
int end_of_buffer_action = num_rules + 1;
struct yytbl_data *yyacc_tbl = 0, *yymeta_tbl = 0, *yybase_tbl = 0,
*yydef_tbl = 0, *yynxt_tbl = 0, *yychk_tbl = 0, *yyacclist_tbl=0;
- int32_t *yyacc_data = 0, *yybase_data = 0, *yydef_data = 0,
+ flex_int32_t *yyacc_data = 0, *yybase_data = 0, *yydef_data = 0,
*yynxt_data = 0, *yychk_data = 0, *yyacclist_data=0;
- int32_t yybase_curr = 0, yyacclist_curr=0,yyacc_curr=0;
+ flex_int32_t yybase_curr = 0, yyacclist_curr=0,yyacc_curr=0;
acc_array = allocate_integer_array (current_max_dfas);
nummt = 0;
buf_prints (&yydmap_buf,
"\t{YYTD_ID_ACCLIST, (void**)&yy_acclist, sizeof(%s)},\n",
- long_align ? "int32_t" : "int16_t");
+ long_align ? "flex_int32_t" : "flex_int16_t");
yyacclist_tbl = (struct yytbl_data*)calloc(1,sizeof(struct yytbl_data));
yytbl_data_init (yyacclist_tbl, YYTD_ID_ACCLIST);
yyacclist_tbl->td_lolen = MAX(numas,1) + 1;
yyacclist_tbl->td_data = yyacclist_data =
- (int32_t *) calloc (yyacclist_tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (yyacclist_tbl->td_lolen, sizeof (flex_int32_t));
yyacclist_curr = 1;
j = 1; /* index into "yy_acclist" array */
buf_prints (&yydmap_buf,
"\t{YYTD_ID_ACCEPT, (void**)&yy_accept, sizeof(%s)},\n",
- long_align ? "int32_t" : "int16_t");
+ long_align ? "flex_int32_t" : "flex_int16_t");
yyacc_tbl =
(struct yytbl_data *) calloc (1,
yytbl_data_init (yyacc_tbl, YYTD_ID_ACCEPT);
yyacc_tbl->td_lolen = k;
yyacc_tbl->td_data = yyacc_data =
- (int32_t *) calloc (yyacc_tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (yyacc_tbl->td_lolen, sizeof (flex_int32_t));
yyacc_curr=1;
for (i = 1; i <= lastdfa; ++i) {
/* Write out meta-equivalence classes (used to index
* templates with).
*/
- int32_t *yymecs_data = 0;
+ flex_int32_t *yymecs_data = 0;
yymeta_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct
yytbl_data_init (yymeta_tbl, YYTD_ID_META);
yymeta_tbl->td_lolen = numecs + 1;
yymeta_tbl->td_data = yymecs_data =
- (int32_t *) calloc (yymeta_tbl->td_lolen,
- sizeof (int32_t));
+ (flex_int32_t *) calloc (yymeta_tbl->td_lolen,
+ sizeof (flex_int32_t));
if (trace)
fputs (_("\n\nMeta-Equivalence Classes:\n"),
out_str_dec (get_int32_decl (), "yy_meta", numecs + 1);
buf_prints (&yydmap_buf,
"\t{YYTD_ID_META, (void**)&yy_meta, sizeof(%s)},\n",
- "int32_t");
+ "flex_int32_t");
for (i = 1; i <= numecs; ++i) {
if (trace)
buf_prints (&yydmap_buf,
"\t{YYTD_ID_BASE, (void**)&yy_base, sizeof(%s)},\n",
(tblend >= INT16_MAX
- || long_align) ? "int32_t" : "int16_t");
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
yybase_tbl =
(struct yytbl_data *) calloc (1,
sizeof (struct yytbl_data));
yytbl_data_init (yybase_tbl, YYTD_ID_BASE);
yybase_tbl->td_lolen = total_states + 1;
yybase_tbl->td_data = yybase_data =
- (int32_t *) calloc (yybase_tbl->td_lolen,
- sizeof (int32_t));
+ (flex_int32_t *) calloc (yybase_tbl->td_lolen,
+ sizeof (flex_int32_t));
yybase_curr = 1;
for (i = 1; i <= lastdfa; ++i) {
buf_prints (&yydmap_buf,
"\t{YYTD_ID_DEF, (void**)&yy_def, sizeof(%s)},\n",
(total_states >= INT16_MAX
- || long_align) ? "int32_t" : "int16_t");
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
yydef_tbl =
(struct yytbl_data *) calloc (1,
yytbl_data_init (yydef_tbl, YYTD_ID_DEF);
yydef_tbl->td_lolen = total_states + 1;
yydef_tbl->td_data = yydef_data =
- (int32_t *) calloc (yydef_tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (yydef_tbl->td_lolen, sizeof (flex_int32_t));
for (i = 1; i <= total_states; ++i) {
mkdata (def[i]);
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NXT, (void**)&yy_nxt, sizeof(%s)},\n",
(total_states >= INT16_MAX
- || long_align) ? "int32_t" : "int16_t");
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
yynxt_tbl =
(struct yytbl_data *) calloc (1,
yytbl_data_init (yynxt_tbl, YYTD_ID_NXT);
yynxt_tbl->td_lolen = tblend + 1;
yynxt_tbl->td_data = yynxt_data =
- (int32_t *) calloc (yynxt_tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (yynxt_tbl->td_lolen, sizeof (flex_int32_t));
for (i = 1; i <= tblend; ++i) {
/* Note, the order of the following test is important.
buf_prints (&yydmap_buf,
"\t{YYTD_ID_CHK, (void**)&yy_chk, sizeof(%s)},\n",
(total_states >= INT16_MAX
- || long_align) ? "int32_t" : "int16_t");
+ || long_align) ? "flex_int32_t" : "flex_int16_t");
yychk_tbl =
(struct yytbl_data *) calloc (1,
yytbl_data_init (yychk_tbl, YYTD_ID_CHK);
yychk_tbl->td_lolen = tblend + 1;
yychk_tbl->td_data = yychk_data =
- (int32_t *) calloc (yychk_tbl->td_lolen, sizeof (int32_t));
+ (flex_int32_t *) calloc (yychk_tbl->td_lolen, sizeof (flex_int32_t));
for (i = 1; i <= tblend; ++i) {
if (chk[i] == 0)
int total_table_size = tblend + numecs + 1;
char *trans_offset_type =
(total_table_size >= INT16_MAX || long_align) ?
- "int32_t" : "int16_t";
+ "flex_int32_t" : "flex_int16_t";
set_indent (0);
indent_puts ("struct yy_trans_info");
indent_puts ("struct yy_trans_info");
indent_up ();
indent_puts ("{");
- indent_puts ("int32_t yy_verify;");
- indent_puts ("int32_t yy_nxt;");
+ indent_puts ("flex_int32_t yy_verify;");
+ indent_puts ("flex_int32_t yy_nxt;");
indent_puts ("};");
indent_down ();
}
}
if (nultrans) {
- int32_t *yynultrans_data = 0;
+ flex_int32_t *yynultrans_data = 0;
/* Begin generating yy_NUL_trans */
out_str_dec (get_state_decl (), "yy_NUL_trans",
buf_prints (&yydmap_buf,
"\t{YYTD_ID_NUL_TRANS, (void**)&yy_NUL_trans, sizeof(%s)},\n",
(fullspd) ? "struct yy_trans_info*" :
- "int32_t");
+ "flex_int32_t");
yynultrans_tbl =
(struct yytbl_data *) calloc (1,
yynultrans_tbl->td_flags |= YYTD_PTRANS;
yynultrans_tbl->td_lolen = lastdfa + 1;
yynultrans_tbl->td_data = yynultrans_data =
- (int32_t *) calloc (yynultrans_tbl->td_lolen,
- sizeof (int32_t));
+ (flex_int32_t *) calloc (yynultrans_tbl->td_lolen,
+ sizeof (flex_int32_t));
for (i = 1; i <= lastdfa; ++i) {
if (fullspd) {
* @return YYTD_DATA*.
*/
#define BYTES2TFLAG(n)\
- (((n) == sizeof(int8_t))\
+ (((n) == sizeof(flex_int8_t))\
? YYTD_DATA8\
- :(((n)== sizeof(int16_t))\
+ :(((n)== sizeof(flex_int16_t))\
? YYTD_DATA16\
: YYTD_DATA32))
*/
#define TFLAGS_CLRDATA(flg) ((flg) & ~(YYTD_DATA8 | YYTD_DATA16 | YYTD_DATA32))
-int yytbl_write32 (struct yytbl_writer *wr, uint32_t v);
-int yytbl_write16 (struct yytbl_writer *wr, uint16_t v);
-int yytbl_write8 (struct yytbl_writer *wr, uint8_t v);
-int yytbl_writen (struct yytbl_writer *wr, void *v, int32_t len);
-static int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i);
-static int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
+int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v);
+int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v);
+int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v);
+int yytbl_writen (struct yytbl_writer *wr, void *v, flex_int32_t len);
+static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i);
+static flex_int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
int j, int k);
int yytbl_data_fwrite (struct yytbl_writer *wr, struct yytbl_data *td)
{
size_t rv;
- int32_t bwritten = 0;
- int32_t i, total_len;
+ flex_int32_t bwritten = 0;
+ flex_int32_t i, total_len;
fpos_t pos;
if ((rv = yytbl_write16 (wr, td->td_id)) < 0)
total_len = yytbl_calc_total_len (td);
for (i = 0; i < total_len; i++) {
switch (YYTDFLAGS2BYTES (td->td_flags)) {
- case sizeof (int8_t):
+ case sizeof (flex_int8_t):
rv = yytbl_write8 (wr, yytbl_data_geti (td, i));
break;
- case sizeof (int16_t):
+ case sizeof (flex_int16_t):
rv = yytbl_write16 (wr, yytbl_data_geti (td, i));
break;
- case sizeof (int32_t):
+ case sizeof (flex_int32_t):
rv = yytbl_write32 (wr, yytbl_data_geti (td, i));
break;
default:
}
else
/* Don't count the int we just wrote. */
- wr->total_written -= sizeof (int32_t);
+ wr->total_written -= sizeof (flex_int32_t);
return bwritten;
}
* @param len number of bytes
* @return -1 on error. number of bytes written on success.
*/
-int yytbl_writen (struct yytbl_writer *wr, void *v, int32_t len)
+int yytbl_writen (struct yytbl_writer *wr, void *v, flex_int32_t len)
{
size_t rv;
* @param v a dword in host byte order
* @return -1 on error. number of bytes written on success.
*/
-int yytbl_write32 (struct yytbl_writer *wr, uint32_t v)
+int yytbl_write32 (struct yytbl_writer *wr, flex_uint32_t v)
{
- uint32_t vnet;
+ flex_uint32_t vnet;
size_t bytes, rv;
vnet = htonl (v);
- bytes = sizeof (uint32_t);
+ bytes = sizeof (flex_uint32_t);
rv = fwrite (&vnet, bytes, 1, wr->out);
if (rv != 1)
return -1;
* @param v a word in host byte order
* @return -1 on error. number of bytes written on success.
*/
-int yytbl_write16 (struct yytbl_writer *wr, uint16_t v)
+int yytbl_write16 (struct yytbl_writer *wr, flex_uint16_t v)
{
- uint16_t vnet;
+ flex_uint16_t vnet;
size_t bytes, rv;
vnet = htons (v);
- bytes = sizeof (uint16_t);
+ bytes = sizeof (flex_uint16_t);
rv = fwrite (&vnet, bytes, 1, wr->out);
if (rv != 1)
return -1;
* @param v the value to be written
* @return -1 on error. number of bytes written on success.
*/
-int yytbl_write8 (struct yytbl_writer *wr, uint8_t v)
+int yytbl_write8 (struct yytbl_writer *wr, flex_uint8_t v)
{
size_t bytes, rv;
- bytes = sizeof (uint8_t);
+ bytes = sizeof (flex_uint8_t);
rv = fwrite (&v, bytes, 1, wr->out);
if (rv != 1)
return -1;
* @param k index into struct, must be 0 or 1. Only valid for YYTD_ID_TRANSITION table
* @return data[i][j + k]
*/
-static int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
+static flex_int32_t yytbl_data_getijk (const struct yytbl_data *tbl, int i,
int j, int k)
{
- int32_t lo;
+ flex_int32_t lo;
k %= 2;
lo = tbl->td_lolen;
switch (YYTDFLAGS2BYTES (tbl->td_flags)) {
- case sizeof (int8_t):
- return ((int8_t *) (tbl->td_data))[(i * lo + j) * (k + 1) +
+ case sizeof (flex_int8_t):
+ return ((flex_int8_t *) (tbl->td_data))[(i * lo + j) * (k + 1) +
k];
- case sizeof (int16_t):
- return ((int16_t *) (tbl->td_data))[(i * lo + j) * (k +
+ case sizeof (flex_int16_t):
+ return ((flex_int16_t *) (tbl->td_data))[(i * lo + j) * (k +
1) +
k];
- case sizeof (int32_t):
- return ((int32_t *) (tbl->td_data))[(i * lo + j) * (k +
+ case sizeof (flex_int32_t):
+ return ((flex_int32_t *) (tbl->td_data))[(i * lo + j) * (k +
1) +
k];
default:
* @param i index into array.
* @return data[i]
*/
-static int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i)
+static flex_int32_t yytbl_data_geti (const struct yytbl_data *tbl, int i)
{
switch (YYTDFLAGS2BYTES (tbl->td_flags)) {
- case sizeof (int8_t):
- return ((int8_t *) (tbl->td_data))[i];
- case sizeof (int16_t):
- return ((int16_t *) (tbl->td_data))[i];
- case sizeof (int32_t):
- return ((int32_t *) (tbl->td_data))[i];
+ case sizeof (flex_int8_t):
+ return ((flex_int8_t *) (tbl->td_data))[i];
+ case sizeof (flex_int16_t):
+ return ((flex_int16_t *) (tbl->td_data))[i];
+ case sizeof (flex_int32_t):
+ return ((flex_int32_t *) (tbl->td_data))[i];
default:
flex_die (_("invalid td_flags detected"));
break;
* @param newval new value for data[i]
*/
static void yytbl_data_seti (const struct yytbl_data *tbl, int i,
- int32_t newval)
+ flex_int32_t newval)
{
switch (YYTDFLAGS2BYTES (tbl->td_flags)) {
- case sizeof (int8_t):
- ((int8_t *) (tbl->td_data))[i] = (int8_t) newval;
+ case sizeof (flex_int8_t):
+ ((flex_int8_t *) (tbl->td_data))[i] = (flex_int8_t) newval;
break;
- case sizeof (int16_t):
- ((int16_t *) (tbl->td_data))[i] = (int16_t) newval;
+ case sizeof (flex_int16_t):
+ ((flex_int16_t *) (tbl->td_data))[i] = (flex_int16_t) newval;
break;
- case sizeof (int32_t):
- ((int32_t *) (tbl->td_data))[i] = (int32_t) newval;
+ case sizeof (flex_int32_t):
+ ((flex_int32_t *) (tbl->td_data))[i] = (flex_int32_t) newval;
break;
default:
flex_die (_("invalid td_flags detected"));
/** Calculate the number of bytes needed to hold the largest
* absolute value in this data array.
* @param tbl the data table
- * @return sizeof(n) where n in {int8_t, int16_t, int32_t}
+ * @return sizeof(n) where n in {flex_int8_t, flex_int16_t, flex_int32_t}
*/
static size_t min_int_size (struct yytbl_data *tbl)
{
- uint32_t i, total_len;
- int32_t max = 0;
+ flex_uint32_t i, total_len;
+ flex_int32_t max = 0;
total_len = yytbl_calc_total_len (tbl);
for (i = 0; i < total_len; i++) {
- int32_t n;
+ flex_int32_t n;
n = abs (yytbl_data_geti (tbl, i));
}
if (max <= INT8_MAX)
- return sizeof (int8_t);
+ return sizeof (flex_int8_t);
else if (max <= INT16_MAX)
- return sizeof (int16_t);
+ return sizeof (flex_int16_t);
else
- return sizeof (int32_t);
+ return sizeof (flex_int32_t);
}
/** Transform data to smallest possible of (int32, int16, int8).
*/
void yytbl_data_compress (struct yytbl_data *tbl)
{
- int32_t i, newsz, total_len;
+ flex_int32_t i, newsz, total_len;
struct yytbl_data newtbl;
yytbl_data_init (&newtbl, tbl->td_id);
TFLAGS_CLRDATA (newtbl.td_flags) | BYTES2TFLAG (newsz);
for (i = 0; i < total_len; i++) {
- int32_t g;
+ flex_int32_t g;
g = yytbl_data_geti (tbl, i);
yytbl_data_seti (&newtbl, i, g);
#include "tables_shared.h"
struct yytbl_writer {
FILE *out;
- uint32_t total_written;
+ flex_uint32_t total_written;
/**< bytes written so far */
fpos_t th_ssize_pos;
/**< position of th_ssize */
* @param td the table
* @return the number of integers in the table
*/
-yyskel_static int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
+yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl)
{
- int32_t n;
+ flex_int32_t n;
/* total number of ints */
n = tbl->td_lolen;
/** bit flags for t_flags field of struct yytbl_data */
enum yytbl_flags {
/* These first three are mutually exclusive */
- YYTD_DATA8 = 0x01, /**< data is an array of type int8_t */
- YYTD_DATA16 = 0x02, /**< data is an array of type int16_t */
- YYTD_DATA32 = 0x04, /**< data is an array of type int32_t */
+ YYTD_DATA8 = 0x01, /**< data is an array of type flex_int8_t */
+ YYTD_DATA16 = 0x02, /**< data is an array of type flex_int16_t */
+ YYTD_DATA32 = 0x04, /**< data is an array of type flex_int32_t */
/* These two are mutually exclusive. */
YYTD_PTRANS = 0x08, /**< data is a list of indexes of entries
/* The serialized tables header. */
struct yytbl_hdr {
- uint32_t th_magic; /**< Must be 0xF13C57B1 (comes from "Flex Table") */
- uint32_t th_hsize; /**< Size of this header in bytes. */
- uint32_t th_ssize; /**< Size of this dataset, in bytes, including header. */
- uint16_t th_flags; /**< Currently unused, must be 0 */
+ flex_uint32_t th_magic; /**< Must be 0xF13C57B1 (comes from "Flex Table") */
+ flex_uint32_t th_hsize; /**< Size of this header in bytes. */
+ flex_uint32_t th_ssize; /**< Size of this dataset, in bytes, including header. */
+ flex_uint16_t th_flags; /**< Currently unused, must be 0 */
char *th_version; /**< Flex version string. NUL terminated. */
char *th_name; /**< The name of this table set. NUL terminated. */
};
/** A single serialized table */
struct yytbl_data {
- enum yytbl_id td_id; /**< uint16_t table identifier */
- uint16_t td_flags; /**< how to interpret this data */
- uint32_t td_hilen; /**< num elements in highest dimension array */
- uint32_t td_lolen; /**< num elements in lowest dimension array */
+ enum yytbl_id td_id; /**< flex_uint16_t table identifier */
+ flex_uint16_t td_flags; /**< how to interpret this data */
+ flex_uint32_t td_hilen; /**< num elements in highest dimension array */
+ flex_uint32_t td_lolen; /**< num elements in lowest dimension array */
void *td_data; /**< table data */
};
#endif
#ifndef YYTDFLAGS2BYTES
#define YYTDFLAGS2BYTES(td_flags)\
(((td_flags) & YYTD_DATA8)\
- ? sizeof(int8_t)\
+ ? sizeof(flex_int8_t)\
:(((td_flags) & YYTD_DATA16)\
- ? sizeof(int16_t)\
- :sizeof(int32_t)))
+ ? sizeof(flex_int16_t)\
+ :sizeof(flex_int32_t)))
#endif
#ifdef FLEX_SCANNER
%not-for-header
#endif
-yyskel_static int32_t yytbl_calc_total_len (const struct yytbl_data *tbl);
+yyskel_static flex_int32_t yytbl_calc_total_len (const struct yytbl_data *tbl);
#ifdef FLEX_SCANNER
%ok-for-header
#endif