NameId *Engine::intern(const QChar *u, int s) { return const_cast<NameId *>(&*_literals.insert(NameId(u, s))); }
static struct gl_list_t *FindNextNameElementPath(CONST struct Name *n, struct gl_list_t *list, enum find_errors *errval) { unsigned long pos,c,len; struct InstanceName rec; CONST struct Instance *current,*child; struct value_t setvalue,oldvalue; CONST struct Set *sptr; struct gl_list_t *result; PAN *p, *p2; struct Name *n2; *errval = correct_instance; if (NameId(n)){ result = gl_create(NAMELISTSIZE); SetInstanceNameType(rec,StrName); SetInstanceNameStrPtr(rec,NameIdPtr(n)); len = gl_length(list); for (c=1; c<=len; c++){ p = (PAN *)gl_fetch(list,c); current = p->i; pos = ChildSearch(current,&rec); if (pos!=0){ child = InstanceChild(current,pos); if (child!=NULL){ n2 = CopyAppendNameNode(p->n, n); p2 = CreatePAN(child, n2); gl_append_ptr(result,(VOIDPTR)p2); } else{ *errval = unmade_instance; DestroyPANList(&result); return NULL; } } else{ *errval = unmade_instance; /* it would seem this ought to be undefined_instance, * but maybe refinement causes insanity. -- in which case * it should be a caller policy to wait, rather than our * job to anticipate policy and short circuit things here. */ DestroyPANList(&result); return NULL; } } return result; } else { sptr = NameSetPtr(n); setvalue = EvaluateSet(sptr,InstanceEvaluateName); switch(ValueKind(setvalue)){ case integer_value: case symbol_value: case list_value: oldvalue = setvalue; if (ListMode) { setvalue = CreateOrderedSetFromList(oldvalue); } else { setvalue = CreateSetFromList(oldvalue); } DestroyValue(&oldvalue); /* intended to fall through to next case */ case set_value: result = FindArrayChildrenPath(list,SetValue(setvalue),errval); DestroyValue(&setvalue); return result; case error_value: switch(ErrorValue(setvalue)){ case illegal_set_use: *errval = impossible_instance; break; default: *errval = undefined_instance; break; /* more needs to be added here */ } DestroyValue(&setvalue); return NULL; default: ASC_PANIC("Need to add to FindNextNameElementPath.\n"); exit(2);/* Needed to keep gcc from whining */ } } }