[A] Added debug info

This commit is contained in:
seleznevae 2018-05-06 18:50:19 +03:00
parent 1c86313069
commit c3e605354f
3 changed files with 24 additions and 12 deletions

View File

@ -21,6 +21,18 @@ static ft_table_t *create_basic_table(void)
return table; return table;
} }
void print_char_str(const char *str)
{
printf("Char_repr:\n");
while (*str) {
if (*str == '\n')
printf("\n");
printf("%x", (unsigned)*str);
str++;
}
}
int main(void) int main(void)
{ {
int result = 0; int result = 0;
@ -101,61 +113,73 @@ int main(void)
ft_set_default_border_style(FT_BASIC_STYLE); ft_set_default_border_style(FT_BASIC_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_SIMPLE_STYLE); ft_set_default_border_style(FT_SIMPLE_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_PLAIN_STYLE); ft_set_default_border_style(FT_PLAIN_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_DOT_STYLE); ft_set_default_border_style(FT_DOT_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_EMPTY_STYLE); ft_set_default_border_style(FT_EMPTY_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_SOLID_STYLE); ft_set_default_border_style(FT_SOLID_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_SOLID_ROUND_STYLE); ft_set_default_border_style(FT_SOLID_ROUND_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_DOUBLE_STYLE); ft_set_default_border_style(FT_DOUBLE_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_DOUBLE2_STYLE); ft_set_default_border_style(FT_DOUBLE2_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_BOLD_STYLE); ft_set_default_border_style(FT_BOLD_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_BOLD2_STYLE); ft_set_default_border_style(FT_BOLD2_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
ft_set_default_border_style(FT_FRAME_STYLE); ft_set_default_border_style(FT_FRAME_STYLE);
table = create_basic_table(); table = create_basic_table();
printf("Table:\n%s\n", ft_to_string(table)); printf("Table:\n%s\n", ft_to_string(table));
print_char_str(ft_to_string(table));
ft_destroy_table(table); ft_destroy_table(table);
/* Debug */ /* Debug */

View File

@ -2071,11 +2071,9 @@ int ft_table_wwrite_ln(ft_table_t *table, size_t rows, size_t cols, const wchar_
const char *ft_to_string(const ft_table_t *table) const char *ft_to_string(const ft_table_t *table)
{ {
typedef char char_type; typedef char char_type;
// const char_type *empty_string = "";
const enum str_buf_type buf_type = CharBuf; const enum str_buf_type buf_type = CharBuf;
const char *space_char = " "; const char *space_char = " ";
const char *new_line_char = "\n"; const char *new_line_char = "\n";
#define cur_F_STRDUP F_STRDUP
#define EMPTY_STRING "" #define EMPTY_STRING ""
int (*snprintf_row_)(const fort_row_t *, char *, size_t, size_t *, size_t, size_t, const context_t *) = snprintf_row; int (*snprintf_row_)(const fort_row_t *, char *, size_t, size_t *, size_t, size_t, const context_t *) = snprintf_row;
int (*print_row_separator_)(char *, size_t, int (*print_row_separator_)(char *, size_t,
@ -2166,7 +2164,6 @@ clear:
F_FREE(row_height_arr); F_FREE(row_height_arr);
// F_FREE(buffer); // F_FREE(buffer);
return NULL; return NULL;
#undef cur_F_STRDUP
#undef EMPTY_STRING #undef EMPTY_STRING
} }
@ -2176,11 +2173,9 @@ clear:
const wchar_t *ft_to_wstring(const ft_table_t *table) const wchar_t *ft_to_wstring(const ft_table_t *table)
{ {
typedef wchar_t char_type; typedef wchar_t char_type;
// const char_type *empty_string = L"";
const enum str_buf_type buf_type = WCharBuf; const enum str_buf_type buf_type = WCharBuf;
const char *space_char = " "; const char *space_char = " ";
const char *new_line_char = "\n"; const char *new_line_char = "\n";
#define cur_F_STRDUP F_WCSDUP
#define EMPTY_STRING L"" #define EMPTY_STRING L""
int (*snprintf_row_)(const fort_row_t *, wchar_t *, size_t, size_t *, size_t, size_t, const context_t *) = wsnprintf_row; int (*snprintf_row_)(const fort_row_t *, wchar_t *, size_t, size_t *, size_t, size_t, const context_t *) = wsnprintf_row;
int (*print_row_separator_)(wchar_t *, size_t, int (*print_row_separator_)(wchar_t *, size_t,
@ -2273,7 +2268,6 @@ clear:
F_FREE(row_height_arr); F_FREE(row_height_arr);
// F_FREE(buffer); // F_FREE(buffer);
return NULL; return NULL;
#undef cur_F_STRDUP
#undef EMPTY_STRING #undef EMPTY_STRING
} }

View File

@ -535,11 +535,9 @@ int ft_table_wwrite_ln(ft_table_t *table, size_t rows, size_t cols, const wchar_
const char *ft_to_string(const ft_table_t *table) const char *ft_to_string(const ft_table_t *table)
{ {
typedef char char_type; typedef char char_type;
// const char_type *empty_string = "";
const enum str_buf_type buf_type = CharBuf; const enum str_buf_type buf_type = CharBuf;
const char *space_char = " "; const char *space_char = " ";
const char *new_line_char = "\n"; const char *new_line_char = "\n";
#define cur_F_STRDUP F_STRDUP
#define EMPTY_STRING "" #define EMPTY_STRING ""
int (*snprintf_row_)(const fort_row_t *, char *, size_t, size_t *, size_t, size_t, const context_t *) = snprintf_row; int (*snprintf_row_)(const fort_row_t *, char *, size_t, size_t *, size_t, size_t, const context_t *) = snprintf_row;
int (*print_row_separator_)(char *, size_t, int (*print_row_separator_)(char *, size_t,
@ -630,7 +628,6 @@ clear:
F_FREE(row_height_arr); F_FREE(row_height_arr);
// F_FREE(buffer); // F_FREE(buffer);
return NULL; return NULL;
#undef cur_F_STRDUP
#undef EMPTY_STRING #undef EMPTY_STRING
} }
@ -640,11 +637,9 @@ clear:
const wchar_t *ft_to_wstring(const ft_table_t *table) const wchar_t *ft_to_wstring(const ft_table_t *table)
{ {
typedef wchar_t char_type; typedef wchar_t char_type;
// const char_type *empty_string = L"";
const enum str_buf_type buf_type = WCharBuf; const enum str_buf_type buf_type = WCharBuf;
const char *space_char = " "; const char *space_char = " ";
const char *new_line_char = "\n"; const char *new_line_char = "\n";
#define cur_F_STRDUP F_WCSDUP
#define EMPTY_STRING L"" #define EMPTY_STRING L""
int (*snprintf_row_)(const fort_row_t *, wchar_t *, size_t, size_t *, size_t, size_t, const context_t *) = wsnprintf_row; int (*snprintf_row_)(const fort_row_t *, wchar_t *, size_t, size_t *, size_t, size_t, const context_t *) = wsnprintf_row;
int (*print_row_separator_)(wchar_t *, size_t, int (*print_row_separator_)(wchar_t *, size_t,
@ -737,7 +732,6 @@ clear:
F_FREE(row_height_arr); F_FREE(row_height_arr);
// F_FREE(buffer); // F_FREE(buffer);
return NULL; return NULL;
#undef cur_F_STRDUP
#undef EMPTY_STRING #undef EMPTY_STRING
} }