Update to Filter::Util::Call
authorPaul Marquess <paul.marquess@btinternet.com>
Sun, 11 Nov 2001 22:33:33 +0000 (22:33 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Tue, 13 Nov 2001 13:41:02 +0000 (13:41 +0000)
Message-ID: <AIEAJICLCBDNAAOLLOKLAEKFDEAA.Paul_Marquess@Yahoo.co.uk>

Use the new CXT* macros.

p4raw-id: //depot/perl@12972

ext/Filter/Util/Call/Call.pm
ext/Filter/Util/Call/Call.xs

index 6f301c3..a560626 100644 (file)
@@ -18,7 +18,7 @@ use vars qw($VERSION @ISA @EXPORT) ;
 
 @ISA = qw(Exporter DynaLoader);
 @EXPORT = qw( filter_add filter_del filter_read filter_read_exact) ;
-$VERSION = "1.05" ;
+$VERSION = "1.06" ;
 
 sub filter_read_exact($)
 {
index 54b213b..0215fa6 100644 (file)
@@ -2,8 +2,8 @@
  * Filename : Call.xs
  * 
  * Author   : Paul Marquess 
- * Date     : 26th March 2000
- * Version  : 1.05
+ * Date     : 11th November 2001
+ * Version  : 1.06
  *
  *    Copyright (c) 1995-2001 Paul Marquess. All rights reserved.
  *       This program is free software; you can redistribute it and/or
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
-
-#ifndef PERL_VERSION
-#    include "patchlevel.h"
-#    define PERL_REVISION      5
-#    define PERL_VERSION       PATCHLEVEL
-#    define PERL_SUBVERSION    SUBVERSION
-#endif
-
-/* defgv must be accessed differently under threaded perl */
-/* DEFSV et al are in 5.004_56 */
-#ifndef DEFSV
-#    define DEFSV              GvSV(defgv)
+#ifdef _NOT_CORE
+#  include "ppport.h"
 #endif
 
-#ifndef pTHX
-#    define pTHX
-#    define pTHX_
-#    define aTHX
-#    define aTHX_
-#endif
-
-
 /* Internal defines */
 #define PERL_MODULE(s)         IoBOTTOM_NAME(s)
 #define PERL_OBJECT(s)         IoTOP_GV(s)
         do { SvPVX(sv)[len] = '\0'; SvCUR_set(sv, len); } while (0)
 
 
+/* Global Data */
+
+#define MY_CXT_KEY "Filter::Util::Call::_guts" XS_VERSION
+typedef struct {
+    int x_fdebug ;
+    int x_current_idx ;
+} my_cxt_t;
+START_MY_CXT
+#define fdebug          (MY_CXT.x_fdebug)
+#define current_idx     (MY_CXT.x_current_idx)
 
-static int fdebug = 0;
-static int current_idx ;
 
 static I32
 filter_call(pTHX_ int idx, SV *buf_sv, int maxlen)
 {
+    dMY_CXT;
     SV   *my_sv = FILTER_DATA(idx);
     char *nl = "\n";
     char *p;
@@ -204,6 +198,7 @@ filter_read(size=0)
        int     size 
        CODE:
        {
+           dMY_CXT;
            SV * buffer = DEFSV ;
 
            RETVAL = FILTER_READ(IDX + 1, buffer, size) ;
@@ -239,6 +234,7 @@ real_import(object, perlmodule, coderef)
 void
 filter_del()
     CODE:
+        dMY_CXT;
        FILTER_ACTIVE(FILTER_DATA(IDX)) = FALSE ;
 
 
@@ -251,8 +247,12 @@ unimport(package="$Package", ...)
 
 
 BOOT:
+  {
+    MY_CXT_INIT;
+    fdebug = 0;
     /* temporary hack to control debugging in toke.c */
     if (fdebug)
         filter_add(NULL, (fdebug) ? (SV*)"1" : (SV*)"0");  
+  }