mirror of
https://github.com/YosysHQ/yosys
synced 2025-10-11 02:08:08 +00:00
Testing quoted strings
This commit is contained in:
parent
5f6819fd76
commit
5c1dd0c5b2
7 changed files with 126 additions and 0 deletions
57
tests/scripts/plugin.cc
Normal file
57
tests/scripts/plugin.cc
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include "kernel/yosys.h"
|
||||
|
||||
USING_YOSYS_NAMESPACE
|
||||
PRIVATE_NAMESPACE_BEGIN
|
||||
|
||||
struct TestArgsPass : public Pass {
|
||||
TestArgsPass() : Pass("test_args", "dummy pass to test arg parsing") {
|
||||
internal();
|
||||
}
|
||||
void execute(std::vector<std::string> args, RTLIL::Design*) override {
|
||||
int argidx;
|
||||
for (argidx = 0; argidx < GetSize(args); argidx++)
|
||||
{
|
||||
log("%s\n", args[argidx]);
|
||||
}
|
||||
}
|
||||
} TestArgsPass;
|
||||
|
||||
struct TestArgsFrontend : public Frontend {
|
||||
TestArgsFrontend() : Frontend("test_args", "dummy frontend to test arg parsing") {
|
||||
internal();
|
||||
}
|
||||
void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *) override {
|
||||
int argidx;
|
||||
log("pass: %s\n", args[0]);
|
||||
for (argidx = 1; argidx < GetSize(args); argidx++) {
|
||||
if (args[argidx] == "-arg" && argidx+1 < GetSize(args)) {
|
||||
log("arg: %s\n", args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
extra_args(f, filename, args, argidx);
|
||||
log("filename: %s\n", filename);
|
||||
}
|
||||
} TestArgsFrontend;
|
||||
|
||||
struct TestArgsBackend : public Backend {
|
||||
TestArgsBackend() : Backend("test_args", "dummy backend to test arg parsing") {
|
||||
internal();
|
||||
}
|
||||
void execute(std::ostream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *) override {
|
||||
int argidx;
|
||||
log("pass: %s\n", args[0]);
|
||||
for (argidx = 1; argidx < GetSize(args); argidx++) {
|
||||
if (args[argidx] == "-arg" && argidx+1 < GetSize(args)) {
|
||||
log("arg: %s\n", args[++argidx]);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
extra_args(f, filename, args, argidx);
|
||||
log("filename: %s\n", filename);
|
||||
}
|
||||
} TestArgsBackend;
|
||||
|
||||
PRIVATE_NAMESPACE_END
|
Loading…
Add table
Add a link
Reference in a new issue