30 #define VER_BUFFER_SIZE 1048576 // 1M - size of the data chunk stored in memory
31 #define VER_OFFSET_SIZE 65536 // 64K - load new data when less than this is left
32 #define VER_WORD_SIZE 65536 // 64K - the largest token that can be returned
34 #define VER_MINIMUM(a,b) (((a) < (b))? (a) : (b))
81 pFile = fopen( pFileName,
"rb" );
84 printf(
"Ver_StreamAlloc(): Cannot open input file \"%s\".\n", pFileName );
103 RetValue = fread( p->
pBuffer, nCharsToRead, 1, p->
pFile );
126 int nCharsUsed, nCharsToRead;
139 RetValue = fread( p->
pBuffer + nCharsUsed, nCharsToRead, 1, p->
pFile );
306 char * pChar, * pTemp;
308 assert( pCharsToSkip != NULL );
313 for ( pChar = p->
pBufferCur; pChar < p->pBufferEnd; pChar++ )
316 for ( pTemp = pCharsToSkip; *pTemp; pTemp++ )
317 if ( *pChar == *pTemp )
325 if ( *pChar ==
'\n' )
335 printf(
"Ver_StreamSkipSymbol() failed to parse the file \"%s\".\n", p->
pFileName );
351 char * pChar, * pTemp;
353 assert( pCharsToStop != NULL );
358 for ( pChar = p->
pBufferCur; pChar < p->pBufferEnd; pChar++ )
361 for ( pTemp = pCharsToStop; *pTemp; pTemp++ )
362 if ( *pChar == *pTemp )
367 if ( *pChar ==
'\n' )
382 printf(
"Ver_StreamSkipToSymbol() failed to parse the file \"%s\".\n", p->
pFileName );
399 char * pChar, * pTemp;
402 assert( pCharsToStop != NULL );
408 for ( pChar = p->
pBufferCur; pChar < p->pBufferEnd; pChar++ )
411 for ( pTemp = pCharsToStop; *pTemp; pTemp++ )
412 if ( *pChar == *pTemp )
419 printf(
"Ver_StreamGetWord(): The buffer size is exceeded.\n" );
423 if ( *pChar ==
'\n' )
440 printf(
"Ver_StreamGetWord() failed to parse the file \"%s\".\n", p->
pFileName );
Ver_Stream_t * Ver_StreamAlloc(char *pFileName)
FUNCTION DEFINITIONS ///.
void Ver_StreamSkipToChars(Ver_Stream_t *p, char *pCharsToStop)
char Ver_StreamPopChar(Ver_Stream_t *p)
void Ver_StreamSkipChars(Ver_Stream_t *p, char *pCharsToSkip)
char * Ver_StreamGetWord(Ver_Stream_t *p, char *pCharsToStop)
static void Ver_StreamReload(Ver_Stream_t *p)
#define ABC_ALLOC(type, num)
char Ver_StreamScanChar(Ver_Stream_t *p)
void Ver_StreamFree(Ver_Stream_t *p)
char pChars[VER_WORD_SIZE+5]
#define VER_BUFFER_SIZE
DECLARATIONS ///.
int Ver_StreamIsOkey(Ver_Stream_t *p)
#define ABC_NAMESPACE_IMPL_END
int Ver_StreamGetCurPosition(Ver_Stream_t *p)
#define ABC_NAMESPACE_IMPL_START
#define VER_MINIMUM(a, b)
char * Ver_StreamGetFileName(Ver_Stream_t *p)
int Ver_StreamGetFileSize(Ver_Stream_t *p)
int Ver_StreamGetLineNumber(Ver_Stream_t *p)