Peter Prymmer <[EMAIL PROTECTED]> writes:
>I find that the enclosed patch helps get a vanilla (ie "-Dusedevel"
>"-des") build of perl@8102 going on VMS. I note that on VMS we do
>have PerlIO #defined but under a vanilla build we do not have
>USE_PERLIO #defined hence this patch affects the
>s/#ifdef PerlIO/#define USE_PERLIO/ switch.
PerlIO should be defined everywhere these days.
USE_PERLIO will hopefully become the default eventually.
>I would appreciate
>hearing from useperlio experts on the wisdom of the proposed switch. (I
>also noted that this patch does not seem to hurt a `sh Configure
>-Dusedevel -des` build on Tru64 Unix 4.0D in case the question arises).
>Setting the capability to have useperlio to "define" on VMS is a task that
>remains unfinished at this time.
It is not clear to me why you should need to make the change.
It is potentially "wrong" for the sfio case (which isn't an issue
for VMS I know) - but as sfio also has USE_PERLIO turned on (IIRC)
it should be harmless.
#ifdef PerlIO
is anchient history - Graham was do IO (outside the core) about
the same time I was adding the original PerlIO abstraction.
The question I have is what does perlsdio.h fail to get right on VMS?
(Or why does perlsdio.h not get included ?)
(It is what is supposed to provide PerlIO abstraction layer if
we are using FILE * under the hood.)
Normally Configure will put things in config.h to get the flow right.
It is possible that VMS's equivalent has missed something, or
perhaps defined something which has caused the perlio.h #if forest
to misbehave. I did attempt to simplify that forest - perhaps VMS
was attached to one of the trees I thinned.
The reason I ask is that the perlsdio.h scheme is what has been
(mostly) copied into perlio.c as the "stdio layer" - which is
(assuming your stdio is std as Configure has it) the normal
USE_PERLIO model - there is still a FILE * there, but there are
various "filters" on top.
So the "right" things to do are:
A. Remove all the legacy FILE * stuff from IO.xs completely.
B. Fossick with perlsdio.h so that C sees exactly the same
via PerlIO_xxxx #define-s as it would with the patch below.
Can you pre-process IO.c with you patch (i.e. "this is what works"),
and also IO.c from IO.xs without you patch (i.e. this is what we get via
PERLIO_IS_STDIO.
>
>diff -ru perl.8102/ext/IO/IO.xs perl/ext/IO/IO.xs
>--- perl.8102/ext/IO/IO.xs Mon Dec 11 19:30:09 2000
>+++ perl/ext/IO/IO.xs Thu Dec 14 16:38:45 2000
>@@ -17,12 +17,14 @@
> # include <fcntl.h>
> #endif
>
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> typedef int SysRet;
> typedef PerlIO * InputStream;
> typedef PerlIO * OutputStream;
> #else
>+#ifndef PERLIO_IS_STDIO
> #define PERLIO_IS_STDIO 1
>+#endif
> typedef int SysRet;
> typedef FILE * InputStream;
> typedef FILE * OutputStream;
>@@ -42,7 +44,7 @@
> }
>
>
>-#ifndef PerlIO
>+#ifndef USE_PERLIO
> #define PerlIO_fileno(f) fileno(f)
> #endif
>
>@@ -140,8 +142,11 @@
> fgetpos(handle)
> InputStream handle
> CODE:
>+#ifndef USE_PERLIO
>+ Fpos_t pos;
>+#endif
> if (handle) {
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> ST(0) = sv_2mortal(newSV(0));
> if (PerlIO_getpos(handle, ST(0)) != 0) {
> ST(0) = &PL_sv_undef;
>@@ -165,7 +170,7 @@
> SV * pos
> CODE:
> if (handle) {
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> RETVAL = PerlIO_setpos(handle, pos);
> #else
> char *p;
>@@ -195,7 +200,7 @@
> OutputStream fp;
> GV *gv;
> CODE:
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> fp = PerlIO_tmpfile();
> #else
> fp = tmpfile();
>@@ -269,7 +274,7 @@
> int c
> CODE:
> if (handle)
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> RETVAL = PerlIO_ungetc(handle, c);
> #else
> RETVAL = ungetc(c, handle);
>@@ -286,7 +291,7 @@
> InputStream handle
> CODE:
> if (handle)
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> RETVAL = PerlIO_error(handle);
> #else
> RETVAL = ferror(handle);
>@@ -303,7 +308,7 @@
> InputStream handle
> CODE:
> if (handle) {
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> PerlIO_clearerr(handle);
> #else
> clearerr(handle);
>@@ -343,7 +348,7 @@
> OutputStream handle
> CODE:
> if (handle)
>-#ifdef PerlIO
>+#ifdef USE_PERLIO
> RETVAL = PerlIO_flush(handle);
> #else
> RETVAL = Fflush(handle);
--
Nick Ing-Simmons