From: Will Estes Date: Wed, 16 Jul 2003 15:05:54 +0000 (+0000) Subject: flex_*int* type fixes X-Git-Tag: flex-2-5-32~15 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08d7d28ee863e25b782e9d220c3a1b1ec6afab77;p=flex flex_*int* type fixes --- diff --git a/flex.skl b/flex.skl index 614e9ae..3aaa00c 100644 --- a/flex.skl +++ b/flex.skl @@ -1102,7 +1102,7 @@ static struct yytbl_dmap yydmap[] = /** A tables-reader object to maintain some state in the read. */ struct yytbl_reader { FILE * fp; /**< input stream */ - uint32_t bread; /**< bytes read since beginning of current tableset */ + flex_uint32_t bread; /**< bytes read since beginning of current tableset */ }; %endif @@ -2869,35 +2869,35 @@ m4preproc_include(`tables_shared.c') static int yytbl_read8 (void *v, struct yytbl_reader * rd) { errno = 0; - if (fread (v, sizeof (uint8_t), 1, rd->fp) != 1){ + if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){ errno = EIO; return -1; } - rd->bread += sizeof(uint8_t); + rd->bread += sizeof(flex_uint8_t); return 0; } static int yytbl_read16 (void *v, struct yytbl_reader * rd) { errno = 0; - if (fread (v, sizeof (uint16_t), 1, rd->fp) != 1){ + if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){ errno = EIO; return -1; } - *((uint16_t *) v) = ntohs (*((uint16_t *) v)); - rd->bread += sizeof(uint16_t); + *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v)); + rd->bread += sizeof(flex_uint16_t); return 0; } static int yytbl_read32 (void *v, struct yytbl_reader * rd) { errno = 0; - if (fread (v, sizeof (uint32_t), 1, rd->fp) != 1){ + if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){ errno = EIO; return -1; } - *((uint32_t *) v) = ntohl (*((uint32_t *) v)); - rd->bread += sizeof(uint32_t); + *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v)); + rd->bread += sizeof(flex_uint32_t); return 0; } @@ -3030,22 +3030,22 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read * YYTD_STRUCT for the yy_transition array. */ for (j = 0; j < inner_loop_count; j++, i++) { - int32_t t32; + flex_int32_t t32; /* read into t32 no matter what the real size is. */ { - int16_t t16; - int8_t t8; + flex_int16_t t16; + flex_int8_t t8; switch (YYTDFLAGS2BYTES (td.td_flags)) { - case sizeof (int32_t): + case sizeof (flex_int32_t): rv = yytbl_read32 (&t32, rd); break; - case sizeof (int16_t): + case sizeof (flex_int16_t): rv = yytbl_read16 (&t16, rd); t32 = t16; break; - case sizeof (int8_t): + case sizeof (flex_int8_t): rv = yytbl_read8 (&t8, rd); t32 = t8; break; @@ -3067,26 +3067,26 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read : &(((struct yy_trans_info *) p)->yy_nxt); switch (dmap->dm_sz) { - case sizeof (int32_t): + case sizeof (flex_int32_t): if (M4_YY_TABLES_VERIFY){ - if( ((int32_t *) v)[0] != (int32_t) t32) - yy_fatal_error("tables verification failed at YYTD_STRUCT int32_t" M4_YY_CALL_LAST_ARG); + if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32) + yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int32_t" M4_YY_CALL_LAST_ARG); }else - ((int32_t *) v)[0] = (int32_t) t32; + ((flex_int32_t *) v)[0] = (flex_int32_t) t32; break; - case sizeof (int16_t): + case sizeof (flex_int16_t): if (M4_YY_TABLES_VERIFY ){ - if(((int16_t *) v)[0] != (int16_t) t32) - yy_fatal_error("tables verification failed at YYTD_STRUCT int16_t" M4_YY_CALL_LAST_ARG); + if(((flex_int16_t *) v)[0] != (flex_int16_t) t32) + yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int16_t" M4_YY_CALL_LAST_ARG); }else - ((int16_t *) v)[0] = (int16_t) t32; + ((flex_int16_t *) v)[0] = (flex_int16_t) t32; break; - case sizeof(int8_t): + case sizeof(flex_int8_t): if (M4_YY_TABLES_VERIFY ){ - if( ((int8_t *) v)[0] != (int8_t) t32) - yy_fatal_error("tables verification failed at YYTD_STRUCT int8_t" M4_YY_CALL_LAST_ARG); + if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32) + yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int8_t" M4_YY_CALL_LAST_ARG); }else - ((int8_t *) v)[0] = (int8_t) t32; + ((flex_int8_t *) v)[0] = (flex_int8_t) t32; break; default: yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); @@ -3124,29 +3124,29 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read else { /* t32 is a plain int. copy data, then incrememnt p. */ switch (dmap->dm_sz) { - case sizeof (int32_t): + case sizeof (flex_int32_t): if(M4_YY_TABLES_VERIFY ){ - if( ((int32_t *) p)[0] != (int32_t) t32) - yy_fatal_error("tables verification failed at int32_t" M4_YY_CALL_LAST_ARG); + if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32) + yy_fatal_error("tables verification failed at flex_int32_t" M4_YY_CALL_LAST_ARG); }else - ((int32_t *) p)[0] = (int32_t) t32; - p = ((int32_t *) p) + 1; + ((flex_int32_t *) p)[0] = (flex_int32_t) t32; + p = ((flex_int32_t *) p) + 1; break; - case sizeof (int16_t): + case sizeof (flex_int16_t): if(M4_YY_TABLES_VERIFY ){ - if( ((int16_t *) p)[0] != (int16_t) t32) - yy_fatal_error("tables verification failed at int16_t" M4_YY_CALL_LAST_ARG); + if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32) + yy_fatal_error("tables verification failed at flex_int16_t" M4_YY_CALL_LAST_ARG); }else - ((int16_t *) p)[0] = (int16_t) t32; - p = ((int16_t *) p) + 1; + ((flex_int16_t *) p)[0] = (flex_int16_t) t32; + p = ((flex_int16_t *) p) + 1; break; - case sizeof (int8_t): + case sizeof (flex_int8_t): if(M4_YY_TABLES_VERIFY ){ - if( ((int8_t *) p)[0] != (int8_t) t32) - yy_fatal_error("tables verification failed at int8_t" M4_YY_CALL_LAST_ARG); + if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32) + yy_fatal_error("tables verification failed at flex_int8_t" M4_YY_CALL_LAST_ARG); }else - ((int8_t *) p)[0] = (int8_t) t32; - p = ((int8_t *) p) + 1; + ((flex_int8_t *) p)[0] = (flex_int8_t) t32; + p = ((flex_int8_t *) p) + 1; break; default: yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG); @@ -3162,7 +3162,7 @@ static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_read int pad; pad = yypad64(rd->bread); while(--pad >= 0){ - int8_t t8; + flex_int8_t t8; if(yytbl_read8(&t8,rd) != 0) return -1; }