[F] Fixed code style issues
This commit is contained in:
@@ -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 */
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
||||
|
||||
|
||||
|
28
src/row.h
28
src/row.h
@@ -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
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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 */
|
||||
|
20
src/vector.h
20
src/vector.h
@@ -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);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user