schema compile REFACTOR schema compile context options renamed
diff --git a/src/plugins_exts.c b/src/plugins_exts.c
index e084c98..18c9250 100644
--- a/src/plugins_exts.c
+++ b/src/plugins_exts.c
@@ -36,7 +36,7 @@
API uint32_t *
lysc_ctx_get_options(const struct lysc_ctx *ctx)
{
- return &((struct lysc_ctx *)ctx)->options;
+ return &((struct lysc_ctx *)ctx)->compile_opts;
}
API const char *
diff --git a/src/schema_compile.c b/src/schema_compile.c
index f5da94c..c992a30 100644
--- a/src/schema_compile.c
+++ b/src/schema_compile.c
@@ -414,7 +414,7 @@
}
}
if (!idref || !(*idref)) {
- if (ident || (ctx->options & LYS_COMPILE_DISABLED)) {
+ if (ident || (ctx->compile_opts & LYS_COMPILE_DISABLED)) {
/* look into the parsed module to check whether the identity is not merely disabled */
LY_ARRAY_FOR(mod->parsed->identities, v) {
if (!strcmp(mod->parsed->identities[v].name, name)) {
@@ -1609,7 +1609,7 @@
/* validate non-instantiated groupings from the parsed schema,
* without it we would accept even the schemas with invalid grouping specification */
- ctx.options |= LYS_COMPILE_GROUPING;
+ ctx.compile_opts |= LYS_COMPILE_GROUPING;
LY_LIST_FOR(sp->groupings, grp) {
if (!(grp->flags & LYS_USED_GRP)) {
LY_CHECK_GOTO(ret = lys_compile_grouping(&ctx, NULL, grp), cleanup);
diff --git a/src/schema_compile.h b/src/schema_compile.h
index a842210..620c067 100644
--- a/src/schema_compile.h
+++ b/src/schema_compile.h
@@ -53,7 +53,7 @@
struct ly_set uses_rfns; /**< set of compiled non-applied uses refines (stored ::lysc_refine *) */
struct lys_glob_unres *unres; /**< global unres sets */
uint32_t path_len; /**< number of path bytes used */
- uint32_t options; /**< various @ref scflags. */
+ uint32_t compile_opts; /**< various @ref scflags. */
#define LYSC_CTX_BUFSIZE 4078
char path[LYSC_CTX_BUFSIZE];/**< Path identifying the schema node currently being processed */
};
diff --git a/src/schema_compile_amend.c b/src/schema_compile_amend.c
index aab32bb..a0047cc 100644
--- a/src/schema_compile_amend.c
+++ b/src/schema_compile_amend.c
@@ -715,10 +715,10 @@
/* config */
if (rfn->flags & LYS_CONFIG_MASK) {
- if (ctx->options & LYS_COMPILE_NO_CONFIG) {
+ if (ctx->compile_opts & LYS_COMPILE_NO_CONFIG) {
LOGWRN(ctx->ctx, "Refining config inside %s has no effect (%s).",
- (ctx->options & (LYS_IS_INPUT | LYS_IS_OUTPUT)) ? "RPC/action" :
- ctx->options & LYS_IS_NOTIF ? "notification" : "a subtree ignoring config", ctx->path);
+ (ctx->compile_opts & (LYS_IS_INPUT | LYS_IS_OUTPUT)) ? "RPC/action" :
+ ctx->compile_opts & LYS_IS_NOTIF ? "notification" : "a subtree ignoring config", ctx->path);
} else {
target->flags &= ~LYS_CONFIG_MASK;
target->flags |= rfn->flags & LYS_CONFIG_MASK;
@@ -1703,7 +1703,7 @@
struct lysc_node_notif **notifs;
ly_bool allow_mandatory = 0, enabled;
struct ly_set child_set = {0};
- uint32_t i, opt_prev = ctx->options;
+ uint32_t i, opt_prev = ctx->compile_opts;
if (!(target->nodetype & (LYS_CONTAINER | LYS_LIST | LYS_CHOICE | LYS_CASE | LYS_INPUT | LYS_OUTPUT | LYS_NOTIF))) {
LOGVAL(ctx->ctx, LYVE_REFERENCE,
@@ -1738,9 +1738,9 @@
LY_CHECK_GOTO(ret = lys_compile_node_choice_child(ctx, pnode, target, &child_set), cleanup);
} else if (target->nodetype & (LYS_INPUT | LYS_OUTPUT)) {
if (target->nodetype == LYS_INPUT) {
- ctx->options |= LYS_COMPILE_RPC_INPUT;
+ ctx->compile_opts |= LYS_COMPILE_RPC_INPUT;
} else {
- ctx->options |= LYS_COMPILE_RPC_OUTPUT;
+ ctx->compile_opts |= LYS_COMPILE_RPC_OUTPUT;
}
LY_CHECK_GOTO(ret = lys_compile_node(ctx, pnode, target, 0, &child_set), cleanup);
} else {
@@ -1750,7 +1750,7 @@
/* eval if-features again for the rest of this node processing */
LY_CHECK_GOTO(ret = lys_eval_iffeatures(ctx->ctx, pnode->iffeatures, &enabled), cleanup);
if (!enabled) {
- ctx->options |= LYS_COMPILE_DISABLED;
+ ctx->compile_opts |= LYS_COMPILE_DISABLED;
}
/* since the augment node is not present in the compiled tree, we need to pass some of its
@@ -1775,7 +1775,7 @@
ly_set_erase(&child_set, NULL);
/* restore options */
- ctx->options = opt_prev;
+ ctx->compile_opts = opt_prev;
}
actions = lysc_node_actions_p(target);
@@ -1797,7 +1797,7 @@
/* eval if-features again for the rest of this node processing */
LY_CHECK_GOTO(ret = lys_eval_iffeatures(ctx->ctx, pnode->iffeatures, &enabled), cleanup);
if (!enabled) {
- ctx->options |= LYS_COMPILE_DISABLED;
+ ctx->compile_opts |= LYS_COMPILE_DISABLED;
}
/* since the augment node is not present in the compiled tree, we need to pass some of its
@@ -1813,7 +1813,7 @@
ly_set_erase(&child_set, NULL);
/* restore options */
- ctx->options = opt_prev;
+ ctx->compile_opts = opt_prev;
}
}
if (aug_p->notifs) {
@@ -1832,7 +1832,7 @@
/* eval if-features again for the rest of this node processing */
LY_CHECK_GOTO(ret = lys_eval_iffeatures(ctx->ctx, pnode->iffeatures, &enabled), cleanup);
if (!enabled) {
- ctx->options |= LYS_COMPILE_DISABLED;
+ ctx->compile_opts |= LYS_COMPILE_DISABLED;
}
/* since the augment node is not present in the compiled tree, we need to pass some of its
@@ -1848,13 +1848,13 @@
ly_set_erase(&child_set, NULL);
/* restore options */
- ctx->options = opt_prev;
+ ctx->compile_opts = opt_prev;
}
}
cleanup:
ly_set_erase(&child_set, NULL);
- ctx->options = opt_prev;
+ ctx->compile_opts = opt_prev;
return ret;
}
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index 273023d..ee177da 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -67,7 +67,7 @@
struct lysc_unres_dflt *r = NULL;
uint32_t i;
- if (ctx->options & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING)) {
+ if (ctx->compile_opts & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING)) {
return LY_SUCCESS;
}
@@ -115,7 +115,7 @@
struct lysc_unres_dflt *r = NULL;
uint32_t i;
- if (ctx->options & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING)) {
+ if (ctx->compile_opts & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING)) {
return LY_SUCCESS;
}
@@ -279,7 +279,7 @@
*new_when = *when_c;
}
- if (!(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (!(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "when" semantics in a grouping, but repeat the check for different node because
* of dummy node check */
LY_CHECK_RET(ly_set_add(&ctx->unres->xpath, node, 0, NULL));
@@ -2333,7 +2333,7 @@
/* case never has any explicit config */
assert((node->nodetype != LYS_CASE) || !(node->flags & LYS_CONFIG_MASK));
- if (ctx->options & LYS_COMPILE_NO_CONFIG) {
+ if (ctx->compile_opts & LYS_COMPILE_NO_CONFIG) {
/* ignore config statements inside Notification/RPC/action/... data */
node->flags &= ~LYS_CONFIG_MASK;
} else if (!(node->flags & LYS_CONFIG_MASK)) {
@@ -2376,11 +2376,11 @@
LY_CHECK_RET(lys_compile_status(ctx, &node->flags, uses_status ? uses_status : (node->parent ? node->parent->flags : 0)));
/* other flags */
- if ((ctx->options & LYS_IS_INPUT) && (node->nodetype != LYS_INPUT)) {
+ if ((ctx->compile_opts & LYS_IS_INPUT) && (node->nodetype != LYS_INPUT)) {
node->flags |= LYS_IS_INPUT;
- } else if ((ctx->options & LYS_IS_OUTPUT) && (node->nodetype != LYS_OUTPUT)) {
+ } else if ((ctx->compile_opts & LYS_IS_OUTPUT) && (node->nodetype != LYS_OUTPUT)) {
node->flags |= LYS_IS_OUTPUT;
- } else if ((ctx->options & LYS_IS_NOTIF) && (node->nodetype != LYS_NOTIF)) {
+ } else if ((ctx->compile_opts & LYS_IS_NOTIF) && (node->nodetype != LYS_NOTIF)) {
node->flags |= LYS_IS_NOTIF;
}
@@ -2415,9 +2415,9 @@
/* if-features */
LY_CHECK_GOTO(ret = lys_eval_iffeatures(ctx->ctx, pnode->iffeatures, &enabled), error);
- if (!enabled && !(ctx->options & (LYS_COMPILE_NO_DISABLED | LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
+ if (!enabled && !(ctx->compile_opts & (LYS_COMPILE_NO_DISABLED | LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
ly_set_add(&ctx->unres->disabled, node, 1, NULL);
- ctx->options |= LYS_COMPILE_DISABLED;
+ ctx->compile_opts |= LYS_COMPILE_DISABLED;
}
/* config, status and other flags */
@@ -2429,7 +2429,7 @@
if ((node->flags & (LYS_CONFIG_R | LYS_IS_OUTPUT | LYS_IS_NOTIF)) && (node->flags & LYS_ORDBY_MASK)) {
LOGVRB("The ordered-by statement is ignored in lists representing %s (%s).",
(node->flags & LYS_IS_OUTPUT) ? "RPC/action output parameters" :
- (ctx->options & LYS_IS_NOTIF) ? "notification content" : "state data", ctx->path);
+ (ctx->compile_opts & LYS_IS_NOTIF) ? "notification content" : "state data", ctx->path);
node->flags &= ~LYS_ORDBY_MASK;
node->flags |= LYS_ORDBY_SYSTEM;
} else if (!(node->flags & LYS_ORDBY_MASK)) {
@@ -2494,20 +2494,20 @@
{
LY_ERR ret = LY_SUCCESS;
struct lysp_node *child_p;
- uint32_t prev_options = ctx->options;
+ uint32_t prev_options = ctx->compile_opts;
struct lysp_node_action_inout *inout_p = (struct lysp_node_action_inout *)pnode;
struct lysc_node_action_inout *inout = (struct lysc_node_action_inout *)node;
COMPILE_ARRAY_GOTO(ctx, inout_p->musts, inout->musts, lys_compile_must, ret, done);
COMPILE_EXTS_GOTO(ctx, inout_p->exts, inout->exts, inout, ret, done);
- ctx->options |= (inout_p->nodetype == LYS_INPUT) ? LYS_COMPILE_RPC_INPUT : LYS_COMPILE_RPC_OUTPUT;
+ ctx->compile_opts |= (inout_p->nodetype == LYS_INPUT) ? LYS_COMPILE_RPC_INPUT : LYS_COMPILE_RPC_OUTPUT;
LY_LIST_FOR(inout_p->child, child_p) {
LY_CHECK_GOTO(ret = lys_compile_node(ctx, child_p, node, 0, NULL), done);
}
- ctx->options = prev_options;
+ ctx->compile_opts = prev_options;
done:
return ret;
@@ -2561,7 +2561,7 @@
LY_CHECK_GOTO(ret, done);
/* do not check "must" semantics in a grouping */
- if ((action->input.musts || action->output.musts) && !(ctx->options & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
+ if ((action->input.musts || action->output.musts) && !(ctx->compile_opts & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
ret = ly_set_add(&ctx->unres->xpath, action, 0, NULL);
LY_CHECK_GOTO(ret, done);
}
@@ -2587,7 +2587,7 @@
struct lysp_node *child_p;
COMPILE_ARRAY_GOTO(ctx, notif_p->musts, notif->musts, lys_compile_must, ret, done);
- if (notif_p->musts && !(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (notif_p->musts && !(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "must" semantics in a grouping */
ret = ly_set_add(&ctx->unres->xpath, notif, 0, NULL);
LY_CHECK_GOTO(ret, done);
@@ -2634,7 +2634,7 @@
}
COMPILE_ARRAY_GOTO(ctx, cont_p->musts, cont->musts, lys_compile_must, ret, done);
- if (cont_p->musts && !(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (cont_p->musts && !(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "must" semantics in a grouping */
ret = ly_set_add(&ctx->unres->xpath, cont, 0, NULL);
LY_CHECK_GOTO(ret, done);
@@ -2675,10 +2675,10 @@
LY_CHECK_RET(lysc_unres_leaf_dflt_add(ctx, leaf, dflt));
}
- if ((leaf->type->basetype == LY_TYPE_LEAFREF) && !(ctx->options & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
+ if ((leaf->type->basetype == LY_TYPE_LEAFREF) && !(ctx->compile_opts & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
/* store to validate the path in the current context at the end of schema compiling when all the nodes are present */
LY_CHECK_RET(ly_set_add(&ctx->unres->leafrefs, leaf, 0, NULL));
- } else if ((leaf->type->basetype == LY_TYPE_UNION) && !(ctx->options & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
+ } else if ((leaf->type->basetype == LY_TYPE_UNION) && !(ctx->compile_opts & (LYS_COMPILE_DISABLED | LYS_COMPILE_GROUPING))) {
LY_ARRAY_COUNT_TYPE u;
LY_ARRAY_FOR(((struct lysc_type_union *)leaf->type)->types, u) {
if (((struct lysc_type_union *)leaf->type)->types[u]->basetype == LY_TYPE_LEAFREF) {
@@ -2712,7 +2712,7 @@
LY_ERR ret = LY_SUCCESS;
COMPILE_ARRAY_GOTO(ctx, leaf_p->musts, leaf->musts, lys_compile_must, ret, done);
- if (leaf_p->musts && !(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (leaf_p->musts && !(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "must" semantics in a grouping */
ret = ly_set_add(&ctx->unres->xpath, leaf, 0, NULL);
LY_CHECK_GOTO(ret, done);
@@ -2759,7 +2759,7 @@
LY_ERR ret = LY_SUCCESS;
COMPILE_ARRAY_GOTO(ctx, llist_p->musts, llist->musts, lys_compile_must, ret, done);
- if (llist_p->musts && !(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (llist_p->musts && !(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "must" semantics in a grouping */
ret = ly_set_add(&ctx->unres->xpath, llist, 0, NULL);
LY_CHECK_GOTO(ret, done);
@@ -3071,7 +3071,7 @@
}
COMPILE_ARRAY_GOTO(ctx, list_p->musts, list->musts, lys_compile_must, ret, done);
- if (list_p->musts && !(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (list_p->musts && !(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "must" semantics in a grouping */
LY_CHECK_RET(ly_set_add(&ctx->unres->xpath, list, 0, NULL));
}
@@ -3384,7 +3384,7 @@
LY_ERR ret = LY_SUCCESS;
COMPILE_ARRAY_GOTO(ctx, any_p->musts, any->musts, lys_compile_must, ret, done);
- if (any_p->musts && !(ctx->options & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
+ if (any_p->musts && !(ctx->compile_opts & (LYS_COMPILE_GROUPING | LYS_COMPILE_DISABLED))) {
/* do not check "must" semantics in a grouping */
ret = ly_set_add(&ctx->unres->xpath, any, 0, NULL);
LY_CHECK_GOTO(ret, done);
@@ -3545,7 +3545,7 @@
return LY_EVALID;
}
- if (!(ctx->options & LYS_COMPILE_GROUPING)) {
+ if (!(ctx->compile_opts & LYS_COMPILE_GROUPING)) {
/* remember that the grouping is instantiated to avoid its standalone validation */
grp->flags |= LYS_USED_GRP;
}
@@ -3822,7 +3822,7 @@
{
LY_ERR ret = LY_SUCCESS;
struct lysc_node *node = NULL;
- uint32_t prev_opts = ctx->options;
+ uint32_t prev_opts = ctx->compile_opts;
LY_ERR (*node_compile_spec)(struct lysc_ctx *, struct lysp_node *, struct lysc_node *);
@@ -3865,26 +3865,26 @@
break;
case LYS_RPC:
case LYS_ACTION:
- if (ctx->options & (LYS_IS_INPUT | LYS_IS_OUTPUT | LYS_IS_NOTIF)) {
+ if (ctx->compile_opts & (LYS_IS_INPUT | LYS_IS_OUTPUT | LYS_IS_NOTIF)) {
LOGVAL(ctx->ctx, LYVE_SEMANTICS,
"Action \"%s\" is placed inside %s.", pnode->name,
- (ctx->options & LYS_IS_NOTIF) ? "notification" : "another RPC/action");
+ (ctx->compile_opts & LYS_IS_NOTIF) ? "notification" : "another RPC/action");
return LY_EVALID;
}
node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_action));
node_compile_spec = lys_compile_node_action;
- ctx->options |= LYS_COMPILE_NO_CONFIG;
+ ctx->compile_opts |= LYS_COMPILE_NO_CONFIG;
break;
case LYS_NOTIF:
- if (ctx->options & (LYS_IS_INPUT | LYS_IS_OUTPUT | LYS_IS_NOTIF)) {
+ if (ctx->compile_opts & (LYS_IS_INPUT | LYS_IS_OUTPUT | LYS_IS_NOTIF)) {
LOGVAL(ctx->ctx, LYVE_SEMANTICS,
"Notification \"%s\" is placed inside %s.", pnode->name,
- (ctx->options & LYS_IS_NOTIF) ? "another notification" : "RPC/action");
+ (ctx->compile_opts & LYS_IS_NOTIF) ? "another notification" : "RPC/action");
return LY_EVALID;
}
node = (struct lysc_node *)calloc(1, sizeof(struct lysc_node_notif));
node_compile_spec = lys_compile_node_notif;
- ctx->options |= LYS_COMPILE_NOTIFICATION;
+ ctx->compile_opts |= LYS_COMPILE_NOTIFICATION;
break;
case LYS_USES:
ret = lys_compile_uses(ctx, (struct lysp_node_uses *)pnode, parent, child_set);
@@ -3899,7 +3899,7 @@
ret = lys_compile_node_(ctx, pnode, parent, uses_status, node_compile_spec, node, child_set);
- ctx->options = prev_opts;
+ ctx->compile_opts = prev_opts;
lysc_update_path(ctx, NULL, NULL);
return ret;
}