antlr3filestream.c

Langue: en

Version: 373353 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

src/antlr3filestream.c -

The ANTLR3 C filestream is used when the source character stream is a filesystem based input set and all the characters in the filestream can be loaded at once into memory and away the lexer goes.

SYNOPSIS


#include <antlr3.h>

Functions


ANTLR3_API pANTLR3_INPUT_STREAM antlr3AsciiFileStreamNew (pANTLR3_UINT8 fileName)
Use the contents of an operating system file as the input for an input stream.
ANTLR3_API void antlr3Fclose (ANTLR3_FDSC fd)
Close an operating system file and free any handles etc.
ANTLR3_API ANTLR3_FDSC antlr3Fopen (pANTLR3_UINT8 filename, const char *mode)
Open an operating system file and return the descriptor We just use the common open() and related functions here.
ANTLR3_API ANTLR3_UINT32 antlr3Fread (ANTLR3_FDSC fdsc, ANTLR3_UINT32 count, void *data)

ANTLR3_API ANTLR3_UINT32 antlr3Fsize (pANTLR3_UINT8 fileName)

ANTLR3_API ANTLR3_UINT32 antlr3readAscii (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 fileName)

Detailed Description

The ANTLR3 C filestream is used when the source character stream is a filesystem based input set and all the characters in the filestream can be loaded at once into memory and away the lexer goes.

A number of initializers are provided in order that various character sets can be supported from input files. The ANTLR3 C runtime expects to deal with UTF32 characters only (the reasons for this are to do with the simplification of C code when using this form of Unicode encoding, though this is not a panacea. More information can be found on this by consulting:

*
http://www.unicode.org/versions/Unicode4.0.0/ch02.pdf#G11178 Where a well grounded discussion of the encoding formats available may be found.

Function Documentation

ANTLR3_API pANTLR3_INPUT_STREAM antlr3AsciiFileStreamNew (pANTLR3_UINT8 fileName)

Use the contents of an operating system file as the input for an input stream. Parameters:

fileName Name of operating system file to read.

Returns:

*
Pointer to new input stream context upon success
*
One of the ANTLR3_ERR_ defines on error.

References ANTLR3_CALLOC, ANTLR3_CHARSTREAM, ANTLR3_SUCCESS, antlr3AsciiSetupStream(), antlr3readAscii(), ANTLR3_INPUT_STREAM_struct::close, ANTLR3_INPUT_STREAM_struct::fileName, ANTLR3_INPUT_STREAM_struct::istream, ANTLR3_STRING_FACTORY_struct::newStr, ANTLR3_INT_STREAM_struct::streamName, and ANTLR3_INPUT_STREAM_struct::strFactory.

ANTLR3_API void antlr3Fclose (ANTLR3_FDSC fd)

Close an operating system file and free any handles etc.

Referenced by antlr3readAscii().

ANTLR3_API ANTLR3_FDSC antlr3Fopen (pANTLR3_UINT8 filename, const char * mode)

Open an operating system file and return the descriptor We just use the common open() and related functions here. Later we might find better ways on systems such as Windows and OpenVMS for instance. But the idea is to read the while file at once anyway, so it may be irrelevant.

Referenced by antlr3readAscii().

ANTLR3_API ANTLR3_UINT32 antlr3Fread (ANTLR3_FDSC fdsc, ANTLR3_UINT32 count, void * data)

Referenced by antlr3readAscii().

ANTLR3_API ANTLR3_UINT32 antlr3Fsize (pANTLR3_UINT8 fileName)

References _stat.

Referenced by antlr3readAscii().

ANTLR3_API ANTLR3_UINT32 antlr3readAscii (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 fileName)

References ANTLR3_MALLOC, antlr3Fclose(), antlr3Fopen(), antlr3Fread(), antlr3Fsize(), ANTLR3_INPUT_STREAM_struct::data, ANTLR3_INPUT_STREAM_struct::isAllocated, and ANTLR3_INPUT_STREAM_struct::sizeBuf.

Referenced by antlr3AsciiFileStreamNew().

Author

Generated automatically by Doxygen for ANTLR3C from the source code.