static void enumerate(pccluster t, uint tname, pclusteroperator co, pclusteroperator * con) { uint tname1; uint i; assert(co == 0 || co->t == t); con[tname] = co; tname1 = tname + 1; if (co == 0 || co->son == 0) for (i = 0; i < t->sons; i++) { enumerate(t->son[i], tname1, 0, con); tname1 += t->son[i]->desc; } else { assert(t->sons == co->sons); for (i = 0; i < t->sons; i++) { enumerate(t->son[i], tname1, co->son[i], con); tname1 += t->son[i]->desc; } } assert(tname1 == tname + t->desc); }
void enumerate(int energy, int number, int flag, int count) { if(energy * flag == 0 ) { return; } if(energy != flag && energy-flag <= flag) { array[count++] = flag; enumerate(energy-flag, number-1, energy-flag, count); count--; enumerate(energy, number, flag-1, count); } if(energy != flag && energy-flag > flag) { array[count++] = flag; enumerate(energy-flag, number-1, flag, count); } if(energy == flag) { array[count++] = flag; calcu(count, array); count--; enumerate(energy, number, flag-1, count); } return; }
void initialize(){ //Mark Init enumerated = 0xABCDEF01; //Global variable init Pstack_state = PSTK_IDLE; //0x0; MBus_msg_flag = 0; cdc_data_index = 0; // snsv3_r0 = SNSv3_R0_DEFAULT; //Enumeration enumerate(RAD_ADDR); delay(100); enumerate(SNS_ADDR); delay(100); //CDC init-------------------------------------- // SNSv3_R7 snsv3_r7.CDC_LDO_CDC_LDO_ENB = 0x1; snsv3_r7.CDC_LDO_CDC_LDO_DLY_ENB = 0x1; snsv3_r7.ADC_LDO_ADC_LDO_ENB = 0x1; snsv3_r7.ADC_LDO_ADC_LDO_DLY_ENB = 0x1; // Set ADC LDO to around 1.37V: 0x3//0x20 snsv3_r7.ADC_LDO_ADC_VREF_MUX_SEL = 0x3; snsv3_r7.ADC_LDO_ADC_VREF_SEL = 0x20; // Set CDC LDO to around 1.03V: 0x0//0x20 snsv3_r7.CDC_LDO_CDC_VREF_MUX_SEL = 0x0; snsv3_r7.CDC_LDO_CDC_VREF_SEL = 0x20; snsv3_r7.LC_CLK_CONF = 0x9; // default = 0x9 write_mbus_register(SNS_ADDR,7,snsv3_r7.as_int); // SNSv3_R1 snsv3_r1.CDC_S_period = 0x1A; snsv3_r1.CDC_R_period = 0xC; snsv3_r1.CDC_CR_ext = 0x0; write_mbus_register(SNS_ADDR,1,snsv3_r1.as_int); // SNSv3_R0 (need to be initialized here) snsv3_r0.CDC_ext_select_CR = 0x0; snsv3_r0.CDC_max_select = 0x7; snsv3_r0.CDC_ext_max = 0x0; snsv3_r0.CDC_CR_fixB = 0x1; snsv3_r0.CDC_ext_clk = 0x0; snsv3_r0.CDC_outck_in = 0x1; snsv3_r0.CDC_on_adap = 0x1; //0x0 (default 0x1) snsv3_r0.CDC_s_recycle = 0x1; //0x1 (default 0x4) snsv3_r0.CDC_Td = 0x0; snsv3_r0.CDC_OP_on = 0x0; snsv3_r0.CDC_Bias_2nd = 0x7; snsv3_r0.CDC_Bias_1st = 0x7; snsv3_r0.CDC_EXT_RESET = 0x1; snsv3_r0.CDC_CLK = 0x0; write_mbus_register(SNS_ADDR,0,snsv3_r0.as_int); }
int enumerate(int x) { if(x <= 0) return 1; else return enumerate(x-1) + enumerate(x-2); }
static void operation_init(void){ volatile uint32_t temp_addr; volatile uint32_t temp_data; volatile uint32_t temp_numBit; // Set PMU Strength & division threshold // PMU_CTRL Register // PRCv9 Default: 0x8F770049 // Decrease 5x division switching threshold set_pmu_sleep_clk_default(); // Speed up GOC frontend to match PMU frequency // Speed up MBUS // GOC_CTRL Register // PRCv9 Default: 0x00202903 //*((volatile uint32_t *) 0xA2000008) = 0x00202608; // For PREv9E GPIO Isolation disable >> bits 16, 17, 24 *((volatile uint32_t *) 0xA2000008) = 0x0120E508; delay(DELAY_1); //Enumerate & Initialize Registers enumerated = 0xDEADBEEF; exec_count = 0; exec_count_irq = 0; MBus_msg_flag = 0; //Enumeration enumerate(MD_ADDR); delay(MBUS_DELAY*2); enumerate(RAD_ADDR); delay(MBUS_DELAY*2); enumerate(HRV_ADDR); delay(MBUS_DELAY*2); // Set HRVv2 optimal settings for GaAs solar cell hrvv2_r0.HRV_TOP_CONV_RATIO = 0; write_mbus_register(HRV_ADDR,0x0,hrvv2_r0.as_int); // Initialize other global variables WAKEUP_PERIOD_CONT = 100; // 1: 2-4 sec with PRCv9 WAKEUP_PERIOD_CONT_INIT = 1; // 0x1E (30): ~1 min with PRCv9 radio_tx_count = 0; radio_tx_option = 0; md_start_motion = 0; md_capture_img = 0; md_count = 0; INT_TIME = 5; MD_INT_TIME = 15; // Go to sleep without timer //operation_sleep_notimer(); }
int _bproc_test_run(struct bproc_test_t *t, int nproc) { int arr, error; arr = enumerate(nproc, t->flags, -1); while (arr != -1) { error = __bproc_test_run(t, nproc, arr); if (error) return 1; arr = enumerate(nproc, t->flags, arr); } return 0; }
int main (int argc, char const * argv []) { static char const * optv [] = { "", PUTOPTV_S_DIVINE, "Atheros Ethernet Interface Enumerator", (char const *) (0) }; signed c; while ((c = getoptv (argc, argv, optv)) != -1) { switch (c) { default: break; } } argc -= optind; argv += optind; if (argc) { error (1, ECANCELED, ERROR_TOOMANY); } enumerate (); return (0); }
void QuickSaves::delete_surplus_saves(size_t max_saves) { if (max_saves < 1) return; // unlimited saves, no need to prune clear(); // Check the directory to count the saves. If there // are fewer than the max, no need to go further. vector<dir_entry> entries; DirectorySpecifier path; path.SetToQuickSavesDir(); if (path.ReadDirectory(entries)) { if (entries.size() <= max_saves) return; } // We might have too many unnamed saves; load and // count them, deleting any extras. enumerate(); size_t unnamed_saves = 0; for (std::vector<QuickSave>::iterator it = begin(); it != end(); ++it) { if (it->name.length()) continue; if (++unnamed_saves > max_saves) delete_quick_save(*it); } clear(); }
KFR_INTRINSIC friend vec<T, N> get_elements(const expression_rectangular& self, cinput_t, size_t index, vec_shape<T, N>) { using TI = utype<T>; const vec<TI, N> i = enumerate(vec_shape<TI, N>()) + static_cast<TI>(index); return select(i < static_cast<TI>(self.m_size), T(1), T(0)); }
static void enumerate (table_data * data, json_value * value) { int index; for (index = 0; index < value->u.object.length; index++) { switch (value->u.object.values[index].value->type) { case json_object: enumerate(data, value->u.object.values[index].value); break; case json_string: add_data_column(data,value->u.object.values[index].name,value->u.object.values[index].value->u.string.ptr, datatype_text); // puts(value->u.object.values[index].value->u.string.ptr); break; case json_integer: add_data_column(data,value->u.object.values[index].name,&(value->u.object.values[index].value->u.integer), datatype_integer); // printf("%d\n",(value->u.object.values[index].value->u.integer)); break; case json_double: add_data_column(data,value->u.object.values[index].name,&(value->u.object.values[index].value->u.dbl), datatype_real); // printf("%f\n",value->u.object.values[index].value->u.dbl); break; case json_boolean: add_data_column(data,value->u.object.values[index].name,&(value->u.object.values[index].value->u.boolean), datatype_boolean); // printf("%d\n",value->u.object.values[index].value->u.boolean); break; case json_null: add_data_column(data,value->u.object.values[index].name,0, datatype_null); break; default: break; } } }
static I impl(I begin, S end, C pred, P proj, detail::forward_iterator_tag_ fi) { using difference_type = iter_difference_t<I>; difference_type const alloc_limit = 3; // might want to make this a function // of trivial assignment. // Either prove all true and return begin or point to first false while(true) { if(begin == end) return begin; if(!invoke(pred, invoke(proj, *begin))) break; ++begin; } // We now have a reduced range [begin, end) // *begin is known to be false using value_type = iter_value_t<I>; auto len_end = enumerate(begin, end); auto p = len_end.first >= alloc_limit ? detail::get_temporary_buffer<value_type>(len_end.first) : detail::value_init{}; std::unique_ptr<value_type, detail::return_temporary_buffer> const h{p.first}; return stable_partition_fn::impl( begin, len_end.second, pred, proj, len_end.first, p, fi); }
inline std::string create_find_autogenerate_sql(Entity & x) { // filter out non-autogenerate columns typedef typename boost::mpl::remove_if< typename result_of::columns_of<Entity>::type, boost::mpl::not_< is_autogenerate<boost::mpl::_1> > >::type filtered_columns; std::stringstream ss; ss << "SELECT "; enumerate(filtered_columns(), detail::output_table_column_ref<Connection>(), ss, ','); ss << " FROM "; output_table_name<Connection>(ss, table_name_of<Entity>()); ss << " t0"; for_each(columns_of<Entity>(), detail::output_join<Connection>(), ss); ss << " WHERE t0."; output_column_name<Connection>(ss, primary_key_column_of<Entity>()); ss << '='; last_insert_id_hook<Connection>()(ss); ss << ';'; return ss.str(); }
void case_(std::stringstream & ss, C const& col, boost::mpl::int_<1>) const { typedef typename foreign_entity_type_of<C>::type foreign_entity_type; join_index = dynamic::detail::join_idx_of(col); enumerate(columns_of<foreign_entity_type>(), *this, ss, ','); }
static void operation_init(void){ // Set PMU Strength & division threshold // Change PMU_CTRL Register // PRCv9 Default: 0x8F770049 // Decrease 5x division switching threshold *((volatile uint32_t *) 0xA200000C) = 0x8F77004B; // Speed up GOC frontend to match PMU frequency // PRCv9 Default: 0x00202903 *((volatile uint32_t *) 0xA2000008) = 0x00202508; delay(100); //Enumerate & Initialize Registers enumerated = 0xDEADBEEF; MBus_msg_flag = 0; //Enumeration enumerate(MRR_ADDR); delay(MBUS_DELAY*10); // Initialize other global variables WAKEUP_PERIOD_CONT = 3; // 1: 2-4 sec with PRCv9 WAKEUP_PERIOD_CONT_INIT = 1; // 0x1E (30): ~1 min with PRCv9 }
int main() { char line[64]; size_t size = 64; int t, x, i; sp S = NULL; // GETLINE FROM STDIN AND PUSH INTO STACK if (fgets(line, size, stdin) == NULL) { printf("ERROR WITH THE INPUT LINE!\n"); abort(); } else { // STORE THE CHARACTER IN THE LINE (AS INT) t = 0; while(line[t] != '\n') t++; for (i = t-1; i >= 0; i--) { x = line[i] - '0'; S = push(x, S); printf("counting: %d, x is: %c\n", i, x+'0'); } } // CALCULATE THE POSTFIX enumerate(S); return 0; }
winstd::heap::~heap() { if (m_h != invalid) { enumerate(); HeapDestroy(m_h); } }
int main( int argc, char **argv ) { if( argc != 2 ) return std::cerr << "Usage: " << argv[0] << " file.ogg" << std::endl, -1; // enumerate audio devices for( auto &it : enumerate() ) std::cout << "Audio device: " << it << std::endl; // create as many audio contexts as you want context_t sfx, music, voice, ambient, video, ui; // sfx uses device #0 if( !sfx.init(0) ) return std::cerr << "Cant open audio device." << std::endl, -1; // print device name std::cout << "Using audio device: " << sfx.devname << std::endl; // @todo: purge @playonce int source = sfx.playonce( argv[1] ); // wait for source to finish if( source >= 0 ) while( sfx.sources[ source ].is_playing() ) {} return 0; }
void AbstractConfiguration::keys(const std::string& key, Keys& range) const { Mutex::ScopedLock lock(_mutex); range.clear(); enumerate(key, range); }
inline std::string create_find_sql(PrimaryKey const& key, Columns const& cols) { extension::concrete_hooks<Connection> hooks; // calculate join indices join_index_set indices; calc_join_indices(cols, indices); std::stringstream ss; ss << "SELECT "; enumerate(cols, detail::output_select_expr<Connection>(indices.size()), ss, ','); ss << " FROM "; output_table_name<Connection>(ss, table_name_of<Entity>()); ss << " t0"; // output joins for (join_index_set::const_iterator i = indices.begin(); i != indices.end(); ++i) { i->output_join(ss, hooks); } // output extra joins for_each(cols, detail::output_extra_joins<Connection>(indices.size()), ss); ss << " WHERE t0."; output_column_name<Connection>(ss, primary_key_column_of<Entity>()); ss << '='; output_column_value<Connection>(ss, key); // output group by (if any are any group bys) detail::output_group_by<Connection>(ss, cols); ss << ';'; return ss.str(); }
// 2005-06-28 CDC Not ideal, but this lets you extract data from a text string bool FUNCSTRINGPARSE::execute(void) { bool result= false; VMREGTYPE pFormat = 0; const char* format = "null"; VMREGTYPE pstr = 0; const char* str= "null"; int resultmax = 0; bool eolmode = false; if ( machine.pop(pFormat) && ( ( format=machine.GetString((VPVOID)pFormat) ) !=0 ) ) { // Count how many results there should be based on the format string enumerate(format, resultmax, eolmode); resultmax++; // There's always a status value VMREGTYPE* resultset=new VMREGTYPE[resultmax]; // Store results so we can push them on in reverse resultset[0] = 0; if ( machine.pop(pstr) && (str=(char*)machine.GetString((VPVOID)pstr)) ) secernate(format, str, resultset, resultmax); while ( resultmax-- ) result= machine.push((VMREGTYPE)resultset[resultmax]); delete[] resultset; } #ifdef DEBUGGING //cLog::mLogMessage("FUNCSTRINGPARSE(%d,%s,%s) %s\n",resultset[0],format,str,result?"succeeded":"failed"); #endif return result; }
int main(int argc, char **argv) { int reti; uint16_t vid; struct vol *vol; struct dir *retdir; struct path *path; /* initialize */ printf("Initializing\n============\n"); TEST(setuplog("default:note","/dev/tty")); TEST( afp_options_parse_cmdline(&obj, 3, &args[0]) ); TEST_int( afp_config_parse(&obj, NULL), 0); TEST_int( configinit(&obj), 0); TEST( cnid_init() ); TEST( load_volumes(&obj, NULL) ); TEST_int( dircache_init(8192), 0); obj.afp_version = 32; printf("\n"); /* now run tests */ printf("Running tests\n=============\n"); TEST_expr(vid = openvol(&obj, "test"), vid != 0); TEST_expr(vol = getvolbyvid(vid), vol != NULL); /* test directory.c stuff */ TEST_expr(retdir = dirlookup(vol, DIRDID_ROOT_PARENT), retdir != NULL); TEST_expr(retdir = dirlookup(vol, DIRDID_ROOT), retdir != NULL); TEST_expr(path = cname(vol, retdir, cnamewrap("Network Trash Folder")), path != NULL); TEST_expr(retdir = dirlookup(vol, DIRDID_ROOT), retdir != NULL); TEST_int(getfiledirparms(&obj, vid, DIRDID_ROOT_PARENT, "test"), 0); TEST_int(getfiledirparms(&obj, vid, DIRDID_ROOT, ""), 0); TEST_expr(reti = createdir(&obj, vid, DIRDID_ROOT, "dir1"), reti == 0 || reti == AFPERR_EXIST); TEST_int(getfiledirparms(&obj, vid, DIRDID_ROOT, "dir1"), 0); /* FIXME: this doesn't work although it should. "//" get translated to \000 \000 at means ".." ie this should getfiledirparms for DIRDID_ROOT_PARENT -- at least afair! TEST_int(getfiledirparms(&configs->obj, vid, DIRDID_ROOT, "//"), 0); */ TEST_int(createfile(&obj, vid, DIRDID_ROOT, "dir1/file1"), 0); TEST_int(delete(&obj, vid, DIRDID_ROOT, "dir1/file1"), 0); TEST_int(delete(&obj, vid, DIRDID_ROOT, "dir1"), 0); TEST_int(createfile(&obj, vid, DIRDID_ROOT, "file1"), 0); TEST_int(getfiledirparms(&obj, vid, DIRDID_ROOT, "file1"), 0); TEST_int(delete(&obj, vid, DIRDID_ROOT, "file1"), 0); /* test enumerate.c stuff */ TEST_int(enumerate(&obj, vid, DIRDID_ROOT), 0); }
void NoisyCnaEnumerate::solve(const StlIntVector& pi, int limit, int timeLimit, int threads, int state_tree_limit, bool monoclonal, const IntSet& whiteList) { RealTensor F, F_lb, F_ub; StateTreeVector S; StlIntVector mapNewCharToOldChar; StlIntVector mapOldCharToNewChar; _comp.init(pi[0], F, S, F_lb, F_ub, mapNewCharToOldChar, mapOldCharToNewChar); RootedCladisticNoisyAncestryGraph G(F, S, F_lb, F_ub); G.init(); collapse(mapNewCharToOldChar, mapOldCharToNewChar, G); if (monoclonal) { fixTrunk(F_ub, S, mapNewCharToOldChar, mapOldCharToNewChar, G); } G.setLabels(F); // G.RootedCladisticAncestryGraph::writeDOT(std::cerr); IntSet remappedWhiteList; for (const int c : whiteList) { int cc = mapOldCharToNewChar[c]; if (cc != -1) { remappedWhiteList.insert(cc); } } RootedCladisticNoisyEnumeration enumerate(G, limit, timeLimit, threads, _treeSize, true, monoclonal, remappedWhiteList); enumerate.run(); if (enumerate.objectiveValue() >= _treeSize) { if (enumerate.objectiveValue() > _treeSize) { _sols.clear(); _treeSize = enumerate.objectiveValue(); } enumerate.populateSolutionSet(_sols); } std::cerr << std::endl << "Tree size: " << enumerate.objectiveValue() << "/" << _treeSize << std::endl; }
//--------------------------------------------------------------------- D3D10VideoModeList::D3D10VideoModeList( D3D10Driver* pDriver ) { if( NULL == pDriver ) OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, "pDriver parameter is NULL", "D3D10VideoModeList::D3D10VideoModeList" ); mpDriver = pDriver; enumerate(); }
void EnumeratorARCer::runComputation( ) { SUSPEND_SIGNAL_RECEIVED = false; if (signal( SIGUSR1, suspend_signal_handler) == SIG_ERR) error("void EnumeratorARCer::runComputation( ) :" "Can`t catch signal"); enumerate(); }
void AbstractConfiguration::keys(Keys& range) const { FastMutex::ScopedLock lock(_mutex); std::string key; range.clear(); enumerate(key, range); }
void containertest() { typedef typename S::template container<unsigned>::type cont; cont c; BOOST_CHECK(c.size()==0); c.push(10); c.push(9); BOOST_CHECK(c.size()==2); BOOST_CHECK(c.top()==9); { bool nine=false,ten=false; for(typename cont::const_iterator i=c.begin(),e=c.end();i!=e;++i) { if (*i==9) nine=true; else if (*i==10) ten=true; else BOOST_CHECK(false); } test_counter n; enumerate(c,n); BOOST_CHECK(n.n==2); BOOST_CHECK(nine&&ten); } { bool nine=false,ten=false; for(typename cont::iterator i=c.begin(),e=c.end();i!=e;++i) { if (*i==9) nine=true; else if (*i==10) ten=true; else BOOST_CHECK(false); } test_counter n; enumerate(c,n); BOOST_CHECK(n.n==2); BOOST_CHECK(nine&&ten); } }
rho::StringW CBarcodeSingleton::getInitialDefaultID() { CMethodResult oRes; enumerate(oRes); rho::Vector<rho::StringW>& arIDs = oRes.getStringArray(); return arIDs[0]; }
int main() { unsigned int n; int bitset = 0; while (~scanf("%d", &n)) { enumerate(n); } return 0; }
rho::String C<%= name.camel_case %>Singleton::getInitialDefaultID() { CMethodResult oRes; enumerate(oRes); rho::Vector<rho::String>& arIDs = oRes.getStringArray(); return arIDs[0]; }
void case_(std::stringstream & ss, C, boost::mpl::int_<0>) const { typedef typename foreign_entity_type_of<C>::type foreign_entity_type; unsigned int temp = join_idx; join_idx = ++alias_count; enumerate(columns_of<foreign_entity_type>(), *this, ss, ','); join_idx = temp; }