/** * Tests the accessor array setter. */ void test_accessor_array_setter() { void* d = *NULL_POINTER_MEMORY_MODEL; int ds = *NUMBER_100_INTEGER_MEMORY_MODEL; wchar_t* s1 = L"Huhu scheene Welt, lass' mal sehen!"; int s1c = *NUMBER_35_INTEGER_MEMORY_MODEL; int i1 = *NUMBER_0_INTEGER_MEMORY_MODEL; wchar_t* s2 = L"Erde"; int s2c = *NUMBER_4_INTEGER_MEMORY_MODEL; int i2 = *NUMBER_13_INTEGER_MEMORY_MODEL; // Allocate destination array. allocate_array((void*) &d, (void*) &ds, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); fwprintf(stdout, L"d string: %ls\n", (wchar_t*) d); fwprintf(stdout, L"s1: %ls\n", s1); fwprintf(stdout, L"s1c: %i\n", s1c); fwprintf(stdout, L"i1: %i\n", i1); replace_array(d, (void*) s1, (void*) &s1c, (void*) &i1, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); fwprintf(stdout, L"d string 2: %ls\n", (wchar_t*) d); fwprintf(stdout, L"s2: %ls\n", s2); fwprintf(stdout, L"s2c: %i\n", s2c); fwprintf(stdout, L"i2: %i\n", i2); replace_array(d, (void*) s2, (void*) &s2c, (void*) &i2, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); fwprintf(stdout, L"d string 3: %ls\n", (wchar_t*) d); // Deallocate destination array. deallocate_array((void*) &d, (void*) &ds, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); }
/** * Allocates the model. * * @param p0 the model (Hand over as reference!) * @param p1 the model count (Hand over as reference!) * @param p2 the model size (Hand over as reference!) * @param p3 the size * @param p4 the abstraction * @param p5 the abstraction count */ void allocate_model(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5) { if (p2 != *NULL_POINTER_MEMORY_MODEL) { void** s = (void**) p2; if (p1 != *NULL_POINTER_MEMORY_MODEL) { void** c = (void**) p1; log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Allocate model."); allocate(p0, p3, p4, p5); allocate(p1, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) INTEGER_MEMORY_ABSTRACTION, (void*) INTEGER_MEMORY_ABSTRACTION_COUNT); allocate(p2, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) INTEGER_MEMORY_ABSTRACTION, (void*) INTEGER_MEMORY_ABSTRACTION_COUNT); // The count is set to zero, since the model does not contain any elements yet. replace_array(*c, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) INTEGER_PRIMITIVE_MEMORY_ABSTRACTION); // The size is set to the value that was handed over as argument. replace_array(*s, p3, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) INTEGER_PRIMITIVE_MEMORY_ABSTRACTION); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not allocate model. The destination model count is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not allocate model. The destination model size is null."); } }
void iregisterdllfun(void) { int i, index; ResType argtypes[MAX_ARGS]; /* list of types of arguments */ bool vararg[MAX_ARGS]; /* is the argument a variable arg */ bool ispointer[MAX_ARGS]; /* is the argument a pointer */ int varargcount = 0; /* number of variable args */ int ispointercount = 0; /* number of pointer args */ nialptr z = apop(); char *nialname; /* names used by calldllfun */ char *dllname; /* the real name of the function */ /* in the DLL file */ char *library; /* name of the DLL file */ ResType resulttype; /* the type of the result */ nialptr nargtypes; /* the arg type array */ int argcount; int j; int sz; nialptr current; /* usually hold the current entry in the dlllist */ int is_register; /* if we have 5 args we are registering a function */ if ((tally(z) == 5) && (kind(z) == atype)) is_register = 1; /* register mode */ else /* only one arg and it is a char or a phrase, we are deleting the fun */ if ((kind(z) == chartype) || (kind(z) == phrasetype)) is_register = 0; /* delete mode */ else { /* error mode */ apush(makefault("?Incorrect number of arguments to registerdllfun")); freeup(z); return; } if (is_register) { /* The Nial level name for the DLL function */ STRING_CHECK(z, 0) nialname = STRING_GET(z, 0); /* The internal DLL name for the function */ STRING_CHECK(z, 1) dllname = STRING_GET(z, 1); /* The name of the library file */ STRING_CHECK(z, 2) library = STRING_GET(z, 2); /* The name of the result type */ STRING_CHECK(z, 3) resulttype = StringToTypeID(STRING_GET(z, 3)); /* did we find an unrecognized result type? */ if (resulttype < 0) { apush(makefault("?Return type not recognized")); freeup(z); return; } if (kind(fetch_array(z, 4)) != atype) { apush(makefault("?Argument must be a list of strings or phrases")); freeup(z); return; } nargtypes = fetch_array(z, 4); argcount = tally(nargtypes); /* Check each of the argument type */ for (j = 0; j < argcount; j++) STRING_CHECK_FREEUP(nargtypes, j, z) /* create an integer list of argument types from the phrase/string list */ for (i = 0; i < argcount; i++) { char *tmp; tmp = pfirstchar(fetch_array(nargtypes, i)); /* safe: no allocation */ argtypes[i] = StringToTypeID(tmp); /* the ith argument name was not recognized */ if (argtypes[i] < 0) { char stmp[256]; wsprintf(stmp, "?Type \"%s\" for argument %d not recognized", tmp, i + 1); apush(makefault(stmp)); freeup(z); return; } /* set the vararg and ispointer flags for this arg */ vararg[i] = IsVarArg(tmp); ispointer[i] = IsPointer(tmp); /* keep count of these special args */ if (vararg[i]) varargcount++; if (ispointer[i]) ispointercount++; } /* NEW workspace Version */ /* If the list does not yet exist, then create a one element list here */ if (tally(dlllist) == 0) { nialptr tmp = create_new_dll_entry; /* build a empty entry */ setup_dll_entry(tmp) /* fill it with empty data */ apush(tmp); isolitary(); /* make it a list */ decrrefcnt(dlllist); freeup(dlllist); dlllist = apop(); incrrefcnt(dlllist); index = 0; } else { int pos; /* does the requested name already exist in out list? */ if ((pos = inlist(nialname)) >= 0) { /* yes it's here already, so note its position, and free the old * entry */ index = pos; freeEntry(index); } else { /* if we got here, then we need to create a new entry and add it to * and existing dlllist */ nialptr tmp = create_new_dll_entry; setup_dll_entry(tmp) decrrefcnt(dlllist); append(dlllist, tmp); dlllist = apop(); incrrefcnt(dlllist); index = tally(dlllist) - 1; /* this is the location of the new entry */ } } /* grab the entry to work on */ current = fetch_array(dlllist, index); /* fill in data */ set_handle(current, NULL); set_nialname(current, nialname); set_dllname(current, dllname); set_callingconvention(current, (dllname[0] == '_' ? C_CALL : PASCAL_CALL)); set_library(current, library); set_isloaded(current, false); set_resulttype(current, resulttype); set_argcount(current, argcount); set_varargcount(current, varargcount); set_ispointercount(current, ispointercount); sz = argcount; replace_array(current, 10, (sz == 0 ? Null : new_create_array(inttype, 1, 0, &sz))); for (j = 0; j < sz; j++) set_argtypes(current, j, argtypes[j]); replace_array(current, 11, (sz == 0 ? Null : new_create_array(booltype, 1, 0, &sz))); for (j = 0; j < sz; j++) set_ispointer(current, j, ispointer[j]); replace_array(current, 14, (sz == 0 ? Null : new_create_array(booltype, 1, 0, &sz))); for (j = 0; j < sz; j++) set_vararg(current, j, vararg[j]); } else { /* delete entry code */
/** * Optionalises the log file option. * * @param p0 the log file (Hand over as reference!) * @param p1 the log file name * @param p2 the log file name count */ void optionalise_log_file(void* p0, void* p1, void* p2) { if (p2 != *NULL_POINTER_MEMORY_MODEL) { int* nc = (int*) p2; if (p0 != *NULL_POINTER_MEMORY_MODEL) { FILE** f = (FILE**) p0; // CAUTION! DO NOT use logging functionality here! // The logger will not work before its options are set. // Comment out this function call to avoid disturbing messages at system startup! // log_write_terminated_message((void*) stdout, L"Debug: Optionalise log file.\n"); // The terminated file name as character array. void* t = *NULL_POINTER_MEMORY_MODEL; void* tc = *NULL_POINTER_MEMORY_MODEL; void* ts = *NULL_POINTER_MEMORY_MODEL; // // CAUTION! Do NOT use a wide character array here! // // The glibc file stream functions expect standard (multibyte) character arrays. // // Allocate terminated file name as multibyte character array. allocate_model((void*) &t, (void*) &tc, (void*) &ts, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); // Encode wide character option into multibyte character array. encode_utf_8_unicode_character_vector((void*) &t, tc, ts, p1, p2); if (*((int*) ts) <= *((int*) tc)) { // Increase character array size to have place for the termination character. ts = tc + *NUMBER_1_INTEGER_MEMORY_MODEL; // Reallocate terminated file name as multibyte character array. reallocate_array((void*) &t, tc, ts, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); } // Add null termination character to terminated file name. replace_array(t, (void*) NULL_CONTROL_ASCII_CHARACTER_CODE_MODEL, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, tc, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); // Increase terminated file name count. (*((int*) tc))++; // Open log file for writing only. // If the file already exists, it is truncated to zero length. // Otherwise a new file is created. // // FILE objects are allocated and managed internally by the input/ output // library functions. The library creates objects of type FILE. // Programs should deal only with pointers to these objects (FILE* values), // rather than the objects themselves. *f = fopen((char*) t, "w"); if (*f != *NULL_POINTER_MEMORY_MODEL) { // The file owner. int o = *NUMBER_MINUS_1_INTEGER_MEMORY_MODEL; // The file group. int g = *NUMBER_MINUS_1_INTEGER_MEMORY_MODEL; // Set file owner. chown((char*) t, o, g); // The file access rights. //?? TODO: When trying to cross-compile cyboi for windows, //?? the two S_IRGRP and S_IWGRP were not recognised by mingw. int r = S_IRUSR | S_IWUSR; //?? | S_IRGRP | S_IWGRP; // Set file access rights. chmod((char*) t, r); } else { // CAUTION! DO NOT use logging functionality here! // The logger will not work before its options are set. log_write_terminated_message((void*) stdout, L"Error: Could not optionalise log file. An error occured when trying to open or create the file for writing.\n"); } // Deallocate terminated file name as multibyte character array. deallocate_model((void*) &t, (void*) &tc, (void*) &ts, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); } else { // CAUTION! DO NOT use logging functionality here! // The logger will not work before its options are set. log_write_terminated_message((void*) stdout, L"Error: Could not optionalise log file. The file descriptor is null.\n"); } } else { // CAUTION! DO NOT use logging functionality here! // The logger will not work before its options are set. log_write_terminated_message((void*) stdout, L"Error: Could not optionalise log file. The file name count is null.\n"); } }
/** * Starts up the internal memory. * * CAUTION! The internal memory items have a fixed position, * determined by constants. The items HAVE TO be assigned an * initial value, since all source code relies on them. * * Most values are compared against the *NULL_POINTER_MEMORY_MODEL constant * to find out whether they are set or not. If now initial values * would be arbitrary pointers, the program would follow a wrong path, * because it would guess that an instance was properly allocated, * while in reality the value was just an arbitrary initial one. * Therefore, such values are initialised with the well-defined *NULL_POINTER_MEMORY_MODEL. * * CAUTION! ONLY ONE parameter can be handed over to threads! * For example, the tcp socket is running in an own thread. * In cyboi, this one parameter is the internal memory. * Therefore, the knowledge memory and signal memory NEED TO BE ADDED * to the internal memory, in order to be forwardable to threads. * * @param p0 the internal memory * @param p1 the knowledge memory (Hand over as reference!) * @param p2 the knowledge memory count (Hand over as reference!) * @param p3 the knowledge memory size (Hand over as reference!) * @param p4 the signal memory (Hand over as reference!) * @param p5 the signal memory count (Hand over as reference!) * @param p6 the signal memory size (Hand over as reference!) * @param p7 the signal memory interrupt request flag (Hand over as reference!) * @param p8 the signal memory mutex (Hand over as reference!) * @param p9 the signal memory sleep time (Hand over as reference!) * @param p10 the gnu/linux console interrupt request flag (Hand over as reference!) * @param p11 the gnu/linux console mutex (Hand over as reference!) * @param p12 the gnu/linux console sleep time (Hand over as reference!) * @param p13 the x window system interrupt request flag (Hand over as reference!) * @param p14 the x window system mutex (Hand over as reference!) * @param p15 the x window system sleep time (Hand over as reference!) * @param p16 the www service interrupt request flag (Hand over as reference!) * @param p17 the www service mutex (Hand over as reference!) * @param p18 the www service sleep time (Hand over as reference!) * @param p19 the cyboi service interrupt request flag (Hand over as reference!) * @param p20 the cyboi service mutex (Hand over as reference!) * @param p21 the cyboi service sleep time (Hand over as reference!) */ void startup_internal_memory(void* p0, void* p1, 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, void* p15, void* p16, void* p17, void* p18, void* p19, void* p20, void* p21) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"\n\n"); log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Startup internal memory."); // // Initialise all values with null. // // The loop variable. int j = *NUMBER_0_INTEGER_MEMORY_MODEL; while (*NUMBER_1_INTEGER_MEMORY_MODEL) { if (j >= *INTERNAL_MEMORY_MEMORY_MODEL_COUNT) { break; } // Set null pointer at index. // // CAUTION! The standard "set" procedure could have been used here as well. // However, to speed up the program, the "set_array_elements" // procedure was used directly, as it does not do so many comparisons // (like for example with "POINTER_PRIMITIVE_MEMORY_ABSTRACTION", to find the right procedure). replace_array(p0, (void*) NULL_POINTER_MEMORY_MODEL, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &j, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); j++; } // // Set special values. // // The internal memory index. int i = *NUMBER_MINUS_1_INTEGER_MEMORY_MODEL; // Set knowledge memory internals. replace_array(p0, p1, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) KNOWLEDGE_MEMORY_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p0, p2, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) KNOWLEDGE_MEMORY_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p0, p3, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) KNOWLEDGE_MEMORY_SIZE_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set signal memory internals. replace_array(p0, p4, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) SIGNAL_MEMORY_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p0, p5, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) SIGNAL_MEMORY_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p0, p6, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) SIGNAL_MEMORY_SIZE_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set signal memory interrupt request flag. replace_array(p0, p7, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) SIGNAL_MEMORY_INTERRUPT_REQUEST_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set signal memory mutex. replace_array(p0, p8, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) SIGNAL_MEMORY_MUTEX_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set signal memory sleep time. replace_array(p0, p9, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) SIGNAL_MEMORY_SLEEP_TIME_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set gnu/linux console interrupt request flag. replace_array(p0, p10, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_INTERRUPT_REQUEST_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set gnu/linux console mutex. replace_array(p0, p11, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_MUTEX_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set gnu/linux console sleep time. replace_array(p0, p12, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_SLEEP_TIME_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set x window system interrupt request flag. replace_array(p0, p13, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_INTERRUPT_REQUEST_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set x window system mutex. replace_array(p0, p14, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_MUTEX_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set x window system sleep time. replace_array(p0, p15, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_SLEEP_TIME_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set www service interrupt request flag. i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_INTERRUPT_REQUEST_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p0, p16, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set www service mutex. i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_MUTEX_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p0, p17, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set www service sleep time. i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_SLEEP_TIME_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p0, p18, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set cyboi service interrupt request flag. i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_INTERRUPT_REQUEST_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p0, p19, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set cyboi service mutex. i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_MUTEX_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p0, p20, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set cyboi service sleep time. i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_SLEEP_TIME_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p0, p21, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); }
/** * Appends the compound element by name with suffix. * * The name suffix starts with "_$", e.g.: * part_$0 * part_$1 * channel_$2 * abstraction_$0 * * @param p0 the compound model * @param p1 the compound model count * @param p2 the compound model size * @param p3 the name (Hand over as reference!) * @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 append_compound_element_by_name_with_suffix(void* p0, void* p1, 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) { if (p5 != *NULL_POINTER_MEMORY_MODEL) { int* ns = (int*) p5; if (p4 != *NULL_POINTER_MEMORY_MODEL) { int* nc = (int*) p4; if (p3 != *NULL_POINTER_MEMORY_MODEL) { void** n = (void**) p3; log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Append compound element by name with suffix."); // The name suffix. void* s = *NULL_POINTER_MEMORY_MODEL; void* sc = *NULL_POINTER_MEMORY_MODEL; void* ss = *NULL_POINTER_MEMORY_MODEL; //?? fwprintf(stdout, L"TEST append compound element 0 p1 dc: %i\n", *((int*) p1)); // Allocate name suffix as wide character array. allocate_model((void*) &s, (void*) &sc, (void*) &ss, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); //?? fwprintf(stdout, L"TEST append compound element 1 ss: %i\n", *((int*) ss)); //?? fwprintf(stdout, L"TEST append compound element 1 sc: %i\n", *((int*) sc)); //?? fwprintf(stdout, L"TEST append compound element 1 s: %ls\n", (wchar_t*) s); // Use compound count as index to create the element name suffix, // because the element is appended at the end of the compound container. // The suffix integer is encoded into a wide character array. encode((void*) &s, sc, ss, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, p1, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, (void*) INTEGER_MEMORY_ABSTRACTION, (void*) INTEGER_MEMORY_ABSTRACTION_COUNT); //?? fwprintf(stdout, L"TEST append compound element 2 ss: %i\n", *((int*) ss)); //?? fwprintf(stdout, L"TEST append compound element 2 sc: %i\n", *((int*) sc)); //?? fwprintf(stdout, L"TEST append compound element 2 s: %ls\n", (wchar_t*) s); // Resize name. if ((*nc + *LIST_SEPARATOR_CYBOL_NAME_COUNT + *((int*) sc)) >= *ns) { // The new name character vector size. // CAUTION! Append constant in case *nc is zero! *ns = (*nc * *ARRAY_REALLOCATION_FACTOR) + *LIST_SEPARATOR_CYBOL_NAME_COUNT + *((int*) sc); //?? fwprintf(stdout, L"TEST append compound element 2 ns pre: %i\n", *ns); // Reallocate name character vector. reallocate_array(p3, p4, p5, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); //?? fwprintf(stdout, L"TEST append compound element 2 ns post: %i\n", *ns); } //?? fwprintf(stdout, L"TEST append compound element 3 ss: %i\n", *((int*) ss)); //?? fwprintf(stdout, L"TEST append compound element 3 sc: %i\n", *((int*) sc)); //?? fwprintf(stdout, L"TEST append compound element 3 s: %ls\n", (wchar_t*) s); // The element name already contains the element base name. // Append list element separator characters "_$" to element name. // Use name count as index to append the new characters. replace_array(*n, (void*) LIST_SEPARATOR_CYBOL_NAME, (void*) LIST_SEPARATOR_CYBOL_NAME_COUNT, p4, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); *nc = *nc + *LIST_SEPARATOR_CYBOL_NAME_COUNT; //?? fwprintf(stdout, L"TEST append compound element 4 ns: %i\n", *ns); //?? fwprintf(stdout, L"TEST append compound element 4 nc: %i\n", *nc); //?? fwprintf(stdout, L"TEST append compound element 4 n: %ls\n", (wchar_t*) *n); // Set new element name by appending the index determined above. // Use name count as index to append the new characters. replace_array(*n, s, sc, p4, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); *nc = *nc + *((int*) sc); //?? fwprintf(stdout, L"TEST append compound element 5 ns: %i\n", *ns); //?? fwprintf(stdout, L"TEST append compound element 5 nc: %i\n", *nc); //?? fwprintf(stdout, L"TEST append compound element 5 n: %ls\n", (wchar_t*) *n); // Deallocate name suffix as wide character array. deallocate_model((void*) &s, (void*) &sc, (void*) &ss, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); //?? fwprintf(stdout, L"TEST append compound element 6 ns: %i\n", *ns); //?? fwprintf(stdout, L"TEST append compound element 6 nc: %i\n", *nc); //?? fwprintf(stdout, L"TEST append compound element 6 n: %ls\n", (wchar_t*) *n); //?? fwprintf(stdout, L"TEST append compound element 7 p2: %i\n", p2); //?? fwprintf(stdout, L"TEST append compound element 7 *p2: %i\n", *((int*) p2)); //?? fwprintf(stdout, L"TEST append compound element 7 p1: %i\n", p1); //?? fwprintf(stdout, L"TEST append compound element 7 *p1: %i\n", *((int*) p1)); //?? fwprintf(stdout, L"TEST append compound element 7 p0: %i\n", p0); append_compound_element_by_name(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); //?? fwprintf(stdout, L"TEST append compound element 8 p2: %i\n", *((int*) p2)); //?? fwprintf(stdout, L"TEST append compound element 8 p1: %i\n", *((int*) p1)); //?? fwprintf(stdout, L"TEST append compound element 8 p0: %i\n", p0); //?? fwprintf(stdout, L"TEST append compound element 9 ns: %i\n", *ns); //?? fwprintf(stdout, L"TEST append compound element 9 nc: %i\n", *nc); //?? fwprintf(stdout, L"TEST append compound element 9 n: %ls\n", (wchar_t*) *n); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not append compound element by name with suffix. The name is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not append compound element by name with suffix. The name count is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not append compound element by name with suffix. The name size is null."); } }
/** * Builds a list name. * * Expected parameters: * - ?? (required): ?? (description) * * @param p0 the parameters * @param p1 the parameters count * @param p2 the knowledge memory * @param p3 the knowledge memory count * @param p4 the knowledge memory size */ void memorise_building(void* p0, void* p1, void* p2, void* p3, void* p4) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Build list name."); // The basisname name, abstraction, model, details. void** bnn = NULL_POINTER_MEMORY_MODEL; void** bnnc = NULL_POINTER_MEMORY_MODEL; void** bnns = NULL_POINTER_MEMORY_MODEL; void** bna = NULL_POINTER_MEMORY_MODEL; void** bnac = NULL_POINTER_MEMORY_MODEL; void** bnas = NULL_POINTER_MEMORY_MODEL; void** bnm = NULL_POINTER_MEMORY_MODEL; void** bnmc = NULL_POINTER_MEMORY_MODEL; void** bnms = NULL_POINTER_MEMORY_MODEL; void** bnd = NULL_POINTER_MEMORY_MODEL; void** bndc = NULL_POINTER_MEMORY_MODEL; void** bnds = NULL_POINTER_MEMORY_MODEL; // The index name, abstraction, model, details. void** idxn = NULL_POINTER_MEMORY_MODEL; void** idxnc = NULL_POINTER_MEMORY_MODEL; void** idxns = NULL_POINTER_MEMORY_MODEL; void** idxa = NULL_POINTER_MEMORY_MODEL; void** idxac = NULL_POINTER_MEMORY_MODEL; void** idxas = NULL_POINTER_MEMORY_MODEL; void** idxm = NULL_POINTER_MEMORY_MODEL; void** idxmc = NULL_POINTER_MEMORY_MODEL; void** idxms = NULL_POINTER_MEMORY_MODEL; void** idxd = NULL_POINTER_MEMORY_MODEL; void** idxdc = NULL_POINTER_MEMORY_MODEL; void** idxds = NULL_POINTER_MEMORY_MODEL; // The result name, abstraction, model, details. void** resn = NULL_POINTER_MEMORY_MODEL; void** resnc = NULL_POINTER_MEMORY_MODEL; void** resns = NULL_POINTER_MEMORY_MODEL; void** resa = NULL_POINTER_MEMORY_MODEL; void** resac = NULL_POINTER_MEMORY_MODEL; void** resas = NULL_POINTER_MEMORY_MODEL; void** resm = NULL_POINTER_MEMORY_MODEL; void** resmc = NULL_POINTER_MEMORY_MODEL; void** resms = NULL_POINTER_MEMORY_MODEL; void** resd = NULL_POINTER_MEMORY_MODEL; void** resdc = NULL_POINTER_MEMORY_MODEL; void** resds = NULL_POINTER_MEMORY_MODEL; // get the basisname get_universal_compound_element_by_name( (void*) &bnn, (void*) &bnnc, (void*) &bnns, (void*) &bna, (void*) &bnac, (void*) &bnas, (void*) &bnm, (void*) &bnmc, (void*) &bnms, (void*) &bnd, (void*) &bndc, (void*) &bnds, p0, p1, (void*) BASE_BUILD_FLOW_OPERATION_CYBOL_NAME, (void*) BASE_BUILD_FLOW_OPERATION_CYBOL_NAME_COUNT, p2, p3); // get the index get_universal_compound_element_by_name( (void*) &idxn, (void*) &idxnc, (void*) &idxns, (void*) &idxa, (void*) &idxac, (void*) &idxas, (void*) &idxm, (void*) &idxmc, (void*) &idxms, (void*) &idxd, (void*) &idxdc, (void*) &idxds, p0, p1, (void*) INDEX_BUILD_FLOW_OPERATION_CYBOL_NAME, (void*) INDEX_BUILD_FLOW_OPERATION_CYBOL_NAME_COUNT, p2, p3); // get the result get_universal_compound_element_by_name( (void*) &resn, (void*) &resnc, (void*) &resns, (void*) &resa, (void*) &resac, (void*) &resas, (void*) &resm, (void*) &resmc, (void*) &resms, (void*) &resd, (void*) &resdc, (void*) &resds, p0, p1, (void*) COMPOSITION_BUILD_FLOW_OPERATION_CYBOL_NAME, (void*) COMPOSITION_BUILD_FLOW_OPERATION_CYBOL_NAME_COUNT, p2, p3); //check the abstraction for the operation element int comp_res1 = *NUMBER_0_INTEGER_MEMORY_MODEL; int comp_res2 = *NUMBER_0_INTEGER_MEMORY_MODEL; int comp_res3 = *NUMBER_0_INTEGER_MEMORY_MODEL; // Create compare string. wchar_t* int_string = *NULL_POINTER_MEMORY_MODEL; // todo Konstante noch definieren int int_string_count = *NUMBER_0_INTEGER_MEMORY_MODEL; int int_string_size = *NUMBER_10_INTEGER_MEMORY_MODEL; allocate_array((void*) &int_string, (void*) &int_string_size, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); int_string_count = swprintf(int_string, int_string_size, L"%i", *((int*) *idxm)); // destination size *(int*)*resms = *((int*) *bnmc) + *LIST_SEPARATOR_CYBOL_NAME_COUNT + int_string_count; *(int*)*resmc = *((int*) *bnmc) + *LIST_SEPARATOR_CYBOL_NAME_COUNT + int_string_count; // Reallocate result array. reallocate_array(resm, *resms, *resms, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); // Set result array. replace_array(*resm, *bnm, *bnmc, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(*resm, LIST_SEPARATOR_CYBOL_NAME, LIST_SEPARATOR_CYBOL_NAME_COUNT, *bnmc, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); int temp_index = *((int*) *bnmc) + *LIST_SEPARATOR_CYBOL_NAME_COUNT; replace_array(*resm, int_string, &int_string_count, &temp_index, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); // Destroy int_string array. deallocate_array((void*) &int_string, (void*) &int_string_size, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); }
/** * Senses an interrupt request happening on the given device channel. * * In order to sense interrupt requests of various devices, special mechanisms * for interrupt detection have to be started. To these mechanisms belong: * - gnu/linux console * - x window system * - socket * * All of them have their own internal signal/ action/ event/ interrupt waiting loops * which get activated here, running as parallel services in separate threads. * Whenever an event occurs in one of these threads, it gets transformed into a * cyboi-internal interrupt request by setting the corresponding flag. * The cyboi signal checker loop then senses the interrupt and receives the * corresponding message via the channel the interrupt belongs to. * * Expected parameters: * - channel (required): the channel via which to receive the message (gnu_linux_console, www, x_window_system etc.) * - handler (optional): the handler (usually a receive operation) that parses an input and filters out a command that the system is to react to * - language (required): the language (abstraction, type, structure) of the data received (http_request, xdt, boolean, character etc.) * - message (required): the source (knowledge template) from where to receive data * - meta message (optional): the source (knowledge template) from where to receive meta data (details) * - model (required): the compound model to be filled with the data received * - details (required): the compound details to be filled with the data received * - root (required): the knowledge model that will serve as the root * - style (optional, only if channel is www, cyboi or similar): the style of socket communication * - commands (optional, only if a user interface thread is to react to certain commands): * the knowledge model containing the commands that the user interface should react to * - blocking (optional, only if channel is www, cyboi or similar): the flag indicating whether the receive process should be blocking * * @param p0 the parameters * @param p1 the parameters count * @param p2 the internal memory * @param p3 the knowledge memory * @param p4 the knowledge memory count * @param p5 the knowledge memory size * @param p6 the signal memory * @param p7 the signal memory count * @param p8 the signal memory size */ void communicate_sensing(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Sense interrupt request."); // The channel name, abstraction, model, details. void** cn = NULL_POINTER_MEMORY_MODEL; void** cnc = NULL_POINTER_MEMORY_MODEL; void** cns = NULL_POINTER_MEMORY_MODEL; void** ca = NULL_POINTER_MEMORY_MODEL; void** cac = NULL_POINTER_MEMORY_MODEL; void** cas = NULL_POINTER_MEMORY_MODEL; void** cm = NULL_POINTER_MEMORY_MODEL; void** cmc = NULL_POINTER_MEMORY_MODEL; void** cms = NULL_POINTER_MEMORY_MODEL; void** cd = NULL_POINTER_MEMORY_MODEL; void** cdc = NULL_POINTER_MEMORY_MODEL; void** cds = NULL_POINTER_MEMORY_MODEL; // The handler name, abstraction, model, details. void** hn = NULL_POINTER_MEMORY_MODEL; void** hnc = NULL_POINTER_MEMORY_MODEL; void** hns = NULL_POINTER_MEMORY_MODEL; void** ha = NULL_POINTER_MEMORY_MODEL; void** hac = NULL_POINTER_MEMORY_MODEL; void** has = NULL_POINTER_MEMORY_MODEL; void** hm = NULL_POINTER_MEMORY_MODEL; void** hmc = NULL_POINTER_MEMORY_MODEL; void** hms = NULL_POINTER_MEMORY_MODEL; void** hd = NULL_POINTER_MEMORY_MODEL; void** hdc = NULL_POINTER_MEMORY_MODEL; void** hds = NULL_POINTER_MEMORY_MODEL; /*?? // The language name, abstraction, model, details. void** ln = NULL_POINTER_MEMORY_MODEL; void** lnc = NULL_POINTER_MEMORY_MODEL; void** lns = NULL_POINTER_MEMORY_MODEL; void** la = NULL_POINTER_MEMORY_MODEL; void** lac = NULL_POINTER_MEMORY_MODEL; void** las = NULL_POINTER_MEMORY_MODEL; void** lm = NULL_POINTER_MEMORY_MODEL; void** lmc = NULL_POINTER_MEMORY_MODEL; void** lms = NULL_POINTER_MEMORY_MODEL; void** ld = NULL_POINTER_MEMORY_MODEL; void** ldc = NULL_POINTER_MEMORY_MODEL; void** lds = NULL_POINTER_MEMORY_MODEL; // The message name, abstraction, model, details. void** mn = NULL_POINTER_MEMORY_MODEL; void** mnc = NULL_POINTER_MEMORY_MODEL; void** mns = NULL_POINTER_MEMORY_MODEL; void** ma = NULL_POINTER_MEMORY_MODEL; void** mac = NULL_POINTER_MEMORY_MODEL; void** mas = NULL_POINTER_MEMORY_MODEL; void** mm = NULL_POINTER_MEMORY_MODEL; void** mmc = NULL_POINTER_MEMORY_MODEL; void** mms = NULL_POINTER_MEMORY_MODEL; void** md = NULL_POINTER_MEMORY_MODEL; void** mdc = NULL_POINTER_MEMORY_MODEL; void** mds = NULL_POINTER_MEMORY_MODEL; // The meta message name, abstraction, model, details. void** men = NULL_POINTER_MEMORY_MODEL; void** menc = NULL_POINTER_MEMORY_MODEL; void** mens = NULL_POINTER_MEMORY_MODEL; void** mea = NULL_POINTER_MEMORY_MODEL; void** meac = NULL_POINTER_MEMORY_MODEL; void** meas = NULL_POINTER_MEMORY_MODEL; void** mem = NULL_POINTER_MEMORY_MODEL; void** memc = NULL_POINTER_MEMORY_MODEL; void** mems = NULL_POINTER_MEMORY_MODEL; void** med = NULL_POINTER_MEMORY_MODEL; void** medc = NULL_POINTER_MEMORY_MODEL; void** meds = NULL_POINTER_MEMORY_MODEL; // The model name, abstraction, model, details. void** mon = NULL_POINTER_MEMORY_MODEL; void** monc = NULL_POINTER_MEMORY_MODEL; void** mons = NULL_POINTER_MEMORY_MODEL; void** moa = NULL_POINTER_MEMORY_MODEL; void** moac = NULL_POINTER_MEMORY_MODEL; void** moas = NULL_POINTER_MEMORY_MODEL; void** mom = NULL_POINTER_MEMORY_MODEL; void** momc = NULL_POINTER_MEMORY_MODEL; void** moms = NULL_POINTER_MEMORY_MODEL; void** mod = NULL_POINTER_MEMORY_MODEL; void** modc = NULL_POINTER_MEMORY_MODEL; void** mods = NULL_POINTER_MEMORY_MODEL; // The root name, abstraction, model, details. void** rn = NULL_POINTER_MEMORY_MODEL; void** rnc = NULL_POINTER_MEMORY_MODEL; void** rns = NULL_POINTER_MEMORY_MODEL; void** ra = NULL_POINTER_MEMORY_MODEL; void** rac = NULL_POINTER_MEMORY_MODEL; void** ras = NULL_POINTER_MEMORY_MODEL; void** rm = NULL_POINTER_MEMORY_MODEL; void** rmc = NULL_POINTER_MEMORY_MODEL; void** rms = NULL_POINTER_MEMORY_MODEL; void** rd = NULL_POINTER_MEMORY_MODEL; void** rdc = NULL_POINTER_MEMORY_MODEL; void** rds = NULL_POINTER_MEMORY_MODEL; // The socket communication style name, abstraction, model, details. void** stn = NULL_POINTER_MEMORY_MODEL; void** stnc = NULL_POINTER_MEMORY_MODEL; void** stns = NULL_POINTER_MEMORY_MODEL; void** sta = NULL_POINTER_MEMORY_MODEL; void** stac = NULL_POINTER_MEMORY_MODEL; void** stas = NULL_POINTER_MEMORY_MODEL; void** stm = NULL_POINTER_MEMORY_MODEL; void** stmc = NULL_POINTER_MEMORY_MODEL; void** stms = NULL_POINTER_MEMORY_MODEL; void** std = NULL_POINTER_MEMORY_MODEL; void** stdc = NULL_POINTER_MEMORY_MODEL; void** stds = NULL_POINTER_MEMORY_MODEL; // The commands name, abstraction, model, details. void** con = NULL_POINTER_MEMORY_MODEL; void** conc = NULL_POINTER_MEMORY_MODEL; void** cons = NULL_POINTER_MEMORY_MODEL; void** coa = NULL_POINTER_MEMORY_MODEL; void** coac = NULL_POINTER_MEMORY_MODEL; void** coas = NULL_POINTER_MEMORY_MODEL; void** com = NULL_POINTER_MEMORY_MODEL; void** comc = NULL_POINTER_MEMORY_MODEL; void** coms = NULL_POINTER_MEMORY_MODEL; void** cod = NULL_POINTER_MEMORY_MODEL; void** codc = NULL_POINTER_MEMORY_MODEL; void** cods = NULL_POINTER_MEMORY_MODEL; // The blocking name, abstraction, model, details. void** bn = NULL_POINTER_MEMORY_MODEL; void** bnc = NULL_POINTER_MEMORY_MODEL; void** bns = NULL_POINTER_MEMORY_MODEL; void** ba = NULL_POINTER_MEMORY_MODEL; void** bac = NULL_POINTER_MEMORY_MODEL; void** bas = NULL_POINTER_MEMORY_MODEL; void** bm = NULL_POINTER_MEMORY_MODEL; void** bmc = NULL_POINTER_MEMORY_MODEL; void** bms = NULL_POINTER_MEMORY_MODEL; void** bd = NULL_POINTER_MEMORY_MODEL; void** bdc = NULL_POINTER_MEMORY_MODEL; void** bds = NULL_POINTER_MEMORY_MODEL; */ // Get channel. get_universal_compound_element_by_name( (void*) &cn, (void*) &cnc, (void*) &cns, (void*) &ca, (void*) &cac, (void*) &cas, (void*) &cm, (void*) &cmc, (void*) &cms, (void*) &cd, (void*) &cdc, (void*) &cds, p0, p1, (void*) CHANNEL_SENSE_COMMUNICATION_OPERATION_CYBOL_NAME, (void*) CHANNEL_SENSE_COMMUNICATION_OPERATION_CYBOL_NAME_COUNT, p3, p4); // Get handler. get_universal_compound_element_by_name( (void*) &hn, (void*) &hnc, (void*) &hns, (void*) &ha, (void*) &hac, (void*) &has, (void*) &hm, (void*) &hmc, (void*) &hms, (void*) &hd, (void*) &hdc, (void*) &hds, p0, p1, (void*) HANDLER_SENSE_COMMUNICATION_OPERATION_CYBOL_NAME, (void*) HANDLER_SENSE_COMMUNICATION_OPERATION_CYBOL_NAME_COUNT, p3, p4); /*?? // Get language. get_universal_compound_element_by_name( (void*) &ln, (void*) &lnc, (void*) &lns, (void*) &la, (void*) &lac, (void*) &las, (void*) &lm, (void*) &lmc, (void*) &lms, (void*) &ld, (void*) &ldc, (void*) &lds, p0, p1, (void*) RECEIVE_LANGUAGE_NAME, (void*) RECEIVE_LANGUAGE_NAME_COUNT, p3, p4); // Get message. get_universal_compound_element_by_name( (void*) &mn, (void*) &mnc, (void*) &mns, (void*) &ma, (void*) &mac, (void*) &mas, (void*) &mm, (void*) &mmc, (void*) &mms, (void*) &md, (void*) &mdc, (void*) &mds, p0, p1, (void*) RECEIVE_MESSAGE_NAME, (void*) RECEIVE_MESSAGE_NAME_COUNT, p3, p4); // Get meta message. get_universal_compound_element_by_name( (void*) &men, (void*) &menc, (void*) &mens, (void*) &mea, (void*) &meac, (void*) &meas, (void*) &mem, (void*) &memc, (void*) &mems, (void*) &med, (void*) &medc, (void*) &meds, p0, p1, (void*) RECEIVE_META_NAME, (void*) RECEIVE_META_NAME_COUNT, p3, p4); // Get model. get_universal_compound_element_by_name( (void*) &mon, (void*) &monc, (void*) &mons, (void*) &moa, (void*) &moac, (void*) &moas, (void*) &mom, (void*) &momc, (void*) &moms, (void*) &mod, (void*) &modc, (void*) &mods, p0, p1, (void*) RECEIVE_MODEL_NAME, (void*) RECEIVE_MODEL_NAME_COUNT, p3, p4); // Get root. get_universal_compound_element_by_name( (void*) &rn, (void*) &rnc, (void*) &rns, (void*) &ra, (void*) &rac, (void*) &ras, (void*) &rm, (void*) &rmc, (void*) &rms, (void*) &rd, (void*) &rdc, (void*) &rds, p0, p1, (void*) RECEIVE_ROOT_NAME, (void*) RECEIVE_ROOT_NAME_COUNT, p3, p4); // Get socket communication style. get_universal_compound_element_by_name( (void*) &stn, (void*) &stnc, (void*) &stns, (void*) &sta, (void*) &stac, (void*) &stas, (void*) &stm, (void*) &stmc, (void*) &stms, (void*) &std, (void*) &stdc, (void*) &stds, p0, p1, (void*) RECEIVE_STYLE_NAME, (void*) RECEIVE_STYLE_NAME_COUNT, p3, p4); // Get commands. get_universal_compound_element_by_name( (void*) &con, (void*) &conc, (void*) &cons, (void*) &coa, (void*) &coac, (void*) &coas, (void*) &com, (void*) &comc, (void*) &coms, (void*) &cod, (void*) &codc, (void*) &cods, p0, p1, (void*) RECEIVE_COMMANDS_NAME, (void*) RECEIVE_COMMANDS_NAME_COUNT, p3, p4); // Get blocking. get_universal_compound_element_by_name( (void*) &bn, (void*) &bnc, (void*) &bns, (void*) &ba, (void*) &bac, (void*) &bas, (void*) &bm, (void*) &bmc, (void*) &bms, (void*) &bd, (void*) &bdc, (void*) &bds, p0, p1, (void*) RECEIVE_BLOCKING_NAME, (void*) RECEIVE_BLOCKING_NAME_COUNT, p3, p4); */ // The comparison result. int r = *NUMBER_0_INTEGER_MEMORY_MODEL; // The internal memory index. int i = *NUMBER_0_INTEGER_MEMORY_MODEL; if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_equal_arrays((void*) &r, (void*) *cm, (void*) *cmc, (void*) GNU_LINUX_CONSOLE_CYBOL_CHANNEL, (void*) GNU_LINUX_CONSOLE_CYBOL_CHANNEL_COUNT, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { // Set handler abstraction, model, details. replace_array(p2, (void*) ha, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_HANDLER_ABSTRACTION_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hac, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_HANDLER_ABSTRACTION_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hm, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_HANDLER_MODEL_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hmc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_HANDLER_MODEL_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hd, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_HANDLER_DETAILS_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hdc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) GNU_LINUX_CONSOLE_HANDLER_DETAILS_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Sense incoming message. communicate_sensing_message(p2, (void*) GNU_LINUX_CONSOLE_THREAD, (void*) &communicate_sensing_gnu_linux_console); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_equal_arrays((void*) &r, (void*) *cm, (void*) *cmc, (void*) X_WINDOW_SYSTEM_CYBOL_CHANNEL, (void*) X_WINDOW_SYSTEM_CYBOL_CHANNEL_COUNT, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { // Set handler abstraction, model, details. replace_array(p2, (void*) ha, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_HANDLER_ABSTRACTION_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hac, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_HANDLER_ABSTRACTION_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hm, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_HANDLER_MODEL_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hmc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_HANDLER_MODEL_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hd, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_HANDLER_DETAILS_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); replace_array(p2, (void*) hdc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) X_WINDOW_SYSTEM_HANDLER_DETAILS_COUNT_INTERNAL_MEMORY_MEMORY_NAME, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Sense incoming message. communicate_sensing_message(p2, (void*) X_WINDOW_SYSTEM_THREAD, (void*) &communicate_sensing_x_window_system); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_equal_arrays((void*) &r, (void*) *cm, (void*) *cmc, (void*) WWW_CYBOL_CHANNEL, (void*) WWW_CYBOL_CHANNEL_COUNT, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { // Set handler abstraction, model, details. i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_ABSTRACTION_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) ha, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_ABSTRACTION_COUNT_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hac, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_MODEL_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hm, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_MODEL_COUNT_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hmc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_DETAILS_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hd, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *WWW_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_DETAILS_COUNT_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hdc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Sense incoming message (http request or response). communicate_sensing_message(p2, (void*) WWW_SERVICE_THREAD, (void*) &communicate_sensing_www_socket); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_equal_arrays((void*) &r, (void*) *cm, (void*) *cmc, (void*) CYBOI_CYBOL_CHANNEL, (void*) CYBOI_CYBOL_CHANNEL_COUNT, (void*) WIDE_CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { fwprintf(stdout, L"TEST sense cyboi service hac: %i\n", *hac); fwprintf(stdout, L"TEST sense cyboi service ha: %i\n", *ha); // Set handler abstraction, model, details. i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_ABSTRACTION_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) ha, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_ABSTRACTION_COUNT_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hac, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_MODEL_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hm, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_MODEL_COUNT_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hmc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_DETAILS_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hd, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); i = *CYBOI_BASE_INTERNAL_MEMORY_MEMORY_NAME + *SOCKET_HANDLER_DETAILS_COUNT_INTERNAL_MEMORY_MEMORY_NAME; replace_array(p2, (void*) hdc, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, (void*) &i, (void*) POINTER_PRIMITIVE_MEMORY_ABSTRACTION); // Sense incoming message (http request or response). communicate_sensing_message(p2, (void*) CYBOI_SERVICE_THREAD, (void*) &communicate_sensing_cyboi_socket); } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { log_terminated_message((void*) WARNING_LEVEL_LOG_MODEL, (void*) L"Could not sense interrupt request. The channel is unknown."); } }
/** * Copies a boolean. * * @param p0 the destination (Hand over as reference!) * @param p1 the destination count * @param p2 the destination size * @param p3 the source * @param p4 the source count */ void memorise_copying_boolean(void* p0, void* p1, void* p2, void* p3, void* p4) { if (p4 != *NULL_POINTER_MEMORY_MODEL) { int* sc = (int*) p4; if (p2 != *NULL_POINTER_MEMORY_MODEL) { int* ds = (int*) p2; if (p1 != *NULL_POINTER_MEMORY_MODEL) { int* dc = (int*) p1; if (p0 != *NULL_POINTER_MEMORY_MODEL) { void** d = (void**) p0; log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Copy boolean."); // CAUTION! The destination array needs to be resized not only // if the source array is greater, but also if it is smaller! // If this is not done, false results may occur. // Example: A colour gets copied from source to destination. // The source colour is "red" with a count of 3. // The destination colour is "green" with a count of 5. // If the source colour gets copied to the destination, // the resulting destination array is "reden" with a count of 5. // This colour value does not exist and will cause errors! // Therefore, the destination array count and size ALWAYS // have to be adapted to the source array count and size. // If this had been done in the example, the resulting // destination array would have been "red" with a count of 3, // which is correct. // CAUTION! Do NOT use < or > here, for the reasons explained above! if (*sc != *dc) { // Set destination count and size. *dc = *sc; *ds = *dc; reallocate_array(p0, p1, p2, (void*) INTEGER_PRIMITIVE_MEMORY_ABSTRACTION); } replace_array(*d, p3, p4, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) INTEGER_PRIMITIVE_MEMORY_ABSTRACTION); } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not copy boolean. The destination is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not copy boolean. The destination count is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not copy boolean. The destination size is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not copy boolean. The source count is null."); } }