[Bast-commits] r3818 - in trunk/Devel-Declare: . lib/Devel

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Sun Oct 14 22:41:00 GMT 2007


Author: matthewt
Date: 2007-10-14 22:40:59 +0100 (Sun, 14 Oct 2007)
New Revision: 3818

Modified:
   trunk/Devel-Declare/Changes
   trunk/Devel-Declare/lib/Devel/Declare.pm
   trunk/Devel-Declare/stolen_chunk_of_toke.c
Log:
compiles against 5.8.1 (no threads, no multiplicity)

Modified: trunk/Devel-Declare/Changes
===================================================================
--- trunk/Devel-Declare/Changes	2007-10-13 12:33:33 UTC (rev 3817)
+++ trunk/Devel-Declare/Changes	2007-10-14 21:40:59 UTC (rev 3818)
@@ -1,4 +1,7 @@
-Changes for Devel-BeginLift
+Changes for Devel-Declare
 
+0.001001
+  - compilation fixes for 5.8.1+
+
 0.001000
   - Initial release to CPAN

Modified: trunk/Devel-Declare/lib/Devel/Declare.pm
===================================================================
--- trunk/Devel-Declare/lib/Devel/Declare.pm	2007-10-13 12:33:33 UTC (rev 3817)
+++ trunk/Devel-Declare/lib/Devel/Declare.pm	2007-10-14 21:40:59 UTC (rev 3818)
@@ -4,7 +4,7 @@
 use warnings;
 use 5.008001;
 
-our $VERSION = 0.001000;
+our $VERSION = '0.001001';
 
 # mirrored in Declare.xs as DD_HANDLE_*
 

Modified: trunk/Devel-Declare/stolen_chunk_of_toke.c
===================================================================
--- trunk/Devel-Declare/stolen_chunk_of_toke.c	2007-10-13 12:33:33 UTC (rev 3817)
+++ trunk/Devel-Declare/stolen_chunk_of_toke.c	2007-10-14 21:40:59 UTC (rev 3818)
@@ -17,7 +17,7 @@
  *   up but if it does blame me (Matt S Trout), not the poor original authors
  */
 
-/* the following #defines are stolen from assorted headers, not toke.c */
+/* the following #defines are stolen from assorted headers, not toke.c (mst) */
 
 #define DPTR2FPTR(t,p) ((t)PTR2nat(p))  /* data pointer to function pointer */
 #define FPTR2DPTR(t,p) ((t)PTR2nat(p))  /* function pointer to data pointer */
@@ -57,6 +57,14 @@
 #define LEX_FORMLINE     1 /* expecting a format line               */
 #define LEX_KNOWNEXT     0 /* next token known; just return it      */
 
+/* and this one is my own madness (mst) */
+
+#if PERL_REVISION == 5 && PERL_VERSION == 8 && PERL_SUBVERSION >= 8
+#define PERL_5_8_8_PLUS
+#endif
+
+/* and now we're back to the toke.c stuff again (mst) */
+
 static const char ident_too_long[] =
   "Identifier too long";
 static const char c_without_g[] =
@@ -357,6 +365,12 @@
     ch = *t;
     *t = '\0';
     if (t - s > 0) {
+/* this chunk was added to S_incline during 5.8.8. I don't know why but I don't
+   honestly care since I probably want to be bug-compatible anyway (mst) */
+
+/* ... my kingdom for a perl parser in perl ... (mst) */
+
+#ifdef PERL_5_8_8_PLUS
 #ifndef USE_ITHREADS
 	const char *cf = CopFILE(PL_curcop);
 	if (cf && strlen(cf) > 7 && strnEQ(cf, "(eval ", 6)) {
@@ -394,6 +408,8 @@
 	    if (tmpbuf2 != smallbuf2) Safefree(tmpbuf2);
 	}
 #endif
+#endif
+/* second endif closes out the "are we 5.8.(8+)" conditional */
 	CopFILE_free(PL_curcop);
 	CopFILE_set(PL_curcop, s);
     }
@@ -455,7 +471,9 @@
     I32 brackets = 1;			/* bracket nesting level */
     bool has_utf8 = FALSE;		/* is there any utf8 content? */
     I32 termcode;			/* terminating char. code */
-    U8 termstr[UTF8_MAXBYTES];		/* terminating string */
+    /* 5.8.7+ uses UTF8_MAXBYTES but also its utf8.h defs _MAXLEN to it so
+       I'm reasonably hopeful this won't destroy anything (mst) */
+    U8 termstr[UTF8_MAXLEN];		/* terminating string */
     STRLEN termlen;			/* length of terminating string */
     char *last = NULL;			/* last position for nesting bracket */
 
@@ -704,7 +722,12 @@
     /* if we allocated too much space, give some back */
     if (SvCUR(sv) + 5 < SvLEN(sv)) {
 	SvLEN_set(sv, SvCUR(sv) + 1);
+/* 5.8.8 uses SvPV_renew, no prior version actually has the damn thing (mst) */
+#ifdef PERL_5_8_8_PLUS
 	SvPV_renew(sv, SvLEN(sv));
+#else
+	Renew(SvPVX(sv), SvLEN(sv), char);
+#endif
     }
 
     /* decide whether this is the first or second quoted string we've read




More information about the Bast-commits mailing list