void set_unsigned_int(unsigned int x) { modify(unsigned_int_, x); }
void SensorsConfig::modify() { modify( m_sensorView->selectedItem() ); }
constexpr int test2() { const int k = 0; return modify(const_cast<int&>(k)); } // expected-note 2 {{in call}}
void loop() { while(x[0]) modify(&x[0]); }
void modify(const LUID & priv, bool enable) { modify(WinToken(TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES), priv, enable); }
int main() { Lotto *lotto[MAX]; // pointer array for MAX lottos int lottoCount = 0; // number of lottos stored int choice; // menu choice int n1, n2; // for selecting the range int ID; Date searchdate; int searchresult[100]; int i; while(1){ printf("\n\nLotto Menu\n"); printf("1. Add\n"); printf("2. Search\n"); printf("3. List\n"); printf("4. Modify\n"); printf("5. Delete\n"); printf("6. Exit\n"); printf("==> "); scanf("%d",&choice); if(choice==6) break; switch(choice){ case ADD: do{ lotto[lottoCount] = (Lotto*)malloc(sizeof(struct Lotto)); add(lotto, lotto[lottoCount], &lottoCount); printf("Add more (Y/N)? \n"); }while(toupper(getch())=='Y'); break; case SEARCH: printf ("Search by:\n"); printf (" [1] ID\n"); printf (" [2] date\n"); printf (" => "); scanf ("%d", &choice); switch(choice) { case 1: printf ("Enter ID: "); scanf ("%d", &ID); if (searchbyID(lotto, ID, lottoCount) != -1) list(lotto[searchbyID(lotto, ID, lottoCount)]); else printf ("\nNot found!\n\n"); break; case 2: printf ("Enter date: "); scanf ("%d %d %d", &searchdate.year, &searchdate.month, &searchdate.day); if (searchbyDate(lotto, searchdate, lottoCount, searchresult) > 0){ for (i = 0; i < searchbyDate(lotto, searchdate, lottoCount, searchresult); i++) list(lotto[searchresult[i]]); } else printf ("Not found!\n\n"); break; } break; case LIST: printf("Enter id range: "); scanf("%d %d", &n1, &n2); listSome(lotto, n1, n2, lottoCount); break; case MODIFY: printf ("Enter id: "); scanf ("%d", &ID); if (getLottoFromId(lotto, ID, lottoCount) != -1){ modify(lotto[getLottoFromId(lotto, ID, lottoCount)]); } break; case DELETE: printf ("Enter id: "); scanf ("%d", &ID); if (getLottoFromId(lotto, ID, lottoCount) != -1) del(lotto, lotto[getLottoFromId(lotto, ID, lottoCount)], &lottoCount); else printf ("Lotto not found\n"); break; } } }
Configuration::Configuration(Applet *applet, KConfigDialog *parent) : QObject(parent), m_applet(applet), m_editedLauncher(NULL) { KConfigGroup configuration = m_applet->config(); KMenu *addLauncherMenu = new KMenu(parent); QWidget *generalWidget = new QWidget; QWidget *appearanceWidget = new QWidget; QWidget *arrangementWidget = new QWidget; QWidget *actionsWidget = new QWidget; QAction *addLauncherApplicationAction = addLauncherMenu->addAction(KIcon("application-x-executable"), i18n("Add Application...")); QAction *addLauncherFromFileAction = addLauncherMenu->addAction(KIcon("inode-directory"), i18n("Add File or Directory...")); QAction *addMenuLauncher = addLauncherMenu->addAction(KIcon("start-here"), i18n("Add Menu")); KMenu *addMenuLauncherMenu = new KMenu(addLauncherMenu); addMenuLauncher->setMenu(addMenuLauncherMenu); QAction *action = addMenuLauncherMenu->addAction(QString()); action->setData("/"); action->setVisible(false); m_generalUi.setupUi(generalWidget); m_appearanceUi.setupUi(appearanceWidget); m_arrangementUi.setupUi(arrangementWidget); m_actionsUi.setupUi(actionsWidget); connectWidgets(generalWidget); connectWidgets(appearanceWidget); m_arrangementUi.addLauncherButton->setMenu(addLauncherMenu); m_generalUi.groupingStrategy->addItem(i18n("Do Not Group"), QVariant(TaskManager::GroupManager::NoGrouping)); m_generalUi.groupingStrategy->addItem(i18n("Manually"), QVariant(TaskManager::GroupManager::ManualGrouping)); m_generalUi.groupingStrategy->addItem(i18n("By Program Name"), QVariant(TaskManager::GroupManager::ProgramGrouping)); m_generalUi.groupingStrategy->setCurrentIndex(m_generalUi.groupingStrategy->findData(QVariant(configuration.readEntry("groupingStrategy", static_cast<int>(TaskManager::GroupManager::NoGrouping))))); m_generalUi.sortingStrategy->addItem(i18n("Do Not Sort"), QVariant(TaskManager::GroupManager::NoSorting)); m_generalUi.sortingStrategy->addItem(i18n("Manually"), QVariant(TaskManager::GroupManager::ManualSorting)); m_generalUi.sortingStrategy->addItem(i18n("Alphabetically"), QVariant(TaskManager::GroupManager::AlphaSorting)); m_generalUi.sortingStrategy->addItem(i18n("By Desktop"), QVariant(TaskManager::GroupManager::DesktopSorting)); m_generalUi.sortingStrategy->setCurrentIndex(m_generalUi.sortingStrategy->findData(QVariant(configuration.readEntry("sortingStrategy", static_cast<int>(TaskManager::GroupManager::ManualSorting))))); m_generalUi.showOnlyCurrentDesktop->setChecked(configuration.readEntry("showOnlyCurrentDesktop", false)); m_generalUi.showOnlyCurrentActivity->setChecked(configuration.readEntry("showOnlyCurrentActivity", true)); m_generalUi.showOnlyCurrentScreen->setChecked(configuration.readEntry("showOnlyCurrentScreen", false)); m_generalUi.showOnlyMinimized->setChecked(configuration.readEntry("showOnlyMinimized", false)); m_generalUi.showOnlyTasksWithLaunchers->setChecked(configuration.readEntry("showOnlyTasksWithLaunchers", false)); m_generalUi.connectJobsWithTasks->setChecked(configuration.readEntry("connectJobsWithTasks", false)); m_generalUi.groupJobs->setChecked(configuration.readEntry("groupJobs", true)); m_generalUi.jobCloseMode->addItem(i18n("Instantly"), QVariant(InstantClose)); m_generalUi.jobCloseMode->addItem(i18n("After delay"), QVariant(DelayedClose)); m_generalUi.jobCloseMode->addItem(i18n("Manually"), QVariant(ManualClose)); m_generalUi.jobCloseMode->setCurrentIndex(m_generalUi.jobCloseMode->findData(QVariant(configuration.readEntry("jobCloseMode", static_cast<int>(DelayedClose))))); QStringList moveAnimationNames; moveAnimationNames << i18n("None") << i18n("Zoom") << i18n("Jump") << i18n("Spotlight") << i18n("Glow") << i18n("Fade"); QList<AnimationType> moveAnimationIds; moveAnimationIds << NoAnimation << ZoomAnimation << JumpAnimation << SpotlightAnimation << GlowAnimation << FadeAnimation; for (int i = 0; i < moveAnimationIds.count(); ++i) { m_appearanceUi.moveAnimation->addItem(moveAnimationNames.at(i), QVariant(moveAnimationIds.at(i))); } QStringList iconAnimationNames; iconAnimationNames << i18n("None") << i18n("Bounce") << i18n("Zoom") << i18n("Blink") << i18n("Spotlight") << i18n("Rotate") << i18n("Glow"); QList<AnimationType> iconAnimationIds; iconAnimationIds << NoAnimation << BounceAnimation << ZoomAnimation << BlinkAnimation << SpotlightAnimation << RotateAnimation << GlowAnimation; for (int i = 0; i < iconAnimationIds.count(); ++i) { m_appearanceUi.demandsAttentionAnimation->addItem(iconAnimationNames.at(i), QVariant(iconAnimationIds.at(i))); m_appearanceUi.startupAnimation->addItem(iconAnimationNames.at(i), QVariant(iconAnimationIds.at(i))); } m_appearanceUi.titleLabelMode->addItem(i18n("Never"), QVariant(NoLabel)); m_appearanceUi.titleLabelMode->addItem(i18n("On mouse-over"), QVariant(MouseOverLabel)); m_appearanceUi.titleLabelMode->addItem(i18n("For active icon"), QVariant(ActiveIconLabel)); m_appearanceUi.titleLabelMode->addItem(i18n("Always"), QVariant(AlwaysShowLabel)); m_appearanceUi.titleLabelMode->setCurrentIndex(m_appearanceUi.titleLabelMode->findData(QVariant(configuration.readEntry("titleLabelMode", static_cast<int>(AlwaysShowLabel))))); m_appearanceUi.activeIconIndication->addItem(i18n("None"), QVariant(NoIndication)); m_appearanceUi.activeIconIndication->addItem(i18n("Zoom"), QVariant(ZoomIndication)); m_appearanceUi.activeIconIndication->addItem(i18n("Glow"), QVariant(GlowIndication)); m_appearanceUi.activeIconIndication->addItem(i18n("Fade"), QVariant(FadeIndication)); m_appearanceUi.activeIconIndication->setCurrentIndex(m_appearanceUi.activeIconIndication->findData(QVariant(configuration.readEntry("activeIconIndication", static_cast<int>(FadeIndication))))); m_appearanceUi.customBackgroundImage->setUrl(KUrl(configuration.readEntry("customBackgroundImage", QString()))); m_appearanceUi.customBackgroundImage->setFilter("image/svg+xml image/svg+xml-compressed"); if (m_applet->location() != Plasma::Floating && (!m_applet->containment() || m_applet->containment()->objectName() != "FancyPanel")) { m_appearanceUi.customBackgroundImageLabel->hide(); m_appearanceUi.customBackgroundImage->hide(); } m_appearanceUi.moveAnimation->setCurrentIndex(moveAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("moveAnimation", static_cast<int>(GlowAnimation))))); m_appearanceUi.parabolicMoveAnimation->setChecked(configuration.readEntry("parabolicMoveAnimation", false)); m_appearanceUi.demandsAttentionAnimation->setCurrentIndex(iconAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("demandsAttentionAnimation", static_cast<int>(BlinkAnimation))))); m_appearanceUi.startupAnimation->setCurrentIndex(iconAnimationIds.indexOf(static_cast<AnimationType>(configuration.readEntry("startupAnimation", static_cast<int>(BounceAnimation))))); m_arrangementUi.removeButton->setIcon(KIcon("go-previous")); m_arrangementUi.addButton->setIcon(KIcon("go-next")); m_arrangementUi.moveUpButton->setIcon(KIcon("go-up")); m_arrangementUi.moveDownButton->setIcon(KIcon("go-down")); KConfig kickoffConfiguration("kickoffrc", KConfig::NoGlobals); KConfigGroup favoritesGroup(&kickoffConfiguration, "Favorites"); const QStringList currentEntries = configuration.readEntry("arrangement", QStringList("tasks")); QStringList availableEntries; availableEntries << i18n("--- separator ---") << i18n("--- tasks area ---") << i18n("--- jobs area ---") << "menu:/"; availableEntries.append(favoritesGroup.readEntry("FavoriteURLs", QStringList())); for (int i = 0; i < currentEntries.count(); ++i) { QListWidgetItem *item = NULL; if (currentEntries.at(i) == "tasks") { item = new QListWidgetItem(i18n("--- tasks area ---"), m_arrangementUi.currentEntriesListWidget); } else if (currentEntries.at(i) == "jobs") { item = new QListWidgetItem(i18n("--- jobs area ---"), m_arrangementUi.currentEntriesListWidget); } else if (currentEntries.at(i) == "separator") { item = new QListWidgetItem(i18n("--- separator ---"), m_arrangementUi.currentEntriesListWidget); } else { if (hasEntry(currentEntries.at(i), false)) { continue; } Launcher *launcher = m_applet->launcherForUrl(KUrl(currentEntries.at(i))); if (!launcher) { continue; } item = new QListWidgetItem(launcher->icon(), launcher->title(), m_arrangementUi.currentEntriesListWidget); item->setToolTip(launcher->launcherUrl().pathOrUrl()); m_rules[launcher->launcherUrl().pathOrUrl()] = qMakePair(launcher->rules(), launcher->isExcluded()); } m_arrangementUi.currentEntriesListWidget->addItem(item); } for (int i = 0; i < availableEntries.count(); ++i) { if (i > 0 && hasEntry(availableEntries.at(i), false)) { continue; } QListWidgetItem *item = NULL; if (availableEntries.at(i).startsWith("--- ")) { item = new QListWidgetItem(availableEntries.at(i), m_arrangementUi.availableEntriesListWidget); } else { Launcher *launcher = m_applet->launcherForUrl(KUrl(availableEntries.at(i))); if (!launcher) { continue; } item = new QListWidgetItem(launcher->icon(), launcher->title(), m_arrangementUi.availableEntriesListWidget); item->setToolTip(launcher->launcherUrl().pathOrUrl()); m_rules[launcher->launcherUrl().pathOrUrl()] = qMakePair(launcher->rules(), launcher->isExcluded()); } m_arrangementUi.availableEntriesListWidget->addItem(item); } QMap<QPair<Qt::MouseButtons, Qt::KeyboardModifiers>, IconAction> iconActions = m_applet->iconActions(); QMap<QPair<Qt::MouseButtons, Qt::KeyboardModifiers>, IconAction>::iterator iterator; int i = 0; m_actionsUi.actionsTableWidget->setItemDelegateForColumn(0, new ActionDelegate(this)); m_actionsUi.actionsTableWidget->setItemDelegateForColumn(1, new TriggerDelegate(this)); for (iterator = iconActions.begin(); iterator != iconActions.end(); ++iterator) { if (iterator.key().first == Qt::NoButton) { continue; } QStringList action; if (iterator.key().first & Qt::LeftButton) { action.append("left"); } if (iterator.key().first & Qt::MiddleButton) { action.append("middle"); } if (iterator.key().first & Qt::RightButton) { action.append("right"); } if (iterator.key().second & Qt::ShiftModifier) { action.append("shift"); } if (iterator.key().second & Qt::ControlModifier) { action.append("ctrl"); } if (iterator.key().second & Qt::AltModifier) { action.append("alt"); } QTableWidgetItem *triggerItem = new QTableWidgetItem(action.join(QChar('+'))); triggerItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled); QTableWidgetItem *actionItem = new QTableWidgetItem(QString::number(static_cast<int>(iterator.value()))); actionItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled); m_actionsUi.actionsTableWidget->setRowCount(i + 1); m_actionsUi.actionsTableWidget->setItem(i, 0, actionItem); m_actionsUi.actionsTableWidget->setItem(i, 1, triggerItem); ++i; } moveAnimationTypeChanged(m_appearanceUi.moveAnimation->currentIndex()); parent->addPage(generalWidget, i18n("General"), "go-home"); parent->addPage(appearanceWidget, i18n("Appearance"), "preferences-desktop-theme"); parent->addPage(arrangementWidget, i18n("Arrangement"), "format-list-unordered"); parent->addPage(actionsWidget, i18n("Actions"), "configure-shortcuts"); connect(parent, SIGNAL(applyClicked()), this, SLOT(save())); connect(parent, SIGNAL(okClicked()), this, SLOT(save())); connect(m_appearanceUi.moveAnimation, SIGNAL(currentIndexChanged(int)), this, SLOT(moveAnimationTypeChanged(int))); connect(m_appearanceUi.customBackgroundImage, SIGNAL(textChanged(QString)), this, SLOT(modify())); connect(m_arrangementUi.availableEntriesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(availableEntriesCurrentItemChanged(int))); connect(m_arrangementUi.currentEntriesListWidget, SIGNAL(currentRowChanged(int)), this, SLOT(currentEntriesCurrentItemChanged(int))); connect(m_arrangementUi.removeButton, SIGNAL(clicked()), this, SLOT(removeItem())); connect(m_arrangementUi.addButton, SIGNAL(clicked()), this, SLOT(addItem())); connect(m_arrangementUi.moveUpButton, SIGNAL(clicked()), this, SLOT(moveUpItem())); connect(m_arrangementUi.moveDownButton, SIGNAL(clicked()), this, SLOT(moveDownItem())); connect(m_arrangementUi.editLauncherButton, SIGNAL(clicked()), this, SLOT(editLauncher())); connect(m_actionsUi.actionsTableWidget, SIGNAL(clicked(QModelIndex)), this, SLOT(actionClicked(QModelIndex))); connect(m_actionsUi.actionsTableWidget->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(actionSelectionChanged())); connect(m_actionsUi.addButton, SIGNAL(clicked()), this, SLOT(addAction())); connect(m_actionsUi.removeButton, SIGNAL(clicked()), this, SLOT(removeAction())); connect(addLauncherApplicationAction, SIGNAL(triggered()), this, SLOT(findLauncher())); connect(addLauncherFromFileAction, SIGNAL(triggered()), this, SLOT(addLauncher())); connect(addMenuLauncherMenu, SIGNAL(aboutToShow()), this, SLOT(populateMenu())); connect(addMenuLauncherMenu, SIGNAL(triggered(QAction*)), this, SLOT(addMenu(QAction*))); }
void ref(const value_ref &r) { modify(ref_, r); }
void ptr(const value_ptr &p) { modify(ptr_, p); }
void set_string(const std::string &x) { modify(string_, x); }
void set_varchar(const oos::varchar_base &x) { modify(varchar_, x); }
void set_cstr(const char *x, int size) { modify(cstr_, CSTR_LEN, x, size); }
void set_bool(bool x) { modify(bool_, x); }
void set_unsigned_long(unsigned long x) { modify(unsigned_long_, x); }
int main () { nod *cap; int inf, poz; cap = init(cap); //initializare lista //introducerea elementelor in lista printf("Introduceti noduri in lista. Terminati cu cifra zero.\n"); printf("Introduceti elementul = "); scanf("%d",&inf); while(inf != 0) //introducerea se va incheia cu elementul "0" { cap = adaugaSfarsit(cap,inf); //am ales adaugarea la sfarsit printf("Introduceti elementul = "); scanf("%d", &inf); } afisList(cap); //afisarea componentelor listei printf("\nLista are %d elemente", lung(cap)); //adaugarea unui element prin folosirea optiunii de adaugare la inceput printf("\nIntroduceti un element pentru a-l adauga la inceput: "); scanf("%d", &inf); cap = adaugaInceput(cap, inf); afisList(cap); //afisarea componentelor listei printf("\nLista are %d elemente", lung(cap)); //exemplificarea adaugarii dupa un element dat printf("\nIntroduceti valoarea dupa care doriti sa inserati: ");scanf("%d", &poz); printf("Introduceti un element pentru a-l adauga dupa valoarea %d:",poz); scanf("%d", &inf); cap = adaugaDupaElement(cap, poz, inf); afisList(cap); //afisarea componentelor listei printf("\nLista are %d elemente", lung(cap)); //exemplificarea optiunii de modificare a unei valori din lista printf("\nIntroduceti valoarea pe care doriti sa o modificati: "); scanf("%d", &poz); printf("Introduceti noua valoare: "); scanf("%d", &inf); cap = modify(cap,poz,inf); afisList(cap); //afisarea componentelor listei printf("\nLista are %d elemente", lung(cap)); //stergerea primului element din lista printf("\nVom sterge primul element din lista \n"); cap=stergeInceput(cap); afisList(cap); //afisarea componentelor listei printf("\nLista are %d elemente", lung(cap)); //stergerea elementului de la sfarsitul listei printf("\nVom sterge ultimul element din lista \n"); cap = stergeSfarsit(cap); afisList(cap); printf("\nLista are %d elemente", lung(cap)); //stergerea unei anumite valori din lista printf("\nIntroduceti valoarea pe care doriti sa o stergeti: "); scanf("%d", &inf); cap = stergeElement(cap, inf); afisList(cap); printf("\nLista are %d elemente", lung(cap)); //dealocarea listei printf("\nVom dealoca lista\n"); dealocare(cap); return 0; }
void title(const std::string &t) { modify(title_, t); }
main() { uint8 option=0; uint8 key; SysCtlClockSet(SYSCTL_SYSDIV_4| SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_6MHZ); Uart0Init(19200); Uart1Init(9600); Uart2Init(19200); IntMasterEnable(); SysLinearTimer =0; IoPortInit(); //IO口初始化 I2C1Init() ;//Fm31256 TimerInit(); xs6963_init(); PIN_TDA7367stand_Write(ETDA7367work_no); FlashUsecSet(49); //T1Init_LM331(); DPRINTF(("Bat=%d ,cha=%d ,Temp=%d \n",1,2,3)); Usb_Host_Init(); mainHandleinit(); signPWM_init(50.0); PWM_sign_stop(); /*LCD初始化*/ start_mune(); /* fm31256 eeprom 8 */ readbyte_much(setsto_addr,settype_nub,set.byte ); /*修正系数*/ modify_read(); /**/ Oiltempset.oilTwork=EOiltemp_Workon; /*lm331初始化 温度测量使用*/ T1Init_LM331(); /*系统节拍*/ SysLinearTimer=0; while(SysLinearTimer<3*TIMER_FREQ)//后台参数设置 { key=Keyset.keyEfficiency; if(key==key_modify) { while(Keyset.keyEfficiency==key_modify); option++; if(option>=4) { modify_read();//读取修正参数 TgC_read(); modify();//修正 } } } modifyK_js(); SysLinearTimer=0; rx_flag=0; option=0; mainset_go: key=Keyset.keyEfficiency; mainset_mune(); Reversepic(mainset_lin+option*mainset_high, mainset_column, mainset_high, 2*4); while(1) { while(key==Keyset.keyEfficiency) { if(SysLinearTimer>(3*TIMER_FREQ/4)) { // Temp_account(); if(TRUE_z==Gandispose())//地线检测 { mainset_mune(); Reversepic(mainset_lin+option*mainset_high, mainset_column, mainset_high, 2*4); } read_time(); { uint8 byte[12]; Clock_viewxs(byte) ; } SysLinearTimer=0; } } key=Keyset.keyEfficiency; /*按键处理*/ switch(key) { case key_no: case key_back: continue; case key_down: case key_up: Reversepic(mainset_lin+option*mainset_high, mainset_column, mainset_high, 2*4); option=keyoption_js(option, key,4,Emune_key);// Reversepic(mainset_lin+option*mainset_high, mainset_column, mainset_high, 2*4); /* if(key==key_up) { PWM_sign_acc(0.0, 0.0); delay(0x80000); PIN_DCAC_pwm(EDC_power); PWM_sign_acc(0.0, 0.7); } else { PWM_sign_acc(0.0, 0.0); delay(0x80000); PIN_DCAC_pwm(EAC_power); PWM_sign_acc(50.0, 0.8); } */ break; case key_ok: switch(option) { case ELan_main://语言 set.mune.Langue++; set.mune.Langue&=0x01; //ShowtextLine(mainset_lin+option*mainset_high, mainset_column+0x10,Lanset_p[set.mune.Langue]); break; case EOilset_main://油样设置 oidset(); break; case EView_main://历史数据 Viewdata_Hander(); break; case EClock_main://时钟设置 clockset_mune(); break; } goto mainset_go ; case key_oil: Oilclear();//排油 break; } } }
void name(const std::string &name) { modify(name_, name); }
void SAM(C64 *the_c64) { bool done = false; char c; TheCPU = the_c64->TheCPU; TheCPU1541 = the_c64->TheCPU1541; TheVIC = the_c64->TheVIC; TheSID = the_c64->TheSID; TheCIA1 = the_c64->TheCIA1; TheCIA2 = the_c64->TheCIA2; // Get CPU registers and current memory configuration TheCPU->GetState(&R64); TheCPU->ExtConfig = (~R64.ddr | R64.pr) & 7; TheCPU1541->GetState(&R1541); fin = stdin; fout = stdout; ferr = stdout; access_1541 = false; address = R64.pc; fprintf(ferr, "\n *** SAM - Simple Assembler and Monitor ***\n *** Press 'h' for help ***\n\n"); init_abort(); display_registers(); while (!done) { if (access_1541) fprintf(ferr, "1541> "); else fprintf(ferr, "C64> "); fflush(ferr); read_line(); while ((c = get_char()) == ' ') ; switch (c) { case 'a': // Assemble get_token(); assemble(); break; case 'b': // Binary dump get_token(); binary_dump(); break; case 'c': // Compare get_token(); compare(); break; case 'd': // Disassemble get_token(); disassemble(); break; case 'e': // Interrupt vectors int_vectors(); break; case 'f': // Fill get_token(); fill(); break; case 'h': // Help help(); break; case 'i': // ASCII dump get_token(); ascii_dump(); break; case 'k': // Memory configuration get_token(); mem_config(); break; case 'l': // Load data get_token(); load_data(); break; case 'm': // Memory dump get_token(); memory_dump(); break; case 'n': // Screen code dump get_token(); screen_dump(); break; case 'o': // Redirect output get_token(); redir_output(); break; case 'p': // Sprite dump get_token(); sprite_dump(); break; case 'r': // Registers get_reg_token(); registers(); break; case 's': // Save data get_token(); save_data(); break; case 't': // Transfer get_token(); transfer(); break; case 'v': // View machine state view_state(); break; case 'x': // Exit done = true; break; case ':': // Change memory get_token(); modify(); break; case '1': // Switch to 1541 mode access_1541 = true; break; case '6': // Switch to C64 mode access_1541 = false; break; case '?': // Compute expression get_token(); print_expr(); break; case '\n': // Blank line break; default: // Unknown command error("Unknown command"); break; } } exit_abort(); if (fout != ferr) fclose(fout); // Set CPU registers TheCPU->SetState(&R64); TheCPU1541->SetState(&R1541); }
const CursorDiff ScreenData::replace(const QPoint &point, const QString &text, const TextStyle &style, bool only_latin) { return modify(point,text,style,true, only_latin); }
void modify() /*修改函数*/ { int num; char name[10]; char sex; int date; char zhengzhimianmao; char addr[10]; long int tel; int b,c,i,n,t,flag=1; printf("请输入要修改的学生的姓名:\n"); scanf("%s",name); for(i=0;flag&&i<m;i++) { if(strcmp(st[i].name ,name)==0); { printf("\n已找到此人,原始记录为:\n"); printf("\n学号\t姓名\t性别\t出生日期\t政治面貌\t住址\t电话 \n"); printf("\n%d\t%s\%c\t%d\t%c\t%s\t%id\n",st[i].num,st[i].name,st[i].sex,st[i].date,st[i].zhengzhimianmao,st[i].addr,st[i].tel); printf("\n确实要修改此学生信息请按1;不修改请按0\n"); scanf("%d",&n); if(n==1) { printf("\nx需要进行修改的选项\n 1.学号 2.姓名 3.性别 4.出生日期 5.政治面貌 6.住址 7.电话\n"); printf("请输入你想修改的那一项序号:\n"); scanf("%d",&c); if(c>7||c<1) printf("\n选择错误,请重新选择!\n"); } flag=0; } } if(flag==1); printf("\n对不起,查无此人!\n"); do { switch(i-1) /*因为当找到第i个学生时,for语句后i自加乐1,所以下面的应该把改后的信息赋值给第i-1个学生*/ { case 1:printf("学号改为: "); scanf("%d",&num); st[i-1].num=num; break; case 2:printf("姓名改为: "); scanf("%s",name); strcpy(st[i-1].name,name); break; case 3:printf("性别改为: "); getchar(); scanf("%c",&sex); st[i-1].sex=sex; break; case 4:printf("出生日期改为: "); scanf("%d",&date); st[i-1].date=date; break; case 5:printf("政治面貌改为: "); getchar(); scanf("%c",&zhengzhimianmao); st[i-1].zhengzhimianmao=zhengzhimianmao; break; case 6:printf("住址改为: "); scanf("%s",addr); strcpy(st[i-1].addr,addr); break; case 7:printf("电话改为: "); scanf("%id",&tel); st[i-1].tel=tel; break; } printf("\n"); printf("\n是否确定所修改的信息?\n 是 请按1 ;重新修改 请按2: \n"); scanf("%d",&b); } while(b==2); printf("\n继续修改请按1,不再修改请按0\n"); scanf("%d",&t); switch(t) { case 1:modify();break; case 0:break; default:break; } }
const CursorDiff ScreenData::insert(const QPoint &point, const QString &text, const TextStyle &style, bool only_latin) { return modify(point,text,style,false, only_latin); }
void modify(HANDLE token, PCWSTR priv_name, bool enable) { modify(token, as_luid(priv_name), enable); }
void Simulation::replaceAtom(int selI, Atom* a, Atom* b) { b->i = a->i; b->setPos(a->pos()); b->state = a->state; b->nx = a->nx; b->ny = a->ny; b->vx = a->vx; b->vy = a->vy; memcpy(b->bondsLt, a->bondsLt, sizeof(Atom*) * 6); memcpy(b->bondsGt, a->bondsGt, sizeof(Atom*) * 6); b->numBondsLt = a->numBondsLt; b->numBondsGt = a->numBondsGt; memcpy(b->reaction, a->reaction, sizeof(int) * 18); b->reactionStr = a->reactionStr; b->selected = a->selected; int j = 0; while (j < b->numBondsLt) { int k = 0; int c = b->bondsLt[j]->numBondsGt; Atom** bonds = b->bondsLt[j]->bondsGt; while (k < c) { if (bonds[k] == a) {bonds[k] = b;} k++; } j++; } j = 0; while (j < b->numBondsGt) { int k = 0; int c = b->bondsGt[j]->numBondsLt; Atom** bonds = b->bondsGt[j]->bondsLt; while (k < c) { if (bonds[k] == a) {bonds[k] = b;} k++; } j++; } removeItem(a); addItem(b); b->changeSceneSize(); atoms[a->i] = b; if (selI != -1) { selected[selI] = b; } modify(); delete a; /* int actualNumAtoms = numAtoms; numAtoms = atomIndex(a); qDebug() << numAtoms; qDebug() << a; removeItem(atoms[numAtoms]); qDebug() << "a"; addAtom(QPointF(a->nx, a->ny), type, a->state); qDebug() << atoms[numAtoms - 1]; selected.replace(i, atoms[numAtoms - 1]); numAtoms = actualNumAtoms; qDebug() << "e"; delete a; qDebug() << "f"; */ }
void modify(PCWSTR priv_name, bool enable) { modify(WinToken(TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES), priv_name, enable); }
void Simulation::deleteAtom() { modify(); }
constexpr int test1() { int k = 0; return modify(k); }
value mkexn0val(value exnname) { value exnval = alloc_tuple(2); modify(&Field(exnval, 0), Field(global_data, exnname)); modify(&Field(exnval, 1), Val_unit); return exnval; }
int main() { scanf("%d%d", &n, &m); for(int i = 1; i <= n; ++i) scanf("%d", a + i); for(sqn = 1; sqn * sqn < n; ++sqn); sqn = std::max(sqn, (n - 1) / 200 + 1); for(int i = 1, j = 1; i <= n; i += sqn, ++j) { int iLim = std::min(i + sqn - 1, n); fir[j] = i; for(int k = i; k <= iLim; ++k) pos[k] = j; } blk = pos[n]; fir[blk + 1] = n + 1; for(int i = 1; i <= blk; ++i) { memset(b[i] + 1, 0, blk * sizeof(int)); memset(c[i] + 1, 0, n * sizeof(int)); } for(int i = 1; i <= n; ++i) { int x = pos[i], v = a[i], y = pos[v]; ++b[x][y]; ++c[x][v]; p[1][i] = q[1][i] = i; } for(int i = 2; i <= blk; ++i) { for(int j = 1; j <= blk; ++j) b[i][j] += b[i - 1][j]; for(int j = 1; j <= n; ++j) c[i][j] += c[i - 1][j]; memcpy(p[i] + 1, p[1] + 1, n * sizeof(int)); memcpy(q[i] + 1, q[1] + 1, n * sizeof(int)); } while(m--) { int typ, L, R, A, B, pL, pR; scanf("%d%d%d%d", &typ, &L, &R, &A); pL = pos[L]; pR = pos[R]; if(typ == 1) { scanf("%d", &B); if(A == B) continue; int pA = pos[A], pB = pos[B]; if(pL == pR) { int dt = modify(L, R, pL, A, B); if(dt) for(int i = pL; i <= blk; ++i) { b[i][pA] -= dt; b[i][pB] += dt; c[i][A] -= dt; c[i][B] += dt; } } else { int dt = 0; for(int i = pL; i <= blk; ++i) { if(dt) { b[i][pA] -= dt; b[i][pB] += dt; c[i][A] -= dt; c[i][B] += dt; } if(i > pR) continue; int res = modify(std::max(L, fir[i]), std::min(R, fir[i + 1] - 1), i, A, B); if(res) { b[i][pA] -= res; b[i][pB] += res; c[i][A] -= res; c[i][B] += res; dt += res; } } } } else { int y, ans; memset(cnt + 1, 0, blk * sizeof(int)); if(fir[pL] < L || R < fir[pR + 1] - 1) { if(pL == pR) { count1(L, R, pL); ++pL; } else { if(fir[pL] < L) { count1(L, fir[pL + 1] - 1, pL); ++pL; } if(R < fir[pR + 1] - 1) { count1(fir[pR], R, pR); --pR; } } } for(y = 1; y <= blk; ++y) { int ctr = cnt[y] + b[pR][y] - b[pL - 1][y]; if(A <= ctr) break; A -= ctr; } pL = pos[L]; pR = pos[R]; _cnt = cnt - fir[y] + 1; memset(cnt + 1, 0, sqn * sizeof(int)); if(fir[pL] < L || R < fir[pR + 1] - 1) { if(pL == pR) { count2(L, R, pL, y); ++pL; } else { if(fir[pL] < L) { count2(L, fir[pL + 1] - 1, pL, y); ++pL; } if(R < fir[pR + 1] - 1) { count2(fir[pR], R, pR, y); --pR; } } } for(ans = fir[y]; ans < fir[y + 1]; ++ans) { int ctr = _cnt[ans] + c[pR][ans] - c[pL - 1][ans]; if(A <= ctr) break; A -= ctr; } printf("%d\n", ans); } } return 0; }
void set_unsigned_short(unsigned short x) { modify(unsigned_short_, x); }