void MicroSelectWidget::updateFromAllowed() { QString oldFamily = m_pMicroFamily->currentText(); m_pMicroFamily->clear(); #define CHECK_ADD(family) \ if ( (m_allowedAsmSet & AsmInfo::family) \ && !MicroLibrary::self()->microIDs( AsmInfo::family, \ m_allowedGpsimSupport, m_allowedFlowCodeSupport, m_allowedMicrobeSupport ).isEmpty() ) { \ m_pMicroFamily->insertItem( m_pMicroFamily->count(), AsmInfo::setToString(AsmInfo::family) ); \ } CHECK_ADD(PIC12) CHECK_ADD(PIC14) CHECK_ADD(PIC16); #undef CHECK_ADD if ( m_pMicroFamily->contains(oldFamily) ) { //m_pMicroFamily->setCurrentText(oldFamily); // 2018.12.07 { QComboBox *c = m_pMicroFamily; QString text = oldFamily; int i = c->findText(text); if (i != -1) c->setCurrentIndex(i); else if (c->isEditable()) c->setEditText(text); else c->setItemText(c->currentIndex(), text); } } microFamilyChanged(oldFamily); }
void MicroSelectWidget::updateFromAllowed() { QString oldFamily = m_pMicroFamily->currentText(); m_pMicroFamily->clear(); #define CHECK_ADD(family) if ( (m_allowedAsmSet & AsmInfo::family) && !MicroLibrary::self()->microIDs( AsmInfo::family, m_allowedGpsimSupport, m_allowedFlowCodeSupport, m_allowedMicrobeSupport ).isEmpty() ) m_pMicroFamily->insertItem( AsmInfo::setToString(AsmInfo::family) ); CHECK_ADD(PIC12) CHECK_ADD(PIC14) CHECK_ADD(PIC16); #undef CHECK_ADD if ( m_pMicroFamily->contains(oldFamily) ) m_pMicroFamily->setCurrentText(oldFamily); microFamilyChanged(oldFamily); }
static void do_strand_fillac(void *handle, int x, int y, float u, float v, float z) { StrandPart *spart= (StrandPart*)handle; StrandShadeCache *cache= spart->cache; StrandSegment *sseg= spart->segment; APixstrand *apn, *apnew; float t, s; int offset, mask, obi, strnr, seg, zverg, bufferz, maskz=0; offset = y*spart->rectx + x; obi= sseg->obi - spart->re->objectinstance; strnr= sseg->strand->index + 1; seg= sseg->v[1] - sseg->strand->vert; mask= (1<<spart->sample); /* check against solid z-buffer */ zverg= (int)z; if (spart->rectdaps) { /* find the z of the sample */ PixStr *ps; intptr_t *rd= spart->rectdaps + offset; bufferz= 0x7FFFFFFF; if (spart->rectmask) maskz= 0x7FFFFFFF; if (*rd) { for (ps= (PixStr *)(*rd); ps; ps= ps->next) { if (mask & ps->mask) { bufferz= ps->z; if (spart->rectmask) maskz= ps->maskz; break; } } } } else { bufferz= (spart->rectz)? spart->rectz[offset]: 0x7FFFFFFF; if (spart->rectmask) maskz= spart->rectmask[offset]; } #define CHECK_ADD(n) \ if (apn->p[n]==strnr && apn->obi[n]==obi && apn->seg[n]==seg) \ { if (!(apn->mask[n] & mask)) { apn->mask[n] |= mask; apn->v[n] += t; apn->u[n] += s; } break; } (void)0 #define CHECK_ASSIGN(n) \ if (apn->p[n]==0) \ {apn->obi[n]= obi; apn->p[n]= strnr; apn->z[n]= zverg; apn->mask[n]= mask; apn->v[n]= t; apn->u[n]= s; apn->seg[n]= seg; break; } (void)0 /* add to pixel list */ if (zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) { if (!spart->rectmask || zverg > maskz) { t = u * spart->t[0] + v * spart->t[1] + (1.0f - u - v) * spart->t[2]; s = fabsf(u * spart->s[0] + v * spart->s[1] + (1.0f - u - v) * spart->s[2]); apn= spart->apixbuf + offset; while (apn) { CHECK_ADD(0); CHECK_ADD(1); CHECK_ADD(2); CHECK_ADD(3); CHECK_ASSIGN(0); CHECK_ASSIGN(1); CHECK_ASSIGN(2); CHECK_ASSIGN(3); apnew= addpsAstrand(spart->zspan); SWAP(APixstrand, *apnew, *apn); apn->next= apnew; CHECK_ASSIGN(0); } if (cache) { strand_shade_refcount(cache, sseg, sseg->v[1]); strand_shade_refcount(cache, sseg, sseg->v[2]); } spart->totapixbuf[offset]++; } } }
mtev_boolean noit_apply_filterset(const char *filterset, noit_check_t *check, metric_t *metric) { /* We pass in filterset here just in case someone wants to apply * a filterset other than check->filterset.. You never know. */ void *vfs; if(!filterset) return mtev_true; /* No filter */ if(!filtersets) return mtev_false; /* Couldn't possibly match */ LOCKFS(); if(mtev_hash_retrieve(filtersets, filterset, strlen(filterset), &vfs)) { filterset_t *fs = (filterset_t *)vfs; filterrule_t *r, *skipto_rule = NULL; int idx = 0; mtev_atomic_inc32(&fs->ref_cnt); UNLOCKFS(); #define MATCHES(rname, value) noit_apply_filterrule(r->rname##_ht, r->rname ? r->rname : r->rname##_override, r->rname ? r->rname##_e : NULL, value) for(r = fs->rules; r; r = r->next) { int need_target, need_module, need_name, need_metric; /* If we're targeting a skipto rule, match or continue */ idx++; if(skipto_rule && skipto_rule != r) continue; skipto_rule = NULL; need_target = !MATCHES(target, check->target); need_module = !MATCHES(module, check->module); need_name = !MATCHES(name, check->name); need_metric = !MATCHES(metric, metric->metric_name); if(!need_target && !need_module && !need_name && !need_metric) { if(r->type == NOIT_FILTER_SKIPTO) { skipto_rule = r->skipto_rule; continue; } return (r->type == NOIT_FILTER_ACCEPT) ? mtev_true : mtev_false; } /* If we need some of these and we have an auto setting that isn't fulfilled for each of them, we can add and succeed */ #define CHECK_ADD(rname) (!need_##rname || (r->rname##_auto_hash_max > 0 && r->rname##_ht && mtev_hash_size(r->rname##_ht) < r->rname##_auto_hash_max)) if(CHECK_ADD(target) && CHECK_ADD(module) && CHECK_ADD(name) && CHECK_ADD(metric)) { #define UPDATE_FILTER_RULE(rnum, rname, value) do { \ mtev_hash_replace(r->rname##_ht, strdup(value), strlen(value), NULL, free, NULL); \ if(noit_filter_update_conf_rule(fs->name, rnum, #rname, value) < 0) { \ mtevL(noit_error, "Error updating configuration for new filter auto_add on %s=%s\n", #rname, value); \ } \ } while(0) if(need_target) UPDATE_FILTER_RULE(idx, target, check->target); if(need_module) UPDATE_FILTER_RULE(idx, module, check->module); if(need_name) UPDATE_FILTER_RULE(idx, name, check->name); if(need_metric) UPDATE_FILTER_RULE(idx, metric, metric->metric_name); noit_filterset_log_auto_add(fs->name, check, metric, r->type == NOIT_FILTER_ACCEPT); if(r->type == NOIT_FILTER_SKIPTO) { skipto_rule = r->skipto_rule; continue; } return (r->type == NOIT_FILTER_ACCEPT) ? mtev_true : mtev_false; } } filterset_free(fs); return mtev_false; } UNLOCKFS(); return mtev_false; }