Lines Matching refs:input

3  * is a filesystem based input set and all the characters in the filestream
7 * sets can be supported from input files. The ANTLR3 C runtime expects
49 static void setupInputStream (pANTLR3_INPUT_STREAM input);
56 pANTLR3_INPUT_STREAM input;
63 input = antlr3CreateFileStream(fileName);
64 if (input == NULL)
72 input->encoding = encoding;
77 setupInputStream(input);
81 input->istream->streamName = input->strFactory->newStr8(input->strFactory, fileName);
82 input->fileName = input->istream->streamName;
84 return input;
91 pANTLR3_INPUT_STREAM input;
97 input = antlr3CreateStringStream(data);
98 if (input == NULL)
105 input->sizeBuf = size;
110 input->encoding = encoding;
115 setupInputStream(input);
119 input->istream->streamName = input->strFactory->newStr8(input->strFactory, name);
120 input->fileName = input->istream->streamName;
122 return input;
126 /// Determine endianess of the input stream and install the
130 setupInputStream(pANTLR3_INPUT_STREAM input)
155 switch (input->encoding)
164 if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xEF
165 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xBB
166 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+2)) == 0xBF
171 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 3);
174 // Install the UTF8 input routines
176 antlr3UTF8SetupStream(input);
181 // See if there is a BOM at the start of the input. If not then
186 if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xFE
187 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xFF
192 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 2);
194 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_TRUE);
196 else if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xFF
197 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xFE
202 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 2);
204 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_FALSE);
210 antlr3UTF16SetupStream(input, isBigEndian, isBigEndian);
216 // See if there is a BOM at the start of the input. If not then
221 if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0x00
222 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0x00
223 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+2)) == 0xFE
224 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+3)) == 0xFF
229 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 4);
231 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_TRUE);
233 else if ( (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar)) == 0xFF
234 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0xFE
235 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0x00
236 && (ANTLR3_UINT8)(*((pANTLR3_UINT8)input->nextChar+1)) == 0x00
241 input->nextChar = (void *)((pANTLR3_UINT8)input->nextChar + 4);
243 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_FALSE);
249 antlr3UTF32SetupStream(input, isBigEndian, isBigEndian);
257 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_TRUE);
264 antlr3UTF16SetupStream(input, isBigEndian, ANTLR3_FALSE);
271 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_TRUE);
278 antlr3UTF32SetupStream(input, isBigEndian, ANTLR3_FALSE);
286 antlr3EBCDICSetupStream(input);
294 antlr38BitSetupStream(input);
299 /** \brief Use the contents of an operating system file as the input
300 * for an input stream.
304 * - Pointer to new input stream context upon success
310 // Pointer to the input stream we are going to create
312 pANTLR3_INPUT_STREAM input;
320 // Allocate memory for the input stream structure
322 input = (pANTLR3_INPUT_STREAM)
325 if (input == NULL)
332 status = antlr3read8Bit(input, fileName);
334 // Call the common 8 bit input stream handler
337 antlr3GenericSetupStream(input);
345 input->close(input);
349 return input;
353 antlr3read8Bit(pANTLR3_INPUT_STREAM input, pANTLR3_UINT8 fileName)
371 fSize = antlr3Fsize(fileName); /* Size of input file */
373 /* Allocate buffer for this input set
375 input->data = ANTLR3_MALLOC((size_t)fSize);
376 input->sizeBuf = fSize;
378 if (input->data == NULL)
383 input->isAllocated = ANTLR3_TRUE;
388 antlr3Fread(infile, fSize, input->data);
434 /** \brief Use the supplied 'string' as input to the stream
436 * \param data Pointer to the input data
438 * - Pointer to new input stream context upon success
444 // Pointer to the input stream we are going to create
446 pANTLR3_INPUT_STREAM input;
453 // Allocate memory for the input stream structure
455 input = (pANTLR3_INPUT_STREAM)
458 if (input == NULL)
465 input->data = data;
466 input->isAllocated = ANTLR3_FALSE;
468 // Call the common 8 bit input stream handler
471 antlr3GenericSetupStream(input);
473 return input;