mirror of
https://github.com/YosysHQ/yosys
synced 2025-08-08 20:21:25 +00:00
Changed frontend-api from FILE to std::istream
This commit is contained in:
parent
5dce303a2a
commit
19cff41eb4
22 changed files with 116 additions and 89 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue