Exemplo n.º 1
0
Arquivo: te.c Projeto: thigley/THOS
static void editfile(char *filename){
	int mode = 0; //1 edit mode
	printbuffer();
	int location = k_strlen(file_buffer);
	typeTeBottom();
	while(1){
		if(mode){
			if(!newInput()) continue;
			char next = getchar();
			if(next==27) { mode =0;
				typeTeBottom();
				continue;
			}
			if(next==0) continue;
			if(next!='\b') file_buffer[location++]=next;
			else file_buffer[--location]=0;
			clearScreen();
			printbuffer();
		} else{
			if(!newInput()) continue;
			char next = getchar();
			if(next=='q') break;
			else if(next=='w') createorreplacefile(filename, file_buffer);
			else if(next=='e') { mode = 1; clearScreen(); printbuffer();}
		}
	}
}
    void NetworkContainerCombiner::activate(const vector<double>& input, vector<double>& output)
    {
        if (networkContainers.size() == 0)
            LOG(FATAL) << "Trying to activate empty container!";

        const uint indepInputs = totalNumInputs
                - (networkContainers[0]->getOutputsPerNetwork() * networkContainers.size());
        vector<double> newInput(indepInputs);

        newInput.assign(input.begin(), input.begin() + indepInputs);

        vector<double> tempSingleOutputs(newInput);

        const int k = networkContainers[0]->getInputsPerNetwork();
        const int l = input.size() / networkContainers.size();
        const int m = networkContainers[0]->getOutputsPerNetwork();

        if (k + 1 != l) {
            LOG(ERROR) << "Input size doesn't match!";
        }

        for (uint i = 0; i < networkContainers.size(); i++) {
            vector<double> tempOutput = vector<double>(m);
            vector<double> tempInput = vector<double>();
            for (int j = 0; j < k; j++) {
                tempInput.push_back(input[l * i + j]);
            }
            networkContainers[i]->activate(tempInput, tempOutput);
            tempSingleOutputs.insert(tempSingleOutputs.end(), tempOutput.begin(), tempOutput.end());
        }

        // Finally there is always one network
        combinerNetwork->activate(tempSingleOutputs, output);
    }
Exemplo n.º 3
0
NewFilterDialog::NewFilterDialog(QWidget *parent) : QDialog(parent)
{
  m_Ui.setupUi(this);
  connect(m_Ui.pushButtonDelete, SIGNAL(clicked()), this, SLOT(deleteInput()));
  connect(m_Ui.pushButtonEdit, SIGNAL(clicked()), this, SLOT(editInput()));
  connect(m_Ui.pushButtonNew, SIGNAL(clicked()), this, SLOT(newInput()));
}
Exemplo n.º 4
0
void NewFsm::connections() {
	connect(newinput, SIGNAL(clicked()), this, SLOT(newInput()));
	connect(newoutput, SIGNAL(clicked()), this, SLOT(newOutput()));
	connect(deleteinput, SIGNAL(clicked()), this, SLOT(deleteInput()));
	connect(deleteoutput, SIGNAL(clicked()), this, SLOT(deleteOutput()));
	connect(inputup, SIGNAL(clicked()), this, SLOT(moveInputUp()));
	connect(outputup, SIGNAL(clicked()), this, SLOT(moveOutputUp()));
	connect(inputdown, SIGNAL(clicked()), this, SLOT(moveInputDown()));
	connect(outputdown, SIGNAL(clicked()), this, SLOT(moveOutputDown()));
}
Exemplo n.º 5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    QObject::connect(ui->open_rom, &QAction::triggered, this, &MainWindow::handle_open_rom);
    QObject::connect(ui->configure_input, &QAction::triggered, this, &MainWindow::handle_configure_input);
    QObject::connect(&gb_, &GameboyGui::frameReady, ui->gameboywidget, &GameboyWidget::updateImage);
    QObject::connect(ui->gameboywidget, SIGNAL(newInput(uint8_t)), &gb_, SLOT(handleNewInput(uint8_t)));
    QObject::connect(ui->exit, &QAction::triggered, QApplication::instance(), &QCoreApplication::quit);
    ui->gameboywidget->setFocus();
}
Exemplo n.º 6
0
    Console::Console(Device* d, QWidget* window_parent){
        this->d = d;
	
        console_window = new ConsoleWindow(window_parent);

        // link returnPressed with newInput

        QObject::connect(console_window, SIGNAL( returnPressed() ),
                         this, SLOT(newInput() ) );

        QObject::connect(this, SIGNAL( clearLine() ),
                         console_window, SLOT( clear() ));
    }
Exemplo n.º 7
0
void InputWidget::createActions() {

    //-- Rename input
    renameAction = new QAction(this);
    renameAction->setObjectName(QString::fromUtf8("rename"));
    renameAction->setEnabled(true);
    renameAction->setText(QApplication::translate("InputWidget", "Rename", 0,
                          QApplication::UnicodeUTF8));
    renameAction->connect(renameAction,SIGNAL(activated()),this,SLOT(rename()));

    //-- New input
    newinputAction = new QAction(this);
    newinputAction->setObjectName(QString::fromUtf8("newInput"));
    newinputAction->setEnabled(true);
    newinputAction->setText(QApplication::translate("InputWidget", "New Input", 0,
                            QApplication::UnicodeUTF8));
    newinputAction->connect(newinputAction,SIGNAL(activated()),this,SLOT(newInput()));

    //-- Delete last
    deleteinputAction = new QAction(this);
    deleteinputAction->setObjectName(QString::fromUtf8("deleteInput"));
    deleteinputAction->setEnabled(true);
    deleteinputAction->setText(QApplication::translate("InputWidget",
                               "Delete last Input", 0, QApplication::UnicodeUTF8));
    deleteinputAction->connect(deleteinputAction,SIGNAL(activated()),this,SLOT(deleteLast()));

    //-- Delete selected
    deleteselectedinputAction = new QAction(this);
    deleteselectedinputAction->setObjectName(QString::fromUtf8("deleteSelectedInput"));
    deleteselectedinputAction->setEnabled(true);
    deleteselectedinputAction->setText(QApplication::translate("InputWidget",
                                       "Delete selected Input", 0, QApplication::UnicodeUTF8));
    deleteselectedinputAction->connect(deleteselectedinputAction,SIGNAL(activated()),this,SLOT(deleteSelected()));

    //-- Input Up
    inputupAction = new QAction(this);
    inputupAction->setObjectName(QString::fromUtf8("moveupInput"));
    inputupAction->setEnabled(true);
    inputupAction->setText(QApplication::translate("InputWidget", "Move up", 0,
                           QApplication::UnicodeUTF8));
    inputupAction->connect(inputupAction,SIGNAL(activated()),this,SLOT(moveUp()));

    //-- Input Down
    inputdownAction = new QAction(this);
    inputdownAction->setObjectName(QString::fromUtf8("movedownInput"));
    inputdownAction->setEnabled(true);
    inputdownAction->setText(QApplication::translate("InputWidget", "Move down", 0,
                             QApplication::UnicodeUTF8));
    inputdownAction->connect(inputdownAction,SIGNAL(activated()),this,SLOT(moveDown()));
}
Exemplo n.º 8
0
void HelpEditor::HomePageChanged(const QString &page)
{
  if (page.isEmpty())
  {
    m_HomeAction->setEnabled(false);
  }

  m_HomeAction->setEnabled(true);
  if (this->GetEditorInput().Cast<HelpEditorInput>()->GetUrl().isEmpty())
  {
    IEditorInput::Pointer newInput(new HelpEditorInput(page));
    DoSetInput(newInput);
  }
}
Exemplo n.º 9
0
void LoadDefFile(LispEnvironment& aEnvironment, const std::string& aFileName)
{
  const std::string flatfile = InternalUnstringify(aFileName) + ".def";
  LispDefFile* def = aEnvironment.DefFiles().File(aFileName);

  InputStatus oldstatus = aEnvironment.iInputStatus;
  aEnvironment.iInputStatus.SetTo(flatfile);

  LispLocalFile localFP(aEnvironment, flatfile, true,
                        aEnvironment.iInputDirectories);
  if (!localFP.stream.is_open())
    throw LispErrFileNotFound();

  StdFileInput newInput(localFP,aEnvironment.iInputStatus);
  DoLoadDefFile(aEnvironment, &newInput,def);

  aEnvironment.iInputStatus.RestoreFrom(oldstatus);
}
Exemplo n.º 10
0
void InternalLoad(LispEnvironment& aEnvironment, const std::string& aFileName)
{
    const std::string oper = InternalUnstringify(aFileName);

    InputStatus oldstatus = aEnvironment.iInputStatus;
    aEnvironment.iInputStatus.SetTo(oper);

    //TODO make the file api platform independent!!!!
    // Open file
    LispLocalFile localFP(aEnvironment, oper, true,
                          aEnvironment.iInputDirectories);

    if (!localFP.stream.is_open())
        throw LispErrFileNotFound();

    StdFileInput newInput(localFP, aEnvironment.iInputStatus);
    DoInternalLoad(aEnvironment, &newInput);

    aEnvironment.iInputStatus.RestoreFrom(oldstatus);
}