/* This function updates all filters for specified domain using this * domains regex to parse string into domain and name (if exists). */ static errno_t update_all_filters(struct cache_tool_ctx *tctx, struct sss_domain_info *dinfo) { errno_t ret; /* Update user filter */ ret = update_filter(tctx, dinfo, tctx->user_name, tctx->update_user_filter, "(%s=%s)", false, &tctx->user_filter); if (ret != EOK) { return ret; } /* Update group filter */ ret = update_filter(tctx, dinfo, tctx->group_name, tctx->update_group_filter, "(%s=%s)", false, &tctx->group_filter); if (ret != EOK) { return ret; } /* Update netgroup filter */ ret = update_filter(tctx, dinfo, tctx->netgroup_name, tctx->update_netgroup_filter, "(%s=%s)", false, &tctx->netgroup_filter); if (ret != EOK) { return ret; } /* Update service filter */ ret = update_filter(tctx, dinfo, tctx->service_name, tctx->update_service_filter, "(%s=%s)", false, &tctx->service_filter); if (ret != EOK) { return ret; } /* Update autofs filter */ ret = update_filter(tctx, dinfo, tctx->autofs_name, tctx->update_autofs_filter, "(&(objectclass="SYSDB_AUTOFS_MAP_OC")(%s=%s))", true, &tctx->autofs_filter); if (ret != EOK) { return ret; } return EOK; }
/*! * \brief Parses a configuration string for the filter * Parses a configuration string for switch settings and * updates the configuration structure. * \param settings The configuration string in the following form: \verbatim * <id>=<filter>[:<filter>]...[,<id>=<filter>[:<filter>]...]... \endverbatim * \return 1 on success, -1 otherwise */ int conf_parse_filter(char *settings) { /* make a copy since we are modifying it */ int len = strlen(settings); if (len==0) return 1; char *strc = (char *)pkg_malloc(len+1); if (strc == NULL) { PKG_MEM_ERROR; return -1; } memcpy(strc, settings, len+1); remove_spaces(strc); char *set_p = strc; char *token = NULL; while ((token = strsep(&set_p, ","))) { /* iterate through list of settings */ char *id_str = strsep(&token, "="); int id = conf_str2id(id_str); if (id<0) { LM_ERR("cannot parse id '%s'.\n", id_str); pkg_free(strc); return -1; } if (update_filter(id, token) < 0) { LM_ERR("cannot extract filters.\n"); pkg_free(strc); return -1; } } pkg_free(strc); return 1; }
uint32_t timer_get_usec(size_t channel) { Filter *filter = &g_timer_filter[channel]; unsigned int period = timer_device_get_usec(channel); update_filter(filter, period); return filter->current_value; }
void AdjustFilterSettings::orderboxvaluechanged(int) { int j; for(j=0; j<10; j++) qApp->processEvents(); update_filter(); }
void gui_filterbar_c::refresh_list() { ts::wstr_c t; if (edit) t = edit->get_text(); tagschanged = true; update_filter(t); }
void MainWindow::init() { t.reread(); model_sql = new mySqlTableModel(this, *db2, &t); model_sql->setEditStrategy(QSqlTableModel::OnManualSubmit); model_sql->setTable(table_names[0]); ui->tableview_main->setModel(model_sql); ui->tableview_main->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents); show_error(); update_filter(); ui->stackedWidget->setCurrentIndex(0); inited=true; p=new ProcedureCall(db2); }
bool AirspaceWarningManager::update(const AIRCRAFT_STATE& state, const bool circling) { bool changed = false; // save old state for (AirspaceWarningList::iterator it = m_warnings.begin(); it != m_warnings.end(); ++it) it->save_state(); // check from strongest to weakest alerts update_inside(state); update_glide(state); if (circling) update_filter(state); update_task(state); // action changes for (AirspaceWarningList::iterator it = m_warnings.begin(); it != m_warnings.end(); ) { if (it->warning_live(config.AcknowledgementTime)) { if (it->changed_state()) changed = true; it++; } else { if (!it->trivial()) { //changed = true; // was downgraded to eliminate } it = m_warnings.erase(it); } } // sort by importance, most severe top m_warnings.sort(); return changed; }
static void imu_flush_filter(size_t physicalChannel) { for (size_t i = 0; i < 1000; i++) { update_filter(&g_imu_filter[physicalChannel], imu_read(physicalChannel)); } }
void imu_sample_all() { for (size_t i = 0; i < CONFIG_IMU_CHANNELS; i++) { update_filter(&g_imu_filter[i], imu_read(i)); } }
/* This function updates all filters for specified domain using this * domains regex to parse string into domain and name (if exists). */ static errno_t update_all_filters(struct cache_tool_ctx *tctx, struct sss_domain_info *dinfo) { errno_t ret; /* Update user filter */ ret = update_filter(tctx, dinfo, tctx->user_name, tctx->update_user_filter, "(%s=%s)", TYPE_USER, false, &tctx->user_filter); if (ret != EOK) { return ret; } /* Update group filter */ ret = update_filter(tctx, dinfo, tctx->group_name, tctx->update_group_filter, "(%s=%s)", TYPE_GROUP, false, &tctx->group_filter); if (ret != EOK) { return ret; } /* Update netgroup filter */ ret = update_filter(tctx, dinfo, tctx->netgroup_name, tctx->update_netgroup_filter, "(%s=%s)", TYPE_NETGROUP, false, &tctx->netgroup_filter); if (ret != EOK) { return ret; } /* Update service filter */ ret = update_filter(tctx, dinfo, tctx->service_name, tctx->update_service_filter, "(%s=%s)", TYPE_SERVICE, false, &tctx->service_filter); if (ret != EOK) { return ret; } /* Update autofs filter */ ret = update_filter(tctx, dinfo, tctx->autofs_name, tctx->update_autofs_filter, "(&(objectclass="SYSDB_AUTOFS_MAP_OC")(%s=%s))", TYPE_AUTOFSMAP, true, &tctx->autofs_filter); if (ret != EOK) { return ret; } /* Update ssh host filter */ ret = update_filter(tctx, dinfo, tctx->ssh_host_name, tctx->update_ssh_host_filter, "(%s=%s)", TYPE_SSH_HOST, false, &tctx->ssh_host_filter); if (ret != EOK) { return ret; } /* Update sudo rule filter */ ret = update_filter(tctx, dinfo, tctx->sudo_rule_name, tctx->update_sudo_rule_filter, "(%s=%s)", TYPE_SUDO_RULE, false, &tctx->sudo_rule_filter); if (ret != EOK) { return ret; } return EOK; }
short select_exports( short *type_ptr ) { int oset = 0 ; /* slider offset in numbers of people */ short done = FALSE ; short fdone ; short export = FALSE ; short button ; short m_x, m_y ; short dummy ; short obj_x, obj_y ; Filter filter ; short i, flag ; match_refs = (int *) pmalloc( sizeof (int) * next_person ) ; pcross_refs = (int *) pmalloc( sizeof (int) * next_person ) ; ccross_refs = (int *) pmalloc( sizeof (int) * next_couple ) ; total_people = 0 ; for( i=1; i<next_person; i++ ) { if( people[i].birth_date != DELETED_DATE ) matches[total_people++] = i ; } exp_selected = (char *) pmalloc( total_people ) ; if( !exp_selected || !match_refs || !pcross_refs || !ccross_refs ) { rsrc_form_alert( 1, NO_MEMORY ) ; if( exp_selected ) free( exp_selected ) ; if( match_refs ) free( match_refs ) ; if( pcross_refs ) free( pcross_refs ) ; if( ccross_refs ) free( ccross_refs ) ; return FALSE ; } qsort( matches, (size_t) total_people, (size_t) 4, pidx_compare ) ; /* initialise match_refs as not all of array is used */ for( i=0; i<next_person; i++ ) match_refs[i] = -1 ; /* load array to get from reference to match position */ for( i=0; i<total_people; i++ ) match_refs[matches[i]] = i ; for( i=0; i<total_people; i++ ) exp_selected[i] = FALSE ; if( total_people > 16 ) { if( total_people < 256 ) esel_ptr[ES_SLIDER].ob_height = esel_ptr[ES_SLIDE_RANGE].ob_height * 16 / total_people ; else esel_ptr[ES_SLIDER].ob_height = esel_ptr[ES_SLIDE_RANGE].ob_height / 16 ; set_slide( 0, total_people-16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } else { esel_ptr[ES_SLIDER].ob_height = esel_ptr[ES_SLIDE_RANGE].ob_height ; set_slide( 0, 1, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; app_modal_init( esel_ptr, "Export", TITLED ) ; while( !done ) { button = app_modal_do() ; button &= ~DOUBLE_CLICK ; if( button && button != APP_MODAL_TERM ) esel_ptr[button].ob_state &= ~SELECTED ; switch( button ) { case ES_SLIDER : if( total_people > 16 ) { oset = move_slide( esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; oset = ( total_people - 16 ) * oset / 1000 ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_UP : if( total_people > 16 && oset > 0 ) { oset-- ; set_slide( oset, total_people-16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_DOWN : if( total_people > 16 && oset < total_people - 16 ) { oset++ ; set_slide( oset, total_people - 16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_SLIDE_RANGE : if( total_people > 16 ) { graf_mkstate( &m_x, &m_y, &dummy, &dummy ) ; objc_offset( esel_ptr, ES_SLIDER, &obj_x, &obj_y ) ; if( m_y > obj_y ) { oset += 15 ; if( oset > total_people - 16 ) oset = total_people - 16 ; } else { oset -= 15 ; if( oset < 0 ) oset = 0 ; } set_slide( oset, total_people-16, esel_ptr, ES_SLIDER, ES_SLIDE_RANGE, app_modal_box() ) ; } list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ESEL0 : case ESEL1 : case ESEL2 : case ESEL3 : case ESEL4 : case ESEL5 : case ESEL6 : case ESEL7 : case ESEL8 : case ESEL9 : case ESEL10 : case ESEL11 : case ESEL12 : case ESEL13 : case ESEL14 : case ESEL15 : if( esel_ptr[ANCESTORS].ob_state & SELECTED ) { ancestor_select( matches[button-ESEL0 + oset] ) ; esel_ptr[ANCESTORS].ob_state &= ~SELECTED ; esel_ptr[DESCENDANTS].ob_state &= ~SELECTED ; list_exportees( oset ) ; objc_draw( esel_ptr, ROOT, MAX_DEPTH, PTRS( app_modal_box() ) ) ; } else if( esel_ptr[DESCENDANTS].ob_state & SELECTED ) { descendant_select( matches[button-ESEL0 + oset], 0, 0 ) ; esel_ptr[DESCENDANTS].ob_state &= ~SELECTED ; list_exportees( oset ) ; objc_draw( esel_ptr, ROOT, MAX_DEPTH, PTRS( app_modal_box() ) ) ; } else { if( !exp_selected[button-ESEL0 + oset] ) { exp_selected[button-ESEL0 + oset] = TRUE ; esel_ptr[button].ob_state |= CHECKED ; } else { exp_selected[button-ESEL0 + oset] = FALSE ; esel_ptr[button].ob_state &= ~CHECKED ; } objc_draw( esel_ptr, button, MAX_DEPTH, PTRS( app_modal_box() ) ) ; } break ; case ES_SEL_ALL : for( i=0; i<total_people; i++ ) exp_selected[i] = TRUE ; list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; objc_draw( esel_ptr, ES_SEL_ALL, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_DSEL_ALL : for( i=0; i<total_people; i++ ) exp_selected[i] = FALSE ; list_exportees( oset ) ; objc_draw( esel_ptr, ES_LIST, MAX_DEPTH, PTRS( app_modal_box() ) ) ; objc_draw( esel_ptr, ES_DSEL_ALL, MAX_DEPTH, PTRS( app_modal_box() ) ) ; break ; case ES_FILTER : clear_efil_form() ; clear_form_flags() ; for( i = 0 ; i <= FL_NOT8 - FL_NOT1 ; i+= FL_NOT2 - FL_NOT1 ) { set_to_ignore(FL_NOT1+i) ; flags_ptr[FL_NOT1+i].ob_state |= SELECTED ; } fdone = FALSE ; /* loop until filter done */ while( !fdone ) { button = do_sub_form( efil_ptr, "Export Filter", EXP_HELP, TITLED ) ; switch( button ) { case EXP_SEL : case EXP_DESEL : busy( BUSY_MORE ) ; update_filter( &filter, efil_form_addrs.efam_name, efil_form_addrs.eforename, efil_form_addrs.ebefore, efil_form_addrs.eafter, efil_form_addrs.eplace ) ; if( button == EXP_DESEL ) flag = FALSE ; else flag = TRUE ; for( i=0; i<total_people; i++ ) { if( test_match( &filter, matches[i] ) ) exp_selected[i] = flag ; } busy( BUSY_LESS ) ; case EXP_CANCEL : fdone = TRUE ; break ; case EXP_FLAGS : do_sub_form( flags_ptr, "Filter Flags", FL_HELP, TITLED ) ; break ; } } list_exportees( oset ) ; break ; case ES_CANCEL : case APP_MODAL_TERM : done = TRUE ; break ; case ES_OK : export = TRUE ; done = TRUE ; break ; case ES_HELP : help( export_help ) ; objc_draw( esel_ptr, ES_HELP, 0, PTRS( app_modal_box() ) ) ; break ; default : break ; } } esel_ptr[ANCESTORS].ob_state &= ~SELECTED ; esel_ptr[DESCENDANTS].ob_state &= ~SELECTED ; if( esel_ptr[GEDCOM].ob_state & SELECTED ) *type_ptr = GEDCOM_TYPE ; else if( esel_ptr[CSV].ob_state & SELECTED ) *type_ptr = CSV_TYPE ; else *type_ptr = FAMTREE_TYPE ; app_modal_end() ; return export ; }
void doBackgroundSampling(){ for (size_t i = ACCELEROMETER_CHANNEL_MIN; i <= ACCELEROMETER_CHANNEL_MAX; i++){ update_filter(&g_accel_filter[i], readAccelChannel(i)); } }