/*! \brief Input: _. Output: A matrix * * Generates a unimodular matrix. */ gsl_matrix* genU(){ int z, j ,display = 1; /* Initialize and allocate memory for necessary matrices */ gsl_matrix* result = gsl_matrix_alloc(SIZE,SIZE); gsl_matrix* result2 = gsl_matrix_alloc(SIZE,SIZE); gsl_matrix* base = gsl_matrix_alloc(SIZE,SIZE); gsl_matrix_set_identity(result); gsl_matrix_set_identity(result2); gsl_matrix_set_identity(base); /* Display progress of generating a unimodular to the user */ printf("Generating Unimodular\n"); printf("|..................................................|\r\033[01;35m|"); fflush(stdout); if(SIZE/50 > 1) display = SIZE/50; for(z = 0; z<DEPTH; z++){ if(z%2 == 0){ for(j=0; j < SIZE ; j++) { if(j%2 == 0){ randomLine(base,j); gsl_linalg_matmult(result,base,result2); gsl_matrix_memcpy(result,result2); clearLine(base,j); if(j % display == 0){ printf("-"); fflush(stdout); } } } }else{ printf("| 50%%\r\033[01;32m|"); for(j=SIZE-1; j >= 0 ; j--) { if(j%2 == 1){ randomLine(base,j); gsl_linalg_matmult(result,base,result2); gsl_matrix_memcpy(result,result2); clearLine(base,j); if(j % display == 1){ printf("="); fflush(stdout); } } } } } printf("| 100%% DONE\rUnimodular Generated\033[0m\n"); free(result2); free(base); return result; }
/*This will clear only the commanding area, if 1 instead of 0 - will wait for *key press*/ void clearCommander(int wantToWait) { if (wantToWait == 1) { waitingArrows(); } clearLine(20); clearLine(21); clearLine(22); }
void stack(void) { BIT_Y--; writeBlockOnBoard(); randomNextBlock(); BIT_Y = 1; BIT_X = 4; clearLine(); }
void GetInput(char* inputBuffer, unsigned char* inputPointer) { char inputChar = NULL; int currentPointer = *inputPointer; while(true) { PrintInput(inputBuffer, currentPointer); inputChar = _getch(); if(currentPointer > MAX_MSG_LENGTH) { currentPointer--; continue; } else if(0 < currentPointer && inputChar == 8) // backspace { inputBuffer[--currentPointer] = '\0'; } else if(inputChar == '\r') { clearLine(MAX_PRINT_LINE); inputBuffer[currentPointer] = '\0'; *inputPointer = currentPointer; break; } else { if(currentPointer != 0 && currentPointer%MAX_LENGTH_BY_LINE == 0) { inputBuffer[currentPointer++] = '\n'; } inputBuffer[currentPointer++] = inputChar; } } }
void clearScreen() { clearLine(0, sh-1); cursorX=0; cursorY=0; updateCursor(); }
void LCD::drawChar(char c_char) { uint8_t c = *((uint8_t *)(&c_char)); if(column == 0) clearLine(); switch(c) { case '\r': column = 0; break; case '\n': column = 0; line++; clearLine(); break; case 0x0b: line++; break; case 0x08: column--; drawCharRaw(' '); break; case 0x7f: drawCharRaw(' '); break; default: drawCharRaw(c); column++; } if(column >= 21) { column = 0; line++; } }
// Arrow down pressed void Console::handleHistoryDown() { if (0 < historyDown.count() && historySkip) { historyUp.push(historyDown.pop()); historySkip = false; } if (0 < historyDown.count()) { QString cmd = historyDown.pop(); historyUp.push(cmd); clearLine(); insertPlainText(cmd); } else { clearLine(); } }
void clear(){ int line; for(line=0;line<15;line++){ clearLine((char *)(MAIN_SCREEN_ADDRESS)+(LINE_SIZE*line)); } reset_writepos(); }
void setup() { clearLine(0,26,0x66); // show a small title to let the user know what they are doing drawFrame(header_background, 20, 8, 60, 11); printAt("Q OS Setup Process", desc_foreground, 21, 9); messageBox("Welcome to Q OS. Press <RET> to begin\n\rthe setup process."); // get the user ot enter a PC-NAME and UserName for there Q OS Account pcName = messageBox_I("Enter a name to assign to this\n\rcomputer."); userName = messageBox_I("Enter a username to assign to your\n\rQ OS user account."); // get the user to enter a password to protect there account on Q OS password = messageBox_Pass("Enter a password to protect your\n\raccount"); // this is mostly just a proof of concpet nad does nothing except ask a question for now if(messageBox_YN("Do you want to use the Q Data Cloud\n\rservice?") == 1) { useQDC= true; email = messageBox_I("Enter your email to be used with the\n\rQ Data Cloud."); } // require the user to login with their new account loggedIn = false; logout(); }
int renameWalletScreen(char* wallet, char* newWallet) { // reload the wallets array after using this function! // newWallet will receive the new file name (complete, not friendly) // returns 0 if user aborts, 1 if renames. SetBackGround(6); clearLine(1,8); char title[MAX_WALLETNAME_SIZE+6]; strcpy(title, wallet); strcat(title, " to:"); drawScreenTitle("Rename wallet", title); char newname[MAX_WALLETNAME_SIZE]; strcpy(newname, wallet); textInput input; input.forcetext=1; input.symbols = 0; input.charlimit=MAX_WALLETNAME_SIZE; input.buffer = (char*)newname; while(1) { input.key=0; int res = doTextInput(&input); if (res==INPUT_RETURN_EXIT) return 0; // user aborted else if (res==INPUT_RETURN_CONFIRM) { char fwallet[MAX_FILENAME_SIZE]; walletNameToPath(newWallet, newname); walletNameToPath(fwallet, wallet); renameFile(fwallet, newWallet); return 1; } } return 0; }
void TextMgr::statusDraw() { char *statusTextPtr = NULL; charAttrib_Push(); charPos_Push(); if (_statusEnabled) { clearLine(_statusRow, 15); charAttrib_Set(0, 15); charPos_Set(_statusRow, 1); statusTextPtr = stringPrintf(_systemUI->getStatusTextScore()); displayText(statusTextPtr); charPos_Set(_statusRow, 30); if (_vm->getFlag(VM_FLAG_SOUND_ON)) { statusTextPtr = stringPrintf(_systemUI->getStatusTextSoundOn()); } else { statusTextPtr = stringPrintf(_systemUI->getStatusTextSoundOff()); } displayText(statusTextPtr); } charPos_Pop(); charAttrib_Pop(); }
// this is shown at the top of every unanswered question during 'me' setup void meHeader() { clearLine(0,26,0x88); drawFrame(header_background, 20, 8, 60, 11); printAt("Me Setup Process", 0x3D, 21, 9); }
void myLCD::printTotalDuration(int totalDuration) { clearLine(2); m_lcd.print("Duration = "); m_lcd.print(totalDuration); m_lcd.print(" Sec"); }
int main() { char userInput[100]; char *firstWord; char *secondWord; long numInput; int boundsCheck; myStruct * ptrName; ptrName = malloc(sizeof(myStruct)); initscr(); drawInterface(); ptrName->yPos = 13; //This is the center of the interface ptrName->xPos = 37; ptrName->angle = 0; ptrName->pd = 1; //Pen is down ptrName->tStatus = 1; //Turtle is not hidden mvaddch(ptrName->yPos,ptrName->xPos,'@'); do { mvwprintw(stdscr, 27, 47, "Message Board "); mvwprintw(stdscr, 27, 8, "Input? "); getstr(userInput); mvwprintw(stdscr, 30, 40,"You entered: %s",userInput); /*Splitting the user input*/ firstWord = strtok(userInput, " "); secondWord = strtok(NULL, " "); if (secondWord!=NULL) { numInput = atol(secondWord); //converting to integer } clearLine(27,8); boundsCheck = checkBounds(ptrName); //checking the bounds (DOES NOT WORK YET) if (boundsCheck == 1) { movement(firstWord, numInput, ptrName); } refresh(); }while (strcmp(userInput,"quit")!=0); refresh(); endwin(); free(ptrName); return 0; }
void Console::newInput() { QString input_text = console_window->text(); d->getNoticeWindow()->write(tr("> ") + input_text); clearLine(); parseInput(input_text); }
void readCommand(){ clearBuffer(); int pos = 0, line=((typeOffset/2)/VGA_W); //%VGA_H; clearLine(); updateCursor(typeOffset/2); key next; while(1){ if(key_queue_is_empty()) continue; next = remove_key(); /*printint(next.scancode); print(" "); continue;*/ if(next.scancode==75 && pos>0){pos--;} //left arrow if(next.scancode==77 && pos<bufferLength()-1){pos++;} //right arrow if(next.scancode==72) { lookupHistory(); pos=k_strlen(textBuffer); }//up arrow if(next.scancode==80) { lookdownHistory(); pos=k_strlen(textBuffer); }//down arrow if(next.key=='\n') { if(typeOffset>(VGA_H-1)*VGA_W*2) {scroll();typeOffset-=2*VGA_W;} typeOffset=(typeOffset+VGA_W*2)-(typeOffset/2)%VGA_W*2; return; }else if(next.key=='\b') {if(pos==0) continue; else charFromBuffer(pos--);} else if(next.key=='\t') { int num = splitString(textBuffer, ' '); int i; for(i =0;i<num;i++){argv[i]=stringArray[i];} char *ac = autoComp(argv[i-1]); while(*ac!=0) {charToBuffer(*ac,pos++); ac++;} }else if(next.key!=0) {if(pos>(BUFFERSIZE)/2-4) continue; else charToBuffer(next.key, pos++);} if(line==VGA_H-1 && bufferLength()>=VGA_W){scroll();line--;} typeOffset = line*VGA_W*2; typePrompt(); int save = typeOffset; print(textBuffer); clearLine(); typeOffset = save+pos*2; updateCursor(typeOffset/2); } }
void myLCD::printTemp(float thermReading) { clearLine(2); char buff[20]; m_lcd.print("Temp = "); m_lcd.print(ftoa(buff, thermReading, 2)); m_lcd.write((byte)0); m_lcd.print("C"); }
void PrintLogs() { Lock lock; for(int i = 0; i < logs.size(); ++i) { clearLine(i + 1); gotoxy(0, i + 1); printf_s("%s", logs[i], strlen(logs[i])); } }
void scrollMainScreen(){ vidmem= (char *) MAIN_SCREEN_ADDRESS; int i=LINE_SIZE; writepos=0; while(i<MAIN_SCREEN_SIZE){ vidmem[writepos++]=vidmem[i++]; } clearLine((char *)LAST_LINE_ADDRESS); writepos=LAST_LINE; }
// Arrow up pressed void Console::handleHistoryUp() { if (0 < historyUp.count()) { QString cmd = historyUp.pop(); historyDown.push(cmd); clearLine(); insertPlainText(cmd); } historySkip = true; }
void MenuSystem::printTopMenu(char* val, int width){ clearLine(1); for(int i = 0; i < getLeftPadding(val, width); i++){ print(" "); } print(val); for(int i = 0; i < getRightPadding(val, width); i++){ print(" "); } }
/** * Replace the current input with the content of buffer, on screen. * * @param promptLen The lenght of the prompt. * @param buffer The buffer to be printed. * * @return the size of the buffer printed. */ int replaceInput(struct Shell* self, size_t promptLen, char* buffer) { updateCursor(self, promptLen, -1); clearLine(ERASE_RIGHT); clearScreen(CLEAR_BELOW); updateCursor(self, promptLen, 0); printf("%s", buffer); return strlen(buffer); }
void scrollUp(uint8 lineNumber) { char* vidmem = (char*)0xb8000; uint16 i = 0; clearLine(0,lineNumber-1); //updated for (i;i<sw*(sh-1)*2;i++) { vidmem[i] = vidmem[i+sw*2*lineNumber]; } clearLine(sh-1-lineNumber,sh-1); if((cursorY - lineNumber) < 0 ) { cursorY = 0; cursorX = 0; } else { cursorY -= lineNumber; } updateCursor(); }
/** * @brief Reads stdin one line at a time and then extracts * the paren characters: (){}[] to the @a p char array. * @param[out] p The char array of paren characters * @param[in] max The maximum size of @ p char array */ void read(char p[], int max) { int c; char line[MAX] = {0}; while (true) { c = getLine(line, MAX); if (c == EOF) break; extract(line, p, MAX); clearLine(line, MAX); } }
/*It clears whole terminal (prints background interface)*/ void clearTerminal() { int whichLine = 0; silenceOn(); for (whichLine = 0; whichLine <= 23; whichLine++) { clearLine(whichLine); } wrefresh(stdscr); silenceOff(); }
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() )); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); convert_value = 1.2607; coma_here = false; current_op = NONE; operand_1 = 0.; operand_2 = 0.; connect(ui->actionQuitter, SIGNAL(triggered()), this, SLOT(close())); connect(ui->actionA_propos, SIGNAL(triggered()), this, SLOT(onAPropos())); connect(ui->actionA_propos_de_Qt, SIGNAL(triggered()), this, SLOT(onAProposDeQt())); connect(ui->actionParam_tres_conversion, SIGNAL(triggered()), this, SLOT(onParametreConversion())); connect(ui->pushButton_0, SIGNAL(clicked()), this, SLOT(on0())); connect(ui->pushButton_1, SIGNAL(clicked()), this, SLOT(on1())); connect(ui->pushButton_2, SIGNAL(clicked()), this, SLOT(on2())); connect(ui->pushButton_3, SIGNAL(clicked()), this, SLOT(on3())); connect(ui->pushButton_4, SIGNAL(clicked()), this, SLOT(on4())); connect(ui->pushButton_5, SIGNAL(clicked()), this, SLOT(on5())); connect(ui->pushButton_6, SIGNAL(clicked()), this, SLOT(on6())); connect(ui->pushButton_7, SIGNAL(clicked()), this, SLOT(on7())); connect(ui->pushButton_8, SIGNAL(clicked()), this, SLOT(on8())); connect(ui->pushButton_9, SIGNAL(clicked()), this, SLOT(on9())); connect(ui->pushButton_coma, SIGNAL(clicked()), this, SLOT(onComa())); connect(ui->pushButton_equal, SIGNAL(clicked()), this, SLOT(onEqual())); connect(ui->pushButton_divided, SIGNAL(clicked()), this, SLOT(onDivided())); connect(ui->pushButton_plus, SIGNAL(clicked()), this, SLOT(onPlus())); connect(ui->pushButton_minus, SIGNAL(clicked()), this, SLOT(onMinus())); connect(ui->pushButton_times, SIGNAL(clicked()), this, SLOT(onMultiplicate())); connect(ui->pushButton_dollar_euro, SIGNAL(clicked()), this, SLOT(onDollarEuro())); connect(ui->pushButton_euro_dollar, SIGNAL(clicked()), this, SLOT(onEuroDollar())); // shortcuts QShortcut *scDel = new QShortcut(QKeySequence("Del"), this); connect(scDel, SIGNAL(activated()), this, SLOT(clearLine())); QShortcut *scBackspace = new QShortcut(QKeySequence("Backspace"), this); connect(scBackspace, SIGNAL(activated()), this, SLOT(clearLastChar())); // QShortcut *scEnter = new QShortcut(QKeySequence("Enter"), this); // connect(scEnter, SIGNAL(activated()), this, SLOT(onEqual())); // QShortcut *sc0 = new QShortcut(QKeySequence("0"), this); // connect(scBackspace, SIGNAL(activated()), this, SLOT(on0())); }
void displayEditFeed1(int mode, int index, int x, int y) { Time *t; t = &feedTime[index]; temp_text[0] = index + 1 + '0'; temp_text[1] = ':'; temp_text[2] = 0; clearLine(x); Lcd_Out(x, y, title); Lcd_Out(x, y + TITLE_LENGTH, temp_text); Lcd_Out(x, y + TITLE_LENGTH + 3, timeStr(t->hh)); Lcd_Out(x, y + TITLE_LENGTH + 5, column); Lcd_Out(x, y + TITLE_LENGTH + 6, timeStr(t->mn)); }
void QCustomPluginTest::process(QString command) { if(command == tr("!test")){ emit reply("<br>", true); for(int i = 0; i < 100; i++){ emit reply(QString("%1 %").arg(i), false); QTest::qWait(10); emit clearLine(); } emit reply("100 %<br>", true); QString str = ask(QString("Reply with some answer: "), false); emit reply("<br>Got reply: " + str, true); } emit pluginFinished(true); }
void displayMode(int x, int y) { clearLine(x); switch(mode) { case MODE_SET_TEMP: case MODE_EDIT_MIN: case MODE_EDIT_MAX: displayEdited(x, y); break; case MODE_FEED: displayFeedTimes(x, y); break; } }