static void elab_copy_context(tree_t src, const elab_ctx_t *ctx) { const int nsrc = tree_contexts(src); for (int i = 0; i < nsrc; i++) { tree_t c = tree_context(src, i); if (tree_kind(c) == T_USE) elab_use_clause(c, ctx); } }
static bool elab_have_context(tree_t unit, ident_t name) { const int ndest = tree_contexts(unit); for (int i = 0; i < ndest; i++) { tree_t c2 = tree_context(unit, i); if (tree_kind(c2) != T_USE) continue; if (tree_ident(c2) == name) return true; } return false; }
static void elab_pseudo_context(tree_t out, tree_t src) { // Add a pseudo use clause for an entity or architecture so the // makefile generator can find the dependencies ident_t name = tree_ident(src); const int nctx = tree_contexts(out); for (int i = 0; i < nctx; i++) { tree_t c = tree_context(out, i); if (tree_kind(c) != T_USE) continue; else if (tree_ident(c) == name) return; } tree_t c = tree_new(T_USE); tree_set_ident(c, name); tree_add_context(out, c); }
static void elab_copy_context(tree_t src, const elab_ctx_t *ctx) { const int nsrc = tree_contexts(src); for (int i = 0; i < nsrc; i++) { tree_t c = tree_context(src, i); if (tree_kind(c) != T_USE) continue; tree_set_ident2(c, all_i); ident_t name = tree_ident(c); ident_t lname = ident_until(name, '.'); elab_ctx_t new_ctx = *ctx; new_ctx.library = elab_find_lib(lname, ctx); if (name == lname) lib_walk_index(new_ctx.library, elab_context_walk_fn, &new_ctx); else if (!elab_have_context(ctx->out, name)) elab_add_context(c, &new_ctx); } }