From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 28-APR-1989 12:04:33.72
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	fun and games with the VAXCRTL

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Fri, 28 APR 89 07:43:14 PDT
Received: from bu-it.BU.EDU ([128.197.2.40]) by KL.SRI.COM with TCP; Fri, 28 Apr 89 07:26:33 PDT
Received: from BUIT4.BU.EDU by bu-it.BU.EDU (5.58/4.7)
	id AA21285; Fri, 28 Apr 89 10:18:52 EDT
Received:  by buit4.bu.edu (5.58/4.7)
	id AA01618; Fri, 28 Apr 89 10:18:39 EDT
Date:  Fri, 28 Apr 89 10:18:39 EDT
From: gjc@bu-it.BU.EDU
Message-Id:  <8904281418.AA01618@buit4.bu.edu>
To: info-vax@kl.sri.com
Subject: fun and games with the VAXCRTL

Here is a true macro version of getc which will work correctly
on stream-lf format files and on fixed-record-format files, at least.
Why it doesnt work on all files is a mistery of the implementation
of VAXCRTL. Some rather clever people must have worked on that one!

If you can use this getc if can easily double the speed of most
file reading operations, as compared with the DIGITAL provided getc
which turns into fgetc.

struct _xiobuf {int _xcnt; unsigned char *_xptr; unsighed char *_xbase;
 char _xflag; char _xfile;}; /* fix the broken DIGITAL defintion of _iobuf */

#define xgetc(p) \
 (--(*p)->_cnt>=0?((int)*(*((struct _xiobuf **)p))->_cptr++)::xfilbuf(p))

int xfilbuf(p) FILE *p; {(*p)->_cnt = 0; return(fgetc(p));}

Q: Does anyone know why a FILE *f has f being a pointer to a pointer to
   an _iobuf, rather than simply being a pointer to an _iobuf?
   (as in every other stdio implementation I have ever seen?)

Another way to say it, why is a FILE a pointer to struct _iobuf rather
than just being a struct _iobuf?

-gjc


 


