You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2015/10/13 12:22:09 UTC
[41/50] [abbrv] celix git commit: CELIX-237: Added support for
boolean (Z)
CELIX-237: Added support for boolean (Z)
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/8248c2c1
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/8248c2c1
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/8248c2c1
Branch: refs/heads/develop
Commit: 8248c2c1d8d812ae0ad645505bc55941d7ad86aa
Parents: d340898
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Wed Sep 23 14:51:27 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Wed Sep 23 14:51:27 2015 +0200
----------------------------------------------------------------------
.../dynamic_function_interface/dyn_type.c | 3 +++
.../dynamic_function_interface/json_serializer.c | 13 ++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/8248c2c1/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
index de00784..88f8766 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.c
@@ -825,6 +825,9 @@ ffi_type *dynType_ffiType(dyn_type *type) {
static ffi_type * dynType_ffiTypeFor(int c) {
ffi_type *type = NULL;
switch (c) {
+ case 'Z' :
+ type = &ffi_type_uint8;
+ break;
case 'F' :
type = &ffi_type_float;
break;
http://git-wip-us.apache.org/repos/asf/celix/blob/8248c2c1/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
index eb38dbc..ae1b95b 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
@@ -126,6 +126,7 @@ static int jsonSerializer_parseAny(dyn_type *type, void *loc, json_t *val) {
printf("\n");
*/
+ bool *z; //Z
float *f; //F
double *d; //D
char *b; //B
@@ -139,6 +140,10 @@ static int jsonSerializer_parseAny(dyn_type *type, void *loc, json_t *val) {
uint64_t *ul; //j
switch (c) {
+ case 'Z' :
+ z = loc;
+ *z = (bool) json_is_true(val);
+ break;
case 'F' :
f = loc;
*f = (float) json_real_value(val);
@@ -277,6 +282,7 @@ static int jsonSerializer_writeAny(dyn_type *type, void *input, json_t **out) {
json_t *val = NULL;
dyn_type *subType = NULL;
+ bool *z; //Z
float *f; //F
double *d; //D
char *b; //B
@@ -290,6 +296,10 @@ static int jsonSerializer_writeAny(dyn_type *type, void *input, json_t **out) {
uint64_t *ul; //j
switch (descriptor) {
+ case 'Z' :
+ z = input;
+ val = json_boolean((bool)*z);
+ break;
case 'B' :
b = input;
val = json_integer((json_int_t)*b);
@@ -438,4 +448,5 @@ static int jsonSerializer_writeComplex(dyn_type *type, void *input, json_t **out
}
return status;
-}
\ No newline at end of file
+}
+