Bindings V2: reintroduce field 'info' for verbs
[src/app-framework-binder.git] / src / genskel / genskel.c
index 7b7dafa..d3d121f 100644 (file)
@@ -64,14 +64,15 @@ struct path
 struct json_object *root = NULL;
 struct json_object *d_perms = NULL;
 struct json_object *a_perms = NULL;
+const char *preinit = NULL;
 const char *init = NULL;
-const char *start = NULL;
 const char *onevent = NULL;
 const char *api = NULL;
 const char *scope = NULL;
 const char *prefix = NULL;
 const char *postfix = NULL;
 int priv = -1;
+int noconc = -1;
 
 /**
  * Search for a reference of type "#/a/b/c" int the
@@ -441,7 +442,7 @@ void print_session(struct json_object *p)
        s = p ? get_session(p) : 0;
        c = 1;
        if (s & SESSION_CHECK) {
-               printf("%s", "|AFB_SESSION_CHECK" + c);
+               printf("%s", "|AFB_SESSION_CHECK_V2" + c);
                c = 0;
        }
        if (s & SESSION_LOA_3 & ~SESSION_LOA_2)
@@ -453,19 +454,19 @@ void print_session(struct json_object *p)
        else
                l = 0;
        if (l) {
-               printf("%s%d", "|AFB_SESSION_LOA_GE_" + c, l);
+               printf("%s%d_V2", "|AFB_SESSION_LOA_" + c, l);
                c = 0;
        }
        if (s & SESSION_CLOSE) {
-               printf("%s", "|AFB_SESSION_CLOSE" + c);
+               printf("%s", "|AFB_SESSION_CLOSE_V2" + c);
                c = 0;
        }
        if (s & SESSION_RENEW) {
-               printf("%s", "|AFB_SESSION_RENEW" + c);
+               printf("%s", "|AFB_SESSION_REFRESH_V2" + c);
                c = 0;
        }
        if (c)
-               printf("AFB_SESSION_NONE");
+               printf("AFB_SESSION_NONE_V2");
 }
 
 void print_verb(const char *name)
@@ -495,6 +496,7 @@ void print_struct_verb(const char *name, struct json_object *obj)
        printf(
                ",\n"
                "        .auth = %s,\n"
+               "        .info = NULL,\n"
                "        .session = "
                , p ? json_object_get_string(decl_perm(p)) : "NULL"
        );
@@ -586,13 +588,14 @@ void process(char *filename)
 
        /* get some names */
        getvar(&api, "#/info/x-binding-c-generator/api", NULL);
+       getvar(&preinit, "#/info/x-binding-c-generator/preinit", NULL);
        getvar(&init, "#/info/x-binding-c-generator/init", NULL);
-       getvar(&start, "#/info/x-binding-c-generator/start", NULL);
        getvar(&onevent, "#/info/x-binding-c-generator/onevent", NULL);
        getvar(&scope, "#/info/x-binding-c-generator/scope", "static");
        getvar(&prefix, "#/info/x-binding-c-generator/prefix", "afb_verb_");
        getvar(&postfix, "#/info/x-binding-c-generator/postfix", "_cb");
        getvarbool(&priv, "#/info/x-binding-c-generator/private", 0);
+       getvarbool(&noconc, "#/info/x-binding-c-generator/noconcurrency", 0);
        getvar(&api, "#/info/title", "?");
 
        /* get the API name */
@@ -622,10 +625,12 @@ void process(char *filename)
                "%sconst struct afb_binding_v2 %s%s = {\n"
                "    .api = \"%s\",\n"
                "    .specification = _afb_description_v2_%s,\n"
+               "    .info = NULL,\n"
                "    .verbs = _afb_verbs_v2_%s,\n"
+               "    .preinit = %s,\n"
                "    .init = %s,\n"
-               "    .start = %s,\n"
                "    .onevent = %s,\n"
+               "    .noconcurrency = %d\n"
                "};\n"
                "\n"
                , priv ? "static " : ""
@@ -634,9 +639,10 @@ void process(char *filename)
                , api
                , api
                , api
+               , preinit ?: "NULL"
                , init ?: "NULL"
-               , start ?: "NULL"
                , onevent ?: "NULL"
+               , !!noconc
        );
 
        /* clean up */