/**
 * Finalizes the vector.
 *
 * @param p0 the transient model
 * @param p1 the persistent model
 * @param p2 the persistent model size
 */
void finalize_vector(void* p0, void* p1, void* p2) {

    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Finalize vector.");

    // Write output stream and transform from vector.

    // Initialize elements.
    int z = 0;
    int y = 0;
    int x = 0;

    // Get elements.
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &Z_INDEX, (void*) &z);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &Y_INDEX, (void*) &y);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &X_INDEX, (void*) &x);

    // Remove elements.
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &VECTOR_COUNT, (void*) &Z_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &VECTOR_COUNT, (void*) &Y_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &VECTOR_COUNT, (void*) &X_INDEX);

//??    fprintf(p1, %d, &(m->x));
//??    fprintf(p1, %d, &(m->y));
//??    fprintf(p1, %d, &(m->z));
}
/**
 * Gets the index of the signal with highest priority.
 *
 * @param p0 the signal memory
 * @param p1 the index
 */
void get_highest_priority_index(const void* p0, void* p1) {

    if (p1 != NULL_POINTER) {

        int* i = (int*) p1;

        // Initialize elements.
        int c = 0;
        void* p = NULL_POINTER;

        // Get elements.
        get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);
        get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PRIORITIES_INDEX, (void*) &p);

        // The loop variable.
        int j = 0;
        // The priority.
        int prio = 0;
        // The highest priority.
        int h = prio;

        while (1) {

            if (j >= c) {

                break;
            }

            // Get element (signal) priority.
            get_array_element((void*) &p, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &prio);

            if (prio > h) {

                h = prio;

                // If a signal with higher priority is found,
                // then its index is the one to be returned.
                *i = j;
            }

            j++;
        }

    } else {

        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get highest priority index. The index is null.");
    }
}
static void
get_type_str(char *dst, size_t dstsize, int type)
{
	static struct flag_definition defs[] = {
		DEFINE_FLAG(SOCK_CLOEXEC),
		DEFINE_FLAG(SOCK_NONBLOCK)
	};
	static const char *types[] = {
		UNKNOWN,
		"SOCK_STREAM",
		"SOCK_DGRAM",
		"SOCK_RAW",
		"SOCK_RDM",
		"SOCK_SEQPACKET"
	};
	static int ntypes = array_sizeof(types);
	int flags = SOCK_CLOEXEC | SOCK_NONBLOCK;
	const char *fmt, *s;
	char t[256];

	s = get_array_element(types, ntypes, ~flags & type);
	fmaster_chain_flags(t, sizeof(t), flags & type, defs,
			    array_sizeof(defs));
	fmt = t[0] == '\0' ? "%s" : "%s|%s";

	snprintf(dst, dstsize, fmt, s, t);
}
/**
 * Gets the signal.
 *
 * @param p0 the signal memory
 * @param p1 the index
 * @param p2 the signal
 * @param p3 the priority
 * @param p4 the abstraction
 * @param p5 the abstraction size
 */
void get_signal(const void* p0, const void* p1, void* p2, void* p3, void* p4, void* p5) {

    if (p1 != NULL_POINTER) {

        int* i = (int*) p1;

        if (*i >= 0) {

            // Initialize elements.
            int s = 0;
            int c = 0;
            void* sig = NULL_POINTER;
            void* p = NULL_POINTER;
            void* a = NULL_POINTER;
            void* as = NULL_POINTER;

            // Get elements.
            get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_SIZE_INDEX, (void*) &s);
            get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNALS_INDEX, (void*) &sig);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PRIORITIES_INDEX, (void*) &p);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);

            if (*i < c) {

                // Get signal.
                get_array_element((void*) &sig, (void*) &POINTER_ARRAY, p1, p2);
                get_array_element((void*) &p, (void*) &INTEGER_ARRAY, p1, p3);
                get_array_element((void*) &a, (void*) &POINTER_ARRAY, p1, p4);
                get_array_element((void*) &as, (void*) &INTEGER_ARRAY, p1, p5);

            } else {

                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get signal. The index exceeds the count.");
            }

        } else {

            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get signal. The index is negativ.");
        }

    } else {

        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get signal. The index is null.");
    }
}
/**
 * Finalizes the time.
 *
 * @param p0 the transient model
 * @param p1 the persistent model
 * @param p2 the persistent model size
 */
void finalize_time(void* p0, void* p1, void* p2) {

    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Finalize time.");

    // Initialize elements.
    int s = 0;
    int min = 0;
    int h = 0;
    int d = 0;
    int m = 0;
    int y = 0;

    // Get elements.
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SECOND_INDEX, (void*) &s);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &MINUTE_INDEX, (void*) &min);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &HOUR_INDEX, (void*) &h);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &DAY_INDEX, (void*) &d);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &MONTH_INDEX, (void*) &m);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &YEAR_INDEX, (void*) &y);

    // Remove elements in descending order.
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &TIME_COUNT, (void*) &SECOND_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &TIME_COUNT, (void*) &MINUTE_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &TIME_COUNT, (void*) &HOUR_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &TIME_COUNT, (void*) &DAY_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &TIME_COUNT, (void*) &MONTH_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &TIME_COUNT, (void*) &YEAR_INDEX);

//??    fprintf(p1, %d, &(m->value));
}
Beispiel #6
0
jsobjtype get_array_element_object(jsobjtype obj, int idx)
{
	jsobjtype p = 0;
	if (whichproc == 'j')
		return get_array_element_object_nat(obj, idx);
	get_array_element(obj, idx);
	if (!propval)
		return p;
	if (proptype == EJ_PROP_OBJECT || proptype == EJ_PROP_ARRAY)
		sscanf(propval, "%p", &p);
	free(propval);
	propval = 0;
	return p;
}				/* get_array_element_object */
static const char *
get_domain_str(int domain)
{
	static const char *domains[] = {
		"PF_UNSPEC",
		"PF_LOCAL",
		"PF_INET",
		"PF_IMPLINK",
		"PF_PUP",
		"PF_CHAOS",
		"PF_NETBIOS",
		"PF_ISO",
		"PF_ECMA",
		"PF_DATAKIT",
		"PF_CCITT",
		"PF_SNA",
		"PF_DECnet",
		"PF_DLI",
		"PF_LAT",
		"PF_HYLINK",
		"PF_APPLETALK",
		"PF_ROUTE",
		"PF_LINK",
		"pseudo_PF_XTP",
		"PF_COIP",
		"PF_CNT",
		"pseudo_PF_RTIP",
		"PF_IPX",
		"PF_SIP",
		"pseudo_PF_PIP",
		"PF_ISDN",
		"pseudo_PF_KEY",
		"PF_INET6",
		"PF_NATM",
		"PF_ATM",
		"pseudo_PF_HDRCMPLT",
		"PF_NETGRAPH",
		"PF_SLOW",
		"PF_SCLUSTER",
		"PF_ARP",
		"PF_BLUETOOTH",
		"PF_IEEE80211"
	};
	static int ndomains = array_sizeof(domains);

	return (get_array_element(domains, ndomains, domain));
}
/**
 * Removes the signal.
 *
 * @param p0 the signal memory
 * @param p1 the index
 */
void remove_signal(void* p0, const void* p1) {

    if (p1 != NULL_POINTER) {

        int* i = (int*) p1;

        if (*i >= 0) {

            // Initialize elements.
            int s = 0;
            int c = 0;
            void* sig = NULL_POINTER;
            void* p = NULL_POINTER;
            void* a = NULL_POINTER;
            void* as = NULL_POINTER;

            // Get elements.
            get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_SIZE_INDEX, (void*) &s);
            get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNALS_INDEX, (void*) &sig);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PRIORITIES_INDEX, (void*) &p);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);

            if (*i < c) {

                // Remove signal.
                remove_array_element((void*) &sig, (void*) &POINTER_ARRAY, (void*) &c, p1);
                remove_array_element((void*) &p, (void*) &INTEGER_ARRAY, (void*) &c, p1);
                remove_array_element((void*) &a, (void*) &POINTER_ARRAY, (void*) &c, p1);
                remove_array_element((void*) &as, (void*) &INTEGER_ARRAY, (void*) &c, p1);

                // Decrement count.
                c--;

                // Set count.
                set_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);

            } else {

                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove signal. The index exceeds the count.");
            }

        } else {

            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove signal. The index is negativ.");
        }

    } else {

        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove signal. The index is null.");
    }
}
Beispiel #9
0
/**
 * Tests the file read.
 */
void test_file_read() {

    // A file named "/home/cybop/tmp/test.cybol" needs to be created
    // in a text editor, for this test to work.

    // The array.
    void* a = NULL_POINTER;
    // The array size.
    int as = 0;
    // The array count.
    int ac = 0;
    // The file name array.
    char fna[] = {'/', 'h', 'o', 'm', 'e', '/', 'c', 'y', 'b', 'o', 'p', '/', 't', 'm', 'p', '/', 't', 'e', 's', 't', '.', 'c', 'y', 'b', 'o', 'l'};
    // The file name.
    char* fn = fna;
    // The file name count.
    int fnc = 26;

    create_array((void*) &a, (void*) &CHARACTER_ARRAY, (void*) &as);
//??    read_file((void*) &a, (void*) &as, (void*) &ac, (void*) &fn, (void*) &fnc);

    fprintf(stderr, "a: %i\n", a);
    fprintf(stderr, "as: %i\n", as);
    fprintf(stderr, "ac: %i\n", ac);
    fprintf(stderr, "fn: %i\n", fn);
    fprintf(stderr, "fnc: %i\n", fnc);

    int j = 0;
    char c = NULL_CHARACTER;

    while (1) {

        if (j >= ac) {

            break;
        }

        get_array_element((void*) &a, (void*) &CHARACTER_ARRAY, (void*) &j, (void*) &c);
        fputc(c, stdout);

        j++;
    }

    destroy_array((void*) &a, (void*) &CHARACTER_ARRAY, (void*) &as);
}
Beispiel #10
0
/* Get parameters for calling PQsendQueryParams, PQsendQueryPrepared,
   PQexecParams, and PQexecPrepared.  For these functions, the SQL
   uses $1, $2, ... to represent the parameters, so we map the gawk
   associative array values array[1] -> $1, array[2] -> $2, etc.
   Note that the C API uses C arrays which start with subscript 0,
   so be careful about off-by-one errors. */
static int
get_params(unsigned int nargs, unsigned int argnum, const char ***pvp)
{
  awk_value_t paramValues_array;
  const char **paramValues;
  int nParams;

  {
    awk_value_t nParams_node;
    if (!get_argument(argnum, AWK_NUMBER, &nParams_node))
      return -1;
    nParams = nParams_node.num_value;
  }

  if (nParams < 0)
    return nParams;

  if (!nParams || (argnum+1 >= nargs))
    paramValues = NULL;
  else {
    int i;
    if (!get_argument(argnum+1, AWK_ARRAY, &paramValues_array))
      return -1;
    emalloc(paramValues, const char **, nParams*sizeof(*paramValues),
	    "get_params");
    for (i = 0; i < nParams; i++) {
      awk_value_t idx;
      awk_value_t val;
      /* Must add one when doing the array lookup because, for example, we
         must set paramValues[0] to the value for $1 (which is stored in
	 the gawk array with subscript [1]) */
      if (!get_array_element(paramValues_array.array_cookie,
      			     make_number(i+1, &idx), AWK_STRING, &val))
        paramValues[i] = NULL;
      else
	paramValues[i] = val.str_value.str;
    }
  }
  *pvp = paramValues;
  return nParams;
}
/**
 * Handles the compound signal.
 *
 * @param p0 the signal memory
 * @param p1 the compound signal
 * @param p2 the priority
 */
void handle_compound_signal(void* p0, const void* p1, const void* p2) {

    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Handle compound signal.");

    // Initialize elements.
    int c = 0;
    void* pa = NULL_POINTER;
    void* pas = NULL_POINTER;
    void* pm = NULL_POINTER;

    // Get elements.
    get_array_element(p1, (void*) &INTEGER_ARRAY, (void*) &PARTS_COUNT_INDEX, (void*) &c);
    get_array_element(p1, (void*) &POINTER_ARRAY, (void*) &PART_ABSTRACTIONS_INDEX, (void*) &pa);
    get_array_element(p1, (void*) &POINTER_ARRAY, (void*) &PART_ABSTRACTIONS_SIZES_INDEX, (void*) &pas);
    get_array_element(p1, (void*) &POINTER_ARRAY, (void*) &PART_MODELS_INDEX, (void*) &pm);

    // The part signal model.
    int j = 0;
    void* a = NULL_POINTER;
    int as = 0;
    void* m = NULL_POINTER;

    while (1) {

        if (j >= c) {

            break;
        }

        // Get part signal.
        get_array_element((void*) &pa, (void*) &POINTER_ARRAY, (void*) &j, (void*) &a);
        get_array_element((void*) &pas, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &as);
        get_array_element((void*) &pm, (void*) &POINTER_ARRAY, (void*) &j, (void*) &m);

        // Add part signal to memory, using the whole signal's priority.
        // (Each signal has a priority. A signal may consist of part
        // signals. The part signals cannot have higher/lower priority
        // than their original whole signal.)
        set_signal(p0, (void*) &m, p2, (void*) &a, (void*) &as);

        j++;
    }
}
/**
 * Sets the compound element by name.
 *
 * @param p0 the compound
 * @param p1 the compound count
 * @param p2 the compound size
 * @param p3 the name
 * @param p4 the name count
 * @param p5 the name size
 * @param p6 the abstraction
 * @param p7 the abstraction count
 * @param p8 the abstraction size
 * @param p9 the model
 * @param p10 the model count
 * @param p11 the model size
 * @param p12 the details
 * @param p13 the details count
 * @param p14 the details size
 */
void set_compound_element_by_name(void* p0, void* p1, void* p2,
    const void* p3, const void* p4, const void* p5,
    const void* p6, const void* p7, const void* p8,
    const void* p9, const void* p10, const void* p11,
    const void* p12, const void* p13, const void* p14) {

    // The separator index.
    int i = -1;

    get_array_element_index(p3, (void*) &CHARACTER_ARRAY, p4, (void*) &COMPOUND_ELEMENT_SEPARATOR, (void*) &i);

    if (i != -1) {

        // The separator has been found.
        // The full name is hierarchical.
        // The given compound contains elements which are compound models.

        if (p4 != NULL_POINTER) {

            int* nc = (int*) p4;

            if (p3 != NULL_POINTER) {

                void** n = (void**) p3;

                if (i >= 0) {

                    if (i < *nc) {

                        if (i != 0) {

                            if (i != (*nc - 1)) {

                                // The remaining name starts at the index after the separator.
                                // Example: "hello.test"
                                // The index of the separator is 5.
                                // The starting index of the remaining name "test" is 6 = 5 + 1.
                                void* r = (void*) (*n + i + 1);

                                // The remaining name count is the full name count decreased
                                // by the separator index increased by one.
                                // Example: "hello.test"
                                // The full name count is 10.
                                // The separator index is 5.
                                // The count of the remaining name "test" is 4 = 10 - (5 + 1).
                                int rc = *nc - (i + 1);

                                // The models.
                                void* m = NULL_POINTER;
                                int mc = 0;
                                int ms = 0;

                                // Get models.
                                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_INDEX, (void*) &m);
                                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_COUNTS_INDEX, (void*) &mc);
                                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_SIZES_INDEX, (void*) &ms);

                                // Get index of element name.
                                // The separator index i is used as element name count.
                                // Example: "hello.test"
                                // The index i of the separator is 5.
                                // The count of the element name "hello" before the separator is likewise 5.
                                int index = -1;
                                get_compound_element_index(p0, p1, p3, (void*) &i, (void*) &index);

                                if (index != -1) {

                                    // The element model.
                                    void* em = NULL_POINTER;
                                    int emc = 0;
                                    int ems = 0;

                                    // Get element model.
                                    get_array_element((void*) &m, (void*) &POINTER_ARRAY, (void*) &index, (void*) &em);
                                    get_array_element((void*) &mc, (void*) &INTEGER_ARRAY, (void*) &index, (void*) &emc);
                                    get_array_element((void*) &ms, (void*) &INTEGER_ARRAY, (void*) &index, (void*) &ems);

                                    //?? TODO:
                                    //?? For now, the remaining name count is also used as
                                    //?? remaining name size and such handed over twice.
                                    //?? Later implementations may use UNICODE names so that
                                    //?? the name count and size differ.

                                    // Recursively continue to process along the hierarchical name.
                                    set_compound_element_by_name((void*) &em, (void*) &emc, (void*) &ems,
                                        (void*) &r, (void*) &rc, (void*) &rc,
                                        p6, p7, p8, p9, p10, p11, p12, p13, p14);

                                } else {

//??                                    log_message((void*) &WARNING_LOG_LEVEL, (void*) &"Could not set compound element by name. A element with that name does not exist.");
                                }

                            } else {

//??                                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by name. The full name ends with a separator.");
                            }

                        } else {

//??                            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by name. The full name starts with a separator.");
                        }

                    } else {

//??                        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by name. The separator index exceeds the full name count.");
                    }

                } else {

//??                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by name. The separator index is negative.");
                }

            } else {

//??                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by name. The name is null.");
            }

        } else {

//??            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by name. The name count is null.");
        }

    } else {

        // The separator could not be found.
        // The full name is not hierarchical and represents the element name.
        // The given compound contains elements which are primitive models.

        // The index of the name.
        int index = -1;
        get_compound_element_index(p0, p1, p3, p4, (void*) &index);

        if (index != -1) {

//??            log_message((void*) &INFO_LOG_LEVEL, (void*) &SET_COMPOUND_BY_NAME_MESSAGE, (void*) &SET_COMPOUND_BY_NAME_MESSAGE_COUNT);

            //?? TODO:
            //?? - Do NOT just replace existing elements; otherwise the reference
            //??   to them is lost and they can not be destroyed properly.
            //?? - Allow replacement for primitive types (integer, double) that
            //??   do not have to be destroyed!
            //?? - Check the abstraction of the model to be set:
            //??   If it is compound, then do NOT replace; otherwise DO replace!

/*??
            // Use index of the found element.
            set_compound_element_by_index(p0, p1, p2,
                (void*) &index,
                p3, p4, p5,
                p6, p7, p8, p9, p10, p11, p12, p13, p14);
*/

        } else {

//??            log_message((void*) &INFO_LOG_LEVEL, (void*) &ADD_COMPOUND_BY_NAME_MESSAGE, (void*) &ADD_COMPOUND_BY_NAME_MESSAGE_COUNT);

            // Use compound count as index.
            set_compound_element_by_index(p0, p1, p2,
                p1,
                p3, p4, p5,
                p6, p7, p8, p9, p10, p11, p12, p13, p14);
        }
    }
}
int mxf_avid_create_default_metadictionary(MXFHeaderMetadata* headerMetadata, MXFMetadataSet** metaDictSet)
{
    MXFMetadataSet* newMetaDictSet = NULL;
    MXFMetadataSet* classDefSet;
    MXFMetadataSet* set;
    mxfUL label1;
    mxfUL label2;
    mxfUL label3;
    MXFList classMetaDefList;
    MXFList typeMetaDefList;
    MXFList classWeakRefList;
    MXFList typeWeakRefList;
    MXFMetadataItem* item;
    MXFListIterator iter;
    mxfUUID targetInstanceUID;
    int arrayIndex;
    
    mxf_initialise_list(&classMetaDefList, free);
    mxf_initialise_list(&typeMetaDefList, free);
    mxf_initialise_list(&classWeakRefList, free);
    mxf_initialise_list(&typeWeakRefList, free);

    
    CHK_OFAIL(mxf_avid_create_metadictionary(headerMetadata, &newMetaDictSet));
    
    /* register meta-definitions */
    /* set temporary weak reference values which will be replaced later */
    
#define LABEL(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15) \
    bounce_label(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, &label1)

#define LABEL_2(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15) \
    bounce_label(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, &label2)

#define WEAKREF(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15) \
    bounce_label(d0, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, &label3)

#define CLASS_DEF(id, name, description, parentId, isConcrete) \
    CHK_OFAIL(mxf_avid_create_classdef(newMetaDictSet, id, name, description, parentId, isConcrete, &classDefSet)); \
    CHK_OFAIL(mxf_get_item(classDefSet, &MXF_ITEM_K(ClassDefinition, ParentClass), &item)); \
    CHK_OFAIL(add_weakref_to_list(&classWeakRefList, item, -1, parentId)); \
    CHK_OFAIL(add_metadef_to_list(&classMetaDefList, id, &classDefSet->instanceUID));
    
#define PROPERTY_DEF(id, name, description, typeId, isOptional, localId, isUniqueId) \
    CHK_OFAIL(mxf_avid_create_propertydef(classDefSet->headerMetadata->primerPack, classDefSet, \
        id, name, description, typeId, isOptional, localId, isUniqueId, &set));
    
#define CHARACTER_DEF(id, name, description) \
    CHK_OFAIL(mxf_avid_create_typedef_char(newMetaDictSet, id, name, description, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define ENUM_DEF(id, name, description, typeId) \
    CHK_OFAIL(mxf_avid_create_typedef_enum(newMetaDictSet, id, name, description, typeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionEnumeration, Type), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, -1, typeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));
#define ENUM_ELEMENT(name, value) \
    CHK_OFAIL(mxf_avid_add_typedef_enum_element(set, name, value));

#define EXTENUM_DEF(id, name, description) \
    CHK_OFAIL(mxf_avid_create_typedef_extenum(newMetaDictSet, id, name, description, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));
#define EXTENUM_ELEMENT(name, value) \
    CHK_OFAIL(mxf_avid_add_typedef_extenum_element(set, name, value));

#define FIXEDARRAY_DEF(id, name, description, typeId, count) \
    CHK_OFAIL(mxf_avid_create_typedef_fixedarray(newMetaDictSet, id, name, description, typeId, count, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionFixedArray, ElementType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, -1, typeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define INDIRECT_DEF(id, name, description) \
    CHK_OFAIL(mxf_avid_create_typedef_indirect(newMetaDictSet, id, name, description, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define INTEGER_DEF(id, name, description, size, isSigned) \
    CHK_OFAIL(mxf_avid_create_typedef_integer(newMetaDictSet, id, name, description, size, isSigned, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define OPAQUE_DEF(id, name, description) \
    CHK_OFAIL(mxf_avid_create_typedef_opaque(newMetaDictSet, id, name, description, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define RENAME_DEF(id, name, description, typeId) \
    CHK_OFAIL(mxf_avid_create_typedef_rename(newMetaDictSet, id, name, description, typeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionRename, RenamedType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, -1, typeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define RECORD_DEF(id, name, description) \
    CHK_OFAIL(mxf_avid_create_typedef_record(newMetaDictSet, id, name, description, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID)); \
    arrayIndex = 0;
#define RECORD_MEMBER(name, type) \
    CHK_OFAIL(mxf_avid_add_typedef_record_member(set, name, type)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionRecord, MemberTypes), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, arrayIndex, type)); \
    arrayIndex++;

#define SET_DEF(id, name, description, typeId) \
    CHK_OFAIL(mxf_avid_create_typedef_set(newMetaDictSet, id, name, description, typeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionSet, ElementType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, -1, typeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define STREAM_DEF(id, name, description) \
    CHK_OFAIL(mxf_avid_create_typedef_stream(newMetaDictSet, id, name, description, &set)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define STRING_DEF(id, name, description, typeId) \
    CHK_OFAIL(mxf_avid_create_typedef_string(newMetaDictSet, id, name, description, typeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionString, ElementType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, -1, typeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define STRONGOBJREF_DEF(id, name, description, refTypeId) \
    CHK_OFAIL(mxf_avid_create_typedef_strongref(newMetaDictSet, id, name, description, refTypeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionStrongObjectReference, ReferencedType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&classWeakRefList, item, -1, refTypeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));

#define WEAKOBJREF_DEF(id, name, description, refTypeId) \
    CHK_OFAIL(mxf_avid_create_typedef_weakref(newMetaDictSet, id, name, description, refTypeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionWeakObjectReference, ReferencedType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&classWeakRefList, item, -1, refTypeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));
#define WEAKOBJREF_TARGET_ELEMENT(id) \
    CHK_OFAIL(mxf_avid_add_typedef_weakref_target(set, id));

#define VARARRAY_DEF(id, name, description, typeId) \
    CHK_OFAIL(mxf_avid_create_typedef_vararray(newMetaDictSet, id, name, description, typeId, &set)); \
    CHK_OFAIL(mxf_get_item(set, &MXF_ITEM_K(TypeDefinitionVariableArray, ElementType), &item)); \
    CHK_OFAIL(add_weakref_to_list(&typeWeakRefList, item, -1, typeId)); \
    CHK_OFAIL(add_metadef_to_list(&typeMetaDefList, id, &set->instanceUID));
    

    
#include "mxf_avid_metadictionary_data.h"

    
    
    /* de-reference class and type weak references and replace weak reference value with
    instanceUID of target set */

    mxf_initialise_list_iter(&iter, &classWeakRefList);
    while (mxf_next_list_iter_element(&iter))
    {
        WeakRefData* data = (WeakRefData*)mxf_get_iter_element(&iter);
        
        CHK_OFAIL(find_weakref_target_instance_uid(&classMetaDefList, &data->targetIdentification, &targetInstanceUID));
        
        if (data->arrayIndex >= 0)
        {
            mxf_set_uuid(&targetInstanceUID, get_array_element(data->item, data->arrayIndex));
        }
        else
        {
            mxf_set_uuid(&targetInstanceUID, data->item->value);
        }
    }
    
    mxf_initialise_list_iter(&iter, &typeWeakRefList);
    while (mxf_next_list_iter_element(&iter))
    {
        WeakRefData* data = (WeakRefData*)mxf_get_iter_element(&iter);
        
        CHK_OFAIL(find_weakref_target_instance_uid(&typeMetaDefList, &data->targetIdentification, &targetInstanceUID));
        
        if (data->arrayIndex >= 0)
        {
            mxf_set_uuid(&targetInstanceUID, get_array_element(data->item, data->arrayIndex));
        }
        else
        {
            mxf_set_uuid(&targetInstanceUID, data->item->value);
        }
    }
    


    mxf_clear_list(&classMetaDefList);
    mxf_clear_list(&typeMetaDefList);
    mxf_clear_list(&classWeakRefList);
    mxf_clear_list(&typeWeakRefList);

    *metaDictSet = newMetaDictSet;
    return 1;
    
fail:
    if (newMetaDictSet != NULL)
    {
        mxf_remove_set(headerMetadata, newMetaDictSet);
        mxf_free_set(&newMetaDictSet);
    }

    mxf_clear_list(&classMetaDefList);
    mxf_clear_list(&typeMetaDefList);
    mxf_clear_list(&classWeakRefList);
    mxf_clear_list(&typeWeakRefList);

    return 0;
}
/**
 * Gets the compound element by name.
 *
 * @param p0 the compound
 * @param p1 the compound count
 * @param p2 the compound size
 * @param p3 the name
 * @param p4 the name count
 * @param p5 the name size
 * @param p6 the abstraction
 * @param p7 the abstraction count
 * @param p8 the abstraction size
 * @param p9 the model
 * @param p10 the model count
 * @param p11 the model size
 * @param p12 the details
 * @param p13 the details count
 * @param p14 the details size
 */
void get_compound_element_by_name(const void* p0, const void* p1, const void* p2,
    void* p3, void* p4, void* p5,
    void* p6, void* p7, void* p8,
    void* p9, void* p10, void* p11,
    void* p12, void* p13, void* p14) {

    // The separator index.
    int i = -1;

    get_array_element_index(p3, (void*) &CHARACTER_ARRAY, p4, (void*) &COMPOUND_ELEMENT_SEPARATOR, (void*) &i);

    if (i != -1) {

        // The separator has been found.
        // The full name is hierarchical.
        // The given compound contains elements which are compound models.

        if (p4 != NULL_POINTER) {

            int* nc = (int*) p4;

            if (p3 != NULL_POINTER) {

                void** n = (void**) p3;

                if (i >= 0) {

                    if (i < *nc) {

                        if (i != 0) {

                            if (i != (*nc - 1)) {

                                // The remaining name starts at the index after the separator.
                                // Example: "hello.test"
                                // The index of the separator is 5.
                                // The starting index of the remaining name "test" is 6 = 5 + 1.
                                void* r = (void*) (*n + i + 1);

                                // The remaining name count is the full name count decreased
                                // by the separator index increased by one.
                                // Example: "hello.test"
                                // The full name count is 10.
                                // The separator index is 5.
                                // The count of the remaining name "test" is 4 = 10 - (5 + 1).
                                int rc = *nc - (i + 1);

                                // The models.
                                void* m = NULL_POINTER;
                                int mc = 0;
                                int ms = 0;

                                // Get models.
                                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_INDEX, (void*) &m);
                                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_COUNTS_INDEX, (void*) &mc);
                                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_SIZES_INDEX, (void*) &ms);

                                // Get index of element name.
                                // The separator index i is used as element name count.
                                // Example: "hello.test"
                                // The index i of the separator is 5.
                                // The count of the element name "hello" before the separator is likewise 5.
                                int index = -1;
                                get_compound_element_index(p0, p1, p3, (void*) &i, (void*) &index);

                                if (index != -1) {

                                    // The element model.
                                    void* em = NULL_POINTER;
                                    int emc = 0;
                                    int ems = 0;

                                    // Get element model.
                                    get_array_element((void*) &m, (void*) &POINTER_ARRAY, (void*) &index, (void*) &em);
                                    get_array_element((void*) &mc, (void*) &INTEGER_ARRAY, (void*) &index, (void*) &emc);
                                    get_array_element((void*) &ms, (void*) &INTEGER_ARRAY, (void*) &index, (void*) &ems);

                                    //?? TODO:
                                    //?? For now, the remaining name count is also used as
                                    //?? remaining name size and such handed over twice.
                                    //?? Later implementations may use UNICODE names so that
                                    //?? the name count and size differ.

                                    // Recursively continue to process along the hierarchical name.
                                    get_compound_element_by_name((void*) &em, (void*) &emc, (void*) &ems,
                                        (void*) &r, (void*) &rc, (void*) &rc,
                                        p6, p7, p8, p9, p10, p11, p12, p13, p14);

                                } else {

//??                                    log_message((void*) &WARNING_LOG_LEVEL, (void*) &"Could not get compound element by name. A element with that name does not exist.");
                                }

                            } else {

//??                                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by name. The full name ends with a separator.");
                            }

                        } else {

//??                            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by name. The full name starts with a separator.");
                        }

                    } else {

//??                        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by name. The separator index exceeds the full name size.");
                    }

                } else {

//??                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by name. The separator index is negative.");
                }

            } else {

//??                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by name. The name is null.");
            }

        } else {

//??            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by name. The name size is null.");
        }

    } else {

        // The separator could not be found.
        // The full name is not hierarchical and represents the element name.
        // The given compound contains elements which are primitive models.

        // The index of the element name.
        int index = -1;
        get_compound_element_index(p0, p1, p3, p4, (void*) &index);

        if (index != -1) {

//??            log_message((void*) &INFO_LOG_LEVEL, (void*) &GET_COMPOUND_BY_NAME_MESSAGE, (void*) &GET_COMPOUND_BY_NAME_MESSAGE_COUNT);

            get_compound_element_by_index(p0, p1, p2,
                (void*) &index,
                p3, p4, p5,
                p6, p7, p8, p9, p10, p11, p12, p13, p14);

        } else {

//??            log_message((void*) &WARNING_LOG_LEVEL, (void*) &COULD_NOT_GET_COMPOUND_BY_NAME_A_WITH_THAT_NAME_DOES_NOT_EXIST_MESSAGE, (void*) &COULD_NOT_GET_COMPOUND_BY_NAME_A_WITH_THAT_NAME_DOES_NOT_EXIST_MESSAGE_COUNT);
        }
    }
}
/**
 * Gets the compound element by index.
 *
 * @param p0 the compound
 * @param p1 the compound count
 * @param p2 the compound size
 * @param p3 the index
 * @param p4 the name
 * @param p5 the name count
 * @param p6 the name size
 * @param p7 the abstraction
 * @param p8 the abstraction count
 * @param p9 the abstraction size
 * @param p10 the model
 * @param p11 the model count
 * @param p12 the model size
 * @param p13 the details
 * @param p14 the details count
 * @param p15 the details size
 */
void get_compound_element_by_index(const void* p0, const void* p1, const void* p2,
    const void* p3,
    void* p4, void* p5, void* p6,
    void* p7, void* p8, void* p9,
    void* p10, void* p11, void* p12,
    void* p13, void* p14, void* p15) {

    if (p3 != NULL_POINTER) {

        int* i = (int*) p3;

        if (p1 != NULL_POINTER) {

            int* cc = (int*) p1;

            if (*i >= 0) {

//??                log_message((void*) &INFO_LOG_LEVEL, (void*) &"Get compound element by index.");

                // The names, models, abstractions, details.
                void* n = NULL_POINTER;
                void* nc = NULL_POINTER;
                void* ns = NULL_POINTER;
                void* a = NULL_POINTER;
                void* ac = NULL_POINTER;
                void* as = NULL_POINTER;
                void* m = NULL_POINTER;
                void* mc = NULL_POINTER;
                void* ms = NULL_POINTER;
                void* d = NULL_POINTER;
                void* dc = NULL_POINTER;
                void* ds = NULL_POINTER;

                // Get names, models, abstractions, details.
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_INDEX, (void*) &n);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_COUNTS_INDEX, (void*) &nc);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_SIZES_INDEX, (void*) &ns);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_COUNTS_INDEX, (void*) &ac);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_INDEX, (void*) &m);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_COUNTS_INDEX, (void*) &mc);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_SIZES_INDEX, (void*) &ms);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_INDEX, (void*) &d);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_COUNTS_INDEX, (void*) &dc);
                get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_SIZES_INDEX, (void*) &ds);

                if (*i < *cc) {

                    // Get element name, model, abstraction, details.
                    get_array_element((void*) &n, (void*) &POINTER_ARRAY, p3, p4);
                    get_array_element((void*) &nc, (void*) &INTEGER_ARRAY, p3, p5);
                    get_array_element((void*) &ns, (void*) &INTEGER_ARRAY, p3, p6);
                    get_array_element((void*) &a, (void*) &POINTER_ARRAY, p3, p7);
                    get_array_element((void*) &ac, (void*) &INTEGER_ARRAY, p3, p8);
                    get_array_element((void*) &as, (void*) &INTEGER_ARRAY, p3, p9);
                    get_array_element((void*) &m, (void*) &POINTER_ARRAY, p3, p10);
                    get_array_element((void*) &mc, (void*) &INTEGER_ARRAY, p3, p11);
                    get_array_element((void*) &ms, (void*) &INTEGER_ARRAY, p3, p12);
                    get_array_element((void*) &d, (void*) &POINTER_ARRAY, p3, p13);
                    get_array_element((void*) &dc, (void*) &INTEGER_ARRAY, p3, p14);
                    get_array_element((void*) &ds, (void*) &INTEGER_ARRAY, p3, p15);

                } else {

//??                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by index. The index exceeds the count.");
                }

            } else {

//??                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by index. The index is negativ.");
            }

        } else {

//??            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by index. The count is null.");
        }

    } else {

//??        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not get compound element by index. The index is null.");
    }
}
/**
 * Removes the compound element by index.
 *
 * @param p0 the compound
 * @param p1 the compound count
 * @param p2 the compound size
 * @param p3 the index
 */
void remove_compound_element_by_index(void* p0, void* p1, void* p2, const void* p3) {

    if (p3 != NULL_POINTER) {

        int* i = (int*) p3;

        if (p2 != NULL_POINTER) {

            int* cs = (int*) p2;

            if (p1 != NULL_POINTER) {

                int* cc = (int*) p1;

                if (*i >= 0) {

//??                    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Remove compound element by index.");

                    // The names, models, abstractions, details.
                    void* n = NULL_POINTER;
                    void* nc = NULL_POINTER;
                    void* ns = NULL_POINTER;
                    void* a = NULL_POINTER;
                    void* ac = NULL_POINTER;
                    void* as = NULL_POINTER;
                    void* m = NULL_POINTER;
                    void* mc = NULL_POINTER;
                    void* ms = NULL_POINTER;
                    void* d = NULL_POINTER;
                    void* dc = NULL_POINTER;
                    void* ds = NULL_POINTER;

                    // Get names, models, abstractions, details.
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_INDEX, (void*) &n);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_COUNTS_INDEX, (void*) &nc);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_SIZES_INDEX, (void*) &ns);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_COUNTS_INDEX, (void*) &ac);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_INDEX, (void*) &m);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_COUNTS_INDEX, (void*) &mc);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_SIZES_INDEX, (void*) &ms);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_INDEX, (void*) &d);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_COUNTS_INDEX, (void*) &dc);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_SIZES_INDEX, (void*) &ds);

                    if (*i < *cc) {

                        // Remove element name, model, abstraction, details.
                        remove_array_element((void*) &n, (void*) &POINTER_ARRAY, p1, p3);
                        remove_array_element((void*) &nc, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &ns, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &a, (void*) &POINTER_ARRAY, p1, p3);
                        remove_array_element((void*) &ac, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &as, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &m, (void*) &POINTER_ARRAY, p1, p3);
                        remove_array_element((void*) &mc, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &ms, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &d, (void*) &POINTER_ARRAY, p1, p3);
                        remove_array_element((void*) &dc, (void*) &INTEGER_ARRAY, p1, p3);
                        remove_array_element((void*) &ds, (void*) &INTEGER_ARRAY, p1, p3);

                        // Decrement count.
                        (*cc)--;

                    } else {

//??                        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove compound element by index. The index exceeds the count.");
                    }

                } else {

//??                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove compound element by index. The index is negativ.");
                }

            } else {

//??                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove compound element by index. The count is null.");
            }

        } else {

//??            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove compound element by index. The size is null.");
        }

    } else {

//??        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not remove compound element by index. The index is null.");
    }
}
/**
 * Sets the signal.
 *
 * @param p0 the signal memory
 * @param p1 the signal
 * @param p2 the priority
 * @param p3 the abstraction
 * @param p4 the abstraction size
 */
void set_signal(void* p0, const void* p1, const void* p2, const void* p3, const void* p4) {

    // Initialize elements.
    int s = 0;
    int c = 0;
    void* sig = NULL_POINTER;
    void* p = NULL_POINTER;
    void* a = NULL_POINTER;
    void* as = NULL_POINTER;

    // Get elements.
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_SIZE_INDEX, (void*) &s);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNALS_INDEX, (void*) &sig);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PRIORITIES_INDEX, (void*) &p);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);

    // The index.
    int i = c;

    if (i >= 0) {

        if (i == s) {

            // Increase size.
            s = s * 2 + 1;

            // Resize elements.
            resize_array((void*) &sig, (void*) &POINTER_ARRAY, (void*) &s);
            resize_array((void*) &p, (void*) &INTEGER_ARRAY, (void*) &s);
            resize_array((void*) &a, (void*) &POINTER_ARRAY, (void*) &s);
            resize_array((void*) &as, (void*) &INTEGER_ARRAY, (void*) &s);

            // Set array size which is equal for all arrays.
            set_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_SIZE_INDEX, (void*) &s);
        }

        if (i < s) {

            // Set signal.
            set_array_element((void*) &sig, (void*) &POINTER_ARRAY, (void*) &i, p1);
            set_array_element((void*) &p, (void*) &INTEGER_ARRAY, (void*) &i, p2);
            set_array_element((void*) &a, (void*) &POINTER_ARRAY, (void*) &i, p3);
            set_array_element((void*) &as, (void*) &INTEGER_ARRAY, (void*) &i, p4);

            // Increment count.
            c++;

            // Set count.
            set_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);

        } else {

            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set signal. The index exceeds the size.");
        }

    } else {

        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set signal. The index is negativ.");
    }
}
/**
 * Sets the compound element by index.
 *
 * @param p0 the compound
 * @param p1 the compound count
 * @param p2 the compound size
 * @param p3 the index
 * @param p4 the name
 * @param p5 the name count
 * @param p6 the name size
 * @param p7 the abstraction
 * @param p8 the abstraction count
 * @param p9 the abstraction size
 * @param p10 the model
 * @param p11 the model count
 * @param p12 the model size
 * @param p13 the details
 * @param p14 the details count
 * @param p15 the details size
 */
void set_compound_element_by_index(void* p0, void* p1, void* p2,
    const void* p3,
    const void* p4, const void* p5, const void* p6,
    const void* p7, const void* p8, const void* p9,
    const void* p10, const void* p11, const void* p12,
    const void* p13, const void* p14, const void* p15) {

    if (p3 != NULL_POINTER) {

        int* i = (int*) p3;

        if (p2 != NULL_POINTER) {

            int* cs = (int*) p2;

            if (p1 != NULL_POINTER) {

                int* cc = (int*) p1;

                if (*i >= 0) {

//??                    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Set compound element by index.");

                    // The names, models, abstractions, details.
                    void* n = NULL_POINTER;
                    void* nc = NULL_POINTER;
                    void* ns = NULL_POINTER;
                    void* a = NULL_POINTER;
                    void* ac = NULL_POINTER;
                    void* as = NULL_POINTER;
                    void* m = NULL_POINTER;
                    void* mc = NULL_POINTER;
                    void* ms = NULL_POINTER;
                    void* d = NULL_POINTER;
                    void* dc = NULL_POINTER;
                    void* ds = NULL_POINTER;

                    // Get names, models, abstractions, details.
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_INDEX, (void*) &n);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_COUNTS_INDEX, (void*) &nc);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_SIZES_INDEX, (void*) &ns);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_COUNTS_INDEX, (void*) &ac);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_INDEX, (void*) &m);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_COUNTS_INDEX, (void*) &mc);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &MODELS_SIZES_INDEX, (void*) &ms);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_INDEX, (void*) &d);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_COUNTS_INDEX, (void*) &dc);
                    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &DETAILS_SIZES_INDEX, (void*) &ds);

                    if (*i == *cs) {

                        // Increase size.
                        *cs = (*cs * COMPOUND_RESIZE_FACTOR) + 1;

                        // Resize names, models, abstractions, details.
                        resize_array((void*) &n, (void*) &POINTER_ARRAY, p2);
                        resize_array((void*) &nc, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &ns, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &a, (void*) &POINTER_ARRAY, p2);
                        resize_array((void*) &ac, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &as, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &m, (void*) &POINTER_ARRAY, p2);
                        resize_array((void*) &mc, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &ms, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &d, (void*) &POINTER_ARRAY, p2);
                        resize_array((void*) &dc, (void*) &INTEGER_ARRAY, p2);
                        resize_array((void*) &ds, (void*) &INTEGER_ARRAY, p2);
                    }

                    if (*i < *cs) {

                        // Set name, model, abstraction, details.
                        set_array_element((void*) &n, (void*) &POINTER_ARRAY, p3, p4);
                        set_array_element((void*) &nc, (void*) &INTEGER_ARRAY, p3, p5);
                        set_array_element((void*) &ns, (void*) &INTEGER_ARRAY, p3, p6);
                        set_array_element((void*) &a, (void*) &POINTER_ARRAY, p3, p7);
                        set_array_element((void*) &ac, (void*) &INTEGER_ARRAY, p3, p8);
                        set_array_element((void*) &as, (void*) &INTEGER_ARRAY, p3, p9);
                        set_array_element((void*) &m, (void*) &POINTER_ARRAY, p3, p10);
                        set_array_element((void*) &mc, (void*) &INTEGER_ARRAY, p3, p11);
                        set_array_element((void*) &ms, (void*) &INTEGER_ARRAY, p3, p12);
                        set_array_element((void*) &d, (void*) &POINTER_ARRAY, p3, p13);
                        set_array_element((void*) &dc, (void*) &INTEGER_ARRAY, p3, p14);
                        set_array_element((void*) &ds, (void*) &INTEGER_ARRAY, p3, p15);

                        // Increment count.
                        (*cc)++;

                    } else {

//??                        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by index. The index exceeds the size.");
                    }

                } else {

//??                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by index. The index is negativ.");
                }

            } else {

//??                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by index. The count is null.");
            }

        } else {

//??            log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by index. The size is null.");
        }

    } else {

//??        log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not set compound element by index. The index is null.");
    }
}
/**
 * Destroys the signal memory.
 *
 * @param p0 the signal memory
 */
void destroy_signal_memory(void* p0) {

    // Initialize elements.
    int s = 0;
    int c = 0;
    void* sig = NULL_POINTER;
    void* p = NULL_POINTER;
    void* a = NULL_POINTER;
    void* as = NULL_POINTER;

/*??
    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Destroy all signals left in signal memory.");

    int i = 0;
    get_array_count(m->signals, (void*) &i);
    i--;
    void* s = NULL_POINTER;
    void* a = NULL_POINTER;

    while (i >= 0) {

        s = (void*) get_signal(p0, (void*) &i);
        a = (void*) get_abstraction(p0, (void*) &i);
        // Priority is not needed to destroy the signal.

        // Abstraction and priority are removed internally,
        // together with the signal.
        remove_signal(p0, (void*) &i);

        // Destroy signal. Do not destroy the signal's abstraction and
        // priority here; they are static within CYBOI.
        destroy_model(s, NULL, NULL, (void*) a);

        i--;
    }
*/

    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Destroy signal memory.");

    // Get elements.
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_SIZE_INDEX, (void*) &s);
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNALS_COUNT_INDEX, (void*) &c);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNALS_INDEX, (void*) &sig);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PRIORITIES_INDEX, (void*) &p);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_INDEX, (void*) &a);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &ABSTRACTIONS_SIZES_INDEX, (void*) &as);

    // Remove elements in descending order.
    remove_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT, (void*) &ABSTRACTIONS_SIZES_INDEX);
    remove_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT, (void*) &ABSTRACTIONS_INDEX);
    remove_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT, (void*) &PRIORITIES_INDEX);
    remove_array_element(p0, (void*) &POINTER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT, (void*) &SIGNALS_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT, (void*) &SIGNALS_COUNT_INDEX);
    remove_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT, (void*) &SIGNALS_SIZE_INDEX);

    // Destroy elements.
    destroy_array((void*) &sig, (void*) &POINTER_ARRAY, (void*) &s);
    destroy_array((void*) &p, (void*) &INTEGER_ARRAY, (void*) &s);
    destroy_array((void*) &a, (void*) &POINTER_ARRAY, (void*) &s);
    destroy_array((void*) &as, (void*) &INTEGER_ARRAY, (void*) &s);

    // Destroy signal memory.
    destroy_array(p0, (void*) &POINTER_ARRAY, (void*) &SIGNAL_MEMORY_COUNT);
}
/**
 * Handles the operation signal.
 *
 * @param p0 the operation signal
 * @param p1 the statics
 * @param p2 the dynamics
 * @param p3 the internals
 * @param p4 the shutdown flag
 */
void handle_operation_signal(const void* p0, void* p1, void* p2, void* p3, void* p4) {

    log_message((void*) &INFO_LOG_LEVEL, (void*) &"Handle operation signal.");

    // Initialize elements.
    int s = 0;
    void* p = NULL_POINTER;
    void* ps = NULL_POINTER;

    // Get elements.
    get_array_element(p0, (void*) &INTEGER_ARRAY, (void*) &PARAMETERS_SIZE_INDEX, (void*) &s);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PARAMETERS_INDEX, (void*) &p);
    get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &PARAMETERS_SIZES_INDEX, (void*) &ps);

    // Initialize parameter names.
    // The first parameter p0 is the operation name.
    // Following parameters p1 .. are input and output names.
    void* param0 = NULL_POINTER;
    int param0s = 0;
    void* param1 = NULL_POINTER;
    int param1s = 0;
    void* param2 = NULL_POINTER;
    int param2s = 0;
    void* param3 = NULL_POINTER;
    int param3s = 0;
    void* param4 = NULL_POINTER;
    int param4s = 0;
    void* param5 = NULL_POINTER;
    int param5s = 0;
    void* param6 = NULL_POINTER;
    int param6s = 0;
    void* param7 = NULL_POINTER;
    int param7s = 0;
    void* param8 = NULL_POINTER;
    int param8s = 0;
    void* param9 = NULL_POINTER;
    int param9s = 0;
    void* param10 = NULL_POINTER;
    int param10s = 0;

    // Get parameter names.
    int j = 0;

    while (1) {

        if (j >= s) {

            break;
        }

        if (j == 0) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param0);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param0s);

        } else if (j == 1) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param1);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param1s);

        } else if (j == 2) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param2);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param2s);

        } else if (j == 3) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param3);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param3s);

        } else if (j == 4) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param4);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param4s);

        } else if (j == 5) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param5);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param5s);

        } else if (j == 6) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param6);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param6s);

        } else if (j == 7) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param7);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param7s);

        } else if (j == 8) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param8);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param8s);

        } else if (j == 9) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param9);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param9s);

        } else if (j == 10) {

            get_array_element((void*) &p, (void*) &POINTER_ARRAY, (void*) &j, (void*) &param10);
            get_array_element((void*) &ps, (void*) &INTEGER_ARRAY, (void*) &j, (void*) &param10s);
        }

        j++;
    }

    // The done flag.
    int d = 0;
    // The comparison result.
    int r = 0;

    fprintf(stderr, "TEST param0: %s\n", param0);
    fprintf(stderr, "TEST param0s: %d\n", param0s);

    // Add.
    if (d == 0) {

        if (param0s == ADD_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &ADD_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &ADD_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

                add(p1, (void*) &param1, (void*) &param1s, (void*) &param2, (void*) &param2s, (void*) &param3, (void*) &param3s);

                d = 1;
            }
        }
    }

    // Create statics.
    if (d == 0) {

        if (param0s == CREATE_STATICS_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &CREATE_STATICS_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &CREATE_STATICS_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

/*??
                void* m = NULL_POINTER;
                int ms = 0;

                * @param p0 the transient model
                * @param p1 the transient model size
                * @param p2 the persistent model
                * @param p3 the persistent model size
                * @param p4 the abstraction
                * @param p5 the abstraction size
                //?? Work this out! Hand over 9 or just 3 parameters,
                //?? for only part or also position and constraint?
                //?? ATTENTION! One of the given cybol parameters must specify
                //?? the whole model that the newly created part model will be attached to.
                create_model(get_array_element(v, (void*) &TWO_NUMBER), get_array_element(v, (void*) &THREE_NUMBER), get_array_element(v, (void*) &FOUR_NUMBER));
                set_map_element_with_name(s->part_models, get_array_element(v, (void*) &ONE_NUMBER), m);
*/

                d = 1;
            }
        }
    }

    // Destroy statics.
    if (d == 0) {

        if (param0s == DESTROY_STATICS_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &DESTROY_STATICS_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &DESTROY_STATICS_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

/*??
                struct model* s = (struct model*) p1;

                if (s != NULL_POINTER) {

                    //?? Work this out! Hand over 9 or just 3 parameters,
                    //?? for only part or also position and constraint?
                    void* m = get_map_element_with_name(s->part_models, get_map_element_with_name(v, (void*) &ONE_NUMBER));
                    destroy_model(m, get_array_element(v, (void*) &TWO_NUMBER), get_array_element(v, (void*) &THREE_NUMBER), get_array_element(v, (void*) &FOUR_NUMBER));

                } else {

                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not handle destroy statics model. The statics is null.");
                }
*/

                d = 1;
            }
        }
    }

    // Create dynamics.
    if (d == 0) {

        if (param0s == CREATE_DYNAMICS_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &CREATE_DYNAMICS_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &CREATE_DYNAMICS_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

/*??
                struct model* d = (struct model*) p2;

                if (d != NULL_POINTER) {

                    //?? Work this out! Hand over 9 or just 3 parameters,
                    //?? for only part or also position and constraint?
                    void* m = create_model(get_array_element(v, (void*) &TWO_NUMBER), get_array_element(v, (void*) &THREE_NUMBER), get_array_element(v, (void*) &FOUR_NUMBER));
                    set_map_element_with_name(d->part_models, get_array_element(v, (void*) &ONE_NUMBER), m);

                } else {

                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not handle create dynamics model. The dynamics is null.");
                }
*/

                d = 1;
            }
        }
    }

    // Destroy dynamics.
    if (d == 0) {

        if (param0s == DESTROY_DYNAMICS_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &DESTROY_DYNAMICS_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &DESTROY_DYNAMICS_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

/*??
                struct model* d = (struct model*) p2;

                if (d != NULL_POINTER) {

                    //?? Work this out! Hand over 9 or just 3 parameters,
                    //?? for only part or also position and constraint?
                    void* m = get_map_element_with_name(d->part_models, get_map_element_with_name(v, (void*) &ONE_NUMBER));
                    destroy_model(m, get_array_element(v, (void*) &TWO_NUMBER), get_array_element(v, (void*) &THREE_NUMBER), get_array_element(v, (void*) &FOUR_NUMBER));

                } else {

                    log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not handle destroy dynamics model. The dynamics is null.");
                }
*/

                d = 1;
            }
        }
    }

    // Send.
    if (d == 0) {

        if (param0s == SEND_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &SEND_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &SEND_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

/*??
                void* l = get_map_element_with_name(v, "language");

                if (strcmp(l, X_WINDOWS_LANGUAGE) == 0) {

                    send_x_windows_output(get_array_element(v, (void*) &ONE_NUMBER), get_array_element(v, (void*) &TWO_NUMBER), p3);

                } else if (strcmp(l, TUI_LANGUAGE) == 0) {

                }
*/

                d = 1;
            }
        }
    }

    // Receive.
    if (d == 0) {

        if (param0s == RECEIVE_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &RECEIVE_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &RECEIVE_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {


                d = 1;
            }
        }
    }

    // Exit.
    if (d == 0) {

        if (param0s == EXIT_ABSTRACTION_SIZE) {

            compare_array_elements((void*) &param0, (void*) &EXIT_ABSTRACTION, (void*) &CHARACTER_ARRAY, (void*) &EXIT_ABSTRACTION_SIZE, (void*) &r);

            if (r == 1) {

                log_message((void*) &INFO_LOG_LEVEL, (void*) &"Set shutdown flag.");

                int* f = (int*) p4;
                *f = 1;

                d = 1;
            }
        }
    }

/*??
        //?? Only for later, when mouse interrupt is handled directly here, and not in JavaEventHandler.
        if (strcmp(l, "mouse_moved") == 0) {

            Model statics = statics;

            set_model_element(statics, "mouse.pointer_position.x_distance.quantity", new java.lang.Integer(((java.awt.event.MouseEvent) evt).getX()));
            set_model_element(statics, "mouse.pointer_position.x_distance.unit", "pixel");
            set_model_element(statics, "mouse.pointer_position.y_distance.quantity", new java.lang.Integer(((java.awt.event.MouseEvent) evt).getY()));
            set_model_element(statics, "mouse.pointer_position.y_distance.unit", "pixel");

        } else if (strcmp(l, "mouse_clicked") == 0) {

            void* main_frame = get_statics_model_part(statics, (void*) "main_frame");
            struct vector* pointer_position = get_statics_model_part(statics, (void*) "mouse.pointer_position");

            reset_signal(s);

            if (pointer_position != NULL_POINTER) {

//??            mouse_clicked_action(main_frame, (void*) pointer_position->x, (void*) pointer_position->y, (void*) pointer_position->z, s->predicate);

            } else {

                log_message((void*) &ERROR_LOG_LEVEL, (void*) &"Could not handle mouse clicked action. The pointer position is null.");
            }
        }
*/
}
/**
 * Gets the compound element index.
 *
 * @param p0 the compound
 * @param p1 the compound count
 * @param p2 the element name
 * @param p3 the element name count
 * @param p4 the index
 */
void get_compound_element_index(const void* p0, const void* p1, const void* p2, const void* p3, void* p4) {

    if (p4 != NULL_POINTER) {

        int* i = (int*) p4;

        if (p1 != NULL_POINTER) {

            int* cc = (int*) p1;

//??            log_message((void*) &INFO_LOG_LEVEL, (void*) &GET_COMPOUND_INDEX_MESSAGE, (void*) &GET_COMPOUND_INDEX_MESSAGE_COUNT);

            // The element names.
            void* n = NULL_POINTER;
            void* nc = NULL_POINTER;

            // Get element names.
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_INDEX, (void*) &n);
            get_array_element(p0, (void*) &POINTER_ARRAY, (void*) &NAMES_COUNTS_INDEX, (void*) &nc);

            // The loop variable.
            int j = 0;
            // The name.
            void* n1 = NULL_POINTER;
            // The name count.
            int nc1 = 0;
            // The comparison result.
            int r = 0;

            while (1) {

                if (j >= *cc) {

                    break;
                }

                // Get element name.
                get_array_element((void*) &n, (void*) &POINTER_ARRAY, (void*) &j, (void*) &n1);
                get_array_element((void*) &nc, (void*) &POINTER_ARRAY, (void*) &j, (void*) &nc1);

                compare_arrays(p2, p3, (void*) &n1, (void*) &nc1, (void*) &r, (void*) &CHARACTER_ARRAY);

                if (r == 1) {

                    *i = j;

                    break;
                }

                // Reset name and name count.
                n1 = NULL_POINTER;
                nc1 = 0;

                j++;
            }

        } else {

//??            log_message((void*) &ERROR_LOG_LEVEL, (void*) &COULD_NOT_GET_COMPOUND_INDEX_THE_COMPOUND_COUNT_IS_NULL_MESSAGE, (void*) &COULD_NOT_GET_COMPOUND_INDEX_THE_COMPOUND_COUNT_IS_NULL_MESSAGE_COUNT);
        }

    } else {

//??        log_message((void*) &ERROR_LOG_LEVEL, (void*) &COULD_NOT_GET_COMPOUND_INDEX_THE_NAME_COUNT_IS_NULL_MESSAGE, (void*) &COULD_NOT_GET_COMPOUND_INDEX_THE_NAME_COUNT_IS_NULL_MESSAGE_COUNT);
    }
}
Beispiel #22
0
/*
BEGIN {
	n = split("one two three four five six", test_array2)
	ret = test_array_elem(test_array2, "3")
	printf("test_array_elem() returned %d, test_array2[3] = %g\n", ret, test_array2[3])
	if ("5" in test_array2)
		printf("error: test_array_elem() did not remove element \"5\"\n")
	else
		printf("test_array_elem() did remove element \"5\"\n")
	if ("7" in test_array2)
		printf("test_array_elem() added element \"7\" --> %s\n", test_array2[7])
	else
		printf("test_array_elem() did not add element \"7\"\n")
	if ("subarray" in test_array2) {
		if (isarray(test_array2["subarray"])) {
			for (i in test_array2["subarray"])
				printf("test_array2[\"subarray\"][\"%s\"] = %s\n",
					i, test_array2["subarray"][i])
		} else
			printf("test_array_elem() added element \"subarray\" as scalar\n")
	} else
		printf("test_array_elem() did not add element \"subarray\"\n")
	print ""
}
*/
static awk_value_t *
test_array_elem(int nargs, awk_value_t *result)
{
	awk_value_t array, index, index2, value;

	make_number(0.0, result);	/* default return until full success */

	assert(result != NULL);

	if (nargs != 2) {
		printf("test_array_elem: nargs not right (%d should be 2)\n", nargs);
		goto out;
	}

	/* look up an array element and print the value */
	if (! get_argument(0, AWK_ARRAY, & array)) {
		printf("test_array_elem: get_argument 0 (array) failed\n");
		goto out;
	}
	if (! get_argument(1, AWK_STRING, & index)) {
		printf("test_array_elem: get_argument 1 (index) failed\n");
		goto out;
	}
	(void) make_const_string(index.str_value.str, index.str_value.len, & index2);
	if (! get_array_element(array.array_cookie, & index2, AWK_UNDEFINED, & value)) {
		printf("test_array_elem: get_array_element failed\n");
		goto out;
	}
	printf("test_array_elem: a[\"%.*s\"] = %s\n",
			(int) index.str_value.len,
			index.str_value.str,
			valrep2str(& value));

	/* change the element - "3" */
	(void) make_number(42.0, & value);
	(void) make_const_string(index.str_value.str, index.str_value.len, & index2);
	if (! set_array_element(array.array_cookie, & index2, & value)) {
		printf("test_array_elem: set_array_element failed\n");
		goto out;
	}

	/* delete another element - "5" */
	(void) make_const_string("5", 1, & index);
	if (! del_array_element(array.array_cookie, & index)) {
		printf("test_array_elem: del_array_element failed\n");
		goto out;
	}

	/* add a new element - "7" */
	(void) make_const_string("7", 1, & index);
	(void) make_const_string("seven", 5, & value);
	if (! set_array_element(array.array_cookie, & index, & value)) {
		printf("test_array_elem: set_array_element failed\n");
		goto out;
	}

	/* add a subarray */
	(void) make_const_string("subarray", 8, & index);
	fill_in_array(& value);
	if (! set_array_element(array.array_cookie, & index, & value)) {
		printf("test_array_elem: set_array_element (subarray) failed\n");
		goto out;
	}

	/* change and deletion should be reflected in awk script */
	make_number(1.0, result);
out:
	return result;
}