antlr3filestream.c File Reference


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:

#include <antlr3.h>

Include dependency graph for antlr3filestream.c:


Functions

static pANTLR3_INPUT_STREAM antlr3CreateFileStream (pANTLR3_UINT8 fileName)
 Use the contents of an operating system file as the input for an input stream.
static pANTLR3_INPUT_STREAM antlr3CreateStringStream (pANTLR3_UINT8 data)
 Use the supplied 'string' as input to the stream.
ANTLR3_API void antlr3Fclose (ANTLR3_FDSC fd)
 Close an operating system file and free any handles etc.
ANTLR3_API pANTLR3_INPUT_STREAM antlr3FileStreamNew (pANTLR3_UINT8 fileName, ANTLR3_UINT32 encoding)
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 antlr3read8Bit (pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 fileName)
ANTLR3_API pANTLR3_INPUT_STREAM antlr3StringStreamNew (pANTLR3_UINT8 data, ANTLR3_UINT32 encoding, ANTLR3_UINT32 size, pANTLR3_UINT8 name)
static void setupInputStream (pANTLR3_INPUT_STREAM input)
 Determine endianess of the input stream and install the API required for the encoding in that format.

Function Documentation

static pANTLR3_INPUT_STREAM antlr3CreateFileStream ( pANTLR3_UINT8  fileName  )  [static]

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_SUCCESS, antlr3GenericSetupStream(), antlr3read8Bit(), and ANTLR3_INPUT_STREAM_struct::close.

Referenced by antlr3FileStreamNew().

Here is the call graph for this function:

Here is the caller graph for this function:

static pANTLR3_INPUT_STREAM antlr3CreateStringStream ( pANTLR3_UINT8  data  )  [static]

Use the supplied 'string' as input to the stream.

Parameters:
data Pointer to the input data
Returns:
  • Pointer to new input stream context upon success
  • NULL defines on error.

References ANTLR3_CALLOC, ANTLR3_FALSE, antlr3GenericSetupStream(), ANTLR3_INPUT_STREAM_struct::data, and ANTLR3_INPUT_STREAM_struct::isAllocated.

Referenced by antlr3StringStreamNew().

Here is the call graph for this function:

Here is the caller graph for this function:

ANTLR3_API void antlr3Fclose ( ANTLR3_FDSC  fd  ) 

Close an operating system file and free any handles etc.

Referenced by antlr3read8Bit().

Here is the caller graph for this function:

ANTLR3_API pANTLR3_INPUT_STREAM antlr3FileStreamNew ( pANTLR3_UINT8  fileName,
ANTLR3_UINT32  encoding 
)

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 antlr3read8Bit().

Here is the caller graph for this function:

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

Referenced by antlr3read8Bit().

Here is the caller graph for this function:

ANTLR3_API ANTLR3_UINT32 antlr3Fsize ( pANTLR3_UINT8  fileName  ) 

References _stat.

Referenced by antlr3read8Bit().

Here is the caller graph for this function:

ANTLR3_API ANTLR3_UINT32 antlr3read8Bit ( pANTLR3_INPUT_STREAM  input,
pANTLR3_UINT8  fileName 
)

ANTLR3_API pANTLR3_INPUT_STREAM antlr3StringStreamNew ( pANTLR3_UINT8  data,
ANTLR3_UINT32  encoding,
ANTLR3_UINT32  size,
pANTLR3_UINT8  name 
)

static void setupInputStream ( pANTLR3_INPUT_STREAM  input  )  [static]


Generated on Mon Nov 29 17:23:40 2010 for ANTLR3C by  doxygen 1.5.5