From a7d5f3e758012b42d1d8b35077e494be8fdeda66 Mon Sep 17 00:00:00 2001 From: Titan Date: Tue, 26 Nov 2013 15:43:38 +0800 Subject: [PATCH 01/11] modify Validate.c --- example/Makefile | 7 +++ example/layout.json | 12 ++++++ example/layout.schema | 99 +++++++++++++++++++++++++++++++++++++++++++ example/validate.c | 2 +- 4 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 example/Makefile create mode 100644 example/layout.json create mode 100644 example/layout.schema diff --git a/example/Makefile b/example/Makefile new file mode 100644 index 0000000..90b2fcc --- /dev/null +++ b/example/Makefile @@ -0,0 +1,7 @@ +TARGET=validate + +all: + gcc -o ${TARGET} ${TARGET}.c -lwjelement -lwjreader + +clean: + rm ${TARGET} diff --git a/example/layout.json b/example/layout.json new file mode 100644 index 0000000..9228874 --- /dev/null +++ b/example/layout.json @@ -0,0 +1,12 @@ +{ + "type": "layout", + "headers": { + "msg_id": "DSCS1385112923586" + }, + "obj": { + "name": "test", + "status ": "draft", + "orientation": "landscape", + "widget": [] + } +} diff --git a/example/layout.schema b/example/layout.schema new file mode 100644 index 0000000..b9c56b3 --- /dev/null +++ b/example/layout.schema @@ -0,0 +1,99 @@ +{ + name: "layout", + type: "object", + additionalProperties: false, + properties: { + name: { + type: "string", + optional: true + }, + template: { + type: "string", + required: true + }, + orientation: { + type: "string", + enum: [ + "portrait", + "landscape" + ], + optional: true + }, + status: { + type: "string", + enum: [ + "draft", + "ready" + ], + optional: true, + default: "ready" + }, + widgets: { + type: "array", + items: { + name: "widget setting", + type: "object", + optional: true, + additionalProperties: false, + properties: { + widget: { + type: "string", + format: "mongodbid", + description: "Must be a valid widget ID", + required: true + }, + name: { + type: "string", + description: "Must be the widget name( package name )", + required: true + }, + h: { + type: "number", + description: " 0.0 ~ 1.0", + required: true + }, + w: { + type: "number", + description: " 0.0 ~ 1.0", + required: true + }, + top: { + type: "number", + description: " 0.0 ~ 1.0", + required: true + }, + left: { + type: "number", + description: " 0.0 ~ 1.0", + required: true + }, + param: { + type: "array", + optional: true, + items: { + type: "object", + optional: true, + additionalProperties: false, + properties: { + name: { + type: "string", + optional: true + }, + val: { + type: "string", + optional: true + } + } + } + }, + configurable: { + type: "boolean", + optional: false, + default: false + } + } + }, + optional: true + } + } +} diff --git a/example/validate.c b/example/validate.c index f300900..555db7c 100644 --- a/example/validate.c +++ b/example/validate.c @@ -44,7 +44,7 @@ static WJElement schema_load(const char *name, void *client, } free(path); } - + WJEDump(schema); return schema; } From 73e9389f36d47fb35908434e0200851255c40071 Mon Sep 17 00:00:00 2001 From: Titan Date: Tue, 26 Nov 2013 18:08:34 +0800 Subject: [PATCH 02/11] update the layout schema and simple object for validate, task #9338 --- example/layout.json | 18 +++--- example/layout.schema | 142 +++++++++++++++++++++--------------------- 2 files changed, 80 insertions(+), 80 deletions(-) diff --git a/example/layout.json b/example/layout.json index 9228874..c99abd6 100644 --- a/example/layout.json +++ b/example/layout.json @@ -1,12 +1,12 @@ { "type": "layout", - "headers": { - "msg_id": "DSCS1385112923586" - }, - "obj": { - "name": "test", - "status ": "draft", - "orientation": "landscape", - "widget": [] - } + "headers": { + "msg_id": "DSCS1385112923586" + }, + "obj": { + "name": "test", + "status ": "draft", + "orientation": "landscape", + "widget": [] + } } diff --git a/example/layout.schema b/example/layout.schema index b9c56b3..313cd37 100644 --- a/example/layout.schema +++ b/example/layout.schema @@ -1,99 +1,99 @@ { - name: "layout", - type: "object", - additionalProperties: false, - properties: { - name: { - type: "string", - optional: true + "name": "layout", + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "optional": true }, - template: { - type: "string", - required: true + "template": { + "type": "string", + "optional": true }, - orientation: { - type: "string", - enum: [ + "orientation": { + "type": "string", + "enum": [ "portrait", "landscape" ], - optional: true + "optional": true }, - status: { - type: "string", - enum: [ + "status": { + "type": "string", + "enum": [ "draft", "ready" ], - optional: true, - default: "ready" + "optional": true, + "default": "ready" }, - widgets: { - type: "array", - items: { - name: "widget setting", - type: "object", - optional: true, - additionalProperties: false, - properties: { - widget: { - type: "string", - format: "mongodbid", - description: "Must be a valid widget ID", - required: true + "widgets": { + "type": "array", + "items": { + "name": "widget setting", + "type": "object", + "optional": true, + "additionalProperties": false, + "properties": { + "widget": { + "type": "string", + "format": "mongodbid", + "description": "Must be a valid widget ID", + "required": true }, - name: { - type: "string", - description: "Must be the widget name( package name )", - required: true + "name": { + "type": "string", + "description": "Must be the widget name( package name )", + "required": true }, - h: { - type: "number", - description: " 0.0 ~ 1.0", - required: true + "h": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true }, - w: { - type: "number", - description: " 0.0 ~ 1.0", - required: true + "w": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true }, - top: { - type: "number", - description: " 0.0 ~ 1.0", - required: true + "top": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true }, - left: { - type: "number", - description: " 0.0 ~ 1.0", - required: true + "left": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true }, - param: { - type: "array", - optional: true, - items: { - type: "object", - optional: true, - additionalProperties: false, - properties: { - name: { - type: "string", - optional: true + "param": { + "type": "array", + "optional": true, + "items": { + "type": "object", + "optional": true, + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "optional": true }, - val: { - type: "string", - optional: true + "val": { + "type": "string", + "optional": true } } } }, - configurable: { - type: "boolean", - optional: false, - default: false + "configurable": { + "type": "boolean", + "optional": false, + "default": false } } }, - optional: true + "optional": true } } } From 40bf914b2197a2f6fd4e9754bbd62496aba57cce Mon Sep 17 00:00:00 2001 From: Titan Date: Wed, 27 Nov 2013 11:01:05 +0800 Subject: [PATCH 03/11] remove the optional configure because it is not in correct format --- example/layout.schema | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/example/layout.schema b/example/layout.schema index 313cd37..28c24c6 100644 --- a/example/layout.schema +++ b/example/layout.schema @@ -5,11 +5,9 @@ "properties": { "name": { "type": "string", - "optional": true }, "template": { "type": "string", - "optional": true }, "orientation": { "type": "string", @@ -17,7 +15,6 @@ "portrait", "landscape" ], - "optional": true }, "status": { "type": "string", @@ -25,7 +22,6 @@ "draft", "ready" ], - "optional": true, "default": "ready" }, "widgets": { @@ -33,7 +29,6 @@ "items": { "name": "widget setting", "type": "object", - "optional": true, "additionalProperties": false, "properties": { "widget": { @@ -69,31 +64,25 @@ }, "param": { "type": "array", - "optional": true, "items": { "type": "object", - "optional": true, "additionalProperties": false, "properties": { "name": { "type": "string", - "optional": true }, "val": { "type": "string", - "optional": true } } } }, "configurable": { "type": "boolean", - "optional": false, "default": false } } - }, - "optional": true + } } } } From c1aa6ab33ddc311f7f1cfb2c2580b15055f6caa9 Mon Sep 17 00:00:00 2001 From: Titan Date: Wed, 27 Nov 2013 16:52:25 +0800 Subject: [PATCH 04/11] Finish correct layout_campaign schema --- example/layout.schema | 173 ++++++++++++++++++++++++------------------ 1 file changed, 100 insertions(+), 73 deletions(-) diff --git a/example/layout.schema b/example/layout.schema index 28c24c6..8671486 100644 --- a/example/layout.schema +++ b/example/layout.schema @@ -1,88 +1,115 @@ { - "name": "layout", - "type": "object", - "additionalProperties": false, - "properties": { + "name": "layout schema check", + "type": "object", + "properties": { + "type": { + "type": "string", + "required": true + }, + "headers": { + "name": "headers", + "type": "object", + "properties": { + "msg_id": { + "type": "string", + "required": true + } + }, + "required": true + }, + "obj": { + "name": "layout", + "type": "object", + "additionalProperties": false, + "properties": { "name": { - "type": "string", + "type": "string" }, "template": { - "type": "string", + "type": "string", + }, "orientation": { - "type": "string", - "enum": [ - "portrait", - "landscape" - ], + "type": "string", + "enum": [ + "portrait", + "landscape" + ], + }, "status": { - "type": "string", - "enum": [ - "draft", - "ready" - ], - "default": "ready" + "type": "string", + "enum": [ + "draft", + "ready" + ], + "default": "ready" }, - "widgets": { - "type": "array", - "items": { - "name": "widget setting", - "type": "object", - "additionalProperties": false, - "properties": { - "widget": { - "type": "string", - "format": "mongodbid", - "description": "Must be a valid widget ID", - "required": true - }, + "widget": { + "type": "array", + "items": { + "name": "widget setting", + "type": "object", + "additionalProperties": false, + "properties": { + "widget": { + "type": "string", + "format": "mongodbid", + "description": "Must be a valid widget ID", + "required": true + }, + "name": { + "type": "string", + "description": "Must be the widget name( package name )", + "required": true + }, + "h": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "w": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "top": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "left": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "param": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { "name": { - "type": "string", - "description": "Must be the widget name( package name )", - "required": true - }, - "h": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "w": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "top": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "left": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "param": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - }, - "val": { - "type": "string", - } - } - } + "type": "string", + }, - "configurable": { - "type": "boolean", - "default": false + "val": { + "type": "string", + } + } } + }, + "configurable": { + "type": "boolean", + "default": false + } } + }, + "required": true } - } -} + } + }, + "required": true + } +} \ No newline at end of file From 78203b4390cb450205ddb44b67d49e27049cdbc9 Mon Sep 17 00:00:00 2001 From: Titan Date: Wed, 27 Nov 2013 18:37:28 +0800 Subject: [PATCH 05/11] Finetue the schema with widget array, task #9338 --- example/layout.json | 2 +- example/layout.schema | 35 ++++++++++++++++------------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/example/layout.json b/example/layout.json index c99abd6..c724d27 100644 --- a/example/layout.json +++ b/example/layout.json @@ -5,7 +5,7 @@ }, "obj": { "name": "test", - "status ": "draft", + "status": "draft", "orientation": "landscape", "widget": [] } diff --git a/example/layout.schema b/example/layout.schema index 8671486..4578308 100644 --- a/example/layout.schema +++ b/example/layout.schema @@ -4,6 +4,9 @@ "properties": { "type": { "type": "string", + "enum": [ + "layout" + ], "required": true }, "headers": { @@ -20,14 +23,14 @@ "obj": { "name": "layout", "type": "object", - "additionalProperties": false, + "additionalProperties": true, "properties": { "name": { - "type": "string" + "type": "string", + "required": true }, "template": { "type": "string", - }, "orientation": { "type": "string", @@ -35,7 +38,7 @@ "portrait", "landscape" ], - + "required": true }, "status": { "type": "string", @@ -43,21 +46,17 @@ "draft", "ready" ], - "default": "ready" + "default": "ready", + "required": true }, "widget": { "type": "array", + "required": true, "items": { "name": "widget setting", "type": "object", "additionalProperties": false, "properties": { - "widget": { - "type": "string", - "format": "mongodbid", - "description": "Must be a valid widget ID", - "required": true - }, "name": { "type": "string", "description": "Must be the widget name( package name )", @@ -91,25 +90,23 @@ "properties": { "name": { "type": "string", - + "required": true }, "val": { - "type": "string", - + "required": true } } } }, "configurable": { "type": "boolean", - "default": false + "default": false, + "required": true } } - }, - "required": true + } } } - }, - "required": true + } } } \ No newline at end of file From e6934bd098863c02b02f876601648210b0d12daf Mon Sep 17 00:00:00 2001 From: Titan Date: Thu, 28 Nov 2013 10:33:21 +0800 Subject: [PATCH 06/11] update the example/Makefile --- example/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/example/Makefile b/example/Makefile index 90b2fcc..766d301 100644 --- a/example/Makefile +++ b/example/Makefile @@ -1,7 +1,9 @@ TARGET=validate +TARGET2=example all: gcc -o ${TARGET} ${TARGET}.c -lwjelement -lwjreader + gcc -o ${TARGET2} ${TARGET2}.c -lwjelement -lwjreader clean: - rm ${TARGET} + rm ${TARGET} ${TARGET2} From 2bc688f411e7dd72f15f69c499a0a1116c3283cb Mon Sep 17 00:00:00 2001 From: Titan Date: Mon, 2 Dec 2013 10:17:46 +0800 Subject: [PATCH 07/11] add cpack configure in CMakeList.txt --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0544820..5572812 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,3 +59,36 @@ INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/documentation/ include_directories(include) add_subdirectory(src) add_subdirectory(include) + + +SET(MAJOR_VERSION 1) +SET(MINOR_VERSION 0) +SET(PATCH_VERSION 0) +IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") + +INCLUDE (InstallRequiredSystemLibraries) + +SET (CPACK_SET_DESTDIR "on") +SET (CPACK_PACKAGING_INSTALL_PREFIX "/tmp") +SET (CPACK_GENERATOR "DEB") + +SET (CPACK_DEBIAN_PACKAGE_PRIORITY "extra") +SET (CPACK_DEBIAN_PACKAGE_SECTION "libs") +SET (CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) +# autogenerate dependency information +set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) + +SET (CPACK_PACKAGE_DESCRIPTION "Short description") +SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Long description") +SET (CPACK_PACKAGE_VENDOR "Titan Lien (digbil)") +SET (CPACK_PACKAGE_CONTACT "titan@digbil.com") +SET (CPACK_PACKAGE_VERSION_MAJOR "${MAJOR_VERSION}") +SET (CPACK_PACKAGE_VERSION_MINOR "${MINOR_VERSION}") +SET (CPACK_PACKAGE_VERSION_PATCH "${PATCH_VERSION}") + +SET (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}") +SET (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${MAJOR_VERSION}.${MINOR_VERSION}.${CPACK_PACKAGE_VERSION_PATCH}") + +SET (CPACK_COMPONENTS_ALL Libraries ApplicationData) +INCLUDE (CPack) +ENDIF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake") From 58c75201e1ce9352f9ca60d0836642dd4d79752d Mon Sep 17 00:00:00 2001 From: Titan Date: Mon, 2 Dec 2013 18:59:20 +0800 Subject: [PATCH 08/11] update marco of LONG --- include/xpl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xpl.h b/include/xpl.h index fc4d4df..9d6ce58 100644 --- a/include/xpl.h +++ b/include/xpl.h @@ -59,7 +59,7 @@ typedef int XplBool; #ifndef WIN32 -typedef unsigned long LONG; +typedef long LONG; #endif #ifndef FALSE From abd21e6f55cac952a9acf969fc428240519eb6f0 Mon Sep 17 00:00:00 2001 From: Titan Date: Fri, 13 Dec 2013 20:20:19 +0800 Subject: [PATCH 09/11] get 2nd element type --- example/example.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/example/example.c b/example/example.c index 12d4cca..538ea71 100644 --- a/example/example.c +++ b/example/example.c @@ -50,6 +50,11 @@ console.log(JSON.stringify(doc)); #include +WJRType +WJE_GET_TYPE(WJElement parent) +{ + return parent->child->next->type; +} int main(int argc, char **argv) { WJElement doc = NULL; @@ -81,10 +86,7 @@ int main(int argc, char **argv) { WJECloseDocument(WJEGet(doc, "shiny", NULL)); while((person = _WJEObject(doc, "crew[]", WJE_GET, &person))) { - printf("%s (%s) is %d\n", - WJEString(person, "name", WJE_GET, ""), - WJEString(person, "job", WJE_GET, ""), - 2517 - WJEInt64(person, "born", WJE_GET, 0)); + printf("person Type is %c\n", WJE_GET_TYPE(person)); } WJEDump(doc); From d32097af2cb2a2a91081edec9f0259451eb09520 Mon Sep 17 00:00:00 2001 From: Titan Date: Tue, 20 May 2014 11:57:17 +0800 Subject: [PATCH 10/11] remove the required for fuseon layout schema --- example/layout.schema | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/example/layout.schema b/example/layout.schema index 4578308..8328efb 100644 --- a/example/layout.schema +++ b/example/layout.schema @@ -7,7 +7,6 @@ "enum": [ "layout" ], - "required": true }, "headers": { "name": "headers", @@ -18,7 +17,6 @@ "required": true } }, - "required": true }, "obj": { "name": "layout", @@ -109,4 +107,4 @@ } } } -} \ No newline at end of file +} From a6c0f177d48ff8d6b9bbfac50b55f64c5805d55f Mon Sep 17 00:00:00 2001 From: Titan Date: Tue, 20 May 2014 14:39:34 +0800 Subject: [PATCH 11/11] update new schema for fuseon, #5 --- example/layout.schema | 177 ++++++++++++++++++++---------------------- 1 file changed, 85 insertions(+), 92 deletions(-) diff --git a/example/layout.schema b/example/layout.schema index 8328efb..dd11130 100644 --- a/example/layout.schema +++ b/example/layout.schema @@ -2,104 +2,97 @@ "name": "layout schema check", "type": "object", "properties": { - "type": { + "_id": { + "type": "string", + "required": true + }, + "name": { + "type": "string", + "required": true + }, + "template": { + "type": "string", + }, + "orientation": { "type": "string", "enum": [ - "layout" + "portrait", + "landscape" ], + "required": true }, - "headers": { - "name": "headers", - "type": "object", - "properties": { - "msg_id": { - "type": "string", - "required": true - } - }, + "status": { + "type": "string", + "enum": [ + "draft", + "ready" + ], + "default": "ready", + "required": true }, - "obj": { - "name": "layout", - "type": "object", - "additionalProperties": true, - "properties": { - "name": { - "type": "string", - "required": true - }, - "template": { - "type": "string", - }, - "orientation": { - "type": "string", - "enum": [ - "portrait", - "landscape" - ], - "required": true - }, - "status": { - "type": "string", - "enum": [ - "draft", - "ready" - ], - "default": "ready", - "required": true - }, - "widget": { - "type": "array", - "required": true, - "items": { - "name": "widget setting", - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "description": "Must be the widget name( package name )", - "required": true - }, - "h": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "w": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "top": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "left": { - "type": "number", - "description": " 0.0 ~ 1.0", - "required": true - }, - "param": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "required": true - }, - "val": { - "required": true - } - } + "ts": { + "type": "string", + "required": true + }, + "widgets": { + "type": "array", + "required": true, + "items": { + "name": "widget setting", + "type": "object", + "additionalProperties": false, + "properties": { + "widget": { + "type": "string", + "required": true + }, + "name": { + "type": "string", + "description": "Must be the widget name( package name )", + "required": true + }, + "h": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "w": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "top": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "left": { + "type": "number", + "description": " 0.0 ~ 1.0", + "required": true + }, + "_id": { + "type": "string", + "required": true + }, + "param": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "required": true + }, + "val": { + "required": true + }, + + "_id": { + "type": "string", + "required": true } - }, - "configurable": { - "type": "boolean", - "default": false, - "required": true } } }