void setup_program_sort() { nu_input_registers = 3; nu_output_registers = 3; nu_model_inputs = 64; max_instructions = 24; model_floating_point_mode = 0; only_integer_math = 1; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { for (int j = 0; j < nu_input_registers; j++) { model_input[i][j] = (random() & 0xFF) + 1; model_output[i][j] = model_input[i][j]; } if (model_output[i][0] > model_output[i][1]) { float temp = model_output[i][0]; model_output[i][0] = model_output[i][1]; model_output[i][1] = temp; } if (model_output[i][1] > model_output[i][2]) { float temp = model_output[i][1]; model_output[i][1] = model_output[i][2]; model_output[i][2] = temp; } if (model_output[i][0] > model_output[i][1]) { float temp = model_output[i][0]; model_output[i][0] = model_output[i][1]; model_output[i][1] = temp; } } }
void setup_program_greater_or_equal() { nu_input_registers = 2; nu_output_registers = 1; nu_model_inputs = 64; max_instructions = 16; model_floating_point_mode = 0; only_integer_math = 1; allocate_model(); int f = 0; int ok = 0; again : for (int i = 0; i < nu_model_inputs; i++) { for (int j = 0; j < nu_input_registers; j++) { model_input[i][j] = random() & 31; } if (model_input[i][0] >= model_input[i][1]) model_output[i][0] = 2; else model_output[i][0] = 0; // We want at least one model input with equal values. if (model_input[i][0] == model_input[i][1]) ok = 1; } if (!ok) goto again; }
void ColInfo::add_model(ColModel* m) { if(n_models == n_allocated_models) allocate_model(n_allocated_models + 10); models[n_models] = m; n_models++; n_total_tri += m->n_triangle; }
/** * Sends a knowledge model to the receiving array. * * @param p0 the destination receiving wide character array (Hand over as reference!) * @param p1 the destination receiving wide character array count * @param p2 the destination receiving wide character array size * @param p3 the source message abstraction * @param p4 the source message abstraction count * @param p5 the source message model * @param p6 the source message model count * @param p7 the source message details * @param p8 the source message details count * @param p9 the source metadata abstraction * @param p10 the source metadata abstraction count * @param p11 the source metadata model * @param p12 the source metadata model count * @param p13 the source metadata details * @param p14 the source metadata details count * @param p15 the language * @param p16 the language count */ void communicate_sending_inline(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) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Send inline message."); // The converted array. void* a = *NULL_POINTER_MEMORY_MODEL; void* ac = *NULL_POINTER_MEMORY_MODEL; void* as = *NULL_POINTER_MEMORY_MODEL; // Allocate array. allocate_model((void*) &a, (void*) &ac, (void*) &as, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); // Encode source knowledge model into array. encode((void*) &a, ac, as, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, p3, p4, p5, p6, p7, p8, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, p9, p10, p11, p12, p13, p14, *NULL_POINTER_MEMORY_MODEL, *NULL_POINTER_MEMORY_MODEL, p15, p16); /*?? fwprintf(stdout, L"TEST sending inline a: %ls\n", (wchar_t*) a); fwprintf(stdout, L"TEST sending inline ac: %i\n", *((int*) ac)); */ // Write encoded array into destination array. send_data(p0, p1, p2, a, ac, (void*) INLINE_CYBOL_CHANNEL, (void*) INLINE_CYBOL_CHANNEL_COUNT); /*?? fwprintf(stdout, L"TEST sending inline p0: %ls\n", *((wchar_t**) p0)); fwprintf(stdout, L"TEST sending inline p1: %i\n", *((int*) p1)); */ // Deallocate array. deallocate_model((void*) &a, (void*) &ac, (void*) &as, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); }
/** * Encodes the compound into an http response. * * @param p0 the destination character array (Hand over as reference!) * @param p1 the destination character array count * @param p2 the destination character array size * @param p3 the source message abstraction * @param p4 the source message abstraction count * @param p5 the source message model * @param p6 the source message model count * @param p7 the source message details * @param p8 the source message details count * @param p9 the source metadata abstraction * @param p10 the source metadata abstraction count * @param p11 the source metadata model * @param p12 the source metadata model count * @param p13 the source metadata details * @param p14 the source metadata details count */ void encode_http_response(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) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Encode http response."); // // CAUTION! The body is encoded to UTF-8 first, so that its count // can be determined, since it has to be given as header value in http. // // The body character array. void* a = *NULL_POINTER_MEMORY_MODEL; void* ac = *NULL_POINTER_MEMORY_MODEL; void* as = *NULL_POINTER_MEMORY_MODEL; // Allocate body character array. allocate_model((void*) &a, (void*) &ac, (void*) &as, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); // Encode body wide character array into body multibyte character array. encode_utf_8_unicode_character_vector((void*) &a, ac, as, p5, p6); encode_http_response_protocol(p0, p1, p2, p9, p10, p11, p12, p13, p14); overwrite_array(p0, (void*) REQUEST_RESPONSE_LINE_ELEMENT_END_SEPARATOR_HTTP_NAME, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) REQUEST_RESPONSE_LINE_ELEMENT_END_SEPARATOR_HTTP_NAME_COUNT, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); encode_http_response_status_code(p0, p1, p2, p9, p10, p11, p12, p13, p14); overwrite_array(p0, (void*) REQUEST_RESPONSE_LINE_FINAL_ELEMENT_SEPARATOR_HTTP_NAME, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) REQUEST_RESPONSE_LINE_FINAL_ELEMENT_SEPARATOR_HTTP_NAME_COUNT, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); encode_http_response_header(p0, p1, p2, p9, p10, p11, p12, p13, p14, ac); // // CAUTION! Do NOT add the BODY_BEGIN_SEPARATOR_HTTP_NAME // (twice carriage return and line feed). // One CR + LF was already added by HEADER_SEPARATOR_HTTP_NAME // inside the "encode_http_response_header" function. // If there are no header entries (which shouldn't happen normally), // then one CR + LF was already added by // REQUEST_RESPONSE_LINE_FINAL_ELEMENT_SEPARATOR_HTTP_NAME above. // Therefore, ONLY ONE MORE CR + LF is to be added here. // overwrite_array(p0, (void*) HEADER_SEPARATOR_HTTP_NAME, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) HEADER_SEPARATOR_HTTP_NAME_COUNT, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); // This function is commented out, since it is not needed for now. // Its content was moved directly into here (see above), // since the body count (length) needs to be determined. // encode_http_response_body(p0, p1, p2, p3, p4, p5, p6, p7, p8); // CAUTION! Append body ONLY here and NOT before, // since it has to stand at the end of the http message. overwrite_array(p0, a, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, ac, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); // Deallocate body character array. deallocate_model((void*) &a, (void*) &ac, (void*) &as, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); }
/** * Sends a knowledge model as byte stream to the operating system's file system. * * @param p0 the internal memory * @param p1 the source name * @param p2 the source name count * @param p3 the source abstraction * @param p4 the source abstraction count * @param p5 the source model * @param p6 the source model count * @param p7 the source details * @param p8 the source details count * @param p9 the knowledge memory * @param p10 the knowledge memory count * @param p11 the language model * @param p12 the language model count * @param p13 the source clean flag * @param p14 the source clean flag count * @param p15 the file name * @param p16 the file name count */ void communicate_sending_file_system(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) { log_terminated_message((void*) INFORMATION_LEVEL_LOG_MODEL, (void*) L"Send file system message."); // The serialised wide character array. void* s = *NULL_POINTER_MEMORY_MODEL; void* sc = *NULL_POINTER_MEMORY_MODEL; void* ss = *NULL_POINTER_MEMORY_MODEL; // Allocate serialised 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); // Serialise source knowledge model into serialised wide character array. encode((void*) &s, sc, ss, p1, p2, p3, p4, p5, p6, p7, p8, *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, p9, p10, p11, p12); // The encoded character array. void* e = *NULL_POINTER_MEMORY_MODEL; void* ec = *NULL_POINTER_MEMORY_MODEL; void* es = *NULL_POINTER_MEMORY_MODEL; // Allocate encoded character array. allocate_model((void*) &e, (void*) &ec, (void*) &es, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); // Encode serialised wide character array into encoded character array. encode_utf_8_unicode_character_vector((void*) &e, ec, es, s, sc); // Deallocate serialised 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); // Write encoded array into file. send_data((void*) &p15, p16, *NULL_POINTER_MEMORY_MODEL, e, ec, (void*) FILE_CYBOL_CHANNEL, (void*) FILE_CYBOL_CHANNEL_COUNT); // Deallocate encoded character array. deallocate_model((void*) &e, (void*) &ec, (void*) &es, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); }
void setup_program_count_registers() { nu_input_registers = 0; nu_output_registers = nu_registers; nu_model_inputs = 1; max_instructions = nu_registers; model_floating_point_mode = 0; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { for (int j = 0; j < nu_output_registers; j++) { model_output[i][j] = j; } } }
void setup_program_round_float() { nu_input_registers = 1; nu_output_registers = 1; nu_model_inputs = 16; max_instructions = 8; model_floating_point_mode = 1; only_floating_point_math = 1; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { fmodel_input[i][0] = (float)random() * 100.0 / RAND_MAX; fmodel_output[i][0] = custom_round(fmodel_input[i][0], 3); } }
void setup_program_transcendental2_float() { nu_input_registers = 1; nu_output_registers = 1; nu_model_inputs = 20; max_instructions = 10; model_floating_point_mode = 1; only_floating_point_math = 1; include_expensive_math = 1; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { fmodel_input[i][0] = (float)random() * 10.0 / RAND_MAX; fmodel_output[i][0] = sinf(expf(sinf(expf(sinf(fmodel_input[i][0]))))); } }
void setup_program_formula_float() { nu_input_registers = 1; nu_output_registers = 2; nu_model_inputs = 16; max_instructions = 8; model_floating_point_mode = 1; only_floating_point_math = 1; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { fmodel_input[i][0] = (float)random() * 100.0 / RAND_MAX - 50.0; fmodel_output[i][0] = fmodel_input[i][0]; fmodel_output[i][1] = fmodel_input[i][0] * fmodel_input[i][0] + 2.5 * fmodel_input[i][0] + 5.5; } }
void setup_program_quartic_float() { nu_input_registers = 1; nu_output_registers = 1; nu_model_inputs = 20; max_instructions = 16; model_floating_point_mode = 1; only_floating_point_math = 1; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { fmodel_input[i][0] = (float)random() * 10.0 / RAND_MAX; fmodel_output[i][0] = pow(fmodel_input[i][0], 4) + pow(fmodel_input[i][0], 3) + pow(fmodel_input[i][0], 2) + fmodel_input[i][0]; } }
void setup_program_square() { nu_input_registers = 1; nu_output_registers = 2; nu_model_inputs = 8; max_instructions = 8; model_floating_point_mode = 0; allocate_model(); for (int i = 0; i < nu_model_inputs; i++) { for (int j = 0; j < nu_input_registers; j++) { model_input[i][j] = random() & 255; } model_output[i][0] = 0; model_output[i][1] = model_input[i][0] * model_input[i][0]; } }
/** * Converts the given characters to wide characters and * appends them to the destination. * * @param p0 the destination (Hand over as reference!) * @param p1 the destination count * @param p2 the destination size * @param p3 the source name * @param p4 the source name count * @param p5 the source abstraction * @param p6 the source abstraction count * @param p7 the source model * @param p8 the source model count * @param p9 the source details * @param p10 the source details count */ void decode_http_request_protocol_append_part(void* p0, void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, void* p9, void* p10) { // The serialised wide character array. void* s = *NULL_POINTER_MEMORY_MODEL; void* sc = *NULL_POINTER_MEMORY_MODEL; void* ss = *NULL_POINTER_MEMORY_MODEL; // Allocate serialised 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); // Decode encoded character array into serialised wide character array. decode_utf_8_unicode_character_vector((void*) &s, sc, ss, p7, p8); append_part(p0, p1, p2, p3, p4, p5, p6, s, sc, p9, p10); // Deallocate serialised 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); }
void setup_program_abs() { nu_input_registers = 1; nu_output_registers = 1; nu_model_inputs = 16; max_instructions = 8; model_floating_point_mode = 0; only_integer_math = 1; allocate_model(); int f = 0; int ok = 0; for (int i = 0; i < nu_model_inputs; i++) { model_input[i][0] = (random() & 31) - 15; if (model_input[i][0] >= 0) model_output[i][0] = model_input[i][0]; else model_output[i][0] = - model_input[i][0]; } }
/** * Encodes the http response header content length. * * @param p0 the destination character array (Hand over as reference!) * @param p1 the destination character array count * @param p2 the destination character array size * @param p3 the source message model count (content length) */ void encode_http_response_header_content_length(void* p0, void* p1, void* p2, void* p3) { // The wide character array. void* a = *NULL_POINTER_MEMORY_MODEL; void* ac = *NULL_POINTER_MEMORY_MODEL; void* as = *NULL_POINTER_MEMORY_MODEL; // Allocate character array. allocate_model((void*) &a, (void*) &ac, (void*) &as, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); // Encode wide character array into multibyte character array. encode_integer((void*) &a, ac, as, p3, (void*) PRIMITIVE_MEMORY_MODEL_COUNT); overwrite_array(p0, (void*) CONTENT_LENGTH_ENTITY_HEADER_HTTP_NAME, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) CONTENT_LENGTH_ENTITY_HEADER_HTTP_NAME_COUNT, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); overwrite_array(p0, (void*) HEADER_ARGUMENT_SEPARATOR_HTTP_NAME, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) HEADER_ARGUMENT_SEPARATOR_HTTP_NAME_COUNT, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); // CAUTION! Use the message count (content length) integer value // that was handed over as parameter! select_http_response_header_entry_overwrite_array(p0, p1, p2, a, ac); overwrite_array(p0, (void*) HEADER_SEPARATOR_HTTP_NAME, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) HEADER_SEPARATOR_HTTP_NAME_COUNT, p1, (void*) VALUE_PRIMITIVE_MEMORY_NAME, p1, p2); // Deallocate character array. deallocate_model((void*) &a, (void*) &ac, (void*) &as, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION, (void*) WIDE_CHARACTER_MEMORY_ABSTRACTION_COUNT); }
/** * 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"); } }
/** * Gets the host address. * * @param p0 the ipv4 or ipv6 host address, depending on the address namespace (Hand over as reference!) * @param p1 the address model * @param p2 the address model count * @param p3 the address namespace */ void startup_socket_get_host_address(void* p0, void* p1, void* p2, void* p3) { if (p3 != *NULL_POINTER_MEMORY_MODEL) { int* an = (int*) p3; if (p0 != *NULL_POINTER_MEMORY_MODEL) { struct in_addr* a4 = (struct in_addr*) *NULL_POINTER_MEMORY_MODEL; struct in6_addr* a6 = (struct in6_addr*) *NULL_POINTER_MEMORY_MODEL; if (*an == AF_INET) { a4 = (struct in_addr*) p0; } else if (*an == AF_INET6) { a6 = (struct in6_addr*) p0; } log_terminated_message((void*) DEBUG_LEVEL_LOG_MODEL, (void*) L"Startup socket get host address."); // The comparison result. int r = *NUMBER_0_INTEGER_MEMORY_MODEL; if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_integer_equal((void*) &r, p1, (void*) LOOPBACK_ADDRESS_CYBOL_MODEL); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { if (*an == AF_INET) { (*a4).s_addr = INADDR_LOOPBACK; } else if (*an == AF_INET6) { *a6 = in6addr_loopback; } } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { compare_integer_equal((void*) &r, p1, (void*) ANY_ADDRESS_CYBOL_MODEL); if (r != *NUMBER_0_INTEGER_MEMORY_MODEL) { if (*an == AF_INET) { (*a4).s_addr = INADDR_ANY; } else if (*an == AF_INET6) { *a6 = in6addr_any; } } } if (r == *NUMBER_0_INTEGER_MEMORY_MODEL) { // If none of the above address models was found, then the given // address is supposed to be the host address directly. // The terminated address model. void* s = *NULL_POINTER_MEMORY_MODEL; void* sc = *NULL_POINTER_MEMORY_MODEL; void* ss = *NULL_POINTER_MEMORY_MODEL; // Allocate terminated address model. allocate_model((void*) &s, (void*) &sc, (void*) &ss, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); // Encode wide character name into multibyte character array. encode_utf_8_unicode_character_vector((void*) &s, sc, ss, p1, p2); if (*((int*) ss) <= *((int*) sc)) { // Increase character array size to have place for the termination character. *((int*) ss) = *((int*) sc) + *NUMBER_1_INTEGER_MEMORY_MODEL; // Reallocate terminated file name as multibyte character array. reallocate_array((void*) &s, sc, ss, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION); } // Add null termination character to terminated file name. overwrite_array((void*) &s, (void*) NULL_CONTROL_ASCII_CHARACTER_CODE_MODEL, (void*) CHARACTER_PRIMITIVE_MEMORY_ABSTRACTION, (void*) PRIMITIVE_MEMORY_MODEL_COUNT, sc, (void*) VALUE_PRIMITIVE_MEMORY_NAME, sc, ss); // Convert uint16_t integer hostshort from host byte order // to network byte order. inet_pton(*an, (char*) s, p0); // Deallocate terminated address model. deallocate_model((void*) &s, (void*) &sc, (void*) &ss, (void*) NUMBER_0_INTEGER_MEMORY_MODEL, (void*) CHARACTER_MEMORY_ABSTRACTION, (void*) CHARACTER_MEMORY_ABSTRACTION_COUNT); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not get startup socket host address. The host address is null."); } } else { log_terminated_message((void*) ERROR_LEVEL_LOG_MODEL, (void*) L"Could not get startup socket host address. The address namespace is null."); } }
/** * 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."); } }