log_error now trows exception, main is covering catch
This commit is contained in:
parent
fcfb85e9dc
commit
54549d36e9
@ -150,12 +150,8 @@ void logv_error(const char *format, va_list ap)
|
|||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
log_files = backup_log_files;
|
log_files = backup_log_files;
|
||||||
throw 0;
|
|
||||||
#elif defined(_MSC_VER)
|
|
||||||
_exit(EXIT_FAILURE);
|
|
||||||
#else
|
|
||||||
_Exit(EXIT_FAILURE);
|
|
||||||
#endif
|
#endif
|
||||||
|
throw log_execution_error_exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
void log(const char *format, ...)
|
void log(const char *format, ...)
|
||||||
|
@ -43,6 +43,10 @@ struct log_cmd_error_exception
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct log_execution_error_exception
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
extern std::vector<FILE *> log_files;
|
extern std::vector<FILE *> log_files;
|
||||||
extern std::vector<std::ostream *> log_streams;
|
extern std::vector<std::ostream *> log_streams;
|
||||||
extern FILE *log_errfile;
|
extern FILE *log_errfile;
|
||||||
|
@ -32,6 +32,8 @@ USING_NEXTPNR_NAMESPACE
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -113,6 +115,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
deinit_python();
|
deinit_python();
|
||||||
return rc;
|
return rc;
|
||||||
|
} catch (log_execution_error_exception) {
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
#else
|
||||||
|
_Exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
|
|
||||||
|
|
||||||
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
|
||||||
: QMainWindow(parent), ctx(_ctx)
|
: QMainWindow(parent), ctx(_ctx)
|
||||||
{
|
{
|
||||||
|
@ -17,11 +17,6 @@ void MainWindow::createMenu()
|
|||||||
menuBar->addAction(menu_Custom->menuAction());
|
menuBar->addAction(menu_Custom->menuAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::open()
|
void MainWindow::open() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainWindow::save()
|
bool MainWindow::save() { return false; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -20,8 +20,7 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
|||||||
createMenu();
|
createMenu();
|
||||||
|
|
||||||
task = new TaskManager(_ctx);
|
task = new TaskManager(_ctx);
|
||||||
connect(task, SIGNAL(log(std::string)), this,
|
connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
|
||||||
SLOT(writeInfo(std::string)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow() {}
|
MainWindow::~MainWindow() {}
|
||||||
@ -43,7 +42,4 @@ void MainWindow::open()
|
|||||||
task->parsejson(fn);
|
task->parsejson(fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool MainWindow::save()
|
bool MainWindow::save() { return false; }
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
@ -1,13 +1,13 @@
|
|||||||
#include "worker.h"
|
#include "worker.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include "bitstream.h"
|
||||||
|
#include "design_utils.h"
|
||||||
#include "jsonparse.h"
|
#include "jsonparse.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "pack.h"
|
#include "pack.h"
|
||||||
#include "pcf.h"
|
#include "pcf.h"
|
||||||
#include "place_sa.h"
|
#include "place_sa.h"
|
||||||
#include "route.h"
|
#include "route.h"
|
||||||
#include "bitstream.h"
|
|
||||||
#include "design_utils.h"
|
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
Worker::Worker(Context *_ctx) : ctx(_ctx)
|
Worker::Worker(Context *_ctx) : ctx(_ctx)
|
||||||
@ -35,7 +35,6 @@ void Worker::parsejson(const std::string &filename)
|
|||||||
Q_EMIT log("done");
|
Q_EMIT log("done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TaskManager::TaskManager(Context *ctx)
|
TaskManager::TaskManager(Context *ctx)
|
||||||
{
|
{
|
||||||
Worker *worker = new Worker(ctx);
|
Worker *worker = new Worker(ctx);
|
||||||
@ -52,7 +51,4 @@ TaskManager::~TaskManager()
|
|||||||
workerThread.wait();
|
workerThread.wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskManager::info(const std::string &result)
|
void TaskManager::info(const std::string &result) { Q_EMIT log(result); }
|
||||||
{
|
|
||||||
Q_EMIT log(result);
|
|
||||||
}
|
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef WORKER_H
|
#ifndef WORKER_H
|
||||||
#define WORKER_H
|
#define WORKER_H
|
||||||
|
|
||||||
#include "nextpnr.h"
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
#include "nextpnr.h"
|
||||||
|
|
||||||
// FIXME
|
// FIXME
|
||||||
USING_NEXTPNR_NAMESPACE
|
USING_NEXTPNR_NAMESPACE
|
||||||
@ -16,6 +16,7 @@ public Q_SLOTS:
|
|||||||
void parsejson(const std::string &filename);
|
void parsejson(const std::string &filename);
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void log(const std::string &text);
|
void log(const std::string &text);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Context *ctx;
|
Context *ctx;
|
||||||
};
|
};
|
||||||
@ -24,6 +25,7 @@ class TaskManager : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
QThread workerThread;
|
QThread workerThread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TaskManager(Context *ctx);
|
TaskManager(Context *ctx);
|
||||||
~TaskManager();
|
~TaskManager();
|
||||||
|
@ -60,6 +60,7 @@ void svg_dump_el(const GraphicElement &el)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
namespace po = boost::program_options;
|
namespace po = boost::program_options;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
std::string str;
|
std::string str;
|
||||||
@ -185,7 +186,8 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
#ifdef ICE40_HX1K_ONLY
|
#ifdef ICE40_HX1K_ONLY
|
||||||
if (chipArgs.type != ArchArgs::HX1K) {
|
if (chipArgs.type != ArchArgs::HX1K) {
|
||||||
std::cout << "This version of nextpnr-ice40 is built with HX1K-support "
|
std::cout << "This version of nextpnr-ice40 is built with "
|
||||||
|
"HX1K-support "
|
||||||
"only.\n";
|
"only.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -219,7 +221,8 @@ int main(int argc, char *argv[])
|
|||||||
std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" "
|
std::cout << "<svg xmlns=\"http://www.w3.org/2000/svg\" "
|
||||||
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
|
"xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n";
|
||||||
for (auto bel : ctx.getBels()) {
|
for (auto bel : ctx.getBels()) {
|
||||||
std::cout << "<!-- " << ctx.getBelName(bel).str(&ctx) << " -->\n";
|
std::cout << "<!-- " << ctx.getBelName(bel).str(&ctx)
|
||||||
|
<< " -->\n";
|
||||||
for (auto &el : ctx.getBelGraphics(bel))
|
for (auto &el : ctx.getBelGraphics(bel))
|
||||||
svg_dump_el(el);
|
svg_dump_el(el);
|
||||||
}
|
}
|
||||||
@ -254,15 +257,16 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (ctx.getBelType(b) == TYPE_SB_IO) {
|
if (ctx.getBelType(b) == TYPE_SB_IO) {
|
||||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_D_OUT_0));
|
dst_wires.push_back(ctx.getWireBelPin(b, PIN_D_OUT_0));
|
||||||
dst_wires.push_back(ctx.getWireBelPin(b, PIN_OUTPUT_ENABLE));
|
dst_wires.push_back(
|
||||||
|
ctx.getWireBelPin(b, PIN_OUTPUT_ENABLE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.shuffle(src_wires);
|
ctx.shuffle(src_wires);
|
||||||
ctx.shuffle(dst_wires);
|
ctx.shuffle(dst_wires);
|
||||||
|
|
||||||
for (int i = 0; i < int(src_wires.size()) && i < int(dst_wires.size());
|
for (int i = 0;
|
||||||
i++) {
|
i < int(src_wires.size()) && i < int(dst_wires.size()); i++) {
|
||||||
delay_t actual_delay;
|
delay_t actual_delay;
|
||||||
WireId src = src_wires[i], dst = dst_wires[i];
|
WireId src = src_wires[i], dst = dst_wires[i];
|
||||||
if (!get_actual_route_delay(&ctx, src, dst, actual_delay))
|
if (!get_actual_route_delay(&ctx, src, dst, actual_delay))
|
||||||
@ -284,7 +288,6 @@ int main(int argc, char *argv[])
|
|||||||
if (vm.count("json")) {
|
if (vm.count("json")) {
|
||||||
std::string filename = vm["json"].as<std::string>();
|
std::string filename = vm["json"].as<std::string>();
|
||||||
std::ifstream f(filename);
|
std::ifstream f(filename);
|
||||||
|
|
||||||
parse_json_file(f, filename, &ctx);
|
parse_json_file(f, filename, &ctx);
|
||||||
|
|
||||||
if (vm.count("pcf")) {
|
if (vm.count("pcf")) {
|
||||||
@ -330,6 +333,13 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
deinit_python();
|
deinit_python();
|
||||||
return rc;
|
return rc;
|
||||||
|
} catch (log_execution_error_exception) {
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
_exit(EXIT_FAILURE);
|
||||||
|
#else
|
||||||
|
_Exit(EXIT_FAILURE);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user