summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKirill Simonov <xi@resolvent.net>2006-05-29 20:08:09 +0000
committerKirill Simonov <xi@resolvent.net>2006-05-29 20:08:09 +0000
commit6eb1ded4c43d20264ed22f0d82f16043417cd765 (patch)
tree54f6731b7262f38cff0c3b7f29b9371556f1346e /include
parent95b98ba9b588df2f28b0a0acca11a1133fb266f0 (diff)
downloadlibyaml-git-6eb1ded4c43d20264ed22f0d82f16043417cd765.tar.gz
Working on the decoding code.
Diffstat (limited to 'include')
-rw-r--r--include/yaml/yaml.h53
1 files changed, 40 insertions, 13 deletions
diff --git a/include/yaml/yaml.h b/include/yaml/yaml.h
index c4bd0ba..9ec2c7a 100644
--- a/include/yaml/yaml.h
+++ b/include/yaml/yaml.h
@@ -252,7 +252,7 @@ typedef struct {
* source. The handler should write not more than @a size bytes to the @a
* buffer. The number of written bytes should be set to the @a length variable.
*
- * @param[in] ext A pointer to an application data specified by
+ * @param[in] data A pointer to an application data specified by
* @c yaml_parser_set_read_handler.
* @param[out] buffer The buffer to write the data from the source.
* @param[in] size The size of the buffer.
@@ -262,10 +262,22 @@ typedef struct {
* the returned value should be @c 0. On EOF, the handler should set the
* @a length to @c 0 and return @c 1.
*/
-typedef int yaml_read_handler_t(void *ext, unsigned char *buffer, size_t size,
+
+typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size,
size_t *size_read);
/**
+ * This structure holds a string input specified by
+ * @c yaml_parser_set_input_string.
+ */
+
+typedef struct {
+ unsigned char *start;
+ unsigned char *end;
+ unsigned char *current;
+} yaml_string_input_t;
+
+/**
* The parser structure.
*
* All members are internal. Manage the structure using the @c yaml_parser_
@@ -279,7 +291,7 @@ typedef struct {
* @{
*/
- error_type_t error;
+ yaml_error_type_t error;
/**
* @}
@@ -302,23 +314,23 @@ typedef struct {
/** The pointer to the beginning of the working buffer. */
yaml_char_t *buffer;
- /** The size of the buffer (in bytes). */
- size_t buffer_size;
+ /** The pointer to the end of the working buffer. */
+ yaml_char_t *buffer_end;
/** The pointer to the current character in the working buffer. */
- yaml_char_t *buffer_pointer;
+ yaml_char_t *pointer;
- /** The number of unread characters in the buffer (in characters). */
- size_t buffer_length;
+ /** The number of unread characters in the working buffer. */
+ size_t unread;
- /** The remaining undecoded characters. */
+ /** The pointer to the beginning of the raw buffer. */
unsigned char *raw_buffer;
- /** The size of the raw buffer (in bytes). */
- size_t raw_buffer_size;
+ /** The pointer to the current character in the raw buffer. */
+ unsigned char *raw_pointer;
- /** Is the application responsible for freeing the raw buffer? */
- int raw_buffer_foreign;
+ /** The number of unread bytes in the raw buffer. */
+ size_t raw_unread;
/** The input encoding. */
yaml_encoding_t encoding;
@@ -335,6 +347,9 @@ typedef struct {
/** The column of the current position (starting from @c 0). */
size_t column;
+ /* String input structure. */
+ yaml_string_input_t string_input;
+
/**
* @}
*/
@@ -461,6 +476,18 @@ yaml_realloc(void *ptr, size_t size);
void
yaml_free(void *ptr);
+/** The size of the raw buffer. */
+
+#define YAML_RAW_BUFFER_SIZE 16384
+
+/**
+ * The size of the buffer.
+ *
+ * We allocate enough space for decoding the whole raw buffer.
+ */
+
+#define YAML_BUFFER_SIZE (YAML_RAW_BUFFER_SIZE*3)
+
/** @} */