static const unsigned char * alias(struct sas_info *sip, struct sas_map *maps, int mapindex, const unsigned char *cf, const unsigned char *gw, const unsigned char *pos) { List *candlist; struct sas_alias *ap; if (!sip || !maps[mapindex].v || !sip->cand || !(candlist = hash_find(sip->cand,maps[mapindex].v))) return maps[mapindex].v; for (ap = list_first(candlist); ap; ap = list_next(candlist)) { struct sas_constraint *cp; int ok = 0, any_of = 0, one_of = 0; if (!ap->constraints || !cf) /* when no CF we do dumb aliasing */ return ap->head; for (any_of = one_of = 0, cp = list_first(ap->constraints); cp; cp = list_next(ap->constraints)) { if (satisfies_constraint(cp,maps,mapindex,cf,gw,pos)) { ++ok; if (cp->type == sc_cons_lem && !cp->u.l.neg) ++one_of; } else if (cp->type != sc_cons_lem || cp->u.l.neg) break; else if (cp->type == sc_cons_lem && !cp->u.l.neg) ++any_of; } if (ok && (!any_of || one_of) && ok + any_of == list_len(ap->constraints)) return ap->head; } return maps[mapindex].v; }
bool isIndexInBound(char *indVar, int size) { return satisfies_constraint(indVar, GREATER_EQUAL, 0) && satisfies_constraint(indVar, LESS, size); }