R: changes name convention on objective elements

This commit is contained in:
2026-04-06 15:02:20 +03:00
parent 707087b8fe
commit 2414abbdcb
59 changed files with 643 additions and 638 deletions
+3 -3
View File
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <string.h>
void init_d_arr_ptr(d_array_ptr_t *arr, int64_t init_capacity) {
void u_d_arr_ptr_init(d_array_ptr_t *arr, int64_t init_capacity) {
arr->capacity = init_capacity;
arr->length = 0;
arr->arr = malloc(sizeof(void *) * init_capacity);
@@ -13,7 +13,7 @@ void init_d_arr_ptr(d_array_ptr_t *arr, int64_t init_capacity) {
memset(arr->arr, 0, init_capacity);
}
void add_d_arr_ptr(d_array_ptr_t *arr, void *ptr, int64_t idx) {
void u_d_arr_ptr_add(d_array_ptr_t *arr, void *ptr, int64_t idx) {
int64_t new_capacity = idx * 2;
if (idx > arr->capacity - 1) {
arr->arr = realloc(arr->arr, new_capacity);
@@ -26,7 +26,7 @@ void add_d_arr_ptr(d_array_ptr_t *arr, void *ptr, int64_t idx) {
arr->length = idx+1;
}
void free_d_arr(d_array_ptr_t *arr) {
void u_d_arr_ptr_free(d_array_ptr_t *arr) {
arr->capacity = 0;
arr->length = 0;
free(arr->arr);
+3 -3
View File
@@ -10,8 +10,8 @@ typedef struct d_array_ptr_t {
void *last_el;
} d_array_ptr_t;
void init_d_arr_ptr(d_array_ptr_t *arr, int64_t init_capacity);
void add_d_arr_ptr(d_array_ptr_t *arr, void *ptr, int64_t idx);
void free_d_arr(d_array_ptr_t *arr);
void u_d_arr_ptr_init(d_array_ptr_t *arr, int64_t init_capacity);
void u_d_arr_ptr_add(d_array_ptr_t *arr, void *ptr, int64_t idx);
void u_d_arr_ptr_free(d_array_ptr_t *arr);
#endif
+5 -5
View File
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <wchar.h>
size_t count_utf8_code_points(const char *s) {
size_t u_utf8_code_points_count(const char *s) {
size_t count = 0;
while (*s) {
count += (*s++ & 0xC0) != 0x80;
@@ -13,11 +13,11 @@ size_t count_utf8_code_points(const char *s) {
return count;
}
int64_t convert_utf8_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
int64_t u_utf8_conver_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
size_t *restrict len) {
// Step 1: Convert UTF-8 (MBCS) to wchar_t (wide)
size_t wide_len =
count_utf8_code_points(utf8_str); // Get required length (-1 on error)
u_utf8_code_points_count(utf8_str); // Get required length (-1 on error)
if (wide_len == (size_t)-1) {
*len = 0;
perror("mbstowcs failed");
@@ -30,10 +30,10 @@ int64_t convert_utf8_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
return 0;
}
int64_t curs_printw(WINDOW *win, int64_t y, int64_t x, char *const utf8_str) {
int64_t u_utf8_curs_printw(WINDOW *win, int64_t y, int64_t x, char *const utf8_str) {
wchar_t *wname = NULL;
size_t nsize = 0;
convert_utf8_to_wide(utf8_str, &wname, &nsize);
u_utf8_conver_to_wide(utf8_str, &wname, &nsize);
mvwaddwstr(win, y, x, wname);
free(wname);
return nsize;
+5 -3
View File
@@ -4,8 +4,10 @@
#include <ncursesw/ncurses.h>
#include <stddef.h>
#include <stdint.h>
size_t count_utf8_code_points(const char *s);
int64_t convert_utf8_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
size_t u_utf8_code_points_count(const char *s);
int64_t u_utf8_convert_to_wide(const char *utf8_str, wchar_t **restrict wide_str,
size_t *restrict len);
int64_t curs_printw(WINDOW *win, int64_t y, int64_t x, char *const utf8_str);
int64_t u_utf8_curs_printw(WINDOW *win, int64_t y, int64_t x, char *const utf8_str);
#endif