/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Routines to implement fast character input
*
* David Korn
* AT&T Labs
*
*/
#include <ast.h>
#include <sfio.h>
#include <error.h>
#include <fcin.h>
/*
* open stream <f> for fast character input
*/
{
register int n;
char *buff;
errno = 0;
{
return(EOF);
}
n = sfvalue(f);
if(sffileno(f) >= 0)
return(n);
}
/*
* With _Fcin.fcptr>_Fcin.fcbuff, the stream pointer is advanced and
* If _Fcin.fclast!=0, performs an sfreserve() for the next buffer.
* If a notify function has been set, it is called
* If last is non-zero, and the stream is a file, 0 is returned when
* the previous character is a 0 byte.
*/
int fcfill(void)
{
register int n;
register Sfio_t *f;
if(!(f=fcfile()))
{
/* see whether pointer has passed null byte */
else
return(0);
}
if(last)
{
return(0);
}
if(!last)
return(0);
else if(fcfopen(f) < 0)
return(EOF);
}
/*
* Synchronize and close the current stream
*/
int fcclose(void)
{
register unsigned char *ptr;
return(0);
return(fcfill());
}
/*
* Set the notify function that is called for each fcfill()
*/
{
}
#ifdef __EXPORT__
# define extern __EXPORT__
#endif
{
}
{
}
/* for testing purposes with small buffers */
#endif
struct Extra
{
unsigned char *next;
};
{
register int i, c, n;
{
c = 1;
{
}
*len = c;
if(c==1)
else if(c==0)
else
return(c);
}
{
case -1:
{
for(i=n; i < MB_LEN_MAX+n; i++)
{
break;
}
}
*len = 1;
/* fall through */
case 0:
case 1:
c=fcget();
break;
default:
}
return(c);
}