cxTypes cxHashRootReadArray(cxHashRoot root,xmlTextReaderPtr reader) { cxTypes types = cxArrayTypesCreate(); int depth = xmlTextReaderDepth(reader); while(xmlTextReaderRead(reader) && depth != xmlTextReaderDepth(reader)){ if(xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT){ continue; } cxAny value = NULL; cxConstChars temp = cxXMLReadElementName(reader); if(ELEMENT_IS_TYPE(cxString)){ cxTypes types = cxHashRootReadString(root, reader); value = types != NULL ? types->any : NULL; } else if(ELEMENT_IS_TYPE(cxHash)){ cxTypes types = cxHashRootReadHash(root, reader); value = types != NULL ? types->any : NULL; } else if(ELEMENT_IS_TYPE(cxArray)){ cxTypes types = cxHashRootReadArray(root, reader); value = types != NULL ? types->any : NULL; } else { value = cxReadValues(root, temp, reader); } if(value != NULL){ cxArrayAppend(types->any, value); } } return types; }
cxAny cxAutoPoolAppend(cxAny any) { CX_RETURN(any == NULL,NULL); cxObject object = any; cxAutoPool pool = cxAutoPoolInstance(); cxArrayAppend(pool->objects, any); CX_ASSERT(object->cxRefcount > 1, "apped to auto pool object,refcount > 1"); CX_UNUSED_PARAM(object); CX_RELEASE(any); return any; }
cxVec2f cxWindowPointToViewPoint(cxAny pview,cxVec2f wPoint) { cxView this = pview; cxView pv = this; cxVec3f out; cxMatrix4f matrix; kmVec3Fill(&out, wPoint.x, wPoint.y, 0); cxArray list = CX_ALLOC(cxArray); while (pv != NULL && pv->parentView != NULL) { cxArrayAppend(list, pv); pv = pv->parentView; } CX_ARRAY_REVERSE(list, ele){ pv = cxArrayObject(ele); kmMat4Inverse(&matrix, &pv->normalMatrix); kmVec3Transform(&out, &out, &matrix); kmMat4Inverse(&matrix, &pv->anchorMatrix); kmVec3Transform(&out, &out, &matrix); }
cxArray cxStringSplit(cxString string,cxConstChars sp) { CX_ASSERT(string != NULL, "args error"); cxConstChars body = cxStringBody(string); cxInt length = cxStringLength(string) + 1; cxChar buffer[length]; cxInt idx = 0; cxArray ret = CX_CREATE(cxArray); for(cxInt i=0; i < length; i++){ if(!cxConstCharsHasChar(sp, body[i]) && body[i] != '\0'){ buffer[idx++] = body[i]; continue; } if(idx == 0){ continue; } cxString item = CX_CREATE(cxString); cxStringAppend(item, buffer, idx); cxArrayAppend(ret, item); idx = 0; } return ret; }
void cxStackPush(cxStack stack,cxAny any) { cxArrayAppend(stack->array, any); }
void cxTimeLineSet(cxAny pav,cxFloat time) { cxTimeLine this = pav; cxArrayAppend(this->times, cxNumberFloat(time)); }
void cxStackPush(cxAny pstack,cxAny any) { CX_ASSERT_THIS(pstack, cxStack); cxArrayAppend(this->array, any); }