[C] Preparations for doxygen

This commit is contained in:
seleznevae
2018-05-05 18:38:45 +03:00
parent 25992d0f9d
commit d010dc9cf8
10 changed files with 262 additions and 212 deletions

View File

@@ -149,7 +149,7 @@ static int ft_row_printf_impl(FTABLE *table, size_t row, const char *fmt, va_lis
if (padding_row == NULL)
goto clear;
if (IS_ERROR(vector_push(table->rows, &padding_row))) {
if (FT_IS_ERROR(vector_push(table->rows, &padding_row))) {
destroy_row(padding_row);
goto clear;
}
@@ -196,7 +196,7 @@ static int ft_row_wprintf_impl(FTABLE *table, size_t row, const wchar_t *fmt, va
if (padding_row == NULL)
goto clear;
if (IS_ERROR(vector_push(table->rows, &padding_row))) {
if (FT_IS_ERROR(vector_push(table->rows, &padding_row))) {
destroy_row(padding_row);
goto clear;
}
@@ -292,7 +292,7 @@ static int ft_write_impl(FTABLE *table, const char *cell_content)
return FT_ERROR;
int status = fill_buffer_from_string(str_buffer, cell_content);
if (IS_SUCCESS(status)) {
if (FT_IS_SUCCESS(status)) {
table->cur_col++;
}
return status;
@@ -309,7 +309,7 @@ static int ft_wwrite_impl(FTABLE *table, const wchar_t *cell_content)
return FT_ERROR;
int status = fill_buffer_from_wstring(str_buffer, cell_content);
if (IS_SUCCESS(status)) {
if (FT_IS_SUCCESS(status)) {
table->cur_col++;
}
return status;
@@ -323,7 +323,7 @@ int ft_nwrite(FTABLE *table, size_t n, const char *cell_content, ...)
size_t i = 0;
assert(table);
int status = ft_write_impl(table, cell_content);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
va_list va;
@@ -332,7 +332,7 @@ int ft_nwrite(FTABLE *table, size_t n, const char *cell_content, ...)
for (i = 0; i < n; ++i) {
const char *cell = va_arg(va, const char *);
status = ft_write_impl(table, cell);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
}
va_end(va);
@@ -344,7 +344,7 @@ int ft_nwrite_ln(FTABLE *table, size_t n, const char *cell_content, ...)
size_t i = 0;
assert(table);
int status = ft_write_impl(table, cell_content);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
va_list va;
@@ -353,7 +353,7 @@ int ft_nwrite_ln(FTABLE *table, size_t n, const char *cell_content, ...)
for (i = 0; i < n; ++i) {
const char *cell = va_arg(va, const char *);
status = ft_write_impl(table, cell);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
va_end(va);
return status;
}
@@ -371,7 +371,7 @@ int ft_nwwrite(FTABLE *table, size_t n, const wchar_t *cell_content, ...)
size_t i = 0;
assert(table);
int status = ft_wwrite_impl(table, cell_content);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
va_list va;
@@ -380,7 +380,7 @@ int ft_nwwrite(FTABLE *table, size_t n, const wchar_t *cell_content, ...)
for (i = 0; i < n; ++i) {
const wchar_t *cell = va_arg(va, const wchar_t *);
status = ft_wwrite_impl(table, cell);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
}
va_end(va);
@@ -392,7 +392,7 @@ int ft_nwwrite_ln(FTABLE *table, size_t n, const wchar_t *cell_content, ...)
size_t i = 0;
assert(table);
int status = ft_wwrite_impl(table, cell_content);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
va_list va;
@@ -401,7 +401,7 @@ int ft_nwwrite_ln(FTABLE *table, size_t n, const wchar_t *cell_content, ...)
for (i = 0; i < n; ++i) {
const wchar_t *cell = va_arg(va, const wchar_t *);
status = ft_wwrite_impl(table, cell);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
va_end(va);
return status;
}
@@ -420,7 +420,7 @@ int ft_row_write(FTABLE *table, size_t cols, const char *cells[])
assert(table);
for (i = 0; i < cols; ++i) {
int status = ft_write_impl(table, cells[i]);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
/* todo: maybe current pos in case of error should be equal to the one before function call? */
return status;
}
@@ -432,7 +432,7 @@ int ft_row_write_ln(FTABLE *table, size_t cols, const char *cells[])
{
assert(table);
int status = ft_row_write(table, cols, cells);
if (IS_SUCCESS(status)) {
if (FT_IS_SUCCESS(status)) {
ft_ln(table);
}
return status;
@@ -445,7 +445,7 @@ int ft_row_wwrite(FTABLE *table, size_t cols, const wchar_t *cells[])
assert(table);
for (i = 0; i < cols; ++i) {
int status = ft_wwrite_impl(table, cells[i]);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
/* todo: maybe current pos in case of error should be equal to the one before function call? */
return status;
}
@@ -457,7 +457,7 @@ int ft_row_wwrite_ln(FTABLE *table, size_t cols, const wchar_t *cells[])
{
assert(table);
int status = ft_row_wwrite(table, cols, cells);
if (IS_SUCCESS(status)) {
if (FT_IS_SUCCESS(status)) {
ft_ln(table);
}
return status;
@@ -472,7 +472,7 @@ int ft_table_write(FTABLE *table, size_t rows, size_t cols, const char *table_ce
assert(table);
for (i = 0; i < rows; ++i) {
int status = ft_row_write(table, cols, (const char **)&table_cells[i * cols]);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
/* todo: maybe current pos in case of error should be equal to the one before function call? */
return status;
}
@@ -486,7 +486,7 @@ int ft_table_write_ln(FTABLE *table, size_t rows, size_t cols, const char *table
{
assert(table);
int status = ft_table_write(table, rows, cols, table_cells);
if (IS_SUCCESS(status)) {
if (FT_IS_SUCCESS(status)) {
ft_ln(table);
}
return status;
@@ -500,7 +500,7 @@ int ft_table_wwrite(FTABLE *table, size_t rows, size_t cols, const wchar_t *tabl
assert(table);
for (i = 0; i < rows; ++i) {
int status = ft_row_wwrite(table, cols, (const wchar_t **)&table_cells[i * cols]);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
/* todo: maybe current pos in case of error should be equal to the one before function call? */
return status;
}
@@ -514,7 +514,7 @@ int ft_table_wwrite_ln(FTABLE *table, size_t rows, size_t cols, const wchar_t *t
{
assert(table);
int status = ft_table_wwrite(table, rows, cols, table_cells);
if (IS_SUCCESS(status)) {
if (FT_IS_SUCCESS(status)) {
ft_ln(table);
}
return status;
@@ -554,7 +554,7 @@ const char *ft_to_string(const FTABLE *table)
size_t height = 0;
size_t width = 0;
int status = table_geometry(table, &height, &width);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
return NULL;
}
size_t sz = height * width + 1;
@@ -566,7 +566,7 @@ const char *ft_to_string(const FTABLE *table)
return NULL;
}
while (string_buffer_capacity(table->conv_buffer) < sz) {
if (IS_ERROR(realloc_string_buffer_without_copy(table->conv_buffer))) {
if (FT_IS_ERROR(realloc_string_buffer_without_copy(table->conv_buffer))) {
return NULL;
}
}
@@ -578,7 +578,7 @@ const char *ft_to_string(const FTABLE *table)
size_t *col_width_arr = NULL;
size_t *row_height_arr = NULL;
status = table_rows_and_cols_geometry(table, &col_width_arr, &cols, &row_height_arr, &rows);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return NULL;
if (rows == 0)
@@ -657,7 +657,7 @@ const wchar_t *ft_to_wstring(const FTABLE *table)
size_t height = 0;
size_t width = 0;
int status = table_geometry(table, &height, &width);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
return NULL;
}
size_t sz = height * width + 1;
@@ -669,7 +669,7 @@ const wchar_t *ft_to_wstring(const FTABLE *table)
return NULL;
}
while (string_buffer_capacity(table->conv_buffer) < sz) {
if (IS_ERROR(realloc_string_buffer_without_copy(table->conv_buffer))) {
if (FT_IS_ERROR(realloc_string_buffer_without_copy(table->conv_buffer))) {
return NULL;
}
}
@@ -685,7 +685,7 @@ const wchar_t *ft_to_wstring(const FTABLE *table)
if (rows == 0)
return cur_F_STRDUP(empty_string);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return NULL;
int written = 0;
@@ -771,7 +771,7 @@ int ft_add_separator(FTABLE *table)
if (sep_p == NULL)
return FT_MEMORY_ERROR;
int status = vector_push(table->separators, &sep_p);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
}
@@ -939,12 +939,12 @@ int ft_set_default_cell_option(uint32_t option, int value)
}
FT_EXTERN int ft_set_default_tbl_option(uint32_t option, int value)
int ft_set_default_tbl_option(uint32_t option, int value)
{
return set_default_entire_table_option(option, value);
}
FT_EXTERN int ft_set_tbl_option(FTABLE *table, uint32_t option, int value)
int ft_set_tbl_option(FTABLE *table, uint32_t option, int value)
{
assert(table);
@@ -956,12 +956,12 @@ FT_EXTERN int ft_set_tbl_option(FTABLE *table, uint32_t option, int value)
return set_entire_table_option(table->options, option, value);
}
FT_EXTERN void ft_set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void *ptr))
void ft_set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void *ptr))
{
set_memory_funcs(f_malloc, f_free);
}
FT_EXTERN int ft_set_cell_span(FTABLE *table, size_t row, size_t col, size_t hor_span)
int ft_set_cell_span(FTABLE *table, size_t row, size_t col, size_t hor_span)
{
assert(table);
if (hor_span < 2)

View File

@@ -112,7 +112,7 @@ fort_cell_options_t *get_cell_opt_and_create_if_not_exists(fort_cell_opt_contain
fort_cell_options_t opt = g_default_cell_option;// DEFAULT_CELL_OPTION;
opt.cell_row = row;
opt.cell_col = col;
if (IS_SUCCESS(vector_push(cont, &opt))) {
if (FT_IS_SUCCESS(vector_push(cont, &opt))) {
return (fort_cell_options_t *)vector_at(cont, sz);
}

View File

@@ -79,7 +79,7 @@ fort_cell_t *get_cell_implementation(fort_row_t *row, size_t col, enum PolicyOnN
fort_cell_t *new_cell = create_cell();
if (new_cell == NULL)
return NULL;
if (IS_ERROR(vector_push(row->cells, &new_cell))) {
if (FT_IS_ERROR(vector_push(row->cells, &new_cell))) {
destroy_cell(new_cell);
return NULL;
}
@@ -573,13 +573,13 @@ fort_row_t *create_row_from_string(const char *str)
goto clear;
int status = fill_cell_from_string_(cell, base_pos);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
status = vector_push(row->cells, &cell);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
@@ -596,13 +596,13 @@ fort_row_t *create_row_from_string(const char *str)
goto clear;
int status = fill_cell_from_string_(cell, zero_string);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
status = vector_push(row->cells, &cell);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
@@ -661,13 +661,13 @@ fort_row_t *create_row_from_wstring(const wchar_t *str)
goto clear;
int status = fill_cell_from_string_(cell, base_pos);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
status = vector_push(row->cells, &cell);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
@@ -684,13 +684,13 @@ fort_row_t *create_row_from_wstring(const wchar_t *str)
goto clear;
int status = fill_cell_from_string_(cell, zero_string);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
status = vector_push(row->cells, &cell);
if (IS_ERROR(status)) {
if (FT_IS_ERROR(status)) {
destroy_cell(cell);
goto clear;
}
@@ -736,7 +736,7 @@ fort_row_t *create_row_from_fmt_string(const char *fmt, va_list *va_args)
break;
/* Otherwise buffer was too small, so incr. buffer size ant try again. */
if (!IS_SUCCESS(realloc_string_buffer_without_copy(buffer)))
if (!FT_IS_SUCCESS(realloc_string_buffer_without_copy(buffer)))
goto clear;
}
@@ -793,7 +793,7 @@ fort_row_t *create_row_from_fmt_wstring(const wchar_t *fmt, va_list *va_args)
break;
/* Otherwise buffer was too small, so incr. buffer size ant try again. */
if (!IS_SUCCESS(realloc_string_buffer_without_copy(buffer)))
if (!FT_IS_SUCCESS(realloc_string_buffer_without_copy(buffer)))
goto clear;
}

View File

@@ -198,7 +198,7 @@ fort_status_t fill_buffer_from_string(string_buffer_t *buffer, const char *str)
while (sz >= string_buffer_capacity(buffer)) {
int status = realloc_string_buffer_without_copy(buffer);
if (!IS_SUCCESS(status)) {
if (!FT_IS_SUCCESS(status)) {
return status;
}
}
@@ -221,7 +221,7 @@ fort_status_t fill_buffer_from_wstring(string_buffer_t *buffer, const wchar_t *s
while (sz >= string_buffer_capacity(buffer)) {
int status = realloc_string_buffer_without_copy(buffer);
if (!IS_SUCCESS(status)) {
if (!FT_IS_SUCCESS(status)) {
return status;
}
}

View File

@@ -25,7 +25,7 @@ fort_row_t *get_row_implementation(fort_table_t *table, size_t row, enum PolicyO
fort_row_t *new_row = create_row();
if (new_row == NULL)
return NULL;
if (IS_ERROR(vector_push(table->rows, &new_row))) {
if (FT_IS_ERROR(vector_push(table->rows, &new_row))) {
destroy_row(new_row);
return NULL;
}
@@ -101,7 +101,7 @@ fort_status_t table_rows_and_cols_geometry(const FTABLE *table,
size_t cols = 0;
size_t rows = 0;
int status = get_table_sizes(table, &rows, &cols);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
size_t *col_width_arr = (size_t *)F_CALLOC(sizeof(size_t), cols);
@@ -210,7 +210,7 @@ fort_status_t table_geometry(const FTABLE *table, size_t *height, size_t *width)
size_t *row_height_arr = NULL;
int status = table_rows_and_cols_geometry(table, &col_width_arr, &cols, &row_height_arr, &rows);
if (IS_ERROR(status))
if (FT_IS_ERROR(status))
return status;
*width = 1 + (cols == 0 ? 1 : cols) + 1; /* for boundaries (that take 1 symbol) + newline */