diff options
Diffstat (limited to 'cddl')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l index fc74df1..4897527 100644 --- a/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l +++ b/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l @@ -41,12 +41,32 @@ * We need to undefine lex's input and unput macros so that references to these * call the functions provided at the end of this source file. */ +#if defined(sun) #undef input #undef unput +#else +/* + * Define YY_INPUT for flex since input() can't be re-defined. + */ +#define YY_INPUT(buf,result,max_size) \ + if (yypcb->pcb_fileptr != NULL) { \ + if (((result = fread(buf, 1, max_size, yypcb->pcb_fileptr)) == 0) \ + && ferror(yypcb->pcb_fileptr)) \ + longjmp(yypcb->pcb_jmpbuf, EDT_FIO); \ + } else { \ + int n; \ + for (n = 0; n < max_size && \ + yypcb->pcb_strptr < yypcb->pcb_string + yypcb->pcb_strlen; n++) \ + buf[n] = *yypcb->pcb_strptr++; \ + result = n; \ + } +#endif static int id_or_type(const char *); +#if defined(sun) static int input(void); static void unput(int); +#endif /* * We first define a set of labeled states for use in the D lexer and then a @@ -408,7 +428,7 @@ if (yypcb->pcb_token != 0) { xyerror(D_CHR_OFLOW, "character constant is " "too long"); } -#ifdef _LITTLE_ENDIAN +#if BYTE_ORDER == _LITTLE_ENDIAN p = ((char *)&yylval.l_int) + nbytes - 1; for (q = s; nbytes != 0; nbytes--) *p-- = *q++; @@ -697,7 +717,9 @@ yyinit(dt_pcb_t *pcb) yypcb = pcb; yylineno = 1; yypragma = NULL; +#if defined(sun) yysptr = yysbuf; +#endif } /* @@ -793,6 +815,7 @@ id_or_type(const char *s) return (ttok); } +#if defined(sun) static int input(void) { @@ -834,3 +857,4 @@ unput(int c) *yysptr++ = c; yytchar = c; } +#endif |