/***********************************************************************/ /* Open Visualization Data Explorer */ /* (C) Copyright IBM Corp. 1989,1999 */ /* ALL RIGHTS RESERVED */ /* This code licensed under the */ /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */ /***********************************************************************/ #include #include #include #define MAXOBJECTS 44 /* must match mdf-c generated dx.mdf file */ /* copy the array contents */ extern Array _dxfReallyCopyArray(Array a); int m_CollectSeries(Object *in, Object *out) { int i, m; int seen_null = 0; int say_warn = 0; float f, *fp; int num = 0; Object newo = NULL; out[0] = NULL; /* check for a special case. if the first input pair contains a group * and a scalar list, and if the number of group members is the * same as the number of items in the list, then create a series from * the group members using each item in the list as the series position. */ if (in[0] && in[1]) { if (DXGetObjectClass(in[0]) != CLASS_GROUP) goto notspecial; if (!DXQueryParameter(in[1], TYPE_FLOAT, 1, &i)) goto notspecial; if (i == 1) goto notspecial; DXGetMemberCount((Group)in[0], &m); if (i != m) goto notspecial; /* ok, does seem to be special */ fp = (float *)DXAllocate(m * sizeof(float)); if (!fp) return ERROR; if (!DXExtractParameter(in[1], TYPE_FLOAT, 1, m, (Pointer)fp)) { DXFree((Pointer)fp); return ERROR; } out[0] = (Object)DXNewSeries(); if (!out[0]) { DXFree((Pointer)fp); return ERROR; } for (i=0; newo = DXGetEnumeratedMember((Group)in[0], i, NULL); i++) { if (!DXSetSeriesMember((Series)out[0], i, fp[i], newo)) { DXDelete(out[0]); out[0] = NULL; DXFree((Pointer)fp); return ERROR; } } DXFree((Pointer)fp); return OK; } /* ok, not that case. continue with the original code */ notspecial: /* for each pair of inputs, if they are both null, skip them and * continue. if one is non-null, return an error. if both are * good, add them to the series. */ for (i = 0; i