diff options
author | jb <jb@FreeBSD.org> | 2008-04-26 04:26:23 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 2008-04-26 04:26:23 +0000 |
commit | fe5ac1ba72a34716a14217c30491034d77819294 (patch) | |
tree | 590716de9d2ef6d92b4919abc1bd187d7ac358a8 /cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l | |
parent | a656947bce3ec6684ed893b093de053cc050ec11 (diff) | |
download | FreeBSD-src-fe5ac1ba72a34716a14217c30491034d77819294.zip FreeBSD-src-fe5ac1ba72a34716a14217c30491034d77819294.tar.gz |
* Define YY_INPUT for flex since input() can't be re-defined.
* On FreeBSD define both LITTLE_ENDIAN and BIG_ENDIAN and then set the
BYTE_ORDER to the one we are using. On Solaris they define one or
the other but not both. For us to keep using FreeBSD header files,
we need to use endian definitions the same way we do in pure BSD
code.
Diffstat (limited to 'cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l')
-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 |