DavicomDevice * create_davicom_device(usb_device device) { const usb_device_descriptor *deviceDescriptor = gUSBModule->get_device_descriptor(device); if (deviceDescriptor == NULL) { TRACE_ALWAYS("Error of getting USB device descriptor.\n"); return NULL; } #define IDS(__vendor, __product) (((__vendor) << 16) | (__product)) switch(IDS(deviceDescriptor->vendor_id, deviceDescriptor->product_id)) { case IDS(0x0fe6, 0x8101): return new DavicomDevice(device, "Sunrising JP108"); case IDS(0x07aa, 0x9601): return new DavicomDevice(device, "Corega FEther USB-TXC"); case IDS(0x0a46, 0x9601): return new DavicomDevice(device, "Davicom USB-100"); case IDS(0x0a46, 0x6688): return new DavicomDevice(device, "ZT6688 USB NIC"); case IDS(0x0a46, 0x0268): return new DavicomDevice(device, "ShanTou ST268 USB NIC"); case IDS(0x0a46, 0x8515): return new DavicomDevice(device, "ADMtek ADM8515 USB NIC"); case IDS(0x0a47, 0x9601): return new DavicomDevice(device, "Hirose USB-100"); case IDS(0x0a46, 0x9000): return new DavicomDevice(device, "DM9000E"); } return NULL; }
std::wstring logclass_filter::desc() const { if (m_class_low == 0 && m_class_high == 0) { return IDS2(IDS_ALL_LOG_LEVEL); } else if (m_class_low == m_class_high) { return std::wstring(IDS2(IDS_LOG_LEVEL)) + L" = " + quote(helper::GetLogLevelDescription(m_class_high)); } else if (m_class_low == 0) { return std::wstring(IDS2(IDS_LOG_LEVEL)) + L" <= " + quote(helper::GetLogLevelDescription(m_class_high)); } else if (m_class_high == 0) { return std::wstring(IDS(IDS_LOG_LEVEL)) + L" >= " + quote(helper::GetLogLevelDescription(m_class_low)); } else { return std::wstring(IDS2(IDS_LOG_LEVEL)) + IDSFMT2(IDS_BETWEEN_s_AND_s, quote(helper::GetLogLevelDescription(m_class_low)).c_str(), quote(helper::GetLogLevelDescription(m_class_high)).c_str()); } }
LRESULT CLogContentFilterEditDlg::OnOK(WORD , WORD , HWND , BOOL& ) { CStringW text; GetDlgItemText(IDC_EDIT_LOGCONTENT, text); CButton btn((HWND)GetDlgItem(IDC_CHECK_IGNORECASE)); bool ics = (btn.GetCheck() == 1); CButton btn2((HWND)GetDlgItem(IDC_CHECK_REGEX)); bool use_regex = (btn2.GetCheck() == 1); if (!m_filter->setfilter((LPCWSTR)text, ics, use_regex)) { ::MessageBoxW(m_hWnd, IDS(IDS_REGEX_PARSE_ERROR), IDS(IDS_ERROR), MB_ICONWARNING|MB_OK); return 0; } EndDialog(IDOK); return 0; }
std::wstring logcontent_filter::desc() const { std::wstring str; if (m_use_regex) { str = IDSFMT(IDS_LOG_CONTENT_MATCH_REGEX_s, m_matcher.c_str()); } else { str = IDSFMT(IDS_LOG_CONTENT_CONTAIN_s, m_matcher.c_str()); } if (m_ignore_case) str += L" (" + IDS(IDS_IGNORE_CASE) + L")"; return str; }
inline uint RIDS(lzindex I, uint rpos) { return IDS(I, leftrankLZTrie(I.fwdtrie,Rev(I,rpos))); }
OP_ERROR SOP_IdBlast::cookMySop(OP_Context &context) { fpreal now; exint id; GA_Offset start, end; GA_PointGroup *group; GA_ROAttributeRef id_gah; GA_ROPageHandleI id_ph; UT_String pattern; UT_WorkArgs tokens; IdOffsetMap id_map, srcid_map; GroupIdMapPair pair; now = context.getTime(); if (lockInputs(context) >= UT_ERROR_ABORT) return error(); // Duplicate the incoming geometry. duplicateSource(0, context); // Get the id pattern. IDS(pattern, now); // If it's emptry, don't do anything. if (pattern.length() == 0) { unlockInputs(); return error(); } // Tokenize the range so we can handle multiple blocks. pattern.tokenize(tokens, " "); // Try to find the 'id' point attribute on the 1st input geometry. id_gah = gdp->findPointAttribute(GA_SCOPE_PUBLIC, "id"); // If it doesn't exist, display a node error message and exit. if (id_gah.isInvalid()) { addError(SOP_MESSAGE, "Input geometry has no 'id' attribute."); unlockInputs(); return error(); } // Bind the page handles to the attributes. id_ph.bind(id_gah.getAttribute()); // Iterate over all the points we selected. for (GA_Iterator it(gdp->getPointRange()); it.blockAdvance(start, end); ) { // Set the page handle to the start of this block. id_ph.setPage(start); // Iterate over all the points in the block. for (GA_Offset pt = start; pt < end; ++pt) { // Get the 'id' value for the point. id = id_ph.get(pt); id_map[id] = pt; } } // Create the group. group = createAdhocPointGroup(*gdp); // Add the group and the id map to the pair. pair.first = group; pair.second = &id_map; // Iterate over each block in the tokens and add any ids to the group. for (int i=0; i < tokens.getArgc(); ++i) { UT_String id_range(tokens[i]); id_range.traversePattern(-1, &pair, addOffsetToGroup); } // Destroy the points. gdp->destroyPointOffsets(GA_Range(*group)); unlockInputs(); return error(); }
static void query_test(const char* expected, const char *expected_status) { #define ARRAY_SIZE 10 ODBC_BUF *odbc_buf = NULL; SQLUINTEGER *ids; SQLCHAR *descs; SQLLEN *id_lens, *desc_lens; SQLULEN processed; SQLUSMALLINT i, statuses[ARRAY_SIZE]; int desc_len = trunc ? 4 : 51; int rec_size = 0; Record *rec = NULL; char status[20]; assert(odbc_stmt != SQL_NULL_HSTMT); odbc_reset_statement(); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_STATUS_PTR, statuses, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_ARRAY_SIZE, (void *) ARRAY_SIZE, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROWS_FETCHED_PTR, &processed, 0); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN, 0); if (!record_bind) { ids = (SQLUINTEGER *) ODBC_GET(sizeof(SQLUINTEGER) * ARRAY_SIZE); descs = ODBC_GET(sizeof(SQLCHAR) * ARRAY_SIZE * desc_len); desc_lens = (SQLLEN *) ODBC_GET(sizeof(SQLLEN) * ARRAY_SIZE); id_lens = (SQLLEN *) ODBC_GET(sizeof(SQLLEN) * ARRAY_SIZE); assert(descs && ids && desc_lens && id_lens); } else { rec_size = (sizeof(Record) + (sizeof(SQLCHAR) * desc_len + sizeof(SQLLEN) - 1)) & ~(sizeof(SQLLEN) - 1); SQLSetStmtAttr(odbc_stmt, SQL_ATTR_ROW_BIND_TYPE, int2ptr(rec_size), 0); rec = (Record *) ODBC_GET(rec_size * ARRAY_SIZE); ids = &rec->id; id_lens = &rec->id_len; desc_lens = &rec->desc_len; descs = (SQLCHAR *) (((char *) rec) + sizeof(Record)); } #define REC(f,n) (((char*)f)+rec_size*(n)) #define DESCS(n) (rec ? (SQLCHAR*)REC(descs,n): (descs+(n)*desc_len)) #define IDS(n) *(rec ? (SQLUINTEGER*)REC(ids,n) : &ids[n]) #define ID_LENS(n) *(rec ? (SQLLEN*)REC(id_lens,n) : &id_lens[n]) #define DESC_LENS(n) *(rec ? (SQLLEN*)REC(desc_lens,n) : &desc_lens[n]) processed = ARRAY_SIZE + 1; for (i = 0; i < ARRAY_SIZE; i++) { statuses[i] = SQL_ROW_UPDATED; IDS(i) = i * 132; sprintf((char *) DESCS(i), "aaa"); ID_LENS(i) = 0; DESC_LENS(i) = -i; } SQLBindCol(odbc_stmt, 1, SQL_C_ULONG, &IDS(0), 0, &ID_LENS(0)); SQLBindCol(odbc_stmt, 2, SQL_C_CHAR, DESCS(0), desc_len, &DESC_LENS(0)); CHKExecDirect(T(test_query), SQL_NTS, "S"); CHKFetch(expected); assert(processed <= ARRAY_SIZE); for (i = 0; i < processed; ++i) { char buf[128]; sprintf(buf, "%crow number %d", 'a' + i, i * 13); if (trunc) buf[3] = 0; if (IDS(i) != i + 1 || strcmp((char *) DESCS(i), buf) != 0) { fprintf(stderr, "Invalid result\n\tgot '%d|%s'\n\texpected '%d|%s'\n", (int) IDS(i), DESCS(i), i + 1, buf); exit(1); } switch (statuses[i]) { case SQL_ROW_SUCCESS: status[i] = 'V'; break; case SQL_ROW_SUCCESS_WITH_INFO: status[i] = 'v'; break; case SQL_ROW_ERROR: status[i] = '!'; break; case SQL_ROW_NOROW: status[i] = ' '; break; default: fprintf(stderr, "Invalid status returned\n"); exit(1); } } status[i] = 0; if (expected_status && strcmp(expected_status, status) != 0) { fprintf(stderr, "Invalid status\n\tgot '%s'\n\texpected '%s'\n", status, expected_status); exit(1); } ODBC_FREE(); }
void all_start(){ Result res; int showFlag; char snumOpen[4],snumClose[4],sfindFlag[4]; const char *start,*end; const char *file; start = gtk_entry_get_text(GTK_ENTRY(TallStart)); end = gtk_entry_get_text(GTK_ENTRY(TallEnd)); file= gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(FallFile)); showFlag = 0; CreatALGraph(file); //广度优先搜索算法 res = BFS(*start,*end,showFlag); sprintf(snumOpen,"%d",res.numOpen); sprintf(snumClose,"%d",res.numClose); if(res.findFlag == 1){ strcpy(sfindFlag,"是"); }else{ strcpy(sfindFlag,"否"); } gtk_entry_set_text(GTK_ENTRY(TallOpen[0]),snumOpen); gtk_entry_set_text(GTK_ENTRY(TallClose[0]),snumClose); gtk_entry_set_text(GTK_ENTRY(TallFind[0]),sfindFlag); //深度优先搜索算法 res = DFS(*start,*end,showFlag); sprintf(snumOpen,"%d",res.numOpen); sprintf(snumClose,"%d",res.numClose); if(res.findFlag == 1){ strcpy(sfindFlag,"是"); }else{ strcpy(sfindFlag,"否"); } gtk_entry_set_text(GTK_ENTRY(TallOpen[1]),snumOpen); gtk_entry_set_text(GTK_ENTRY(TallClose[1]),snumClose); gtk_entry_set_text(GTK_ENTRY(TallFind[1]),sfindFlag); //深度受限搜索算法 res = DLS(*start,*end,showFlag); sprintf(snumOpen,"%d",res.numOpen); sprintf(snumClose,"%d",res.numClose); if(res.findFlag == 1){ strcpy(sfindFlag,"是"); }else{ strcpy(sfindFlag,"否"); } gtk_entry_set_text(GTK_ENTRY(TallOpen[2]),snumOpen); gtk_entry_set_text(GTK_ENTRY(TallClose[2]),snumClose); gtk_entry_set_text(GTK_ENTRY(TallFind[2]),sfindFlag); //迭代搜索算法 res = IDS(*start,*end,showFlag); sprintf(snumOpen,"%d",res.numOpen); sprintf(snumClose,"%d",res.numClose); if(res.findFlag == 1){ strcpy(sfindFlag,"是"); }else{ strcpy(sfindFlag,"否"); } gtk_entry_set_text(GTK_ENTRY(TallOpen[3]),snumOpen); gtk_entry_set_text(GTK_ENTRY(TallClose[3]),snumClose); gtk_entry_set_text(GTK_ENTRY(TallFind[3]),sfindFlag); //等代价搜索算法 res = UCS(*start,*end,showFlag); sprintf(snumOpen,"%d",res.numOpen); sprintf(snumClose,"%d",res.numClose); if(res.findFlag == 1){ strcpy(sfindFlag,"是"); }else{ strcpy(sfindFlag,"否"); } gtk_entry_set_text(GTK_ENTRY(TallOpen[4]),snumOpen); gtk_entry_set_text(GTK_ENTRY(TallClose[4]),snumClose); gtk_entry_set_text(GTK_ENTRY(TallFind[4]),sfindFlag); //最佳优先搜索算法 res = BestFS(*start,*end,showFlag); sprintf(snumOpen,"%d",res.numOpen); sprintf(snumClose,"%d",res.numClose); if(res.findFlag == 1){ strcpy(sfindFlag,"是"); }else{ strcpy(sfindFlag,"否"); } gtk_entry_set_text(GTK_ENTRY(TallOpen[5]),snumOpen); gtk_entry_set_text(GTK_ENTRY(TallClose[5]),snumClose); gtk_entry_set_text(GTK_ENTRY(TallFind[5]),sfindFlag); }
ASIXDevice * create_asix_device(usb_device device) { const usb_device_descriptor *deviceDescriptor = gUSBModule->get_device_descriptor(device); if (deviceDescriptor == NULL) { TRACE_ALWAYS("Error of getting USB device descriptor.\n"); return NULL; } #define IDS(__vendor, __product) (((__vendor) << 16) | (__product)) switch(IDS(deviceDescriptor->vendor_id, deviceDescriptor->product_id)) { // AX88172 case IDS(0x0b95, 0x1720): return new AX88172Device(device, "ASIX 88172 10/100"); case IDS(0x07b8, 0x420a): return new AX88172Device(device, "ABOCOM UF200"); case IDS(0x1189, 0x0893): return new AX88172Device(device, "Acer C&M EP-1427X-2"); case IDS(0x0557, 0x2009): return new AX88172Device(device, "ATEN UC-210T"); case IDS(0x08dd, 0x90ff): return new AX88172Device(device, "Billionton USB2AR"); case IDS(0x07aa, 0x0017): return new AX88172Device(device, "Corega USB2TX"); case IDS(0x2001, 0x1A00): return new AX88172Device(device, "D-Link DUB-E100"); case IDS(0x1631, 0x6200): return new AX88172Device(device, "GoodWay USB2Ethernet"); case IDS(0x04f1, 0x3008): return new AX88172Device(device, "JVC MP-PRX1"); case IDS(0x077b, 0x2226): return new AX88172Device(device, "LinkSys USB 2.0"); case IDS(0x0411, 0x003d): return new AX88172Device(device, "Melco LUA-U2-KTX"); case IDS(0x0846, 0x1040): return new AX88172Device(device, "NetGear USB 2.0 Ethernet"); case IDS(0x086e, 0x1920): return new AX88172Device(device, "System TALKS SGC-X2UL"); case IDS(0x6189, 0x182d): return new AX88172Device(device, "Sitecom LN-029"); // AX88772 case IDS(0x0b95, 0x7720): return new AX88772Device(device, "ASIX 88772 10/100"); case IDS(0x13b1, 0x0018): return new AX88772Device(device, "Linksys USB200M rev.2"); case IDS(0x07d1, 0x3c05): // alternate D-Link DUB-E100 rev. B1 case IDS(0x2001, 0x3c05): return new AX88772Device(device, "D-Link DUB-E100 rev.B1"); case IDS(0x1557, 0x7720): return new AX88772Device(device, "OQO 01+ Ethernet"); case IDS(0x05ac, 0x1402): return new AX88772Device(device, "Apple A1277"); // AX88178 case IDS(0x0b95, 0x1780): return new AX88178Device(device, "ASIX 88178 10/100/1000"); case IDS(0x050d, 0x5055): return new AX88178Device(device, "Belkin F5D5055"); case IDS(0x04bb, 0x0930): return new AX88178Device(device, "I/O Data ETG-US2"); case IDS(0x1737, 0x0039): return new AX88178Device(device, "LinkSys 1000"); case IDS(0x14ea, 0xab11): return new AX88178Device(device, "Planex GU-1000T"); case IDS(0x0df6, 0x061c): return new AX88178Device(device, "Sitecom LN-028"); } return NULL; }
std::wstring logclass_filter::name() const { return (LPCWSTR)IDS(IDS_FILTER_RULE_LOG_LEVEL); }