[F] Fixed code style issues

This commit is contained in:
seleznevae 2018-05-06 17:04:34 +03:00
parent 9daee298b0
commit e870d1dc2c
10 changed files with 172 additions and 149 deletions

View File

@ -6,8 +6,36 @@ def comment_line(line):
def amalgamate(config):
with open(config["output_file"], "w") as output_f:
output_f.write("/* The file was GENERATED by an amalgamation script.*/\n")
output_f.write("/* DO NOT EDIT BY HAND!!! */\n\n")
output_f.write("""
/*
libfort
MIT License
Copyright (c) 2017 - 2018 Seleznev Anton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/* The file was GENERATED by an amalgamation script.*/
/* DO NOT EDIT BY HAND!!! */\n\n
""")
for hdr_file in config["header_files"]:
with open(config["src_dir"] + "/" + hdr_file, "r") as input_f:
@ -56,7 +84,7 @@ def is_c_source_file(file):
def main():
config = {}
config["output_file"] = "./include/fort.c"
config["output_file"] = "./lib/fort.c"
config["src_dir"] = "./src"
all_files = os.listdir(config["src_dir"])
config["src_files"] = filter(is_c_source_file, all_files)

View File

@ -1,7 +1,35 @@
/*
libfort
MIT License
Copyright (c) 2017 - 2018 Seleznev Anton
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/* The file was GENERATED by an amalgamation script.*/
/* DO NOT EDIT BY HAND!!! */
/********************************************************
Begin of file "fort_utils.h"
********************************************************/
@ -41,15 +69,13 @@
#define MIN(a,b) ((a) < (b) ? (a) : b)
enum PolicyOnNull
{
enum PolicyOnNull {
Create,
DoNotCreate
};
enum F_BOOL
{
enum F_BOOL {
F_FALSE = 0,
F_TRUE = 1
};
@ -88,14 +114,12 @@ struct fort_row;
struct vector;
struct fort_cell;
struct string_buffer;
struct separator
{
struct separator {
int enabled;
};
typedef struct fort_table_options fort_table_options_t;
struct fort_context
{
struct fort_context {
fort_table_options_t *table_options;
size_t row;
size_t column;
@ -112,8 +136,7 @@ typedef struct separator separator_t;
enum CellType
{
enum CellType {
CommonCell,
GroupMasterCell,
GroupSlaveCell
@ -131,8 +154,8 @@ extern void *(*fort_realloc)(void *ptr, size_t size);
void set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void *ptr));
char *fort_strdup(const char* str);
wchar_t *fort_wcsdup(const wchar_t* str);
char *fort_strdup(const char *str);
wchar_t *fort_wcsdup(const wchar_t *str);
size_t number_of_columns_in_format_string(const char *fmt);
size_t number_of_columns_in_format_wstring(const wchar_t *fmt);
//int snprint_n_chars(char *buf, size_t length, size_t n, char ch);
@ -180,19 +203,19 @@ typedef struct vector vector_t;
#define INVALID_VEC_INDEX ((size_t) -1)
extern vector_t* create_vector(size_t item_size, size_t capacity);
extern void destroy_vector(vector_t*);
extern vector_t* copy_vector(vector_t*);
extern vector_t *create_vector(size_t item_size, size_t capacity);
extern void destroy_vector(vector_t *);
extern vector_t *copy_vector(vector_t *);
extern size_t vector_size(const vector_t*);
extern size_t vector_capacity(const vector_t*);
extern size_t vector_index_of(const vector_t*, const void *item);
extern size_t vector_size(const vector_t *);
extern size_t vector_capacity(const vector_t *);
extern size_t vector_index_of(const vector_t *, const void *item);
extern int vector_push(vector_t*, const void *item);
extern int vector_erase(vector_t*, size_t index);
extern void vector_clear(vector_t*);
extern int vector_push(vector_t *, const void *item);
extern int vector_erase(vector_t *, size_t index);
extern void vector_clear(vector_t *);
extern const void *vector_at_c(const vector_t *vector, size_t index);
extern void* vector_at(vector_t*, size_t index);
extern void *vector_at(vector_t *, size_t index);
extern fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos);
@ -240,26 +263,24 @@ int mk_wcswidth(const wchar_t *pwcs, size_t n);
/*****************************************************************************
* STRING BUFFER
* ***************************************************************************/
enum str_buf_type
{
enum str_buf_type {
CharBuf,
WCharBuf
};
struct string_buffer;
typedef struct string_buffer string_buffer_t;
struct string_buffer
{
struct string_buffer {
union {
char *cstr;
wchar_t *wstr;
void *data;
}str;
} str;
size_t data_sz;
enum str_buf_type type;
};
string_buffer_t* create_string_buffer(size_t number_of_chars, enum str_buf_type type);
string_buffer_t *create_string_buffer(size_t number_of_chars, enum str_buf_type type);
void destroy_string_buffer(string_buffer_t *buffer);
fort_status_t realloc_string_buffer_without_copy(string_buffer_t *buffer);
@ -294,8 +315,7 @@ int buffer_wprintf(string_buffer_t *buffer, size_t buffer_row, wchar_t *buf, siz
#include <stdint.h>
#include <limits.h>
struct fort_column_options
{
struct fort_column_options {
int col_min_width;
enum ft_text_alignment align;
};
@ -313,8 +333,7 @@ typedef struct vector vector_t;
#define OPTION_SET(ft_opts, option) ((ft_opts) |=(option))
#define OPTION_UNSET(ft_opts, option) ((ft_opts) &= ~((uint32_t)option))
struct fort_cell_options
{
struct fort_cell_options {
size_t cell_row;
size_t cell_col;
uint32_t options;
@ -335,8 +354,8 @@ typedef struct fort_cell_options fort_cell_options_t;
typedef vector_t fort_cell_opt_container_t;
fort_cell_opt_container_t *create_cell_opt_container(void);
void destroy_cell_opt_container(fort_cell_opt_container_t *cont);
const fort_cell_options_t* cget_cell_opt(const fort_cell_opt_container_t *cont, size_t row, size_t col);
fort_cell_options_t* get_cell_opt_and_create_if_not_exists(fort_cell_opt_container_t *cont, size_t row, size_t col);
const fort_cell_options_t *cget_cell_opt(const fort_cell_opt_container_t *cont, size_t row, size_t col);
fort_cell_options_t *get_cell_opt_and_create_if_not_exists(fort_cell_opt_container_t *cont, size_t row, size_t col);
fort_status_t set_cell_option(fort_cell_opt_container_t *cont, size_t row, size_t col, uint32_t option, int value);
fort_status_t unset_cell_option(fort_cell_opt_container_t *cont, unsigned row, unsigned col, uint32_t option);
@ -356,15 +375,13 @@ fort_status_t set_default_cell_option(uint32_t option, int value);
* BL BB BB BB BV BB BB BB BV BB BB BB BR <----- BottomSeparator
*/
enum HorSeparatorPos
{
enum HorSeparatorPos {
TopSeparator,
InsideSeparator,
BottomSeparator
};
enum BorderItemPos
{
enum BorderItemPos {
TL_bip = 0,
TT_bip = 1,
TV_bip = 2,
@ -388,8 +405,7 @@ enum BorderItemPos
};
enum SeparatorItemPos
{
enum SeparatorItemPos {
LH_sip = 0,
IH_sip = 1,
II_sip = 2,
@ -399,8 +415,7 @@ enum SeparatorItemPos
};
struct fort_border_style
{
struct fort_border_style {
const char *border_chars[BorderItemPosSize];
const char *header_border_chars[BorderItemPosSize];
const char *separator_chars[SepratorItemPosSize];
@ -419,8 +434,7 @@ extern struct fort_border_style FORT_BOLD2_STYLE;
extern struct fort_border_style FORT_FRAME_STYLE;
struct fort_entire_table_options
{
struct fort_entire_table_options {
unsigned int left_margin;
unsigned int top_margin;
unsigned int right_margin;
@ -431,21 +445,20 @@ extern fort_entire_table_options_t g_entire_table_options;
fort_status_t set_entire_table_option(fort_table_options_t *table_options, uint32_t option, int value);
fort_status_t set_default_entire_table_option(uint32_t option, int value);
struct fort_table_options
{
struct fort_table_options {
struct fort_border_style border_style;
fort_cell_opt_container_t * cell_options;
fort_cell_opt_container_t *cell_options;
fort_entire_table_options_t entire_table_options;
};
typedef struct fort_table_options fort_table_options_t;
extern fort_table_options_t g_table_options;
size_t max_border_elem_strlen(struct fort_table_options*);
size_t max_border_elem_strlen(struct fort_table_options *);
fort_table_options_t* create_table_options(void);
fort_table_options_t* copy_table_options(const fort_table_options_t *option);
void destroy_table_options(fort_table_options_t* options);
fort_table_options_t *create_table_options(void);
fort_table_options_t *copy_table_options(const fort_table_options_t *option);
void destroy_table_options(fort_table_options_t *options);
@ -471,7 +484,7 @@ void destroy_table_options(fort_table_options_t* options);
/*****************************************************************************
* CELL
* ***************************************************************************/
fort_cell_t * create_cell(void);
fort_cell_t *create_cell(void);
void destroy_cell(fort_cell_t *cell);
@ -496,7 +509,7 @@ int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, co
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str);
#endif
string_buffer_t* cell_get_string_buffer(fort_cell_t *cell);
string_buffer_t *cell_get_string_buffer(fort_cell_t *cell);
#endif /* CELL_H */
@ -524,10 +537,10 @@ struct fort_row;
typedef struct fort_row fort_row_t;
fort_row_t * create_row(void);
fort_row_t *create_row(void);
void destroy_row(fort_row_t *row);
fort_row_t * create_row_from_string(const char *str);
fort_row_t* create_row_from_fmt_string(const char* fmt, va_list *va_args);
fort_row_t *create_row_from_string(const char *str);
fort_row_t *create_row_from_fmt_string(const char *fmt, va_list *va_args);
size_t columns_in_row(const fort_row_t *row);
@ -543,10 +556,10 @@ int get_row_cell_types(const fort_row_t *row, enum CellType *types, size_t types
fort_status_t row_set_cell_span(fort_row_t *row, size_t cell_column, size_t hor_span);
int print_row_separator(char *buffer, size_t buffer_sz,
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
@ -555,19 +568,19 @@ int print_row_separator(char *buffer, size_t buffer_sz,
int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col_width_arr, size_t col_width_arr_sz,
size_t row_height, const context_t *context);
size_t row_height, const context_t *context);
#ifdef FT_HAVE_WCHAR
fort_row_t *create_row_from_wstring(const wchar_t *str);
fort_row_t* create_row_from_fmt_wstring(const wchar_t* fmt, va_list *va_args);
fort_row_t *create_row_from_fmt_wstring(const wchar_t *fmt, va_list *va_args);
int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t *col_width_arr, size_t col_width_arr_sz,
size_t row_height, const context_t *context);
size_t row_height, const context_t *context);
#endif
@ -589,8 +602,7 @@ int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t
struct ft_table;
typedef struct ft_table ft_table_t;
struct ft_table
{
struct ft_table {
vector_t *rows;
fort_table_options_t *options;
string_buffer_t *conv_buffer;
@ -623,13 +635,13 @@ fort_row_t *get_row(ft_table_t *table, size_t row);
const fort_row_t *get_row_c(const ft_table_t *table, size_t row);
fort_row_t *get_row_and_create_if_not_exists(ft_table_t *table, size_t row);
string_buffer_t * get_cur_str_buffer_and_create_if_not_exists(ft_table_t * table);
string_buffer_t *get_cur_str_buffer_and_create_if_not_exists(ft_table_t *table);
fort_status_t table_rows_and_cols_geometry(const ft_table_t *table,
size_t **col_width_arr_p, size_t *col_width_arr_sz,
size_t **row_height_arr_p, size_t *row_height_arr_sz);
size_t **col_width_arr_p, size_t *col_width_arr_sz,
size_t **row_height_arr_p, size_t *row_height_arr_sz);
fort_status_t table_geometry(const ft_table_t *table, size_t *height, size_t *width);
#endif /* TABLE_H */

View File

@ -9,7 +9,7 @@
/*****************************************************************************
* CELL
* ***************************************************************************/
fort_cell_t * create_cell(void);
fort_cell_t *create_cell(void);
void destroy_cell(fort_cell_t *cell);
@ -34,6 +34,6 @@ int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, co
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str);
#endif
string_buffer_t* cell_get_string_buffer(fort_cell_t *cell);
string_buffer_t *cell_get_string_buffer(fort_cell_t *cell);
#endif /* CELL_H */

View File

@ -33,15 +33,13 @@
#define MIN(a,b) ((a) < (b) ? (a) : b)
enum PolicyOnNull
{
enum PolicyOnNull {
Create,
DoNotCreate
};
enum F_BOOL
{
enum F_BOOL {
F_FALSE = 0,
F_TRUE = 1
};
@ -80,14 +78,12 @@ struct fort_row;
struct vector;
struct fort_cell;
struct string_buffer;
struct separator
{
struct separator {
int enabled;
};
typedef struct fort_table_options fort_table_options_t;
struct fort_context
{
struct fort_context {
fort_table_options_t *table_options;
size_t row;
size_t column;
@ -104,8 +100,7 @@ typedef struct separator separator_t;
enum CellType
{
enum CellType {
CommonCell,
GroupMasterCell,
GroupSlaveCell
@ -123,8 +118,8 @@ extern void *(*fort_realloc)(void *ptr, size_t size);
void set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void *ptr));
char *fort_strdup(const char* str);
wchar_t *fort_wcsdup(const wchar_t* str);
char *fort_strdup(const char *str);
wchar_t *fort_wcsdup(const wchar_t *str);
size_t number_of_columns_in_format_string(const char *fmt);
size_t number_of_columns_in_format_wstring(const wchar_t *fmt);
//int snprint_n_chars(char *buf, size_t length, size_t n, char ch);

View File

@ -5,8 +5,7 @@
#include <stdint.h>
#include <limits.h>
struct fort_column_options
{
struct fort_column_options {
int col_min_width;
enum ft_text_alignment align;
};
@ -24,8 +23,7 @@ typedef struct vector vector_t;
#define OPTION_SET(ft_opts, option) ((ft_opts) |=(option))
#define OPTION_UNSET(ft_opts, option) ((ft_opts) &= ~((uint32_t)option))
struct fort_cell_options
{
struct fort_cell_options {
size_t cell_row;
size_t cell_col;
uint32_t options;
@ -46,8 +44,8 @@ typedef struct fort_cell_options fort_cell_options_t;
typedef vector_t fort_cell_opt_container_t;
fort_cell_opt_container_t *create_cell_opt_container(void);
void destroy_cell_opt_container(fort_cell_opt_container_t *cont);
const fort_cell_options_t* cget_cell_opt(const fort_cell_opt_container_t *cont, size_t row, size_t col);
fort_cell_options_t* get_cell_opt_and_create_if_not_exists(fort_cell_opt_container_t *cont, size_t row, size_t col);
const fort_cell_options_t *cget_cell_opt(const fort_cell_opt_container_t *cont, size_t row, size_t col);
fort_cell_options_t *get_cell_opt_and_create_if_not_exists(fort_cell_opt_container_t *cont, size_t row, size_t col);
fort_status_t set_cell_option(fort_cell_opt_container_t *cont, size_t row, size_t col, uint32_t option, int value);
fort_status_t unset_cell_option(fort_cell_opt_container_t *cont, unsigned row, unsigned col, uint32_t option);
@ -67,15 +65,13 @@ fort_status_t set_default_cell_option(uint32_t option, int value);
* BL BB BB BB BV BB BB BB BV BB BB BB BR <----- BottomSeparator
*/
enum HorSeparatorPos
{
enum HorSeparatorPos {
TopSeparator,
InsideSeparator,
BottomSeparator
};
enum BorderItemPos
{
enum BorderItemPos {
TL_bip = 0,
TT_bip = 1,
TV_bip = 2,
@ -99,8 +95,7 @@ enum BorderItemPos
};
enum SeparatorItemPos
{
enum SeparatorItemPos {
LH_sip = 0,
IH_sip = 1,
II_sip = 2,
@ -110,8 +105,7 @@ enum SeparatorItemPos
};
struct fort_border_style
{
struct fort_border_style {
const char *border_chars[BorderItemPosSize];
const char *header_border_chars[BorderItemPosSize];
const char *separator_chars[SepratorItemPosSize];
@ -130,8 +124,7 @@ extern struct fort_border_style FORT_BOLD2_STYLE;
extern struct fort_border_style FORT_FRAME_STYLE;
struct fort_entire_table_options
{
struct fort_entire_table_options {
unsigned int left_margin;
unsigned int top_margin;
unsigned int right_margin;
@ -142,21 +135,20 @@ extern fort_entire_table_options_t g_entire_table_options;
fort_status_t set_entire_table_option(fort_table_options_t *table_options, uint32_t option, int value);
fort_status_t set_default_entire_table_option(uint32_t option, int value);
struct fort_table_options
{
struct fort_table_options {
struct fort_border_style border_style;
fort_cell_opt_container_t * cell_options;
fort_cell_opt_container_t *cell_options;
fort_entire_table_options_t entire_table_options;
};
typedef struct fort_table_options fort_table_options_t;
extern fort_table_options_t g_table_options;
size_t max_border_elem_strlen(struct fort_table_options*);
size_t max_border_elem_strlen(struct fort_table_options *);
fort_table_options_t* create_table_options(void);
fort_table_options_t* copy_table_options(const fort_table_options_t *option);
void destroy_table_options(fort_table_options_t* options);
fort_table_options_t *create_table_options(void);
fort_table_options_t *copy_table_options(const fort_table_options_t *option);
void destroy_table_options(fort_table_options_t *options);

View File

@ -13,10 +13,10 @@ struct fort_row;
typedef struct fort_row fort_row_t;
fort_row_t * create_row(void);
fort_row_t *create_row(void);
void destroy_row(fort_row_t *row);
fort_row_t * create_row_from_string(const char *str);
fort_row_t* create_row_from_fmt_string(const char* fmt, va_list *va_args);
fort_row_t *create_row_from_string(const char *str);
fort_row_t *create_row_from_fmt_string(const char *fmt, va_list *va_args);
size_t columns_in_row(const fort_row_t *row);
@ -32,10 +32,10 @@ int get_row_cell_types(const fort_row_t *row, enum CellType *types, size_t types
fort_status_t row_set_cell_span(fort_row_t *row, size_t cell_column, size_t hor_span);
int print_row_separator(char *buffer, size_t buffer_sz,
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
@ -44,19 +44,19 @@ int print_row_separator(char *buffer, size_t buffer_sz,
int snprintf_row(const fort_row_t *row, char *buffer, size_t buf_sz, size_t *col_width_arr, size_t col_width_arr_sz,
size_t row_height, const context_t *context);
size_t row_height, const context_t *context);
#ifdef FT_HAVE_WCHAR
fort_row_t *create_row_from_wstring(const wchar_t *str);
fort_row_t* create_row_from_fmt_wstring(const wchar_t* fmt, va_list *va_args);
fort_row_t *create_row_from_fmt_wstring(const wchar_t *fmt, va_list *va_args);
int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
const size_t *col_width_arr, size_t cols,
const fort_row_t *upper_row, const fort_row_t *lower_row,
enum HorSeparatorPos separatorPos, const separator_t *sep,
const context_t *context);
int wsnprintf_row(const fort_row_t *row, wchar_t *buffer, size_t buf_sz, size_t *col_width_arr, size_t col_width_arr_sz,
size_t row_height, const context_t *context);
size_t row_height, const context_t *context);
#endif

View File

@ -7,26 +7,24 @@
/*****************************************************************************
* STRING BUFFER
* ***************************************************************************/
enum str_buf_type
{
enum str_buf_type {
CharBuf,
WCharBuf
};
struct string_buffer;
typedef struct string_buffer string_buffer_t;
struct string_buffer
{
struct string_buffer {
union {
char *cstr;
wchar_t *wstr;
void *data;
}str;
} str;
size_t data_sz;
enum str_buf_type type;
};
string_buffer_t* create_string_buffer(size_t number_of_chars, enum str_buf_type type);
string_buffer_t *create_string_buffer(size_t number_of_chars, enum str_buf_type type);
void destroy_string_buffer(string_buffer_t *buffer);
fort_status_t realloc_string_buffer_without_copy(string_buffer_t *buffer);

View File

@ -5,8 +5,7 @@
struct ft_table;
typedef struct ft_table ft_table_t;
struct ft_table
{
struct ft_table {
vector_t *rows;
fort_table_options_t *options;
string_buffer_t *conv_buffer;
@ -39,13 +38,13 @@ fort_row_t *get_row(ft_table_t *table, size_t row);
const fort_row_t *get_row_c(const ft_table_t *table, size_t row);
fort_row_t *get_row_and_create_if_not_exists(ft_table_t *table, size_t row);
string_buffer_t * get_cur_str_buffer_and_create_if_not_exists(ft_table_t * table);
string_buffer_t *get_cur_str_buffer_and_create_if_not_exists(ft_table_t *table);
fort_status_t table_rows_and_cols_geometry(const ft_table_t *table,
size_t **col_width_arr_p, size_t *col_width_arr_sz,
size_t **row_height_arr_p, size_t *row_height_arr_sz);
size_t **col_width_arr_p, size_t *col_width_arr_sz,
size_t **row_height_arr_p, size_t *row_height_arr_sz);
fort_status_t table_geometry(const ft_table_t *table, size_t *height, size_t *width);
#endif /* TABLE_H */

View File

@ -13,19 +13,19 @@ typedef struct vector vector_t;
#define INVALID_VEC_INDEX ((size_t) -1)
extern vector_t* create_vector(size_t item_size, size_t capacity);
extern void destroy_vector(vector_t*);
extern vector_t* copy_vector(vector_t*);
extern vector_t *create_vector(size_t item_size, size_t capacity);
extern void destroy_vector(vector_t *);
extern vector_t *copy_vector(vector_t *);
extern size_t vector_size(const vector_t*);
extern size_t vector_capacity(const vector_t*);
extern size_t vector_index_of(const vector_t*, const void *item);
extern size_t vector_size(const vector_t *);
extern size_t vector_capacity(const vector_t *);
extern size_t vector_index_of(const vector_t *, const void *item);
extern int vector_push(vector_t*, const void *item);
extern int vector_erase(vector_t*, size_t index);
extern void vector_clear(vector_t*);
extern int vector_push(vector_t *, const void *item);
extern int vector_erase(vector_t *, size_t index);
extern void vector_clear(vector_t *);
extern const void *vector_at_c(const vector_t *vector, size_t index);
extern void* vector_at(vector_t*, size_t index);
extern void *vector_at(vector_t *, size_t index);
extern fort_status_t vector_swap(vector_t *cur_vec, vector_t *mv_vec, size_t pos);

View File

@ -34,8 +34,7 @@ void test_table_cell_options(void);
void test_table_tbl_options(void);
void test_memory_errors(void);
struct test_case
{
struct test_case {
char name [128];
void (*test)(void);
};