void ram(void) { struct NRF_CFG config; uint8_t buf[16]; // Space to save signal strength and username. uint8_t count = 0; char usernames[8][16]; uint8_t strength[8]; config.nrmacs=1; config.maclen[0] = 16; config.channel = 81; memcpy(config.mac0, "\x01\x02\x03\x02\x01", 5); nrf_config_set(&config); lcdClear(); lcdPrintln("Track it:"); lcdPrintln("---------"); lcdRefresh(); do{ if( nrf_rcv_pkt_time(64,sizeof(buf),buf) == 16 ){ buf[14] = 0; // TODO: allow last package parameter 0x25 if( buf[1] == 0x23 || buf[1] == 0x24){ if(0==insertUser(usernames, strength, (char *)buf+6, buf[3], count)) { if(count<8) ++count; printNames(usernames, strength, count); } } } }while ((getInputRaw())==BTN_NONE); }
//______________________________________________________________________________ int execDictSelection() { std::cout << "*** Stress TClass with DictSelection ***\n"; loadLib("libclassesDictSelection_dictrflx.so"); propertiesNames Nullproperties; propertiesNames properties; std::vector<std::string> classNames={ "classVanilla", "classTemplateVanilla<char>", "classTransientMember", "classTestAutoselect", "classAutoselected", "classWithAttributes", "classAutoselectedFromTemplateElaborate1", "classAutoselectedFromTemplateElaborate2", "classRemoveTemplateArgs<float,bool>", "classRemoveTemplateArgs<testNs::D>", "testNs::classRemoveTemplateArgs2<float*>", "testNs::classRemoveTemplateArgs2<float*,int,classVanilla>", "testNs::classRemoveTemplateArgs2<int*>", "testNs::classRemoveTemplateArgs2<int*,int,classVanilla>", "testNs::classRemoveTemplateArgs2<classVanilla>", "testNs::classRemoveTemplateArgs2<classVanilla,int >", "testNs::classRemoveTemplateArgs2<classVanilla,int, classVanilla >", "testNs::classRemoveTemplateArgs2<classRemoveTemplateArgs<classAutoselected> >", "testNs::classRemoveTemplateArgs2<testNs::D>", "A<B<double,double>,int,float >", "A<B<double>,int,float >", "C<char>", "C<char,int,3>", "C<C<char>,C<char,C<C<char,int>,int>,3>>", "C<C<C<C<C<char>,C<char,C<C<char,int>,int>,3>>>,C<char,C<C<char,int>,int>,3>>,C<char,C<C<char,int>,int>,3>>", "myVector<C<char>>", "myVector<C<char,int>>", "myVector<C<char,int,3>>", "myVector<float>", "myVector<myVector<myVector<myVector<float>>>>", "myVector<float,myAllocator<float>>", "classTemplateElaborate<char>" }; // Start the tests for (auto& className : classNames) printClassInfo(className,Nullproperties,false); // Now some plain name checking for (auto& className : classNames) printNames(className); return 0; }
int AclReader::read(const std::string& fn, boost::shared_ptr<AclData> d) { fileName = fn; lineNumber = 0; char buff[1024]; std::ifstream ifs(fn.c_str(), std::ios_base::in); if (!ifs.good()) { errorStream << "Unable to open ACL file \"" << fn << "\": eof=" << (ifs.eof()?"T":"F") << "; fail=" << (ifs.fail()?"T":"F") << "; bad=" << (ifs.bad()?"T":"F"); return -1; } // Propagate nonzero per-user max connection setting from CLI if (cliMaxConnPerUser > 0) { connQuotaRulesExist = true; (*connQuota)[AclData::ACL_KEYWORD_ALL] = cliMaxConnPerUser; } // Propagate nonzero per-user max queue setting from CLI if (cliMaxQueuesPerUser > 0) { queueQuotaRulesExist = true; (*queueQuota)[AclData::ACL_KEYWORD_ALL] = cliMaxQueuesPerUser; } // Loop to process the Acl file try { bool err = false; while (ifs.good()) { ifs.getline(buff, 1024); lineNumber++; if (std::strlen(buff) > 0 && buff[0] != '#') // Ignore blank lines and comments err |= !processLine(buff); } if (!ifs.eof()) { errorStream << "Unable to read ACL file \"" << fn << "\": eof=" << (ifs.eof()?"T":"F") << "; fail=" << (ifs.fail()?"T":"F") << "; bad=" << (ifs.bad()?"T":"F"); ifs.close(); return -2; } ifs.close(); if (err) return -3; QPID_LOG(notice, "ACL: Read file \"" << fn << "\""); } catch (const std::exception& e) { errorStream << "Unable to read ACL file \"" << fn << "\": " << e.what(); ifs.close(); return -4; } catch (...) { errorStream << "Unable to read ACL file \"" << fn << "\": Unknown exception"; ifs.close(); return -5; } printNames(); printRules(); printQuotas(AclData::ACL_KEYWORD_QUOTA_CONNECTIONS, connQuota); printQuotas(AclData::ACL_KEYWORD_QUOTA_QUEUES, queueQuota); loadDecisionData(d); return 0; }
int main() { char input[100]; nodes[0].word = true; addName("sun"); while(gets(input)) { if(input[0] == '?') { int i = 1; while(input[i] == ' ') // Skip whitespace i++; printNames(input+i); } else { int i = 1; while(input[i] == ' ') i++; addName(input+i); } } }