[A] Added more symbols to border char set

This commit is contained in:
seleznevae 2018-11-02 16:00:58 +03:00
parent c45abff7c3
commit c89587b5aa
7 changed files with 248 additions and 74 deletions

View File

@ -405,7 +405,25 @@ fort_status_t set_default_cell_option(uint32_t option, int value);
*****************************************************************************/ *****************************************************************************/
/* /*
* TL TT TT TT TV TT TT TT TV TB TB TB TR <----- TopSeparator * TL TT TT TT TV TT TT TT TT TT TT TT TR
* LL IV RR
* LL IV RR
* LH IH IH IH II IH IH IH TI IH IH IH RH
* LL IV IV RR
* LL IV IV RR
* LL LI IH IH IH RI RH
* LL IV IV RR
* LL IV IV RR
* LH IH IH IH BI IH IH IH II IH IH IH RH
* LL IV RR
* LL IV RR
* BL BB BB BB BV BB BB BB BV BB BB BB BR
*/
/*
* TL TT TT TT TV TT TT TT TV TT TT TT TR <----- TopSeparator
* LL IV IV RR * LL IV IV RR
* LH IH IH IH II IH IH IH II IH IH IH RH <----- InsideSeparator * LH IH IH IH II IH IH IH II IH IH IH RH <----- InsideSeparator
* LL IV IV RR * LL IV IV RR
@ -438,6 +456,11 @@ enum BorderItemPos {
BV_bip = 13, BV_bip = 13,
BR_bip = 14, BR_bip = 14,
LI_bip = 15,
TI_bip = 16,
RI_bip = 17,
BI_bip = 18,
BorderItemPosSize BorderItemPosSize
}; };
@ -929,14 +952,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -944,20 +969,22 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
}, \ }, \
} }
#define BASIC2_STYLE { \ #define BASIC2_STYLE { \
/* border_chars */ \ /* border_chars */ \
{ \ { \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -971,14 +998,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
" ", "-", " ", " ", \ " ", "-", " ", " ", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -992,14 +1021,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
" ", "-", "-", " ", \ " ", "-", "-", " ", \
" ", " ", " ", \ " ", " ", " ", \
" ", "-", "-", " ", \ " ", "-", "-", " ", \
" ", "-", "-", " " \ " ", "-", "-", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1013,14 +1044,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
".", ".", ".", ".", \ ".", ".", ".", ".", \
":", ":", ":", \ ":", ":", ":", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
":", ".", ":", ":" \ ":", ".", ":", ":", \
"+", "+", "+", "+", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
".", ".", ".", ".", \ ".", ".", ".", ".", \
":", ":", ":", \ ":", ":", ":", \
":", ".", ":", ":", \ ":", ".", ":", ":", \
":", ".", ":", ":" \ ":", ".", ":", ":", \
"+", "+", "+", "+", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1034,14 +1067,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1050,20 +1085,22 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
} }
#define SOLID_STYLE { \ #define SOLID_STYLE { \
/* border_chars */ \ /* border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1077,14 +1114,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1099,14 +1138,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1115,20 +1156,22 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
} }
#define DOUBLE2_STYLE { \ #define DOUBLE2_STYLE { \
/* border_chars */ \ /* border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1143,14 +1186,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1164,14 +1209,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -1185,14 +1232,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "" \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -2493,6 +2542,8 @@ static void set_border_options_for_options(fort_table_options_t *options, const
BOR_CHARS[BL_bip] = BOR_CHARS[BV_bip] = BOR_CHARS[BR_bip] = border_chs->out_intersect_ch; BOR_CHARS[BL_bip] = BOR_CHARS[BV_bip] = BOR_CHARS[BR_bip] = border_chs->out_intersect_ch;
BOR_CHARS[II_bip] = border_chs->in_intersect_ch; BOR_CHARS[II_bip] = border_chs->in_intersect_ch;
BOR_CHARS[LI_bip] = BOR_CHARS[TI_bip] = BOR_CHARS[RI_bip] = BOR_CHARS[BI_bip] = border_chs->in_intersect_ch;
// if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') { // if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') {
// BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0'; // BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0';
// } // }
@ -2511,6 +2562,8 @@ static void set_border_options_for_options(fort_table_options_t *options, const
H_BOR_CHARS[BL_bip] = H_BOR_CHARS[BV_bip] = H_BOR_CHARS[BR_bip] = header_border_chs->out_intersect_ch; H_BOR_CHARS[BL_bip] = H_BOR_CHARS[BV_bip] = H_BOR_CHARS[BR_bip] = header_border_chs->out_intersect_ch;
H_BOR_CHARS[II_bip] = header_border_chs->in_intersect_ch; H_BOR_CHARS[II_bip] = header_border_chs->in_intersect_ch;
H_BOR_CHARS[LI_bip] = H_BOR_CHARS[TI_bip] = H_BOR_CHARS[RI_bip] = H_BOR_CHARS[BI_bip] = header_border_chs->in_intersect_ch;
// if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') { // if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') {
// H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0'; // H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0';
// } // }
@ -3972,8 +4025,10 @@ int print_row_separator(char *buffer, size_t buffer_sz,
IV = &(*border_chars)[II_bip]; IV = &(*border_chars)[II_bip];
R = &(*border_chars)[RH_bip]; R = &(*border_chars)[RH_bip];
IT = &(*border_chars)[TV_bip]; // IT = &(*border_chars)[TV_bip];
IB = &(*border_chars)[BV_bip]; // IB = &(*border_chars)[BV_bip];
IT = &(*border_chars)[TI_bip];
IB = &(*border_chars)[BI_bip];
II = &(*border_chars)[IH_bip]; II = &(*border_chars)[IH_bip];
break; break;
case BottomSeparator: case BottomSeparator:
@ -4145,8 +4200,10 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
IV = &(*border_chars)[II_bip]; IV = &(*border_chars)[II_bip];
R = &(*border_chars)[RH_bip]; R = &(*border_chars)[RH_bip];
IT = &(*border_chars)[TV_bip]; // IT = &(*border_chars)[TV_bip];
IB = &(*border_chars)[BV_bip]; // IB = &(*border_chars)[BV_bip];
IT = &(*border_chars)[TI_bip];
IB = &(*border_chars)[BI_bip];
II = &(*border_chars)[IH_bip]; II = &(*border_chars)[IH_bip];
break; break;
case BottomSeparator: case BottomSeparator:

View File

@ -846,6 +846,8 @@ static void set_border_options_for_options(fort_table_options_t *options, const
BOR_CHARS[BL_bip] = BOR_CHARS[BV_bip] = BOR_CHARS[BR_bip] = border_chs->out_intersect_ch; BOR_CHARS[BL_bip] = BOR_CHARS[BV_bip] = BOR_CHARS[BR_bip] = border_chs->out_intersect_ch;
BOR_CHARS[II_bip] = border_chs->in_intersect_ch; BOR_CHARS[II_bip] = border_chs->in_intersect_ch;
BOR_CHARS[LI_bip] = BOR_CHARS[TI_bip] = BOR_CHARS[RI_bip] = BOR_CHARS[BI_bip] = border_chs->in_intersect_ch;
// if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') { // if (border_chs->separator_ch == '\0' && border_chs->in_intersect_ch == '\0') {
// BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0'; // BOR_CHARS[LH_bip] = BOR_CHARS[RH_bip] = '\0';
// } // }
@ -864,6 +866,8 @@ static void set_border_options_for_options(fort_table_options_t *options, const
H_BOR_CHARS[BL_bip] = H_BOR_CHARS[BV_bip] = H_BOR_CHARS[BR_bip] = header_border_chs->out_intersect_ch; H_BOR_CHARS[BL_bip] = H_BOR_CHARS[BV_bip] = H_BOR_CHARS[BR_bip] = header_border_chs->out_intersect_ch;
H_BOR_CHARS[II_bip] = header_border_chs->in_intersect_ch; H_BOR_CHARS[II_bip] = header_border_chs->in_intersect_ch;
H_BOR_CHARS[LI_bip] = H_BOR_CHARS[TI_bip] = H_BOR_CHARS[RI_bip] = H_BOR_CHARS[BI_bip] = header_border_chs->in_intersect_ch;
// if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') { // if (header_border_chs->separator_ch == '\0' && header_border_chs->in_intersect_ch == '\0') {
// H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0'; // H_BOR_CHARS[LH_bip] = H_BOR_CHARS[RH_bip] = '\0';
// } // }

View File

@ -214,14 +214,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -229,20 +231,22 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
}, \ }, \
} }
#define BASIC2_STYLE { \ #define BASIC2_STYLE { \
/* border_chars */ \ /* border_chars */ \
{ \ { \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"|", "|", "|", \ "|", "|", "|", \
"+", "-", "+", "+", \ "+", "-", "+", "+", \
"+", "-", "+", "+" \ "+", "-", "+", "+", \
"+", "+", "+", "+", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -256,14 +260,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
" ", "-", " ", " ", \ " ", "-", " ", " ", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -277,14 +283,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
" ", "-", "-", " ", \ " ", "-", "-", " ", \
" ", " ", " ", \ " ", " ", " ", \
" ", "-", "-", " ", \ " ", "-", "-", " ", \
" ", "-", "-", " " \ " ", "-", "-", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -298,14 +306,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
".", ".", ".", ".", \ ".", ".", ".", ".", \
":", ":", ":", \ ":", ":", ":", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
":", ".", ":", ":" \ ":", ".", ":", ":", \
"+", "+", "+", "+", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
".", ".", ".", ".", \ ".", ".", ".", ".", \
":", ":", ":", \ ":", ":", ":", \
":", ".", ":", ":", \ ":", ".", ":", ":", \
":", ".", ":", ":" \ ":", ".", ":", ":", \
"+", "+", "+", "+", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -319,14 +329,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
" ", " ", " ", " ", \ " ", " ", " ", " ", \
" ", " ", " ", \ " ", " ", " ", \
"\0", "\0", "\0", "\0", \ "\0", "\0", "\0", "\0", \
" ", " ", " ", " " \ " ", " ", " ", " ", \
" ", " ", " ", " ", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -335,20 +347,22 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
} }
#define SOLID_STYLE { \ #define SOLID_STYLE { \
/* border_chars */ \ /* border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -362,14 +376,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -384,14 +400,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -400,20 +418,22 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
} }
#define DOUBLE2_STYLE { \ #define DOUBLE2_STYLE { \
/* border_chars */ \ /* border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -428,14 +448,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -449,14 +471,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \
@ -470,14 +494,16 @@ fort_status_t set_default_cell_option(uint32_t option, int value)
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "" \
}, \ }, \
/* header_border_chars */ \ /* header_border_chars */ \
{ \ { \
"", "", "", "", \ "", "", "", "", \
"", "", "", \ "", "", "", \
"", "", "", "", \ "", "", "", "", \
"", "", "", "" \ "", "", "", "", \
"", "", "", "", \
}, \ }, \
/* separator_chars */ \ /* separator_chars */ \
{ \ { \

View File

@ -52,7 +52,25 @@ fort_status_t set_default_cell_option(uint32_t option, int value);
*****************************************************************************/ *****************************************************************************/
/* /*
* TL TT TT TT TV TT TT TT TV TB TB TB TR <----- TopSeparator * TL TT TT TT TV TT TT TT TT TT TT TT TR
* LL IV RR
* LL IV RR
* LH IH IH IH II IH IH IH TI IH IH IH RH
* LL IV IV RR
* LL IV IV RR
* LL LI IH IH IH RI RH
* LL IV IV RR
* LL IV IV RR
* LH IH IH IH BI IH IH IH II IH IH IH RH
* LL IV RR
* LL IV RR
* BL BB BB BB BV BB BB BB BV BB BB BB BR
*/
/*
* TL TT TT TT TV TT TT TT TV TT TT TT TR <----- TopSeparator
* LL IV IV RR * LL IV IV RR
* LH IH IH IH II IH IH IH II IH IH IH RH <----- InsideSeparator * LH IH IH IH II IH IH IH II IH IH IH RH <----- InsideSeparator
* LL IV IV RR * LL IV IV RR
@ -85,6 +103,11 @@ enum BorderItemPos {
BV_bip = 13, BV_bip = 13,
BR_bip = 14, BR_bip = 14,
LI_bip = 15,
TI_bip = 16,
RI_bip = 17,
BI_bip = 18,
BorderItemPosSize BorderItemPosSize
}; };

View File

@ -306,8 +306,10 @@ int print_row_separator(char *buffer, size_t buffer_sz,
IV = &(*border_chars)[II_bip]; IV = &(*border_chars)[II_bip];
R = &(*border_chars)[RH_bip]; R = &(*border_chars)[RH_bip];
IT = &(*border_chars)[TV_bip]; // IT = &(*border_chars)[TV_bip];
IB = &(*border_chars)[BV_bip]; // IB = &(*border_chars)[BV_bip];
IT = &(*border_chars)[TI_bip];
IB = &(*border_chars)[BI_bip];
II = &(*border_chars)[IH_bip]; II = &(*border_chars)[IH_bip];
break; break;
case BottomSeparator: case BottomSeparator:
@ -479,8 +481,10 @@ int wprint_row_separator(wchar_t *buffer, size_t buffer_sz,
IV = &(*border_chars)[II_bip]; IV = &(*border_chars)[II_bip];
R = &(*border_chars)[RH_bip]; R = &(*border_chars)[RH_bip];
IT = &(*border_chars)[TV_bip]; // IT = &(*border_chars)[TV_bip];
IB = &(*border_chars)[BV_bip]; // IB = &(*border_chars)[BV_bip];
IT = &(*border_chars)[TI_bip];
IB = &(*border_chars)[BI_bip];
II = &(*border_chars)[IH_bip]; II = &(*border_chars)[IH_bip];
break; break;
case BottomSeparator: case BottomSeparator:

View File

@ -492,4 +492,64 @@ void test_table_cell_options(void)
assert_str_equal(table_str, table_str_etalon); assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table); ft_destroy_table(table);
} }
WHEN("Cells with spans in common and header cells") {
set_test_options_as_default();
table = ft_create_table();
ft_set_border_style(table, FT_DOUBLE2_STYLE);
int n = ft_set_cell_span(table, 0, 0, 2);
assert_true(n == FT_SUCCESS);
n = ft_set_cell_span(table, 0, 2, 3);
assert_true(n == FT_SUCCESS);
n = ft_set_cell_span(table, 1, 1, 3);
assert_true(n == FT_SUCCESS);
n = ft_set_cell_option(table, 0, FT_ANY_COLUMN, FT_COPT_ROW_TYPE, FT_ROW_HEADER);
assert_true(n == FT_SUCCESS);
n = ft_write_ln(table, "111", "2222", "33333", "444444", "55555555");
assert_true(n == FT_SUCCESS);
n = ft_write_ln(table, "2222", "33333", "444444", "55555555", "111");
assert_true(n == FT_SUCCESS);
n = ft_write_ln(table, "33333", "444444", "55555555", "111", "2222");
assert_true(n == FT_SUCCESS);
n = ft_write_ln(table, "2222", "33333", "444444", "55555555", "111");
assert_true(n == FT_SUCCESS);
n = ft_write_ln(table, "2222", "33333", "444444", "55555555", "111");
assert_true(n == FT_SUCCESS);
n = ft_set_cell_span(table, 4, 3, 2);
assert_true(n == FT_SUCCESS);
const char *table_str = ft_to_string(table);
assert_true(table_str != NULL);
const char *table_str_etalon =
"╔════════════════╤════════════════════════════╗\n"
"║ │ ║\n"
"║ 111 │ 33333 ║\n"
"║ │ ║\n"
"╠═══════╤════════╧═════════════════════╤══════╣\n"
"║ │ │ ║\n"
"║ 2222 │ 33333 │ 111 ║\n"
"║ │ │ ║\n"
"╟───────┼────────┬──────────┬──────────┼──────╢\n"
"║ │ │ │ │ ║\n"
"║ 33333 │ 444444 │ 55555555 │ 111 │ 2222 ║\n"
"║ │ │ │ │ ║\n"
"╟───────┼────────┼──────────┼──────────┼──────╢\n"
"║ │ │ │ │ ║\n"
"║ 2222 │ 33333 │ 444444 │ 55555555 │ 111 ║\n"
"║ │ │ │ │ ║\n"
"╟───────┼────────┼──────────┼──────────┴──────╢\n"
"║ │ │ │ ║\n"
"║ 2222 │ 33333 │ 444444 │ 55555555 ║\n"
"║ │ │ │ ║\n"
"╚═══════╧════════╧══════════╧═════════════════╝\n";
assert_str_equal(table_str, table_str_etalon);
ft_destroy_table(table);
}
} }

View File

@ -50,8 +50,8 @@ struct test_case {
if (strcmp(str1, str2) != 0) \ if (strcmp(str1, str2) != 0) \
{ \ { \
fprintf(stderr, "%s:%d(%s):Abort! Not equals strings:\n",__FILE__,__LINE__, __func__); \ fprintf(stderr, "%s:%d(%s):Abort! Not equals strings:\n",__FILE__,__LINE__, __func__); \
fprintf(stderr, "Left string:\n%s\n", str1); \ fprintf(stderr, "Left string(len = %d):\n%s\n", (int)strlen(str1), str1); \
fprintf(stderr, "Right string:\n%s\n", str2); \ fprintf(stderr, "Right string(len = %d):\n%s\n", (int)strlen(str2), str2); \
exit(EXIT_FAILURE); \ exit(EXIT_FAILURE); \
} }
@ -60,8 +60,8 @@ struct test_case {
{ \ { \
fprintf(stderr, "%s:%d(%s):Abort! Not equals strings:\n",__FILE__,__LINE__, __func__); \ fprintf(stderr, "%s:%d(%s):Abort! Not equals strings:\n",__FILE__,__LINE__, __func__); \
setlocale(LC_CTYPE, ""); \ setlocale(LC_CTYPE, ""); \
fwprintf(stdout, L"Left string:\n%ls\n", str1); \ fwprintf(stdout, L"Left string(len = %d):\n%ls\n", (int)wcslen(str1), str1); \
fwprintf(stdout, L"Right string:\n%ls\n", str2); \ fwprintf(stdout, L"Right string(len = %d):\n%ls\n", (int)wcslen(str2), str2); \
fflush(stdout); \ fflush(stdout); \
exit(EXIT_FAILURE); \ exit(EXIT_FAILURE); \
} }