The reëntrant version shouldn't be needed unless USE_PURE_BISON.
Jarkko Hietaniemi [Sat, 28 Oct 2000 16:02:47 +0000 (16:02 +0000)]
p4raw-id: //depot/perl@7465

embed.h
embed.pl
perl.h
proto.h
toke.c

diff --git a/embed.h b/embed.h
index a588819..c50ff16 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define watch                  Perl_watch
 #define whichsig               Perl_whichsig
 #define yyerror                        Perl_yyerror
-#if defined(USE_PURE_BISON)
+#ifdef USE_PURE_BISON
+#define yylex_r                        Perl_yylex_r
 #define yylex                  Perl_yylex
 #else
 #define yylex                  Perl_yylex
 #endif
-#define syylex                 S_syylex
 #define yyparse                        Perl_yyparse
 #define yywarn                 Perl_yywarn
 #if defined(MYMALLOC)
 #define watch(a)               Perl_watch(aTHX_ a)
 #define whichsig(a)            Perl_whichsig(aTHX_ a)
 #define yyerror(a)             Perl_yyerror(aTHX_ a)
-#if defined(USE_PURE_BISON)
+#ifdef USE_PURE_BISON
+#define yylex_r(a,b)           Perl_yylex_r(aTHX_ a,b)
 #define yylex(a,b)             Perl_yylex(aTHX_ a,b)
 #else
 #define yylex()                        Perl_yylex(aTHX)
 #endif
-#define syylex()               S_syylex(aTHX)
 #define yyparse()              Perl_yyparse(aTHX)
 #define yywarn(a)              Perl_yywarn(aTHX_ a)
 #if defined(MYMALLOC)
 #define whichsig               Perl_whichsig
 #define Perl_yyerror           CPerlObj::Perl_yyerror
 #define yyerror                        Perl_yyerror
-#if defined(USE_PURE_BISON)
+#ifdef USE_PURE_BISON
+#define Perl_yylex_r           CPerlObj::Perl_yylex_r
+#define yylex_r                        Perl_yylex_r
 #define Perl_yylex             CPerlObj::Perl_yylex
 #define yylex                  Perl_yylex
 #else
 #define Perl_yylex             CPerlObj::Perl_yylex
 #define yylex                  Perl_yylex
 #endif
-#define S_syylex               CPerlObj::S_syylex
-#define syylex                 S_syylex
 #define Perl_yyparse           CPerlObj::Perl_yyparse
 #define yyparse                        Perl_yyparse
 #define Perl_yywarn            CPerlObj::Perl_yywarn
index 62135fc..99b73ed 100755 (executable)
--- a/embed.pl
+++ b/embed.pl
@@ -2089,12 +2089,12 @@ Ap      |void   |vwarner        |U32 err|const char* pat|va_list* args
 p      |void   |watch          |char** addr
 Ap     |I32    |whichsig       |char* sig
 p      |int    |yyerror        |char* s
-#if defined(USE_PURE_BISON)
+#ifdef USE_PURE_BISON
+p      |int    |yylex_r        |YYSTYPE *lvalp|int *lcharp
 p      |int    |yylex          |YYSTYPE *lvalp|int *lcharp
 #else
 p      |int    |yylex
 #endif
-sp     |int    |syylex
 p      |int    |yyparse
 p      |int    |yywarn         |char* s
 #if defined(MYMALLOC)
diff --git a/perl.h b/perl.h
index 72b3f41..6f46dcd 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -2661,10 +2661,6 @@ typedef char* (CPERLscope(*re_intuit_start_t)) (pTHX_ regexp *prog, SV *sv,
 typedef SV*    (CPERLscope(*re_intuit_string_t)) (pTHX_ regexp *prog);
 typedef void   (CPERLscope(*regfree_t)) (pTHX_ struct regexp* r);
 
-#ifdef USE_PURE_BISON
-int Perl_yylex(pTHX_ YYSTYPE *lvalp, int *lcharp);
-#endif
-
 typedef void (*DESTRUCTORFUNC_NOCONTEXT_t) (void*);
 typedef void (*DESTRUCTORFUNC_t) (pTHXo_ void*);
 typedef void (*SVFUNC_t) (pTHXo_ SV*);
diff --git a/proto.h b/proto.h
index 06ef1b1..1d0f855 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -832,12 +832,12 @@ PERL_CALLCONV void        Perl_vwarner(pTHX_ U32 err, const char* pat, va_list* args);
 PERL_CALLCONV void     Perl_watch(pTHX_ char** addr);
 PERL_CALLCONV I32      Perl_whichsig(pTHX_ char* sig);
 PERL_CALLCONV int      Perl_yyerror(pTHX_ char* s);
-#if defined(USE_PURE_BISON)
+#ifdef USE_PURE_BISON
+PERL_CALLCONV int      Perl_yylex_r(pTHX_ YYSTYPE *lvalp, int *lcharp);
 PERL_CALLCONV int      Perl_yylex(pTHX_ YYSTYPE *lvalp, int *lcharp);
 #else
 PERL_CALLCONV int      Perl_yylex(pTHX);
 #endif
-STATIC int     S_syylex(pTHX);
 PERL_CALLCONV int      Perl_yyparse(pTHX);
 PERL_CALLCONV int      Perl_yywarn(pTHX_ char* s);
 #if defined(MYMALLOC)
diff --git a/toke.c b/toke.c
index 3572b0e..b007de4 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -80,9 +80,9 @@ static I32 utf16rev_textfilter(pTHXo_ int idx, SV *sv, int maxlen);
 #endif
 
 #ifdef USE_PURE_BISON
-#ifndef YYMAXLEVEL
-#define YYMAXLEVEL 100
-#endif
+#  ifndef YYMAXLEVEL
+#    define YYMAXLEVEL 100
+#  endif
 YYSTYPE* yylval_pointer[YYMAXLEVEL];
 int* yychar_pointer[YYMAXLEVEL];
 int yyactlevel = 0;
@@ -92,7 +92,7 @@ int yyactlevel = 0;
 #  define yychar (*yychar_pointer[yyactlevel])
 #  define PERL_YYLEX_PARAM yylval_pointer[yyactlevel],yychar_pointer[yyactlevel]
 #  undef yylex 
-#  define yylex()      Perl_yylex(aTHX_ yylval_pointer[yyactlevel],yychar_pointer[yyactlevel])
+#  define yylex()      Perl_yylex_r(aTHX_ yylval_pointer[yyactlevel],yychar_pointer[yyactlevel])
 #endif
 
 #include "keywords.h"
@@ -2071,38 +2071,40 @@ S_find_in_my_stash(pTHX_ char *pkgname, I32 len)
       if we already built the token before, use it.
 */
 
+#ifdef USE_PURE_BISON
 #ifdef __SC__
-#pragma segment Perl_yylex
+#pragma segment Perl_yylex_r
 #endif
 int
-#ifdef USE_PURE_BISON
-Perl_yylex(pTHX_ YYSTYPE *lvalp, int *lcharp)
-#else
-Perl_yylex(pTHX)
-#endif
+Perl_yylex_r(pTHX_ YYSTYPE *lvalp, int *lcharp)
 {
     dTHR;
     int r;
 
-#ifdef USE_PURE_BISON
     yylval_pointer[yyactlevel] = lvalp;
     yychar_pointer[yyactlevel] = lcharp;
     yyactlevel++;
     if (yyactlevel >= YYMAXLEVEL)
        Perl_croak(aTHX_ "panic: YYMAXLEVEL");
-#endif
 
-    r = S_syylex(aTHX);
+    r = Perl_yylex(aTHX);
 
-#ifdef USE_PURE_BISON
     yyactlevel--;
-#endif
 
     return r;
 }
+#endif
 
-STATIC int
-S_syylex(pTHX) /* need to be separate from yylex for reentrancy */
+#ifdef __SC__
+#pragma segment Perl_yylex
+#endif
+
+int
+#ifdef USE_PURE_BISON
+Perl_yylex(pTHX_ YYSTYPE *lvalp, int *lcharp)
+#else
+Perl_yylex(pTHX)
+#endif
 {
     dTHR;
     register char *s;