ason_read - Man Page

Parse ASON values into ason_t objects.

Synopsis

#include <ason/ason.h>
#include <ason/read.h>

ason_t *ason_read(const char *text, ...);
ason_t *ason_readn(const char *text, size_t length, ...);

#include <ason/namespace.h>

ason_t *ason_ns_read(ason_ns_t *ns, const char *text, ...);
ason_t *ason_ns_readn(ason_ns_t *ns, const char *text, size_t length, ...);

Description

ason_read parses an ASON value and creates an ason_t representation of that value. ason_readn is the same, but reads only length characters of the string.

ason_ns_read and ason_ns_readn are the same, but take an additional argument, ns, which is a namespace to evaluate variables from, and store variables to. See ason_namespace(3).

Format Arguments

Each of these functions allows for additional arguments which will be converted to ASON values and put in the appropriate place within the parsed value. The following tokens can be placed in the string to indicate where additional arguments should be consumed:

?i - An integer argument. Converted to a numeric ASON value.
?u - An unsigned integer argument. Converted to a numeric ASON value.
?I - A 64-bit integer argument. Converted to a numeric ASON value.
?U - A 64-bit unsigned integer argument. Converted to a numeric ASON value.
?s - A string argument. Converted to an ASON string value. Can be used as a key value in objects. ? - An ason_t value. Used as-is.

Bugs

libason will try to negotiate between the current locale and the JSON-mandated UTF-8 encoding, but for best results, users should deal directly in UTF-8.

Return Value

All functions should always return a valid pointer to ason_t.

See Also

ason(3) ason_values(3)

Author

Casey Dahlin <casey.dahlin@gmail.com>

Referenced By

ason(3), ason_values(3).

The man pages ason_ns_read(3), ason_ns_readn(3) and ason_readn(3) are aliases of ason_read(3).

JANUARY 2014 Linux User Manuals