Changeset 53654 in vbox for trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.l
- Timestamp:
- Jan 2, 2015 12:27:36 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/lib/libdtrace/common/dt_lex.l
r53634 r53654 25 25 */ 26 26 27 #ifndef VBOX 27 28 #include <string.h> 28 29 #include <stdlib.h> … … 31 32 #include <ctype.h> 32 33 #include <errno.h> 34 #else /* VBOX */ 35 # include <iprt/ctype.h> 36 # define isdigit(a_ch) RT_C_IS_DIGIT(a_ch) 37 #endif /* VBOX */ 33 38 34 39 #include <dt_impl.h> … … 37 42 #include <dt_string.h> 38 43 44 #ifndef USING_FLEX 39 45 /* 40 46 * We need to undefine lex's input and unput macros so that references to these … … 43 49 #undef input 44 50 #undef unput 51 #else /* USING_FLEX */ 52 # define YY_INPUT(buf, result, max_size) \ 53 do { \ 54 if (yypcb->pcb_fileptr != NULL) { \ 55 result = (int)fread(buf, 1, max_size, yypcb->pcb_fileptr); \ 56 if (!result && ferror(yypcb->pcb_fileptr)) \ 57 YY_FATAL_ERROR("input in flex scanner failed"); \ 58 } else { \ 59 size_t off = yypcb->pcb_strptr - yypcb->pcb_string; \ 60 if (off < yypcb->pcb_strlen) { \ 61 result = max_size; \ 62 if ((size_t)result > yypcb->pcb_strlen) \ 63 result = (int)yypcb->pcb_strlen; \ 64 memcpy(buf, yypcb->pcb_strptr, result); \ 65 yypcb->pcb_strptr += result; \ 66 } else \ 67 result = 0; \ 68 } \ 69 } while (0) 70 #endif /* USING_FLEX */ 45 71 46 72 static int id_or_type(const char *); 73 #ifndef USING_FLEX 47 74 static int input(void); 48 75 static void unput(int); 76 #endif 49 77 50 78 /* … … 249 277 */ 250 278 if (isdigit(v[0]) || v[0] == '-' || v[0] == '+') { 279 #ifdef VBOX 280 int rc; 281 #endif 251 282 if (isdigit(v[0])) 252 283 yyintprefix = 0; … … 254 285 yyintprefix = *v++; 255 286 287 #ifndef VBOX 256 288 errno = 0; 257 289 yylval.l_int = strtoull(v, &p, 0); 290 #else 291 rc = RTStrToUInt64Ex(v, &p, 0, &yylval.l_int); 292 #endif 258 293 (void) strncpy(yyintsuffix, p, 259 294 sizeof (yyintsuffix)); 260 295 yyintdecimal = *v != '0'; 261 296 262 if (errno == ERANGE) { 297 #ifndef VBOX 298 if (errno == ERANGE) 299 #else 300 if (rc == VWRN_NUMBER_TOO_BIG || rc == VWRN_NEGATIVE_UNSIGNED) 301 #endif 263 302 xyerror(D_MACRO_OFLOW, "macro argument" 264 303 " %s constant %s results in integer" 265 304 " overflow\n", yytext, v); 266 }267 305 268 306 return (DT_TOK_INT); … … 336 374 char *p; 337 375 376 #ifndef VBOX 338 377 errno = 0; 339 378 yylval.l_int = strtoull(yytext, &p, 0); 379 #else 380 int rc = RTStrToUInt64Ex(yytext, &p, 0, &yylval.l_int); 381 #endif 340 382 yyintprefix = 0; 341 383 (void) strncpy(yyintsuffix, p, sizeof (yyintsuffix)); 342 384 yyintdecimal = yytext[0] != '0'; 343 385 344 if (errno == ERANGE) { 386 #ifndef VBOX 387 if (errno == ERANGE) 388 #else 389 if (rc == VWRN_NUMBER_TOO_BIG || rc == VWRN_NEGATIVE_UNSIGNED) 390 #endif 345 391 xyerror(D_INT_OFLOW, "constant %s results in " 346 392 "integer overflow\n", yytext); 347 }348 393 349 394 if (*p != '\0' && strchr("uUlL", *p) == NULL) { … … 697 742 yylineno = 1; 698 743 yypragma = NULL; 744 #ifndef USING_FLEX 699 745 yysptr = yysbuf; 746 #endif 700 747 } 701 748 … … 793 840 } 794 841 842 #ifndef USING_FLEX 843 795 844 static int 796 845 input(void) … … 834 883 yytchar = c; 835 884 } 885 886 #endif /* USING_FLEX */
Note:
See TracChangeset
for help on using the changeset viewer.