/***********************************************************************/ /* 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 43 /* must match mdf-c generated dx.mdf file */ /* copy the array contents */ extern Array _dxfReallyCopyArray(Array a); /* coalesce separate arrays into one. (code in list.m) */ extern Array _dxfBuildList(Object *in); /* extern, but as far as i know not being used anywhere else */ Group _dxfBuildGroup(Object *in); int m_Append(Object *in, Object *out) { /* was going to have append accept same inputs as List, but * the rest of the inputs are (name,object) pairs, or (value,object) * pairs. that doesn't make sense for list, which is just a * simple list of objects. */ #if 0 Class c; if (in[0]) { c = DXGetObjectClass(in[0]); if (c == CLASS_GROUP) out[0] = (Object)_dxfBuildGroup(in); else if (c == CLASS_ARRAY || c == CLASS_STRING) out[0] = (Object)_dxfBuildList(in); } else { /* shouldn't this depend on whether the first thing * is an array or not? guess i can't change the existing * default which is to make a new empty group and add the * rest of the inputs as members. */ #endif out[0] = (Object)_dxfBuildGroup(in); #if 0 } #endif return (out[0] != NULL) ? OK : ERROR; } Group _dxfBuildGroup(Object *in) { int i; int seen_null = 0; int say_warn = 0; int seen_valid = 0; Class gclass; Object newo; Group newgroup = NULL; char *cp; float f; int cnt; /* this will now do two distinct functions: * if the first input is a group, it makes all subsequent * inputs a member of the group. * if the first input is an array or string, it concatinates * all subsequent inputs to the end of the array. */ if (in[0]) { if (DXGetObjectClass(in[0]) != CLASS_GROUP) { DXSetError(ERROR_BAD_CLASS, "#10192", "input"); goto error; } gclass = DXGetGroupClass((Group)in[0]); newgroup = (Group)DXCopy(in[0], COPY_STRUCTURE); } else { newgroup = DXNewGroup(); if (!newgroup) goto error; /* DXWarning("#4018"); -* creating a new group */ } /* 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 group. look for repeated names. */ for (i = 1; i