summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
b6ad3eb)
Also make correct strings
Change-Id: Iac63fb8202c115458910ca1ec42fbca9872df9f8
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
const char *scope = NULL;
const char *prefix = NULL;
const char *postfix = NULL;
const char *scope = NULL;
const char *prefix = NULL;
const char *postfix = NULL;
/**
* Search for a reference of type "#/a/b/c" int the
/**
* Search for a reference of type "#/a/b/c" int the
const char *a, *b;
char *desc, c, buf[3];
size_t len;
const char *a, *b;
char *desc, c, buf[3];
size_t len;
a = b = json_object_to_json_string_ext(root, 0);
len = 1;
a = b = json_object_to_json_string_ext(root, 0);
len = 1;
buf[0] = c;
buf[1] = 0;
}
buf[0] = c;
buf[1] = 0;
}
desc[len++] = '"';
desc[len++] = '\n';
pos = 0;
desc[len++] = '"';
desc[len++] = '\n';
pos = 0;
desc[len++] = '"';
pos = 5;
}
desc[len++] = '"';
pos = 5;
}
- desc[len++] = buf[i++];
+ c = buf[i++];
+ desc[len++] = c;
+ e = !e && c == '\\';
+void getvarbool(int *var, const char *path, int defval)
+{
+ struct json_object *o;
+
+ if (*var != 0 && *var != 1) {
+ o = search(path);
+ if (o && json_object_is_type(o, json_type_boolean))
+ *var = json_object_get_boolean(o);
+ else
+ *var = !!defval;
+ }
+}
+
void getvar(const char **var, const char *path, const char *defval)
{
struct json_object *o;
void getvar(const char **var, const char *path, const char *defval)
{
struct json_object *o;
getvar(&scope, "#/meta-binding/scope", "static");
getvar(&prefix, "#/meta-binding/prefix", "afb_verb_");
getvar(&postfix, "#/meta-binding/postfix", "_cb");
getvar(&scope, "#/meta-binding/scope", "static");
getvar(&prefix, "#/meta-binding/prefix", "afb_verb_");
getvar(&postfix, "#/meta-binding/postfix", "_cb");
+ getvarbool(&priv, "#/meta-binding/private", 0);
/* get the API name */
printf(
/* get the API name */
printf(
" { .verb = NULL }\n"
"};\n"
"\n"
" { .verb = NULL }\n"
"};\n"
"\n"
- "const struct afb_binding_v2 afbBindingV2 = {\n"
+ "%sconst struct afb_binding_v2 %s = {\n"
" .api = \"%s\",\n"
" .specification = _afb_description_v2_,\n"
" .verbs = _afb_verbs_v2_,\n"
" .api = \"%s\",\n"
" .specification = _afb_description_v2_,\n"
" .verbs = _afb_verbs_v2_,\n"
" .onevent = %s,\n"
"};\n"
"\n"
" .onevent = %s,\n"
"};\n"
"\n"
+ , priv?"static ":"", priv?"_afb_binding_v2_":"afbBindingV2"
, api?:"?", init?:"NULL", start?:"NULL", onevent?:"NULL"
);
, api?:"?", init?:"NULL", start?:"NULL", onevent?:"NULL"
);