clangformat

This commit is contained in:
Miodrag Milanovic 2018-08-08 18:17:34 +02:00
parent ecc21caa77
commit fc5cee6fb8
11 changed files with 31 additions and 34 deletions

View File

@ -35,8 +35,8 @@
#include "design_utils.h"
#include "jsonparse.h"
#include "log.h"
#include "timing.h"
#include "version.h"
#include <timing.h>
NEXTPNR_NAMESPACE_BEGIN
@ -244,7 +244,7 @@ int CommandHandler::exec()
if (executeBeforeContext())
return 0;
std::unique_ptr<Context> ctx;
if (vm.count("load")) {
ctx = project.load(vm["load"].as<std::string>());

View File

@ -17,12 +17,12 @@
*
*/
#include "project.h"
#include <boost/filesystem/convenience.hpp>
#include <boost/property_tree/json_parser.hpp>
#include "project.h"
#include "log.h"
#include "jsonparse.h"
#include <fstream>
#include "jsonparse.h"
#include "log.h"
NEXTPNR_NAMESPACE_BEGIN
@ -34,10 +34,10 @@ void ProjectHandler::save(Context *ctx, std::string filename)
root.put("project.name", boost::filesystem::basename(filename));
root.put("project.arch.name", ctx->archId().c_str(ctx));
root.put("project.arch.type", ctx->archArgsToId(ctx->archArgs()).c_str(ctx));
/* root.put("project.input.json", );*/
/* root.put("project.input.json", );*/
root.put("project.params.freq", int(ctx->target_freq / 1e6));
root.put("project.params.seed", ctx->rngstate);
saveArch(ctx,root);
saveArch(ctx, root);
pt::write_json(f, root);
}
@ -55,7 +55,6 @@ std::unique_ptr<Context> ProjectHandler::load(std::string filename)
if (version != 1)
log_error("Wrong project format version.\n");
ctx = createContext(root);
std::string arch_name = root.get<std::string>("project.arch.name");
@ -77,7 +76,7 @@ std::unique_ptr<Context> ProjectHandler::load(std::string filename)
if (params.count("seed"))
ctx->rngseed(params.get<uint64_t>("seed"));
}
loadArch(ctx.get(),root, proj.parent_path().string());
loadArch(ctx.get(), root, proj.parent_path().string());
} catch (...) {
log_error("Error loading project file.\n");
}

View File

@ -17,11 +17,11 @@
*
*/
#include "project.h"
#include <boost/filesystem/convenience.hpp>
#include <boost/property_tree/json_parser.hpp>
#include "project.h"
#include "log.h"
#include <fstream>
#include "log.h"
NEXTPNR_NAMESPACE_BEGIN
@ -50,8 +50,6 @@ std::unique_ptr<Context> ProjectHandler::createContext(pt::ptree &root)
return std::unique_ptr<Context>(new Context(chipArgs));
}
void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path)
{
}
void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) {}
NEXTPNR_NAMESPACE_END

View File

@ -17,16 +17,14 @@
*
*/
#include <boost/filesystem/convenience.hpp>
#include "project.h"
#include "log.h"
#include <boost/filesystem/convenience.hpp>
#include <fstream>
#include "log.h"
NEXTPNR_NAMESPACE_BEGIN
void ProjectHandler::saveArch(Context *ctx, pt::ptree &root)
{
}
void ProjectHandler::saveArch(Context *ctx, pt::ptree &root) {}
std::unique_ptr<Context> ProjectHandler::createContext(pt::ptree &root)
{
@ -34,8 +32,6 @@ std::unique_ptr<Context> ProjectHandler::createContext(pt::ptree &root)
return std::unique_ptr<Context>(new Context(chipArgs));
}
void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path)
{
}
void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path) {}
NEXTPNR_NAMESPACE_END

View File

@ -463,5 +463,4 @@ void BaseMainWindow::save_proj()
}
}
NEXTPNR_NAMESPACE_END

View File

@ -49,6 +49,7 @@ class BaseMainWindow : public QMainWindow
virtual ~BaseMainWindow();
Context *getContext() { return ctx.get(); }
void updateJsonLoaded();
protected:
void createMenusAndBars();
void disableActions();

View File

@ -29,7 +29,8 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
NEXTPNR_NAMESPACE_BEGIN
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent) : BaseMainWindow(std::move(context), args, parent)
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent)
: BaseMainWindow(std::move(context), args, parent)
{
initMainResource();
@ -50,7 +51,8 @@ void MainWindow::newContext(Context *ctx)
setWindowTitle(title.c_str());
}
void MainWindow::createMenu() {
void MainWindow::createMenu()
{
// Add arch specific actions
actionLoadBase = new QAction("Open Base Config", this);
actionLoadBase->setIcon(QIcon(":/icons/resources/open_base.png"));
@ -71,7 +73,7 @@ void MainWindow::createMenu() {
menuDesign->addSeparator();
menuDesign->addAction(actionLoadBase);
menuDesign->addAction(actionSaveConfig);
menuDesign->addAction(actionSaveConfig);
}
static const ChipInfoPOD *get_chip_info(const RelPtr<ChipInfoPOD> *ptr) { return ptr->get(); }
@ -96,8 +98,8 @@ static QStringList getSupportedPackages(ArchArgs::ArchArgsTypes chip)
return packages;
}
void MainWindow::new_proj() {
void MainWindow::new_proj()
{
QMap<QString, int> arch;
arch.insert("Lattice ECP5 25K", ArchArgs::LFE5U_25F);
arch.insert("Lattice ECP5 45K", ArchArgs::LFE5U_45F);

View File

@ -47,6 +47,7 @@ class MainWindow : public BaseMainWindow
void newContext(Context *ctx);
void open_base();
void save_config();
private:
QAction *actionLoadBase;
QAction *actionSaveConfig;

View File

@ -23,7 +23,8 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
NEXTPNR_NAMESPACE_BEGIN
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent) : BaseMainWindow(std::move(context), args, parent)
MainWindow::MainWindow(std::unique_ptr<Context> context, ArchArgs args, QWidget *parent)
: BaseMainWindow(std::move(context), args, parent)
{
initMainResource();

View File

@ -24,12 +24,12 @@
#include <QIcon>
#include <QInputDialog>
#include <QLineEdit>
#include <fstream>
#include "bitstream.h"
#include "design_utils.h"
#include "jsonparse.h"
#include "log.h"
#include "pcf.h"
#include <fstream>
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }

View File

@ -17,10 +17,10 @@
*
*/
#include <boost/filesystem/convenience.hpp>
#include "project.h"
#include "log.h"
#include <boost/filesystem/convenience.hpp>
#include <fstream>
#include "log.h"
#include "pcf.h"
NEXTPNR_NAMESPACE_BEGIN
@ -28,7 +28,7 @@ NEXTPNR_NAMESPACE_BEGIN
void ProjectHandler::saveArch(Context *ctx, pt::ptree &root)
{
root.put("project.arch.package", ctx->archArgs().package);
// if(!pcfFilename.empty())
// if(!pcfFilename.empty())
// root.put("project.input.pcf", pcfFilename);
}
@ -62,7 +62,7 @@ std::unique_ptr<Context> ProjectHandler::createContext(pt::ptree &root)
void ProjectHandler::loadArch(Context *ctx, pt::ptree &root, std::string path)
{
auto input = root.get_child("project").get_child("input");
boost::filesystem::path pcf = boost::filesystem::path(path) / input.get<std::string>("pcf");
boost::filesystem::path pcf = boost::filesystem::path(path) / input.get<std::string>("pcf");
std::ifstream f(pcf.string());
if (!apply_pcf(ctx, f))
log_error("Loading PCF failed.\n");