Exemple #1
0
/*! get the historical information
 *
 *	\return
 *		QUILL_SUCCESS: declare cursor succeeded 
 *		FAILURE_QUERY_*: query failed
 */
QuillErrCode
PGSQLDatabase::openCursorsHistory(SQLQuery *queryhor, 
								  SQLQuery *queryver,
								  bool longformat)

{  
	QuillErrCode st = QUILL_SUCCESS;

	if ((st = execCommand(queryhor->getDeclareCursorStmt())) == QUILL_FAILURE) {
		dprintf(D_ALWAYS, "error opening Jobs_Horizontal_History cursor\n");
		return FAILURE_QUERY_HISTORYADS_HOR;
	}
	if (longformat && 
		(st = execCommand(queryver->getDeclareCursorStmt())) == QUILL_FAILURE) {
		dprintf(D_ALWAYS, "error opening Jobs_Vertical_History cursor\n");
		return FAILURE_QUERY_HISTORYADS_VER;
	}

		// initialize watermarks
	historyHorNumRowsFetched = 0;
	historyVerNumRowsFetched = 0;

		// initialize current read positions
	historyHorFirstRowIndex = 0;
	historyVerFirstRowIndex = 0;

	return QUILL_SUCCESS;
}
Exemple #2
0
/*
*   processes call tree.
*   runs if command, if successful run commands in then block otherwise 
*   runs commands in else block. 
*   calls itself if command is nested_if block
*   parameters: IFBLOCK* ifBlock - processes tree rooted at ifBlock 
*   returns : 0 if success otherwise 1
*/
static int processTree(IFBLOCK* ifBlock)
{
    int result;//result of processing
    COMMSEQ* node;//for linked list iteration
    IFBLOCK* currIfBlock;//poiner to nested if block
    char* command,**arglist;//for convenience
    
    result = execCommand(ifBlock->commandargs + 1);//result of if commad
    node = (result == 0) ? ifBlock->thenComSeq 
                            : ifBlock->elseComSeq;//which block to execute
    while(node != NULL)
    {
        if(node->type == COMMAND){//executable command
            command = (char*)node->cmd;
            arglist = splitline(command);//get command args
            result = execCommand(arglist);//execute command
        }
        else{//nested_if block
            currIfBlock = (IFBLOCK*)node->cmd;
            result = processTree(currIfBlock);//recursively process nested if
        }
        node = node->next;//go to next node
    }
    return result;
}
MHIREDIS_T MHiRedis::connect(const std::string& host, const int port,
                             const std::sting& password, const int db) {
    context_ = redisConnect(host_ip_.c_str(), port_);

    if (!context_) {
        cleanUp();
        return MH_CONNECT_RET_NULL;
    }

    if (context_->err != 0) {
        // log errstr

        cleanUp();
        return MH_CONNECT_ERROR;
    }
    if (!passwork.emply()) {
        std::string auth_comm = "AUTH " + password;
        MHIREDIS_T ret = execCommand(auth_comm, NULL);
        if (ret != MH_SUCCESS) {
            return MH_AUTH_FAILED;
        }
    }

    std::string sel_comm = "SELECT " + itoa(db);
    ret = execCommand(sel_comm, NULL);
    if (ret != MH_SUCCESS) {
        return MH_SEL_FAILED;
    }

    return MH_SUCCESS;
}
Exemple #4
0
int main(int argc, char *argv[]){

	if(argc <= 1){
		printProgramInfo();
		return 0;
	}

	initData();
	dataIndex = 0;
	
	pSourceCodeFile = fopen(argv[1], "rb");
	int cmd = 0;
	if (pSourceCodeFile==NULL){
		fatalError(FILE_OPEN_FAILED_ERROR_MSG);
	}
	while(!feof(pSourceCodeFile)){
		cmd = getNextCommand();
		if(cmd!=EOF){
			execCommand(cmd);
		}
	}
	fclose(pSourceCodeFile);
	msg(EXECUTION_FINISHED_MSG);
	return 0;
}
Exemple #5
0
void gesamtbild::landmenu()
{
// menupanel->landmenu();
execCommand(QString("hide sidemenu"));		//lets the sidebar disappear, isn't needed for a landwalk.

gameview->landing();
// 	tab[0]->hide();
// 	tab[1]->hide();
// 	tab[2]->hide();
// menupanel->clear();
// menupanel->removeTab(0);
// menupanel->removeTab(1);
// menupanel->removeTab(2);

// int index;
// 	index = menupanel->addTab(tab[3],QIcon(":img/icons/steuerrad01.png") , tr("Schiffsmenu"));
// 	menupanel->setTabToolTip(index, tr("Schiffsaktionen und -befehle verwalten"));

// 	index = menupanel->addTab(tab[4], tr("Baumenu"));
// 	menupanel->setTabToolTip(index, tr("Gebaude bauen"));

//  	index = menupanel->addTab(tab[5],QIcon(""), tr("blah"));
//  	menupanel->setTabToolTip(index, tr("irgendwas"));
// 

// tab[3]->show();
// tab[4]->show();
// tab[5]->show();
}
Exemple #6
0
void Console::handleReturn()
{
	QString command=getCommand();
	moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
	emit execCommand(command);
	displayPrompt();
}
Exemple #7
0
Int_t IRODS::cd(const Char_t* directory)
{
   // change directory

   buildCommand("icd", directory);
   return execCommand();
}
Exemple #8
0
Int_t IRODS::mkdir(const Char_t* path, Option_t* opt)
{
   // Create new directory in IRODS space

   buildCommand("imkdir", path, opt);
   return execCommand();
}
DbusActionWidget::DbusActionWidget(
    KHotKeys::DBusAction *action,
    QWidget *parent )
        : Base(action, parent)
    {
    ui.setupUi(this);

    connect(
        ui.application, SIGNAL(textChanged(QString)),
        _changedSignals, SLOT(map()) );
    _changedSignals->setMapping(ui.application, "application" );
    connect(
        ui.object, SIGNAL(textChanged(QString)),
        _changedSignals, SLOT(map()) );
    _changedSignals->setMapping(ui.object, "object" );
    connect(
        ui.function, SIGNAL(textChanged(QString)),
        _changedSignals, SLOT(map()) );
    _changedSignals->setMapping(ui.function, "function" );
    connect(
        ui.arguments, SIGNAL(textChanged(QString)),
        _changedSignals, SLOT(map()) );
    _changedSignals->setMapping(ui.arguments, "arguments" );

    connect(
        ui.launchButton, SIGNAL(clicked()),
        this, SLOT(launchDbusBrowser()) );
    connect(
        ui.execButton, SIGNAL(clicked()),
        this, SLOT(execCommand()) );
    }
void PerforcePart::revert( const QString& filename )
{
    if ( KMessageBox::questionYesNo( 0,
            i18n("Do you really want to revert "
                 "the file %1 and lose all your changes?").arg( filename ), QString::null, i18n("Revert"), i18n("Do Not Revert") ) == KMessageBox::Yes ) {
        execCommand( "revert", filename );
    }
}
Exemple #11
0
void CmdBox::initSlotsAndSignals(){
    QObject::connect(getCmdEdit(), SIGNAL(textChanged(QString)),
                     this, SLOT(updateLastItem(QString)));
    QObject::connect(getRunButton(), SIGNAL(clicked()),
                     this, SLOT(execCommand()));
    QObject::connect(getCmdEdit(), SIGNAL(textChanged(QString)),
                     this, SLOT(updateList(QString)));
}
Exemple #12
0
int main(void) {
  char *line;

  printf("\n\nECO32 Machine Monitor 1.0\n\n");
  initInstrTable();
  cpuSetPC(0xC0000000);
  
  // mgeisse
  execCommand("boot 0");
  
  while (1) {
    line = getLine("ECO32 > ");
    addHist(line);
    execCommand(line);
  }
  return 0;
}
Exemple #13
0
QuillErrCode
PGSQLDatabase::closeCursorsHistory(SQLQuery *queryhor, 
								   SQLQuery *queryver,
								   bool longformat)

{  
	QuillErrCode st;
	if ((st = execCommand(queryhor->getCloseCursorStmt())) == QUILL_FAILURE) {
		return FAILURE_QUERY_HISTORYADS_HOR;
	}
	if (longformat 
		&& (st = execCommand(queryver->getCloseCursorStmt())) == QUILL_FAILURE) {
		return FAILURE_QUERY_HISTORYADS_VER;
	}

	return QUILL_SUCCESS;
}
Exemple #14
0
void MsgEdit::execCommand(CommandDef *cmd)
{
    if (m_cmd.param){
        Message *msg = (Message*)(m_cmd.param);
        delete msg;
    }
    m_cmd = *cmd;
    QTimer::singleShot(0, this, SLOT(execCommand()));
}
Exemple #15
0
Int_t IRODS::forcedelete(const Char_t* path)
{
   // Delete a file.
   // WARNING: THIS WILL DELETE THE PHYSICAL FILE,
   // not just the catalogue entry!!!

   buildCommand("irm", path, "-f");
   return execCommand();
}
Exemple #16
0
Int_t IRODS::get(const Char_t* source, const Char_t* target)
{
   // copy a file from IRODS space.

   TString args;
   args.Form("-P %s %s", source, target);
   buildCommand("iget", args.Data());
   return execCommand();
}
Exemple #17
0
Int_t IRODS::put(const Char_t* source, const Char_t* target)
{
   // put a new file into IRODS space.

   TString args;
   args.Form("%s %s", source, target);
   buildCommand("iput", args.Data(), "-N0");
   return execCommand();
}
void HtmlEditor::formatFontName()
{
    QStringList families = QFontDatabase().families();
    bool ok = false;
    QString family = QInputDialog::getItem(this, tr("Font"), tr("Select font:"),
                                           families, 0, false, &ok);

    if (ok)
        execCommand("fontName", family);
}
void HtmlEditor::createLink()
{
    QString link = QInputDialog::getText(this, tr("Create link"),
                                         "Enter URL");
    if (!link.isEmpty()) {
        QUrl url = guessUrlFromString(link);
        if (url.isValid())
            execCommand("createLink", url.toString());
    }
}
Exemple #20
0
void FileUtils::zipFile(const QString &zipFileName, const QString &srcFileName)
{
	QString newSrcFileName = getFullPath(srcFileName);
	if (!checkExists(newSrcFileName))
	{
		return;
	}
	QString newZipFileName = getFullPath(zipFileName);
	QString commandLine = QString("7zr a \"%0\" \"%1\"").arg(newZipFileName).arg(newSrcFileName);
	execCommand(commandLine);
}
void LoadMaker::buildInitialStock()
{
    for (int i=0; i < 4; i++) {
        string bucket = string("buck_") + boost::lexical_cast<string>(i);
        string cmd = string("add ") + bucket;
        execCommand(m_sock, cmd, m_buffer);

        ItemsListPtr items(new list<int>);
        for (int j=0; j < 8; j++) {
            string item = string("item_") + boost::lexical_cast<string>(j);
            string cmd = string("create ") + bucket + " " + item;
            execCommand(m_sock, cmd, m_buffer);

            int id = boost::lexical_cast<int>(string(m_buffer.raw()));
            items->push_back(id);
        }

        g_data.m_buckets[bucket] = items;
        g_data.m_maxBucketId = i;
    }
}
void Server::work()
{
    running = true;
    while(running) {
        auto cmd = readCommand();
        if (!cmd.first.empty()) {
            auto res = execCommand(cmd);
            writeResult(res);
        }
        std::this_thread::sleep_for(std::chrono::milliseconds(sleepTime));
    }
}
Exemple #23
0
void FileUtils::unzip(const QString &zipFileName, const QString &outputDir)
{
	QString newZipFileName = getFullPath(zipFileName);
	if (!checkExists(newZipFileName))
	{
		return;
	}
	QString newOutputDir = getFullPath(outputDir);
	 // 如 "7zr x \"-oE:/trd/product/Rokh/bin/data/test7z\" \"E:/trd/product/Rokh/bin/tests/test1.7z\""
	QString commandLine = QString("7zr x \"-o%1\" \"%0\"").arg(newZipFileName).arg(newOutputDir);
	execCommand(commandLine);
}
Exemple #24
0
int Interactive::evaluate()
{
#ifdef USE_READLINE
	const char* prompt=PROMPT;
	char* c;
	do {
		c=readline::readline(prompt);
		execCommand(c);
	} while(c!=NULL);
	output << endl;
	return EXIT_SUCCESS;
#endif
}
Exemple #25
0
void CommandQueue::onSecond(uint64_t tick) {
	Lock l(cs);
	if(!clientPtr)
		return;
	
	for(auto i = queue.begin(); i != queue.end(); ++i) {
		const pair<uint64_t, CommandItem>& p = *i;
		if(tick >= p.first) {
			execCommand(p.second);
			i = queue.erase(i);
		}
	}
}
Exemple #26
0
void main() {
    char input[80];

    while(1) {
        PRINTS("> \0");

        // Get a command from the user
        SCANS(input);
        PRINTS("\r\n\0");

        // Execute the command
        execCommand(input);
    }
}
Exemple #27
0
konsole::konsole()
{
// 	lc_iterator = (lastcommands);
	output = new QPlainTextEdit(this);
	output->setReadOnly(true);
	input = new QLineEdit(this);
	
	QVBoxLayout *clayout = new QVBoxLayout(this);
	clayout->addWidget(output);
	clayout->addWidget(input);
	connect(input, SIGNAL(returnPressed()), this, SLOT(execCommand()));
	connect(input, SIGNAL(returnPressed()), input, SLOT(clear()));

}
Exemple #28
0
void Commands_updateKey(int track, struct track_key* key)
{
	struct UpdateKeyData* data;
	Command* command;
	
	command = malloc(sizeof(Command));
	memset(command, 0, sizeof(Command));

	command->userData = data = malloc(sizeof(struct UpdateKeyData));
	command->exec = execUpdateKey;
	command->undo = undoUpdateKey;
	data->track = track;
	data->key = *key;

	execCommand(command);
}
Exemple #29
0
void Commands_toggleBookmark(TrackData* trackData, int row)
{
	struct BookmarkData* data;
	Command* command;

	command = malloc(sizeof(Command));
	memset(command, 0, sizeof(Command));

	command->userData = data = malloc(sizeof(struct BookmarkData));
	command->exec = toggleBookmark;
	command->undo = toggleBookmark;
	data->trackData = trackData;
	data->row = row;

	execCommand(command);
}
Exemple #30
0
int main(void)
{
	//int Value = 0;
	
	DDRC  = 0x7F;
	PORTC = 0x7D;
	serial_initialize(57600);				// USART Initialize
	//serial_initialize(250000);				// USART Initialize
	dxl_initialize( 0, 7 ); // Not using device index
	sei();
	SetUpServos();
	SetConstants();
	SetKConstants();

	printf("ARMS CONTROL - Left \r" );
	printf("Ver1.0 - Last Moddification 23-03-15\r" );

	while (1)
	{
	
		
	if(cmdReady)
	{
		 if(!execCommand()) printf("Unknown command\r");
	}
	
	
	if(doLoop)
	{
		executeControl();
		count = count + 100;
	}
	
	if(doGripper)
	{
		executeGripper();
	}
		
		_delay_ms(3);
	

	Leds();

	}

	return 1;
}