diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-08-23 15:03:55 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-08-23 15:03:55 +0200 |
commit | 19cff41eb4261b20374058f16807a229af46f304 (patch) | |
tree | 10cdd990dfbba21e7851127fca75de4c74cdd274 /frontends/ilang | |
parent | 5dce303a2a2c27d50e99856b6f33467798e13020 (diff) | |
download | yosys-19cff41eb4261b20374058f16807a229af46f304.tar.gz yosys-19cff41eb4261b20374058f16807a229af46f304.tar.bz2 yosys-19cff41eb4261b20374058f16807a229af46f304.zip |
Changed frontend-api from FILE to std::istream
Diffstat (limited to 'frontends/ilang')
-rw-r--r-- | frontends/ilang/ilang_frontend.cc | 5 | ||||
-rw-r--r-- | frontends/ilang/ilang_frontend.h | 5 | ||||
-rw-r--r-- | frontends/ilang/lexer.l | 5 | ||||
-rw-r--r-- | frontends/ilang/parser.y | 1 |
4 files changed, 10 insertions, 6 deletions
diff --git a/frontends/ilang/ilang_frontend.cc b/frontends/ilang/ilang_frontend.cc index 2d4b99c52..f6f926db1 100644 --- a/frontends/ilang/ilang_frontend.cc +++ b/frontends/ilang/ilang_frontend.cc @@ -45,15 +45,16 @@ struct IlangFrontend : public Frontend { log("representation of a design in yosys's internal format.)\n"); log("\n"); } - virtual void execute(FILE *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) + virtual void execute(std::istream *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design) { log_header("Executing ILANG frontend.\n"); extra_args(f, filename, args, 1); log("Input filename: %s\n", filename.c_str()); + ILANG_FRONTEND::lexin = f; ILANG_FRONTEND::current_design = design; rtlil_frontend_ilang_yydebug = false; - rtlil_frontend_ilang_yyrestart(f); + rtlil_frontend_ilang_yyrestart(NULL); rtlil_frontend_ilang_yyparse(); rtlil_frontend_ilang_yylex_destroy(); } diff --git a/frontends/ilang/ilang_frontend.h b/frontends/ilang/ilang_frontend.h index 317ec0d51..b04d6c512 100644 --- a/frontends/ilang/ilang_frontend.h +++ b/frontends/ilang/ilang_frontend.h @@ -26,12 +26,11 @@ #define ILANG_FRONTEND_H #include "kernel/yosys.h" -#include <stdio.h> YOSYS_NAMESPACE_BEGIN namespace ILANG_FRONTEND { - void ilang_frontend(FILE *f, RTLIL::Design *design); + extern std::istream *lexin; extern RTLIL::Design *current_design; } @@ -42,7 +41,7 @@ int rtlil_frontend_ilang_yylex(void); void rtlil_frontend_ilang_yyerror(char const *s); void rtlil_frontend_ilang_yyrestart(FILE *f); int rtlil_frontend_ilang_yyparse(void); -void rtlil_frontend_ilang_yylex_destroy(void); +int rtlil_frontend_ilang_yylex_destroy(void); int rtlil_frontend_ilang_yyget_lineno(void); #endif diff --git a/frontends/ilang/lexer.l b/frontends/ilang/lexer.l index f3bdeb1a4..4109cd4bc 100644 --- a/frontends/ilang/lexer.l +++ b/frontends/ilang/lexer.l @@ -29,9 +29,12 @@ #pragma clang diagnostic ignored "-Wdeprecated-register" #endif -#include "kernel/rtlil.h" +#include "ilang_frontend.h" #include "parser.tab.h" +#define YY_INPUT(buf,result,max_size) \ + result = ILANG_FRONTEND::lexin->readsome(buf, max_size); + %} %option yylineno diff --git a/frontends/ilang/parser.y b/frontends/ilang/parser.y index e1ef39a55..a5cc06898 100644 --- a/frontends/ilang/parser.y +++ b/frontends/ilang/parser.y @@ -27,6 +27,7 @@ #include "ilang_frontend.h" YOSYS_NAMESPACE_BEGIN namespace ILANG_FRONTEND { + std::istream *lexin; RTLIL::Design *current_design; RTLIL::Module *current_module; RTLIL::Wire *current_wire; |