Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pkg_check_modules(GLIB2 REQUIRED glib-2.0)
include_directories(${GLIB2_INCLUDE_DIRS})
webos_add_compiler_flags(ALL -Wall -D__STRICT_ANSI__ ${GLIB2_CFLAGS_OTHER} -pthread)

set(NO_LOGGING TRUE CACHE BOOL "Do not use logging")
set(NO_LOGGING FALSE CACHE BOOL "Do not use logging")
if(NO_LOGGING)
webos_add_compiler_flags(ALL -DPJSON_NO_LOGGING)
else()
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,15 @@ Below are the tools and libraries (and their minimum versions) required to build
- lemon 3.7.9
- make (any version)
- freewebos/cmake-modules-webos 1.0b
- FIXME openwebos/PmLogLib-headers 3.0.0
-- Not quite clear on how to resolve this. For now disabled logging
- freewbos/PmLogLib-headers 3.0.0 (only headers from PmLogLib)
- pkg-config 0.26
- uriparser 0.7.5
- yajl 1.0.12 or 2.0.4
- bash

Below is the component (and its minimum version) required to use key-value logging:

- openwebos/PmLogLib 3.0.0
- freewebos/PmLogLib 3.0.0


How to Build on Linux or FreeBSD
Expand Down
5 changes: 1 addition & 4 deletions src/pbnjson_c/jschema_types_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@

#include "jparse_types.h"
#include "jgen_types.h"
#include "validation/typedefs.h"
#include <yajl/yajl_parse.h>


typedef struct _Validator Validator;
typedef struct _UriResolver UriResolver;
typedef struct _ValidationState ValidationState;

/**
* This structure & any nestested structures (included jvalues)
* cannot be changed while parsing except to resolve external references
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/array_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>
#include <glib.h>

Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/boolean_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/combined_types_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/combined_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>
#include <glib.h>

Expand Down
8 changes: 3 additions & 5 deletions src/pbnjson_c/validation/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#pragma once

#include "typedefs.h"
#include "validator.h"
#include <stdbool.h>
#include <glib.h>
Expand All @@ -27,19 +28,16 @@ extern "C" {
#endif

typedef struct _StringSpan StringSpan;
typedef struct _Validator Validator;
typedef struct _UriResolver UriResolver;
typedef struct _UriScope UriScope;

/** @brief Definitions is standard place for subschemas */
typedef struct _Definitions
struct _Definitions
{
Validator base; /**< @brief Base class. We want definitions to be visitable. */

unsigned ref_count; /**< @brief Reference count */
char *name; /**< @brief Name of the definition, key in the parent schema. */
GSList *validators; /**< @brief List of subschemas with their names. */
} Definitions;
};

/** @brief Constructor */
Definitions* definitions_new(void);
Expand Down
2 changes: 1 addition & 1 deletion src/pbnjson_c/validation/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

#pragma once

#include "typedefs.h"
#include <stdbool.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Validator Validator;
typedef struct _Feature Feature;

/**
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/generic_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>

#ifdef __cplusplus
Expand Down
5 changes: 2 additions & 3 deletions src/pbnjson_c/validation/jvalue_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

#pragma once

#include "typedefs.h"
#include "feature.h"
#include <jtypes.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Validator Validator;
typedef struct jvalue *jvalue_ref;

/** @brief Feature application function.
*
* @param[in] v Validator to apply the feature to
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/null_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion src/pbnjson_c/validation/number_feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

#pragma once

#include "typedefs.h"
#include "feature.h"
#include "number.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Validator Validator;

/** @brief Number feature application function.
*
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/number_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "validator.h"
#include "number.h"
#include <jtypes.h>
#include <stddef.h>

#ifdef __cplusplus
Expand Down
4 changes: 1 addition & 3 deletions src/pbnjson_c/validation/object_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "feature.h"
#include "typedefs.h"
#include "validator_fwd.h"
#include <stdbool.h>
#include <glib.h>
Expand All @@ -27,9 +28,6 @@
extern "C" {
#endif

typedef struct _UriResolver UriResolver;
typedef struct _ValidationState ValidationState;

/** @brief Object properties class */
typedef struct _ObjectProperties
{
Expand Down
3 changes: 1 addition & 2 deletions src/pbnjson_c/validation/object_required.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@

#include "feature.h"
#include "validator_fwd.h"
#include "typedefs.h"
#include <stdbool.h>
#include <glib.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _UriResolver UriResolver;

/** @brief Object required class for {"required": [...]} */
typedef struct _ObjectRequired
{
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/object_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <stddef.h>

#ifdef __cplusplus
Expand Down
4 changes: 1 addition & 3 deletions src/pbnjson_c/validation/parser_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
#pragma once

#include "error_code.h"
#include "typedefs.h"
#include <stddef.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Validator Validator;
typedef struct _UriResolver UriResolver;

/** @brief Schema parsing error callback.
*
* The parser may notify about schema parsing errors.
Expand Down
2 changes: 1 addition & 1 deletion src/pbnjson_c/validation/parser_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
#include <stdbool.h>
#include <stddef.h>
#include "error_code.h"
#include "typedefs.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Validator Validator;

/** @brief The data available in the semantic actions. */
typedef struct _ParserContext
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>

#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/schema_parsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include "typedefs.h"
#include <stdbool.h>
#include <glib.h>

Expand Down
1 change: 1 addition & 0 deletions src/pbnjson_c/validation/string_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#pragma once

#include "validator.h"
#include <jtypes.h>
#include <glib.h>
#include <stddef.h>

Expand Down
3 changes: 2 additions & 1 deletion src/pbnjson_c/validation/type_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

#pragma once

#include "typedefs.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _StringSpan StringSpan;
typedef struct _Validator Validator;
typedef enum _ValidatorType ValidatorType;

/** @brief Type parser errors */
Expand Down
13 changes: 13 additions & 0 deletions src/pbnjson_c/validation/typedefs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** typedefs.h -- header file to set useful typedefs only once */

#ifndef TYPEDEFS_H_
#define TYPEDEFS_H_

typedef struct _Validator Validator;
typedef struct _ValidationState ValidationState;
typedef struct _ValidationEvent ValidationEvent;
typedef struct _UriResolver UriResolver;
typedef struct _UriScope UriScope;
typedef struct _Definitions Definitions;

#endif
6 changes: 3 additions & 3 deletions src/pbnjson_c/validation/uri_resolver.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

#pragma once

#include "typedefs.h"
#include <stdbool.h>
#include <glib.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _Validator Validator;

/** @brief Class UriResolver
*
Expand All @@ -35,11 +35,11 @@ typedef struct _Validator Validator;
* in the validator hierarchies (consider a reference down the tree pointing
* to the root validator).
*/
typedef struct _UriResolver
struct _UriResolver
{
/** @brief Hash map of document -> hash table of fragments in the documents. */
GHashTable *documents;
} UriResolver;
};

/** @brief Constructor */
UriResolver* uri_resolver_new(void);
Expand Down
7 changes: 3 additions & 4 deletions src/pbnjson_c/validation/uri_scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@

#pragma once

#include "typedefs.h"
#include <stdbool.h>
#include <glib.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _UriResolver UriResolver;

/** @brief URI scope stack class */
typedef struct _UriScope
struct _UriScope
{
UriResolver *uri_resolver; /**< @brief UriResolver for convenience */

/** @brief Stack contains pointers to document URI. */
GSList *uri_stack;
} UriScope;
};

/** @brief Constructor */
UriScope *uri_scope_new(void);
Expand Down
5 changes: 3 additions & 2 deletions src/pbnjson_c/validation/validation_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#pragma once

#include "typedefs.h"
#include <stdbool.h>
#include <stddef.h>

Expand All @@ -40,7 +41,7 @@ typedef enum
} ValidationEventTypes;

/** @brief Validation event data */
typedef struct _ValidationEvent
struct _ValidationEvent
{
ValidationEventTypes type; /**< @brief Type of event */
union
Expand All @@ -52,7 +53,7 @@ typedef struct _ValidationEvent
size_t len; /**< @brief Length of the text */
} string; /**< @brief String parameter for every JSON type except boolean */
} value; /**< @brief Associated value */
} ValidationEvent;
};


/** @brief Create validation event for JSON null. */
Expand Down
Loading