summaryrefslogtreecommitdiff
path: root/decoder/JSON_parser.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-24 22:35:50 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-24 22:35:50 +0000
commit5d661b49dab6e0e3620efbd4e45a2ed53d04232c (patch)
tree9fd881a62c8211c5917834bb404047d4dc56fd08 /decoder/JSON_parser.h
parented704ce2e0ec5ebb64a07c68f977a830a8e7d161 (diff)
build on cygwin
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@23 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/JSON_parser.h')
-rw-r--r--decoder/JSON_parser.h42
1 files changed, 21 insertions, 21 deletions
diff --git a/decoder/JSON_parser.h b/decoder/JSON_parser.h
index ceb5b24b..de980072 100644
--- a/decoder/JSON_parser.h
+++ b/decoder/JSON_parser.h
@@ -14,7 +14,7 @@
# define JSON_PARSER_DLL_API __declspec(dllimport)
# endif
#else
-# define JSON_PARSER_DLL_API
+# define JSON_PARSER_DLL_API
#endif
/* Determine the integer type use to parse non-floating point numbers */
@@ -22,7 +22,7 @@
typedef long long JSON_int_t;
#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%lld"
#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%lld"
-#else
+#else
typedef long JSON_int_t;
#define JSON_PARSER_INTEGER_SSCANF_TOKEN "%ld"
#define JSON_PARSER_INTEGER_SPRINTF_TOKEN "%ld"
@@ -31,9 +31,9 @@ typedef long JSON_int_t;
#ifdef __cplusplus
extern "C" {
-#endif
+#endif
-typedef enum
+typedef enum
{
JSON_T_NONE = 0,
JSON_T_ARRAY_BEGIN, // 1
@@ -53,9 +53,9 @@ typedef enum
typedef struct JSON_value_struct {
union {
JSON_int_t integer_value;
-
- long double float_value;
-
+
+ double float_value;
+
struct {
const char* value;
size_t length;
@@ -65,22 +65,22 @@ typedef struct JSON_value_struct {
typedef struct JSON_parser_struct* JSON_parser;
-/*! \brief JSON parser callback
+/*! \brief JSON parser callback
\param ctx The pointer passed to new_JSON_parser.
- \param type An element of JSON_type but not JSON_T_NONE.
+ \param type An element of JSON_type but not JSON_T_NONE.
\param value A representation of the parsed value. This parameter is NULL for
JSON_T_ARRAY_BEGIN, JSON_T_ARRAY_END, JSON_T_OBJECT_BEGIN, JSON_T_OBJECT_END,
JSON_T_NULL, JSON_T_TRUE, and SON_T_FALSE. String values are always returned
as zero-terminated C strings.
\return Non-zero if parsing should continue, else zero.
-*/
+*/
typedef int (*JSON_parser_callback)(void* ctx, int type, const struct JSON_value_struct* value);
-/*! \brief The structure used to configure a JSON parser object
-
+/*! \brief The structure used to configure a JSON parser object
+
\param depth If negative, the parser can parse arbitrary levels of JSON, otherwise
the depth is the limit
\param Pointer to a callback. This parameter may be NULL. In this case the input is merely checked for validity.
@@ -88,7 +88,7 @@ typedef int (*JSON_parser_callback)(void* ctx, int type, const struct JSON_value
\param depth. Specifies the levels of nested JSON to allow. Negative numbers yield unlimited nesting.
\param allowComments. To allow C style comments in JSON, set to non-zero.
\param handleFloatsManually. To decode floating point numbers manually set this parameter to non-zero.
-
+
\return The parser object.
*/
typedef struct {
@@ -111,11 +111,11 @@ typedef struct {
*/
JSON_PARSER_DLL_API void init_JSON_config(JSON_config* config);
-/*! \brief Create a JSON parser object
-
- \param config. Used to configure the parser. Set to NULL to use the default configuration.
+/*! \brief Create a JSON parser object
+
+ \param config. Used to configure the parser. Set to NULL to use the default configuration.
See init_JSON_config
-
+
\return The parser object.
*/
JSON_PARSER_DLL_API extern JSON_parser new_JSON_parser(JSON_config* config);
@@ -132,12 +132,12 @@ JSON_PARSER_DLL_API extern int JSON_parser_char(JSON_parser jc, int next_char);
/*! \brief Finalize parsing.
Call this method once after all input characters have been consumed.
-
+
\return Non-zero, if all parsed characters are valid JSON, zero otherwise.
*/
JSON_PARSER_DLL_API extern int JSON_parser_done(JSON_parser jc);
-/*! \brief Determine if a given string is valid JSON white space
+/*! \brief Determine if a given string is valid JSON white space
\return Non-zero if the string is valid, zero otherwise.
*/
@@ -146,7 +146,7 @@ JSON_PARSER_DLL_API extern int JSON_parser_is_legal_white_space_string(const cha
#ifdef __cplusplus
}
-#endif
-
+#endif
+
#endif /* JSON_PARSER_H */