/* Copyright (c) 1979 Regents of the University of California */
* pi - Pascal interpreter code translator
* Charles Haley, Bill Joy UCB
* Version 1.1 February 1978
* pxp - Pascal execution profiler
* Version 1.1 February 1978
* Structure describing queued listing lines during the forward move
* of error recovery. These lines will be stroed by yyoutline during
* the forward move and flushed by yyoutfl or yyflush when an
* error occurs or a program termination.
* Filename gives the current input file, lastname is
* the last filename we printed, and lastid is the seqid of the last line
* we printed, to help us avoid printing
* multiple copies of lines.
* Print the current line in the input line
* buffer or, in a forward move of the recovery, queue it for printing.
bp
= tree(6, T_BOTTLE
, yyline
, yylinpt
, filename
, yyseqid
);
bp
->Bnext
= bottled
->Bnext
, bottled
->Bnext
= bp
;
yyprline(charbuf
, yyline
, filename
, yyseqid
);
* Flush all the bottled output.
* Flush the listing to the sequence id toseqid
while (bp
->Bseqid
<= toseqid
) {
yygetline(bp
->Bfile
, bp
->Bseekp
, bp
->Bline
, bp
->Bseqid
);
* Yysync guarantees that the line associated
* with the current token was the last line
* printed for a syntactic error message.
yygetline(yyefile
, yyseekp
, yyeline
, yyeseqid
);
* Yygetline gets a line from a file after we have
* lost it. The pointer efile gives the name of the file,
* seekp its offset in the file, and eline its line number.
* If this routine has been called before the last file
* it worked on will be open in yygetunit, with the files
* name being given in yygetfile. Note that this unit must
* be opened independently of the unit in use for normal i/o
* to this file; if it were a dup seeks would seek both files.
yygetline(efile
, seekp
, eline
, eseqid
)
int seekp
, eline
, eseqid
;
if (efile
!= yygetfile
) {
yygetunit
= fopen( yygetfile
, "r" );
perror(yygetfile
), pexit(DIED
);
if ( fseek( yygetunit
, (long) seekp
, 0 ) < 0)
cnt
= fread( bp
, sizeof( * bp
) , CBSIZE
, yygetunit
);
yyprline(bp
, eline
, efile
, eseqid
);
yygetline(OY
.Yyefile
, OY
.Yyseekp
, OY
.Yyeline
, OY
.Yyeseqid
);
* Print the line in the character buffer which has
* line number line. The buffer may be terminated by a new
* line character or a null character. We process
* form feed directives, lines with only a form feed character, and
* suppress numbering lines which are empty here.
yyprline(buf
, line
, file
, id
)
if (buf
[0] == '\f' && buf
[1] == '\n') {
while (*cp
!= 0 && *cp
!= '\n')
* Set the current file name to be file,
* printing the name, or a header on a new
if (file
== filename
&& opt('n') && (printed
& 02) == 0) {
* Put out an include file name
* if an error occurs but the name has
* not been printed (or if another name
* has been printed since it has).
if (cp
== lastname
&& printed
)
printf("%s %s:\n" , myctime( &tvec
) , cp
);