diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/command.cc | 21 | ||||
-rw-r--r-- | common/command.h | 2 |
2 files changed, 14 insertions, 9 deletions
diff --git a/common/command.cc b/common/command.cc index 27e59260..3341b521 100644 --- a/common/command.cc +++ b/common/command.cc @@ -473,19 +473,24 @@ int CommandHandler::exec() } } -std::unique_ptr<Context> CommandHandler::load_json(std::string filename) +void CommandHandler::load_json(Context *ctx, std::string filename) { - dict<std::string, Property> values; - std::unique_ptr<Context> ctx = createContext(values); - setupContext(ctx.get()); - setupArchContext(ctx.get()); + ctx->cells.clear(); + ctx->nets.clear(); + ctx->net_aliases.clear(); + ctx->ports.clear(); + ctx->hierarchy.clear(); + ctx->settings.erase(ctx->id("pack")); + ctx->settings.erase(ctx->id("place")); + ctx->settings.erase(ctx->id("route")); + + setupContext(ctx); + setupArchContext(ctx); { std::ifstream f(filename); - if (!parse_json(f, filename, ctx.get())) + if (!parse_json(f, filename, ctx)) log_error("Loading design failed.\n"); } - customAfterLoad(ctx.get()); - return ctx; } void CommandHandler::clear() { vm.clear(); } diff --git a/common/command.h b/common/command.h index ba606ea2..c82bcd3a 100644 --- a/common/command.h +++ b/common/command.h @@ -37,7 +37,7 @@ class CommandHandler virtual ~CommandHandler(){}; int exec(); - std::unique_ptr<Context> load_json(std::string filename); + void load_json(Context *ctx, std::string filename); void clear(); protected: |