Lines Matching refs:input

237 /* we need to keep enough input to show errors in context */
269 * @in: an XML parser input
272 * This function refresh the input for the parser. It doesn't try to
273 * preserve pointers to the input buffer, and discard already read data
320 * @in: an XML parser input
323 * This function increase the input for the parser. It tries to
324 * preserve pointers to the input buffer, and keep already read data
380 * @in: an XML parser input
382 * This function removes used input for the parser.
436 * UTF8 character input and related functions *
444 * Skip to the next char input char.
451 (ctxt->input == NULL))
455 if ((*ctxt->input->cur == 0) &&
456 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0) &&
475 if (*(ctxt->input->cur) == '\n') {
476 ctxt->input->line++; ctxt->input->col = 1;
478 ctxt->input->col++;
491 cur = ctxt->input->cur;
498 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
505 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
510 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
515 ctxt->input->cur += 4;
522 ctxt->input->cur += 3;
536 ctxt->input->cur += 2;
539 ctxt->input->cur++;
542 if (*ctxt->input->cur == 0)
543 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
552 if (*(ctxt->input->cur) == '\n') {
553 ctxt->input->line++; ctxt->input->col = 1;
555 ctxt->input->col++;
556 ctxt->input->cur++;
558 if (*ctxt->input->cur == 0)
559 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
561 if ((*ctxt->input->cur == '%') && (!ctxt->html))
563 if ((*ctxt->input->cur == 0) &&
564 (xmlParserInputGrow(ctxt->input, INPUT_CHUNK) <= 0))
570 * input encoding didn't get properly advertised in the
575 if ((ctxt == NULL) || (ctxt->input == NULL) ||
576 (ctxt->input->end - ctxt->input->cur < 4)) {
584 ctxt->input->cur[0], ctxt->input->cur[1],
585 ctxt->input->cur[2], ctxt->input->cur[3]);
591 ctxt->input->cur++;
601 * bytes in the input buffer. Implement the end of line normalization:
608 * line breaks to #xA on input, before parsing.)
615 if ((ctxt == NULL) || (len == NULL) || (ctxt->input == NULL)) return(0);
619 if ((*ctxt->input->cur >= 0x20) && (*ctxt->input->cur <= 0x7F)) {
621 return((int) *ctxt->input->cur);
635 const unsigned char *cur = ctxt->input->cur;
644 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
649 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
654 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
691 if (*ctxt->input->cur == 0)
692 xmlParserInputGrow(ctxt->input, INPUT_CHUNK);
693 if ((*ctxt->input->cur == 0) &&
694 (ctxt->input->end > ctxt->input->cur)) {
698 if (*ctxt->input->cur == 0xD) {
699 if (ctxt->input->cur[1] == 0xA) {
701 ctxt->input->cur++;
705 return((int) *ctxt->input->cur);
714 if (*ctxt->input->cur == 0xD) {
715 if (ctxt->input->cur[1] == 0xA) {
717 ctxt->input->cur++;
721 return((int) *ctxt->input->cur);
724 * An encoding problem may arise from a truncated input buffer
728 if (ctxt->input->end - ctxt->input->cur < 4) {
735 * input encoding didn't get properly advertised in the
744 ctxt->input->cur[0], ctxt->input->cur[1],
745 ctxt->input->cur[2], ctxt->input->cur[3]);
752 return((int) *ctxt->input->cur);
762 * bytes in the input buffer.
837 * An encoding problem may arise from a truncated input buffer
841 if ((ctxt == NULL) || (ctxt->input == NULL) ||
842 (ctxt->input->end - ctxt->input->cur < 4)) {
848 * input encoding didn't get properly advertised in the
857 ctxt->input->cur[0], ctxt->input->cur[1],
858 ctxt->input->cur[2], ctxt->input->cur[3]);
941 * change the input functions when discovering the character encoding
970 if ((ctxt->input != NULL) &&
971 (ctxt->input->cur[0] == 0xEF) &&
972 (ctxt->input->cur[1] == 0xBB) &&
973 (ctxt->input->cur[2] == 0xBF)) {
974 ctxt->input->cur += 3;
979 /*The raw input characters are encoded
982 *ctxt->input->cur to contain UTF-8 encoded characters.
987 if ((ctxt->input != NULL) && (ctxt->input->cur != NULL) &&
988 (ctxt->input->cur[0] == 0xEF) &&
989 (ctxt->input->cur[1] == 0xBB) &&
990 (ctxt->input->cur[2] == 0xBF)) {
991 ctxt->input->cur += 3;
1058 (ctxt->input != NULL) &&
1059 (ctxt->input->encoding != NULL)) {
1060 ctxt->encoding = xmlStrdup(ctxt->input->encoding);
1092 * @input: the input stream
1095 * change the input functions when discovering the character encoding
1101 xmlSwitchInputEncoding(xmlParserCtxtPtr ctxt, xmlParserInputPtr input,
1108 if (input == NULL)
1110 if (input->buf != NULL) {
1111 if (input->buf->encoder != NULL) {
1116 if (input->buf->encoder == handler)
1121 if ((!xmlStrncmp(BAD_CAST input->buf->encoder->name,
1134 xmlCharEncCloseFunc(input->buf->encoder);
1135 input->buf->encoder = handler;
1138 input->buf->encoder = handler;
1143 if ((input->buf->buffer != NULL) && (input->buf->buffer->use > 0)) {
1154 (input->cur[0] == 0xFF) && (input->cur[1] == 0xFE)) {
1155 input->cur += 2;
1159 (input->cur[0] == 0xFE) && (input->cur[1] == 0xFF)) {
1160 input->cur += 2;
1169 (input->cur[0] == 0xEF) &&
1170 (input->cur[1] == 0xBB) && (input->cur[2] == 0xBF)) {
1171 input->cur += 3;
1175 * Shrink the current input buffer.
1176 * Move it as the raw buffer and create a new input buffer
1178 processed = input->cur - input->base;
1179 xmlBufferShrink(input->buf->buffer, processed);
1180 input->buf->raw = input->buf->buffer;
1181 input->buf->buffer = xmlBufferCreate();
1182 input->buf->rawconsumed = processed;
1183 use = input->buf->raw->use;
1189 nbchars = xmlCharEncInFunc(input->buf->encoder,
1190 input->buf->buffer,
1191 input->buf->raw);
1199 nbchars = xmlCharEncFirstLine(input->buf->encoder,
1200 input->buf->buffer,
1201 input->buf->raw);
1209 input->buf->rawconsumed += use - input->buf->raw->use;
1210 input->base = input->cur = input->buf->buffer->content;
1211 input->end = &input->base[input->buf->buffer->use];
1215 } else if (input->length == 0) {
1220 xmlErrInternal(ctxt, "switching encoding : no input\n", NULL);
1231 * change the input functions when discovering the character encoding
1242 if (ctxt->input != NULL) {
1243 ret = xmlSwitchInputEncoding(ctxt, ctxt->input, handler);
1245 xmlErrInternal(ctxt, "xmlSwitchToEncoding : no input\n",
1266 * @input: an xmlParserInputPtr
1268 * Free up an input stream.
1271 xmlFreeInputStream(xmlParserInputPtr input) {
1272 if (input == NULL) return;
1274 if (input->filename != NULL) xmlFree((char *) input->filename);
1275 if (input->directory != NULL) xmlFree((char *) input->directory);
1276 if (input->encoding != NULL) xmlFree((char *) input->encoding);
1277 if (input->version != NULL) xmlFree((char *) input->version);
1278 if ((input->free != NULL) && (input->base != NULL))
1279 input->free((xmlChar *) input->base);
1280 if (input->buf != NULL)
1281 xmlFreeParserInputBuffer(input->buf);
1282 xmlFree(input);
1289 * Create a new input stream structure
1290 * Returns the new input stream or NULL
1294 xmlParserInputPtr input;
1297 input = (xmlParserInputPtr) xmlMalloc(sizeof(xmlParserInput));
1298 if (input == NULL) {
1299 xmlErrMemory(ctxt, "couldn't allocate a new input stream\n");
1302 memset(input, 0, sizeof(xmlParserInput));
1303 input->line = 1;
1304 input->col = 1;
1305 input->standalone = -1;
1310 input->id = id++;
1311 return(input);
1317 * @input: an I/O Input
1320 * Create a new input stream structure encapsulating the @input into
1323 * Returns the new input stream or NULL
1326 xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input,
1330 if (input == NULL) return(NULL);
1332 xmlGenericError(xmlGenericErrorContext, "new input from I/O\n");
1338 inputStream->buf = input;
1354 * Create a new input stream based on an xmlEntityPtr
1356 * Returns the new input stream or NULL
1360 xmlParserInputPtr input;
1369 "new input from entity: %s\n", entity->name);
1398 input = xmlNewInputStream(ctxt);
1399 if (input == NULL) {
1403 input->filename = (char *) xmlStrdup((xmlChar *) entity->URI);
1404 input->base = entity->content;
1405 input->cur = entity->content;
1406 input->length = entity->length;
1407 input->end = &entity->content[input->length];
1408 return(input);
1416 * Create a new input stream based on a memory buffer.
1417 * Returns the new input stream
1421 xmlParserInputPtr input;
1430 "new fixed input: %.30s\n", buffer);
1431 input = xmlNewInputStream(ctxt);
1432 if (input == NULL) {
1433 xmlErrMemory(ctxt, "couldn't allocate a new input stream\n");
1436 input->base = buffer;
1437 input->cur = buffer;
1438 input->length = xmlStrlen(buffer);
1439 input->end = &buffer[input->length];
1440 return(input);
1448 * Create a new input stream based on a file or an URL.
1450 * Returns the new input stream or NULL in case of error
1461 "new input from file: %s\n", filename);
1520 xmlParserInputPtr input;
1556 ctxt->input = NULL;
1559 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
1560 xmlFreeInputStream(input);
1563 ctxt->input = NULL;
1588 ctxt->input = NULL;
1606 ctxt->input = NULL;
1627 ctxt->input = NULL;
1691 xmlParserInputPtr input;
1695 while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */
1696 xmlFreeInputStream(input);