void SettingsWindow::connectSlots() { connect (m_ok, SIGNAL (clicked()), this, SLOT (apply())); connect (m_reset, SIGNAL (clicked()), this, SLOT (reset())); connect (m_cancel, SIGNAL (clicked()), this, SLOT (cancel())); connect (DS(), SIGNAL (teamChanged (int)), this, SLOT (updateTeam (int))); connect (DS(), SIGNAL (protocolChanged()), this, SLOT (readSettings())); connect (m_useCustomAddress, SIGNAL (toggled (bool)), m_robotAddress, SLOT (setEnabled (bool))); connect (m_baseButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_highlightButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_backgroundButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_foregroundButton, SIGNAL (clicked()), this, SLOT (onSelectorClicked())); connect (m_baseEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); connect (m_highlightEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); connect (m_backgroundEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); connect (m_foregroundEdit, SIGNAL (textChanged (QString)), this, SLOT (onColorChanged (QString))); }
void SettingsWindow::applySettings() { /* Set the team number to be sure the address placeholder is good */ DS()->setTeamNumber (Settings::get ("Team", 0).toInt()); /* Only use a custom robot address if the checkbox is checked */ QString ip = m_useCustomAddress->isChecked() ? m_robotAddress->text() : ""; Settings::set ("Robot Address", ip); /* Apply the robot address */ DS()->setRobotAddress (ip); m_robotAddress->setText (ip); m_robotAddress->setPlaceholderText (DS()->defaultRobotAddress()); /* Apply other settings */ Settings::set ("Auto Updater", m_autoUpdater->isChecked()); Settings::set ("UI Sounds", m_soundEffects->isChecked()); Settings::set ("Prompt on Quit", m_promptOnQuit->isChecked()); /* Create and apply a theme from UI values */ AppTheme::Theme theme; theme.base = m_baseEdit->text(); theme.highlight = m_highlightEdit->text(); theme.background = m_backgroundEdit->text(); theme.foreground = m_foregroundEdit->text(); AppTheme::apply (theme); }
BOOL CTwain::FileXfer(void) { TW_SETUPFILEXFER twsfx; if (!DS(DG_CONTROL, DAT_SETUPFILEXFER, MSG_GET, &twsfx)) { return FALSE; } int nFF = twsfx.Format; if (!FileXferReady(nFF, twsfx.FileName)) { // application aborted transfer return FALSE; } twsfx.Format = (TW_UINT16)nFF; if (!DS(DG_CONTROL, DAT_SETUPFILEXFER, MSG_SET, &twsfx)) { FileXferDone(NULL, 0); return FALSE; } if (!DS(DG_IMAGE, DAT_IMAGEFILEXFER, MSG_GET, NULL)) { FileXferDone(NULL, 0); return FALSE; } ATLASSERT(nState >= TRANSFER_READY); EndXfer(); // acknowledge & end transfer ATLASSERT(nState == TRANSFER_READY || nState == SOURCE_ENABLED); FlushMessageQueue(); FileXferDone(twsfx.FileName, 255); return TRUE; }
static QState buttons_waiting(struct Buttons *me) { switch (Q_SIG(me)) { case Q_ENTRY_SIG: SERIALSTR("<+bw>"); DS(button1, BUTTON_RELEASED_SIGNAL); DS(button2, BUTTON_RELEASED_SIGNAL); DS(button3, BUTTON_RELEASED_SIGNAL); me->up_counter = 3; return Q_HANDLED(); case BUTTONS_SIGNAL: if ((uint16_t)(Q_PAR(me)) == 0) { me->up_counter --; if (me->up_counter) { return Q_HANDLED(); } else { SERIALSTR("@"); return Q_TRAN(buttons_state); } } else { me->up_counter = 3; return Q_HANDLED(); } case Q_EXIT_SIG: SERIALSTR("<-bw>"); return Q_HANDLED(); } return Q_SUPER(buttons_state); }
BOOL CTwain::MemoryXfer(void) { ATLASSERT(nState == TRANSFER_READY); TW_IMAGEINFO info; TW_SETUPMEMXFER twsx; TW_IMAGEMEMXFER mx; if (!DS(DG_CONTROL, DAT_SETUPMEMXFER, MSG_GET, &twsx)) { return FALSE; } // Get actual image info if (!DS(DG_IMAGE, DAT_IMAGEINFO, MSG_GET, &info)) { return FALSE; } ATLASSERT(nState == TRANSFER_READY); if (!MemXferReady(info)) { // application aborted transfer return FALSE; } if (!MemXferAlloc(twsx, mx.Memory)) { MemXferDone(FALSE); return FALSE; } int iRow = 0; while (DS(DG_IMAGE, DAT_IMAGEMEMXFER, MSG_GET, &mx)) { // We got a buffer - make sure DS doesn't // feed us rows past the end of the image: mx.Rows = min(mx.Rows, (unsigned)(info.ImageLength - iRow)); // Don't call the buffer-handler with 0 rows if (mx.Rows != 0) { if (!MemXferBuffer(iRow, mx)) { // Buffer callback says to abort break; } iRow += mx.Rows; } if (ResultCode() == TWRC_XFERDONE) { // DS says that was the last buffer: iRow = info.ImageLength; // no matter what, we're done break; } } MemXferFree(mx.Memory); ATLASSERT(nState >= TRANSFER_READY); EndXfer(); // acknowledge & end transfer ATLASSERT(nState == TRANSFER_READY || nState == SOURCE_ENABLED); FlushMessageQueue(); MemXferDone(iRow == info.ImageLength); return TRUE; }
/* change passwd */ int sql_change_passwd(cs_request_t *req, sqlite3 *db, buf_t *wbuf) { if (req == NULL || req->name == NULL || req->passwd == NULL || db == NULL || wbuf == NULL || wbuf->data == NULL) { E("parameter error."); return -1; } char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX); if (query_line == NULL) { E("cs_malloc() failed."); DPSTR(wbuf); return -1; } /* check identify */ sprintf(query_line, "select * from users where name='%s' and passwd='%s'", req->name, req->passwd); DS(query_line); int sql_select_num = 0; int ret = sqlite3_exec(db, query_line, sql_check_identity_cb, &sql_select_num, NULL); if (ret != SQLITE_OK || sql_select_num != 1) { /* no this user & passwd */ E("sqlite3_exec() failed."); DD(sql_select_num); cs_free(&query_line); strncpy(wbuf->data, "err", 3); wbuf->len = 3; return -1; } /* update user info in users table */ memset(query_line, '\0', QUERY_LEN_MAX); sprintf(query_line, "update users set passwd='%s' where name='%s'", req->content, req->name); DS(query_line); ret = sqlite3_exec(db, query_line, NULL, NULL, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); strncpy(wbuf->data, "err", 3); wbuf->len = 3; return -1; } strncpy(wbuf->data, "ok", 2); wbuf->len = 2; cs_free(&query_line); D(GREEN"user %s change passwd success.", req->name); return 0; }
/* del log */ int sql_del_log(cs_request_t *req, sqlite3 *db, buf_t *wbuf) { if (req == NULL || req->name == NULL || req->buddy_name == NULL || db == NULL || wbuf == NULL || wbuf->data == NULL) { E("parameter error."); return -1; } char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX); if (query_line == NULL) { E("cs_malloc() failed."); DPSTR(wbuf); return -1; } /* check log_type */ sprintf(query_line, "select * from %s where name='%s'", req->name, req->buddy_name); DS(query_line); int log_type = -1; int ret = sqlite3_exec(db, query_line, sql_log_type_cb, &log_type, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); DD(log_type); cs_free(&query_line); return -1; } /* empty offline table message */ memset(query_line, '\0', QUERY_LEN_MAX); if (log_type == 0) sprintf(query_line, "delete from %s_%s", req->name, req->buddy_name); else if (log_type == 1) sprintf(query_line, "delete from %s_%s", req->buddy_name, req->name); else DD(log_type); DS(query_line); ret = sqlite3_exec(db, query_line, NULL, NULL, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); return -1; } strncpy(wbuf->data, "ok", 2); wbuf->len = 2; cs_free(&query_line); D(GREEN"clear log with %s success.", req->buddy_name); return 0; }
static QState buttons_state(struct Buttons *me) { switch (Q_SIG(me)) { case Q_ENTRY_SIG: SERIALSTR("(b2)"); return Q_HANDLED(); case BUTTONS_WAIT_SIGNAL: return Q_TRAN(buttons_waiting); case BUTTONS_SIGNAL: if ((uint16_t)(Q_PAR(me)) & 0b0001) { DS(button1, BUTTON_PRESSED_SIGNAL); } else { DS(button1, BUTTON_RELEASED_SIGNAL); } if ((uint16_t)(Q_PAR(me)) & 0b0010) { DS(button2, BUTTON_PRESSED_SIGNAL); } else { DS(button2, BUTTON_RELEASED_SIGNAL); } if ((uint16_t)(Q_PAR(me)) & 0b0100) { DS(button3, BUTTON_PRESSED_SIGNAL); } else { DS(button3, BUTTON_RELEASED_SIGNAL); } if ((uint16_t)(Q_PAR(me)) & 0b1000) { DS(button4, BUTTON_PRESSED_SIGNAL); } else { DS(button4, BUTTON_RELEASED_SIGNAL); } return Q_HANDLED(); } return Q_SUPER(QHsm_top); }
int sql_logout(cs_request_t *req, sqlite3 *db, buf_t *wbuf) { if (req == NULL || db == NULL || wbuf == NULL || wbuf->data == NULL) { E("parameter error."); return -1; } char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX); if (query_line == NULL) { E("cs_malloc() failed."); DPSTR(wbuf); return -1; } /* update user info in users table */ sprintf(query_line, "update users set fd=-1 where name='%s'", req->name); DS(query_line); int ret = sqlite3_exec(db, query_line, NULL, NULL, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); return -1; } /* notice all buddy */ memset(query_line, '\0', QUERY_LEN_MAX); sprintf(query_line, "select %s.name, users.fd from %s,users where %s.name=users.name", req->name, req->name, req->name); DS(query_line); ret = sqlite3_exec(db, query_line, sql_notice_buddy_cb, req->name, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); return -1; } strncpy(wbuf->data, "ok", 2); wbuf->len = 2; cs_free(&query_line); /* * find mine fd, fd_clr and close fd. * free mine wrbuf * on L171 cs_server.c where n == 0 */ return 0; }
void TextEditorRemoteNode::processIncomingPacket( const QByteArray &B ) { QDataStream DS( B ); quint16 PacketType = PACKET_UNKNOWN; DS >> PacketType; switch( PacketType ) { case PACKET_UNKNOWN: break; case PACKET_TEXT: receiveTextPacket( DS ); break; case PACKET_HIGHLIGHTER: receiveHighlighter( DS ); break; case PACKET_ERRORS: receiveErrors( DS ); break; } }
void Preferences::createWidgets() { m_protocolLabel = new QLabel (tr ("Protocol"), this); m_dashboardLabel = new QLabel (tr ("Dashboard"), this); m_teamNumberLabel = new QLabel (tr ("Team Number"), this); m_teamNumber = new QSpinBox (this); m_protocols = new QComboBox (this); m_dashboards = new QComboBox (this); m_practiceTimings = new QGroupBox (tr ("Practice Timings"), this); m_delayLabel = new QLabel (tr ("Delay")); m_teleopLabel = new QLabel (tr ("Teleop")); m_endGameLabel = new QLabel (tr ("End game")); m_countdownLabel = new QLabel (tr ("Countdown")); m_autonomousLabel = new QLabel (tr ("Autonomous")); m_delay = new QSpinBox (this); m_teleop = new QSpinBox (this); m_endGame = new QSpinBox (this); m_countdown = new QSpinBox (this); m_autonomous = new QSpinBox (this); m_delay->setRange (0, 500); m_teleop->setRange (0, 500); m_endGame->setRange (0, 500); m_countdown->setRange (0, 500); m_autonomous->setRange (0, 500); m_teamNumber->setRange (0, 9999); m_protocols->addItems (DS()->protocols()); m_dashboards->addItems (Dashboards::getInstance()->dashboardList()); m_dashboards->setCurrentIndex (Settings::get ("Dashboard", 0).toInt()); }
int sql_find_buddy_fd(cs_request_t *req, sqlite3 *db) { if (req == NULL || req->name == NULL || req->buddy_name == NULL || db == NULL) { E("parameter error."); return -1; } char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX); if (query_line == NULL) { E("cs_malloc() failed."); return -1; } sprintf(query_line, "select * from users where name='%s'", req->buddy_name); DS(query_line); int fd = 0; int ret = sqlite3_exec(db, query_line, sql_buddy_fd_cb, &fd, NULL); if (ret != SQLITE_OK || fd < 0) { E("sqlite3_exec() failed."); DD(fd); cs_free(&query_line); return -1; } cs_free(&query_line); D(GREEN"user %s fd is %d.", req->buddy_name, fd); return fd; }
void core_Switch(CONTEXT *regs) { struct ExecBase *SysBase = *SysBasePtr; struct Task *task; struct AROSCPUContext *ctx; Ints_Enabled = 0; D(bug("[KRN] core_Switch()\n")); task = SysBase->ThisTask; DS(bug("[KRN] Old task = %p (%s)\n", task, task->tc_Node.ln_Name)); /* Copy current task's context into the ETask structure */ ctx = (struct AROSCPUContext *)GetIntETask(task)->iet_Context; CopyMemory(ctx, regs, sizeof(CONTEXT)); ctx->LastError = *LastErrorPtr; /* store IDNestCnt into tasks's structure */ task->tc_IDNestCnt = SysBase->IDNestCnt; task->tc_SPReg = (APTR)regs->Esp; /* And enable interrupts */ SysBase->IDNestCnt = -1; /* TF_SWITCH flag set? Call the switch routine */ if (task->tc_Flags & TF_SWITCH) { task->tc_Switch(SysBase); } core_Dispatch(regs); }
int CTwain::SetCapOneValue(unsigned Cap, unsigned ItemType, TW_UINT32 ItemVal) { TW_CAPABILITY cap; pTW_ONEVALUE pv; BOOL bSuccess; if (nState != SOURCE_OPEN) { ATLTRACE_ERROR(TWERR_NOT_4); return FALSE; } cap.Cap = (TW_UINT16)Cap; // capability id cap.ConType = TWON_ONEVALUE; // container type do { cap.hContainer = GlobalAlloc(GHND, sizeof (TW_ONEVALUE)); if (!cap.hContainer) { if (IDCANCEL == MessageBox(NULL, _T("Internal error while preparing for TWAIN acquire."), _T("ImageWalker"), MB_RETRYCANCEL | MB_ICONEXCLAMATION)) { return FALSE; } } } while (!cap.hContainer); pv = (pTW_ONEVALUE)GlobalLock(cap.hContainer); pv->ItemType = (TW_UINT16)ItemType; pv->Item = ItemVal; GlobalUnlock(cap.hContainer); bSuccess = DS(DG_CONTROL, DAT_CAPABILITY, MSG_SET, (TW_MEMREF)&cap); GlobalFree(cap.hContainer); return bSuccess; } // SetCapOneValue
int sql_view_info(cs_request_t *req, sqlite3 *db, buf_t *wbuf) { if (req == NULL || req->buddy_name == NULL || db == NULL || wbuf == NULL || wbuf->data == NULL) { E("parameter error."); return -1; } /* check log_type */ char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX); if (query_line == NULL) { E("cs_malloc() failed."); DPSTR(wbuf); return -1; } sprintf(query_line, "select * from users where name='%s'", req->buddy_name); DS(query_line); int ret = sqlite3_exec(db, query_line, sql_get_info_cb, wbuf, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); return -1; } cs_free(&query_line); D(GREEN"view %s info success.", req->buddy_name); return 0; }
int CTwain::TwainMessageHook(LPMSG lpmsg) // returns TRUE if message processed by TWAIN // FALSE otherwise { int bProcessed = FALSE; if (nState >= SOURCE_ENABLED) { // source enabled TW_EVENT twEvent; twEvent.pEvent = (TW_MEMREF)lpmsg; twEvent.TWMessage = MSG_NULL; // relay message to source in case it wants it DS(DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT, &twEvent); bProcessed = (rc == TWRC_DSEVENT); switch (twEvent.TWMessage) { case MSG_XFERREADY: // notify by callback // default callback does transfers XferReady(lpmsg); break; case MSG_CLOSEDSREQ: // notify by callback // default callback closes the source CloseDsRequest(); break; case MSG_NULL: // no message returned from DS break; } // switch } return bProcessed; } // TwainMessageHook
static void quit(struct winampVisModule *this_mod) { #define DS(x) //MessageBox(this_mod->hwndParent,x,"AVS Debug",MB_OK) if (g_hThread) { DS("Waitin for thread to quit\n"); g_ThreadQuit=1; if (WaitForSingleObject(g_hThread,10000) != WAIT_OBJECT_0) { DS("Terminated thread (BAD!)\n"); //MessageBox(NULL,"error waiting for thread to quit","a",MB_TASKMODAL); TerminateThread(g_hThread,0); } DS("Thread done... calling ddraw_quit\n"); DDraw_Quit(); DS("Calling cfgwnd_destroy\n"); CfgWnd_Destroy(); DS("Calling render_quit\n"); Render_Quit(this_mod->hDllInstance); DS("Calling wnd_quit\n"); Wnd_Quit(); DS("closing thread handle\n"); CloseHandle(g_hThread); g_hThread=NULL; DS("calling eel quit\n"); AVS_EEL_IF_quit(); DS("cleaning up critsections\n"); DeleteCriticalSection(&g_cs); DeleteCriticalSection(&g_render_cs); DS("smp_cleanupthreads\n"); C_RenderListClass::smp_cleanupthreads(); } #undef DS #if 0//syntax highlighting if (hRich) FreeLibrary(hRich); hRich=0; #endif }
/* * Task dispatcher. Basically it may be the same one no matter what scheduling algorithm is used */ void core_Dispatch(CONTEXT *regs) { struct ExecBase *SysBase = *SysBasePtr; struct Task *task; struct AROSCPUContext *ctx; Ints_Enabled = 0; D(bug("[KRN] core_Dispatch()\n")); /* * Is the list of ready tasks empty? Well, increment the idle switch cound and stop the main thread. */ if (IsListEmpty(&SysBase->TaskReady)) { if (!Sleep_Mode) { SysBase->IdleCount++; SysBase->AttnResched |= ARF_AttnSwitch; DSLEEP(bug("[KRN] TaskReady list empty. Sleeping for a while...\n")); /* We are entering sleep mode */ Sleep_Mode = SLEEP_MODE_PENDING; } core_LeaveInterrupt(); return; } Sleep_Mode = SLEEP_MODE_OFF; SysBase->DispCount++; /* Get the first task from the TaskReady list, and populate it's settings through Sysbase */ task = (struct Task *)REMHEAD(&SysBase->TaskReady); SysBase->ThisTask = task; SysBase->Elapsed = SysBase->Quantum; SysBase->SysFlags &= ~0x2000; task->tc_State = TS_RUN; SysBase->IDNestCnt = task->tc_IDNestCnt; DS(bug("[KRN] New task = %p (%s)\n", task, task->tc_Node.ln_Name)); /* Handle tasks's flags */ if (task->tc_Flags & TF_EXCEPT) Exception(); if (task->tc_Flags & TF_LAUNCH) { task->tc_Launch(SysBase); } /* Restore the task's state */ ctx = (struct AROSCPUContext *)GetIntETask(task)->iet_Context; CopyMemory(regs, ctx, sizeof(CONTEXT)); *LastErrorPtr = ctx->LastError; /* Leave interrupt and jump to the new task */ core_LeaveInterrupt(); }
Console::Console (QWidget* parent) : QWidget (parent) { createWidgets(); createLayouts(); configureStyles(); connect (m_copyButton, SIGNAL (clicked()), this, SLOT (copy())); connect (m_clearButton, SIGNAL (clicked()), this, SLOT (clear())); connect (DS(), SIGNAL (newMessage (QString)), this, SLOT (log (QString))); }
int CTwain::CancelXfers(void) { EndXfer(); // if transferring, cancel it if (nState == TRANSFER_READY) { DS(DG_CONTROL, DAT_PENDINGXFERS, MSG_RESET, &pendingXfers); if (nState == TRANSFER_READY && bTrace) ATLTRACE(_T("TWAIN:CancelXfers failed.\n")); } return (nState < TRANSFER_READY); } // CancelXfers
int CTwain::EndXfer(void) { if (nState == TRANSFERRING) { DS(DG_CONTROL, DAT_PENDINGXFERS, MSG_ENDXFER, &pendingXfers); if (nState == TRANSFERRING && bTrace) ATLTRACE(_T("TWAIN:EndXfer failed.\n")); } else { if (bTrace) ATLTRACE(_T("TWAIN:**WARNING** EndXfer in wrong state\n")); } return nState < TRANSFERRING; } // EndXfer
int mains() { std::cout<<" Hello World Begin Testing "<<std::endl; string StoreName = "TestStore"; DataStore DS(StoreName); Log ThisLog; //ThisLog<<" Created a datastore "<<endl; return 0; }
int sql_del_info_buddy_cb(void *p, int argc, char **value, char **name) { destroy_t *dt = (destroy_t *)p; char *query_line = (char *)cs_malloc(sizeof(char) * QUERY_LEN_MAX); if (query_line == NULL) { E("cs_malloc() failed."); return -1; } /* delete user info in buddy table */ sprintf(query_line, "delete from %s where name='%s'", value[1], dt->name); DS(query_line); int ret = sqlite3_exec(dt->db, query_line, NULL, NULL, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); return -1; } /* delete name_buddy tables */ memset(query_line, '\0', QUERY_LEN_MAX); int log_type = atoi(value[2]); if (log_type == 0) sprintf(query_line, "drop table %s_%s", dt->name, value[1]); else if (log_type == 1) sprintf(query_line, "drop table %s_%s", value[1], dt->name); else DD(log_type); DS(query_line); ret = sqlite3_exec(dt->db, query_line, NULL, NULL, NULL); if (ret != SQLITE_OK) { E("sqlite3_exec() failed."); cs_free(&query_line); return -1; } cs_free(&query_line); return 0; }
int CTwain::DisableSource(void) { ::BringWindowToTop((HWND)twUI.hParent); if (nState == SOURCE_ENABLED) { DS(DG_CONTROL, DAT_USERINTERFACE, MSG_DISABLEDS, &twUI); if (nState == SOURCE_ENABLED && bTrace) { ATLTRACE(_T("TWAIN:DisableSource failed.\n")); } } return (nState < SOURCE_ENABLED); } // DisableSource
void kopp_fc_func(char *in) { int SingleBlkOnly=0; // Default: we will send key off if Keycode >= 0x80 uint32_t LastWatchdog; uint8_t blkTXcode=0x00; uint8_t inhex_dec[kopp_fc_Command_char]; // in_decbin: decimal value of hex commandline uint8_t hblen = fromhex(in+2, inhex_dec, strlen(in)); strcpy(ErrorMSG,"ok"); // If parameter 2 = "t" then "Transmitt Free Control Telegram" SingleBlkOnly=0; // Default: we will send key off if Keycode >= 0x80 if((in[1] == 't') || (in[1] == 's')) // Transmitt Command // ================= { kopp_fc_tx_on = 1; // Transmitt activated if (in[15]=='J') printon[0]='Y'; else printon[0]='N'; // Sollen wir Daten ausgeben (Zeitstempel etc) if(in[1] == 's') SingleBlkOnly=1; // Command = "s", -> If KeyCode > 0x80 we will send no !! Key Off Code LastWatchdog=ticks; // I guess, Watchdog reset was done shortly before BlockStartTime=ticks; // print some status Information if (printon[0]=='Y') { DS_P(PSTR("Transmitt\r\n")); DS_P(PSTR("commandlineparameter: ")); DS(in); DS_P(PSTR("\r\nStringlength: ")); DU(strlen(in),0); DS_P(PSTR("\r\nNext Character (int) after parameter (should be line end character): ")); DU((int)in[strlen(in)],0); DS_P(PSTR("\r\nAmount of Bytes (Hex) found inside command line parameter: ")); DU(hblen,0); DS_P(PSTR("\r\n")); // following code to check whether ticks uses full 32 bits or will be reset afer 125 ticks DS_P(PSTR("Tick Timer: ")); DH((uint16_t)(( BlockStartTime>>16) & 0xffff),4); DH((uint16_t)(BlockStartTime & 0xffff),4); DS_P(PSTR("\r\n")); }
int main(int argc, char **argv) { DisjointSets DS(5); for (int i = 0; i < 5; ++i) DS.MakeSet(i); DS.Union(0,1); DS.Union(1,2); DS.Union(3,4); cout << DS.Find(0) << ' ' << DS.Find(2) << endl; cout << DS.Find(4) << endl; DS.Union(4,0); cout << DS.Find(0) << ' ' << DS.Find(1) << ' ' << DS.Find(4) << endl; }
int CTwain::CloseSource(void) { rc = TWRC_SUCCESS; if (nState == SOURCE_ENABLED) { DisableSource(); } if (nState == SOURCE_OPEN) { DS(DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS, &SourceId); if (nState == SOURCE_OPEN && bTrace) ATLTRACE(_T("TWAIN:CloseSource failed.\n")); } return (nState < SOURCE_OPEN); } // CloseSource
int YARPMEIDeviceDriver::getSpeeds(void *spds) { long rc = 0; double *out = (double *) spds; DSP_DM vel; for(int i = 0; i < _njoints; i++) { P_DSP_DM current_v_addr = dspPtr->data_struct + DS_CURRENT_VEL + DS(i); pcdsp_transfer_block(dspPtr, TRUE, FALSE, current_v_addr, 1, &vel); out[i] = vel*_dsp_rate; } return rc; }
int CTwain::GetImageLayout(double &left, double &top, double &width, double &height) { TW_IMAGELAYOUT layout; if (DS(DG_IMAGE, DAT_IMAGELAYOUT, MSG_GET, &layout)) { left = Fix32ToFloat(layout.Frame.Left); top = Fix32ToFloat(layout.Frame.Top); width = Fix32ToFloat(layout.Frame.Right) - left; height = Fix32ToFloat(layout.Frame.Bottom) - top; return TRUE; } else { left = top = width = height = 0.0; return FALSE; } } // SetImageLayout
int X(have_simd_sse2)(void) { static int init = 0, res; if (!init) { res = !is_386() && has_cpuid() && (cpuid_edx(1) & (1 << DS(26,25))) && sse2_works(); init = 1; X(check_alignment_of_sse2_pm)(); } return res; }