At 09:56 PM 5/21/2002 +0100, Nick Ing-Simmons wrote:
>>"The size of the pushback buffer for the DEC C RTL is 1, and once it is full
>>additional calls to ungetc() will fail.
>
>Ah. But note though that the iperlsys.h stuff does some other hackery.
Yes, it's quite possible that's the reason for the hackery in the first place.
>Break-points in PerlStdio_unread() would be informative - if we ever get there
>then VMS is going to exercise paths that other stdio's have not pipe-cleaned.
Well, I'm in there now. I've been able to show that we only call
PerlSIO_ungetc once during the run of my reduced test program. The
character we are trying to unget is 0xF1 (0d241). Since I end up in the
middle of the C library when I step into PerlSIO_ungetc, I think that tells
us all the shenanigans the macro goes through to avoid calling decc$ungetc
are to no avail and it does wind up calling it. I believe the reason is
that _ptr == _base and it will only do its pointer manipulations when _ptr >
_base. I don't know enough about what those things are to know what that
means, but here's what the _iobuf structure looks like:
**PERLIO\PerlIOStdio_unread\s
_cnt: 2789
_ptr: 8839168
_base: 8839168
_flag: 73
_padfile: 3
_pad1: 4
_pad2: 0
_file: 3
The calling sequence is below and may tell somebody something.
break at PERLIO\PerlIOStdio_unread\%LINE 51605
51605: if (PerlSIO_ungetc(ch, s) != ch)
DBG> ex ch
PERLIO\PerlIOStdio_unread\%LINE 51604\ch: 241
DBG> Step/Into
stepped to SHARE$DECC$SHR_CODE0+703568
%DEBUG-I-SOURCESCOPE, Source lines not available for .0\%PC
Displaying source in a caller of the current routine
51605: if (PerlSIO_ungetc(ch, s) != ch)
DBG> show calls
module name routine name line rel PC abs PC
SHARE$DECC$SHR_CODE0 00000000000ABC50 FFFFFFFF80607C50
----- the above appears to be a null frame in the same scope as the frame below
*PERLIO PerlIOStdio_unread
51605 0000000000005950 00000000004408E0
*PERLIO Perl_PerlIO_unread
50367 0000000000002C78 000000000043DC08
000000000003285C 000000000099A85C
*PERLIO Perl_PerlIO_flush
50414 0000000000002F30 000000000043DEC0
0000000000031394 0000000000999394
*PERLIO Perl_PerlIO_fill
50474 0000000000003160 000000000043E0F0
*PERLIO PerlIOBase_read 50888 0000000000003F30 000000000043EEC0
*PERLIO PerlIOBuf_read 52071 00000000000067AC 000000000044173C
*PERLIO Perl_PerlIO_read
50356 0000000000002BC8 000000000043DB58
*PERLIO PerlIO_getc 53151 0000000000008AA8 0000000000443A38
*SV Perl_sv_gets 49572 000000000000D9A4 0000000000510B34
*PP_HOT Perl_do_readline
44556 0000000000006CBC 00000000004F587C
*PP_HOT Perl_pp_readline
43241 0000000000001378 00000000004EFF38
*DUMP Perl_runops_debug
45160 0000000000006070 00000000004C6190
*PERL S_run_body 44783 0000000000003C0C 0000000000433EDC
*PERL perl_run 44704 0000000000003844 0000000000433B14
SHARE$DBGPERL 00000000000001E0 00000000000201E0
SHARE$DBGPERL 00000000000000A0 00000000000200A0
FFFFFFFF8370147C FFFFFFFF8370147C