Lines Matching full:data

1 /* Code for the buffer data structure.  */
38 buf->data = NULL;
57 if (buf->data != NULL)
60 free_buffer_data = buf->data;
144 struct buffer_data *data; local
146 for (data = buf->data; data != NULL; data = data->next)
147 if (data->size > 0)
154 * Count how much data is stored in the buffer..
162 struct buffer_data *data; local
165 for (data = buf->data; data != NULL; data = data->next)
172 /* Add data DATA of length LEN to BUF. */
175 buf_output (buf, data, len) in buf_output() argument
177 const char *data;
180 if (buf->data != NULL
185 memcpy (buf->last->bufp + buf->last->size, data, len);
201 if (buf->data == NULL)
202 buf->data = newdata;
213 memcpy (newdata->text, data, len);
218 memcpy (newdata->text, data, BUFFER_DATA_SIZE);
220 data += BUFFER_DATA_SIZE;
244 if (buf->data != NULL
273 while (buf->data != NULL)
275 struct buffer_data *data; local
277 data = buf->data;
279 if (data->size > 0)
283 status = (*buf->output) (buf->closure, data->bufp, data->size,
287 /* Some sort of error. Discard the data, and return. */
290 free_buffer_data = buf->data;
291 buf->data = NULL;
297 if (nbytes != data->size)
299 /* Not all the data was written out. This is only
305 data->size -= nbytes;
306 data->bufp += nbytes;
312 buf->data = data->next;
313 data->next = free_buffer_data;
314 free_buffer_data = data;
323 * Flush any data queued up in the buffer. If BLOCK is nonzero, then
421 struct buffer_data *data; local
424 for (data = buf->data; data != NULL; data = data->next)
425 size += data->size;
427 data = get_buffer_data ();
428 if (data == NULL)
434 data->next = buf->data;
435 buf->data = data;
437 buf->last = data;
439 data->bufp = data->text;
440 data->size = sizeof (int);
442 *((int *) data->text) = size;
461 struct buffer_data *data; local
463 data = get_buffer_data ();
464 if (data == NULL)
470 data->next = buf->data;
471 buf->data = data;
473 buf->last = data;
475 data->bufp = data->text;
476 data->size = sizeof (int);
478 *((int *) data->text) = count;
486 buf_append_data (buf, data, last) in buf_append_data() argument
488 struct buffer_data *data;
491 if (data != NULL)
493 if (buf->data == NULL)
494 buf->data = data;
496 buf->last->next = data;
501 /* Append the data on one buffer to another. This removes the data
509 buf_append_data (to, from->data, from->last);
510 from->data = NULL;
538 struct buffer_data *data; local
541 data = get_buffer_data ();
542 if (data == NULL)
549 *retp = data;
551 (*lastp)->next = data;
552 data->next = NULL;
553 *lastp = data;
555 data->bufp = data->text;
556 data->size = 0;
564 if (fread (data->text, get, 1, f) != 1)
570 data->size += get;
606 struct buffer_data *data; local
609 data = get_buffer_data ();
610 if (data == NULL)
617 *retp = data;
619 (*lastp)->next = data;
620 data->next = NULL;
621 *lastp = data;
623 data->bufp = data->text;
624 data->size = 0;
629 nread = fread (data->text, 1, get, f);
636 data->size = nread;
671 return buf_chain_length (buf->data);
675 * Read an arbitrary amount of data into an input buffer. The buffer
698 if (buf->data == NULL
702 struct buffer_data *data; local
704 data = get_buffer_data ();
705 if (data == NULL)
711 if (buf->data == NULL)
712 buf->data = data;
714 buf->last->next = data;
715 data->next = NULL;
716 buf->last = data;
718 data->bufp = data->text;
719 data->size = 0;
738 all the available data. */
771 struct buffer_data *data; local
776 for (data = buf->data; data != NULL; data = data->next)
778 nl = memchr (data->bufp, '\012', data->size);
781 finallen = nl - data->bufp;
785 len += data->size;
790 if (data != NULL)
800 nldata = data;
801 data = buf->data;
802 while (data != nldata)
806 memcpy (p, data->bufp, data->size);
807 p += data->size;
808 next = data->next;
809 data->next = free_buffer_data;
810 free_buffer_data = data;
811 data = next;
814 memcpy (p, data->bufp, finallen);
817 data->size -= finallen + 1;
818 data->bufp = nl + 1;
819 buf->data = data;
827 /* Read more data until we get a newline. */
833 if (buf->data == NULL
837 data = get_buffer_data ();
838 if (data == NULL)
844 if (buf->data == NULL)
845 buf->data = data;
847 buf->last->next = data;
848 data->next = NULL;
849 buf->last = data;
851 data->bufp = data->text;
852 data->size = 0;
885 * Extract data from the input buffer BUF. This will read up to WANT
888 * call which uses BUF may change the contents of the buffer at *DATA,
889 * so the data should be fully processed before any further calls are
904 while (buf->data != NULL && buf->data->size == 0)
908 next = buf->data->next;
909 buf->data->next = free_buffer_data;
910 free_buffer_data = buf->data;
911 buf->data = next;
916 if (buf->data == NULL)
918 struct buffer_data *data; local
921 data = get_buffer_data ();
922 if (data == NULL)
928 buf->data = data;
929 buf->last = data;
930 data->next = NULL;
931 data->bufp = data->text;
932 data->size = 0;
938 status = (*buf->input) (buf->closure, data->bufp, get,
943 data->size = nbytes;
946 *retdata = buf->data->bufp;
947 if (want < buf->data->size)
950 buf->data->size -= want;
951 buf->data->bufp += want;
955 *got = buf->data->size;
956 buf->data->size = 0;
977 struct buffer_data *data; local
985 for (data = inbuf->data; data != NULL; data = data->next)
987 nl = memchr (data->bufp, '\n', data->size);
990 nldata = data;
1005 if (inbuf->data != nldata)
1011 for (data = inbuf->data; data->next != nldata; data = data->next)
1013 data->next = NULL;
1014 buf_append_data (outbuf, inbuf->data, data);
1015 inbuf->data = nldata;
1020 * the buffer onto OUTBUF. Otherwise we must copy the data.
1025 inbuf->data = nldata->next;
1026 if (inbuf->data == NULL)
1042 * Copy counted data from one buffer to another. The count is an
1044 * pipe). If there is enough data, it should be moved over. If there
1045 * is not enough data, it should remain on the original buffer. A
1047 * to the (negative) count value and no additional data is gathered
1063 struct buffer_data *data; local
1080 for (data = inbuf->data; data != NULL; data = data->next)
1082 if (data->size >= need)
1084 memcpy (intp, data->bufp, need);
1087 memcpy (intp, data->bufp, data->size);
1088 intp += data->size;
1089 need -= data->size;
1091 if (data == NULL)
1098 start = data;
1112 * data from INBUF in all buffers before START, and we
1124 for (data = start->next; data != NULL; data = data->next)
1126 if (need <= data->size)
1128 need -= data->size;
1130 if (data == NULL)
1135 stop = data;
1157 while (inbuf->data != start)
1159 data = inbuf->data;
1160 inbuf->data = data->next;
1161 data->next = free_buffer_data;
1162 free_buffer_data = data;
1180 for (data = start; data->next != stop; data = data->next)
1182 inbuf->data = stop;
1183 data->next = NULL;
1184 buf_append_data (outbuf, start, data);
1238 stdio_buffer_input (closure, data, need, size, got) in stdio_buffer_input() argument
1240 char *data;
1267 *data = ch;
1272 nbytes = fread (data, 1, need, fp);
1293 stdio_buffer_output (closure, data, have, wrote) in stdio_buffer_output() argument
1295 const char *data;
1307 nbytes = fwrite (data, 1, have, fp);
1319 data += nbytes;
1344 /* Certain types of communication input and output data in packets,
1347 I/O and a routine to translate the data in a packet.
1353 significantly increase or decrease the amount of data. The actual
1354 size of the initial data is part of the translated data. The
1356 bytes, and the input translation routine should shrink the data
1369 untranslate the data in INPUT, storing the result in OUTPUT.
1370 SIZE is the amount of data in INPUT, and is also the size of
1375 data in INPUT, storing the result in OUTPUT. The first two
1376 bytes in INPUT will be the size of the data, and so will SIZE.
1377 This should set *TRANSLATED to the amount of translated data in
1384 /* For an input buffer, we may have to buffer up data here. */
1385 /* This is non-zero if the buffered data has been translated.
1386 Otherwise, the buffered data has not been translated, and starts
1389 /* The amount of buffered data. */
1391 /* The buffer allocated to hold the data. */
1395 /* If translated is set, we need another data pointer to track
1445 /* Input data from a packetizing buffer. */
1448 packetizing_buffer_input (closure, data, need, size, got) in packetizing_buffer_input() argument
1450 char *data;
1467 memcpy (data, pb->holddata, size);
1474 memcpy (data, pb->holddata, copy);
1478 data += copy;
1567 /* We did not get any data. Presumably the buffer is in
1574 /* We did not get all the data we need to fill the packet.
1594 need to copy the new data over to make the input
1617 length of the translated data. */
1625 /* We have more data than the caller has provided space
1628 memcpy (data, outbuf + 2, size);
1642 memcpy (data, outbuf + 2, tcount);
1649 data += tcount;
1658 /* Output data to a packetizing buffer. */
1661 packetizing_buffer_output (closure, data, have, wrote) in packetizing_buffer_output() argument
1663 const char *data;
1683 memcpy (inbuf + 2, data, have);
1688 bytes, and we need 2 bytes for the size of the translated data.
1737 /* Flush data to a packetizing buffer. */