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