void ProcessModProd(char* poly1, char* poly2) { table_check = 0; if (poly1 == NULL || poly2 == NULL || strlen(poly1) != 8 || strlen(poly2) != 8) { fprintf(stderr, "Invalid input poly. Please make sure each poly1 and poly2 are of length 8 in hexstring\n"); exit(1); } P = initTable("P1", poly1, 2, 8); INVP = initTable("P2", poly2, 2, 8); unsigned char * res = ModProduct(*P, *INVP); printf( "{%02x}{%02x}{%02x}{%02x} CIRCLEX {%02x}{%02x}{%02x}{%02x} = {%02x}{%02x}{%02x}{%02x}\n", P[0][0], P[0][1], P[0][2], P[0][3], INVP[0][0], INVP[0][1], INVP[0][2], INVP[0][3], res[0], res[1], res[2], res[3]); }
void MainWindow::airmonFunc() { static bool st = false; QProcess *airmon = new QProcess(); QString airmon_start = "/home/sdw/FFA/QT/airmon-sh.sh"; QString airmon_stop = "/home/sdw/FFA/QT/airmon-ksh.sh"; QString path = argv_main[0]; if(st) { ui->tableAP->setDisabled(true); ui->tableClient->setDisabled(true); ui->deauthAll->setDisabled(true); ui->deauthClnt->setDisabled(true); ui->refreshBtn->setDisabled(true); ui->airmonBtn->setText("Turn On"); ui->airmonStatus->setText("<font size=5 color=red>Off</font>"); st = false; QMessageBox::warning(NULL,"adsf",airmon_stop); airmon->start(airmon_stop); } else { ui->refreshBtn->setEnabled(true); ui->airmonBtn->setText("Turn Off"); ui->airmonStatus->setText("<font size=5 color=green>On</font>"); QMessageBox::warning(NULL,"adsf",airmon_start); airmon->start(airmon_start); initTable(); st = true; } }
long double calcMaxError(Function f, Polynomial *polynomial , size_t numof_xs, size_t numof_tests, long double min_x, long double max_x) { long double const step = (max_x - min_x) / numof_xs; Table table; initTable(&table, numof_xs, f); long double curr_x = min_x; for (size_t i = 0; i < numof_xs; ++i) { tableAppend(&table, curr_x + frand() * step); curr_x += step; } makeLagrangePolynomial(polynomial, &table); disposeTable(&table); long double const test_step = (min_x - max_x) / numof_tests; long double max_error = 0.0; long double curr_test = min_x; for (size_t i = 0; i < numof_tests; ++i) { long double const x = curr_test + frand() * test_step; long double const y = calcValue(polynomial, x); long double const right_y = f(x); long double const error = y - right_y; max_error = fabsl(error) > fabsl(max_error) ? error : max_error; curr_test += test_step; } return max_error; }
Matrix::Matrix(ScriptingEnv *env, int r, int c, const QString& label, ApplicationWindow* parent, const QString& name, Qt::WFlags f) : MdiSubWindow(parent, label, name, f), Scripted(env) { m_bk_color = QColor(255, 255, 128); m_matrix_icon = getQPixmap("matrix_xpm"); initTable(r, c); }
void addKey(HashTable *table, char *key, char *value){ //printf("Adding %s : %s to the table\n",key,value); if(table){ table->count += 1; if(table->count >= (table->maxSize)/2){ printf("After adding this one count is %08x\n",table->count); grow(table); } uint32_t k = prehash(key); if(table->values[k % table->maxSize]){ Node *n = initNode(key,value); //printf("Inserting at address: %08x\n",k%table->maxSize); // printf("Collision detected!\n"); insertNode(table->values[k % table->maxSize],n); }else{ //printf("Inserting at address: %08x\n",k%table->maxSize); table->values[k % table->maxSize] = initNode(key,value); } }else{ table = initTable(INITIAL_HASH_SIZE); uint32_t k = prehash(key); printf("Inserting at address: %08x\n",k%table->maxSize); table->values[k % table->maxSize] = initNode(key,value); } }
void ClinicInternalPaymentForm::initResults() { QStringList strList; strList.append(QObject::tr("门诊收据")); strList.append(QObject::tr("应收金额")); initTable(strList); }
int main() { int x, y, c; MEVENT event; initscr(); curs_set(1); keypad(stdscr, TRUE); mousemask(ALL_MOUSE_EVENTS, NULL); initTable(); printTable(SIZE, SIZE); while (result == FALSE) { c = wgetch(stdscr); if (KEY_MOUSE == c) { if (OK == getmouse(&event)) { x = event.x; y = event.y; toggle_on_click(x, y); } } } start_color(); init_pair(1, COLOR_GREEN, COLOR_RED); attron(COLOR_PAIR(1)); printw("Wow You Win...."); getch(); endwin(); return 0; }
float noise::atPoint( float x, float y, float z ) { int ix, iy, iz; int i, j, k; float fx, fy, fz; float xknots[4], yknots[4], zknots[4]; if ( !isInitialized ) { initTable( 23479015 ); } ix = (int)floorf( x ); fx = x - (float)ix; iy = (int)floorf( y ); fy = y - (float)iy; iz = (int)floorf( z ); fz = z - (float)iz; for ( k = -1; k <= 2; k++ ) { for ( j = -1; j <= 2; j++ ) { for ( i = -1; i <= 2 ; i++ ) { xknots[i+1] = value( ix + i, iy + j, iz + k ); } yknots[j+1] = spline( fx, xknots[0], xknots[1], xknots[2], xknots[3] ); } zknots[k+1] = spline( fy, yknots[0], yknots[1], yknots[2], yknots[3] ); } float val = spline( fz, zknots[0], zknots[1], zknots[2], zknots[3] ); return val; }
float noise::atPointUV( float u, float v) { int iu, iv; int j, k; float fu, fv; float uknots[4], vknots[4]; if ( !isInitialized ) { initTable( 23479015 ); } iu = (int)floorf( u ); fu = u - (float)iu; iv = (int)floorf( v ); fv = v - (float)iv; for ( k = -1; k <= 2; k++ ) { for ( j = -1; j <= 2; j++ ) { uknots[j+1] = value( iu + j, iu + k); } vknots[k+1] = spline( fu, uknots[0], uknots[1], uknots[2], uknots[3] ); } float val = spline( fv, vknots[0], vknots[1], vknots[2], vknots[3] ); return val; }
ZobristHash::ZobristHash(int rows, int cols, int statesPerSquare) { setRows(rows); setCols(cols); setStatesPerSquare(statesPerSquare); initTable(); }
bool Image::load(File* file) { initTable(); _width = 0; _height = 0; _bits = NULL; _flags = 0xFFFFFF; if (file) { bool loaded = false; file->seek(0, SEEK_SET); if (!loaded) loaded = loadGIF(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadPNG(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadTGA(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadBIN(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadBLP(file); file->seek(0, SEEK_SET); if (!loaded) loaded = loadBLP2(file); if (!loaded) { delete[] _bits; _bits = NULL; _width = 0; _height = 0; _flags = 0; } else updateAlpha(); return loaded; } return false; }
//#include"ui_lineswin.h" //#include"ui_detailinfowin.h" TrainLinePanel::TrainLinePanel(QWidget *parent) : QWidget(parent), ui(new Ui::TrainLinePanel) { f_updataDB = true; setWindowFlags(Qt::FramelessWindowHint|(windowFlags() & (~Qt::WindowCloseButtonHint))); ui->setupUi(this); // keyboard = new Soft_Keyboard; // connect(ui->listWidget,SIGNAL(doubleClicked(QModelIndex)),keyboard,SLOT(show(QModelIndex))); // connect(ui->train_id_lineEdit,SIGNAL(clicked()),keyboard,SLOT(show())); // connect(ui->line_name_lineEdit,SIGNAL(clicked()),keyboard,SLOT(show())); int trainId = GlobalInfo_t::getCurrentTrainIdFromLocalFile(); QString sql = QString("select line_name from tb_lines_info where train_id=%1").arg(trainId); ResultSet set = GlobalInfo_t::getInstance()->db->query(sql); if(set.count()!=0) { QString lineName = set[0].getPara("line_name"); ui->currentLineLabel->setText(lineName); } initLineList(); initTable(); ui->stackedWidget->setCurrentIndex(1); ui->hideBtn1->setStyleSheet("border:none;background-color: rgba(255, 255, 255, 0);"); ui->hideBtn2->setStyleSheet("border:none;background-color: rgba(255, 255, 255, 0);"); }
MainWindow::MainWindow(QWidget *parent):QMainWindow(parent),ui(new Ui::MainWindow){ ui->setupUi(this); this->setFixedSize(1366,700); initTable(); }
float noise::atValue( float x ) // // Description: // Get the noise value at the given point in 1-space. // // Arguments: // x - the point at which to calculate the noise // // Return Value: // the noise value at the point // { int ix; float fx; if ( !isInitialized ) { initTable( 23479015 ); isInitialized = 1; } ix = (int)floorf( x ); fx = x - (float)ix; return spline( fx, value( ix - 1 ), value( ix ), value( ix + 1 ), value( ix + 2 ) ); }
RuleCheckWidget::RuleCheckWidget(QWidget* parent /* = NULL */) :QDialog(parent) { m_saveList = NULL; initUi(); initTable(); initSlots(); }
ShortcutsImpl::ShortcutsImpl(QWidget * parent) : QDialog(parent), m_mainImpl((MainImpl *)parent) { setupUi(this); initTable( m_mainImpl ); connect(okButton, SIGNAL(clicked()), this, SLOT(slotAccept()) ); connect(defaultButton, SIGNAL(clicked()), this, SLOT(slotDefault()) ); }
void ClinicChargeStatisticForm::init() { initTable(); m_genderComboBox->addItem(strMan); m_genderComboBox->addItem(strWoman); m_startDateEdit->setDate(QDate::currentDate()); m_endDateEdit->setDate(QDate::currentDate()); }
// 将棋を指すソフト int main(int argc, char* argv[]) { initTable(); Position::initZobrist(); auto s = std::unique_ptr<Searcher>(new Searcher); s->init(); s->doUSICommandLoop(argc, argv); s->threads.exit(); }
void HospitalInternalPaymentForm::initResults() { QStringList strList; strList.append("住院收据"); strList.append("应收金额"); initTable(strList); m_allDueIncomeEdit->setText(g_strNull); }
void cn_init_force_lookup() { /*uword i; for(i = 0; i< LINE_WIDTH*LINE_WIDTH; ++i) { lookup[i].x = 0; lookup[i].y = 0; }*/ initTable(); }
void RoomSetting::init(){ ToolUtil::initStyle(this); IconHelper::Instance()->SetIcon(ui->btnMenu_Close,QChar(0xf00d),10); IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12); connect(ui->btnMenu_Close,SIGNAL(clicked()),this,SLOT(close())); initTable(); }
void print_table(str s, const Dtable& T, bool latex, Slist labels) { int SIZE = 7; int MAXSIZE = 10; int MAXLINE = 50; int STANDARDSIZE = 1; bool square(true); int l = T.size(); if (MAXLINE<l) printf("Cautious, table is of size %d, only %d will be displayed \n",l,MAXLINE); int cc = T[0].size(); for (int i=0; i<l; i++) if (T[i].size()!=cc) square = false; int max = max_row(T); List maxRow = initList(max); if (square) { Table sizestr = initTable(l,max); for (int i=0; i<l; i++) { for (int j=0; j<max; j++) { int sz = f(T[i][j]).size()+1; sizestr[i][j] = sz<MAXSIZE ? sz : MAXSIZE; } } maxRow = max_on_row(sizestr); } else maxRow = initList(max,STANDARDSIZE); str et = latex ? " &" : "|"; str slash = latex ? " \\\\ \n" : "\n"; str rrr(T[0].size(),'r'); printf("%s", s.c_str()); printf("\n"); bool labelsB = isnull(labels); str space(6,' '); printf("%s", space.c_str()); //rnc 10/25/15 printf("Obs. made "); for (int j=0; j<6;j++){ //for (int j=0; j<max; j++) { str s = (j==max-1) ? slash : et; printf("%s%s",format(maxRow[j],f(j)).c_str(),s.c_str()); } printf("initial& fibers&obs'rvd&percent& wght'd\\\\ \n"); for (int i=0; i<l && i<MAXLINE; i++) { str pre = labelsB ? f(i) : format(11,labels[i]); printf("%3s %s",pre.c_str(),et.c_str()); int c = T[i].size(); if (c==0) printf("\n"); for (int j=0; j<c; j++) { str s = (j==c-1) ? slash : et; str num = T[i][j]==-1 ? "" : f(T[i][j]).c_str(); printf("%s%s",format(maxRow[j],num).c_str(),s.c_str()); } } printf("\n"); }
GameGUI::GameGUI(Game *sdo, QWidget *parent) : QWidget(parent), ui(new Ui::GameGUI) { game = dynamic_cast<Game *>(sdo); setWindowTitle("Quoridor Game Grid"); game->attacher(this); lay= new QGridLayout(); initTable(); rafraichir(game); setLayout(lay); }
Image::Image(int width, int height) { initTable (); _width = width; _height = height; _bits = new uint32[width * height]; _flags = 0xFFFFFF; _qmemset (_bits, 0xFF000000, width * height); }
Image::Image(int width, int height, uint32* bits) { initTable (); _width = width; _height = height; _bits = bits; _flags = _unowned | 0xFFFFFF; _qmemset (_bits, 0xFF000000, width * height); }
void initRoom(room *Room) { int i = 0; for(i < 0; i < ROOMSIZE; i++) { Room[i].PlayerA.sockfd = -1 ; Room[i].PlayerB.sockfd = -1; Room[i].state = 0; initTable(Room[i].table); } }
void maxStream(Index S, Index E, Graph Gf, Graph Gr) { /*生成列表*/ Table T = (Table)calloc(Gr->vertex, sizeof(TableNode)); if(T == NULL) { fprintf(stderr, "not enough memory"); return; } /*初始化表,并且计算第一条增广路径*/ initTable(S, Gr->vertex, T); getShortestIncrePath(S, T, Gr); /*运算直到没有增广路径*/ while(T[E].dist != Infinity) { modifyGraphByIncrem(E, T, Gf, Gr); initTable(S, Gr->vertex, T); getShortestIncrePath(S, T, Gr); } }
Table createMyTable() { Table table; initTable(&table, numof_my_xs, my_f); tableAppend(&table, 0.25 * pi); tableAppend(&table, 0.5 * pi); tableAppend(&table, 1. * pi); tableAppend(&table, 2. * pi); tableAppend(&table, 3. * pi); return table; }
VResultWindow::VResultWindow(QMdiArea *mdiArea,QString nameWindow):SubWindow(mdiArea,nameWindow) { widget = new QWidget; layout = new QHBoxLayout;//?? no use tableWidget = new QTableWidget(5,5,this); layout->addWidget(tableWidget); tableWidget->setFixedHeight(240); tableWidget->setFixedWidth(420); initTable(); widget->setLayout(layout); setWidget(widget); }
int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); initTable(); Position::initZobrist(); Search::init(); // 一時オブジェクトの生成と破棄 std::unique_ptr<Evaluater>(new Evaluater)->init(Options[USI::OptionNames::EVAL_DIR], true); int statusCode = RUN_ALL_TESTS(); Threads.exit(); return statusCode; }