[C] Made some internal functions static
This commit is contained in:
parent
67a7331770
commit
db5783cdcc
@ -34,6 +34,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
/* The file was GENERATED by an amalgamation script.*/
|
/* The file was GENERATED by an amalgamation script.*/
|
||||||
/* DO NOT EDIT BY HAND!!! */\n\n
|
/* DO NOT EDIT BY HAND!!! */\n\n
|
||||||
|
#define FT_AMALGAMED_SOURCE /* Macros to make internal libfort functions static */\n
|
||||||
""")
|
""")
|
||||||
|
|
||||||
for hdr_file in config["header_files"]:
|
for hdr_file in config["header_files"]:
|
||||||
|
78
lib/fort.c
78
lib/fort.c
@ -28,6 +28,8 @@ SOFTWARE.
|
|||||||
/* DO NOT EDIT BY HAND!!! */
|
/* DO NOT EDIT BY HAND!!! */
|
||||||
|
|
||||||
|
|
||||||
|
#define FT_AMALGAMED_SOURCE /* Macros to make internal libfort functions static */
|
||||||
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
Begin of file "fort_utils.h"
|
Begin of file "fort_utils.h"
|
||||||
@ -47,6 +49,14 @@ SOFTWARE.
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "fort.h"
|
#include "fort.h"
|
||||||
|
|
||||||
|
/* Define FT_INTERNAL to make internal libfort functions static
|
||||||
|
* in the result amalgamed source file.
|
||||||
|
*/
|
||||||
|
#ifdef FT_AMALGAMED_SOURCE
|
||||||
|
#define FT_INTERNAL static
|
||||||
|
#else
|
||||||
|
#define FT_INTERNAL
|
||||||
|
#endif /* FT_AMALGAMED_SORCE */
|
||||||
|
|
||||||
|
|
||||||
#define FORT_COL_SEPARATOR '|'
|
#define FORT_COL_SEPARATOR '|'
|
||||||
@ -466,37 +476,39 @@ void destroy_table_options(fort_table_options_t *options);
|
|||||||
|
|
||||||
/* #include "fort_utils.h" */ /* Commented by amalgamation script */
|
/* #include "fort_utils.h" */ /* Commented by amalgamation script */
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* CELL
|
|
||||||
* ***************************************************************************/
|
|
||||||
fort_cell_t *create_cell(void);
|
fort_cell_t *create_cell(void);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void destroy_cell(fort_cell_t *cell);
|
void destroy_cell(fort_cell_t *cell);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context);
|
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context);
|
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void set_cell_type(fort_cell_t *cell, enum CellType type);
|
void set_cell_type(fort_cell_t *cell, enum CellType type);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
enum CellType get_cell_type(const fort_cell_t *cell);
|
enum CellType get_cell_type(const fort_cell_t *cell);
|
||||||
|
|
||||||
/*
|
FT_INTERNAL
|
||||||
* Returns number of lines in cell. If cell is empty or
|
|
||||||
* contains empty string, then 0 is returned.
|
|
||||||
*/
|
|
||||||
/* static int lines_number_cell(fort_cell_t *cell); */
|
|
||||||
|
|
||||||
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context);
|
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str);
|
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str);
|
||||||
|
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
|
FT_INTERNAL
|
||||||
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context);
|
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str);
|
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
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 */
|
#endif /* CELL_H */
|
||||||
@ -4922,15 +4934,12 @@ int mk_wcswidth_cjk(const wchar_t *pwcs, size_t n)
|
|||||||
/* #include "string_buffer.h" */ /* Commented by amalgamation script */
|
/* #include "string_buffer.h" */ /* Commented by amalgamation script */
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* CELL
|
|
||||||
* ***************************************************************************/
|
|
||||||
|
|
||||||
struct fort_cell {
|
struct fort_cell {
|
||||||
string_buffer_t *str_buffer;
|
string_buffer_t *str_buffer;
|
||||||
enum CellType cell_type;
|
enum CellType cell_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_cell_t *create_cell(void)
|
fort_cell_t *create_cell(void)
|
||||||
{
|
{
|
||||||
fort_cell_t *cell = (fort_cell_t *)F_CALLOC(sizeof(fort_cell_t), 1);
|
fort_cell_t *cell = (fort_cell_t *)F_CALLOC(sizeof(fort_cell_t), 1);
|
||||||
@ -4945,6 +4954,7 @@ fort_cell_t *create_cell(void)
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void destroy_cell(fort_cell_t *cell)
|
void destroy_cell(fort_cell_t *cell)
|
||||||
{
|
{
|
||||||
if (cell == NULL)
|
if (cell == NULL)
|
||||||
@ -4953,12 +4963,14 @@ void destroy_cell(fort_cell_t *cell)
|
|||||||
F_FREE(cell);
|
F_FREE(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void set_cell_type(fort_cell_t *cell, enum CellType type)
|
void set_cell_type(fort_cell_t *cell, enum CellType type)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
cell->cell_type = type;
|
cell->cell_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
enum CellType get_cell_type(const fort_cell_t *cell)
|
enum CellType get_cell_type(const fort_cell_t *cell)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
@ -4966,6 +4978,7 @@ enum CellType get_cell_type(const fort_cell_t *cell)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context)
|
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context)
|
||||||
{
|
{
|
||||||
/* todo:
|
/* todo:
|
||||||
@ -4985,6 +4998,7 @@ size_t hint_width_cell(const fort_cell_t *cell, const context_t *context)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context)
|
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
@ -5001,28 +5015,7 @@ size_t hint_height_cell(const fort_cell_t *cell, const context_t *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
FT_INTERNAL
|
||||||
* Returns number of lines in cell. If cell is empty or
|
|
||||||
* contains empty string, then 0 is returned.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
static int lines_number_cell(fort_cell_t *cell)
|
|
||||||
{
|
|
||||||
assert(cell);
|
|
||||||
if (cell->str_buffer == NULL || cell->str_buffer->str == NULL || cell->str_buffer->str[0] == '\0') {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = 0;
|
|
||||||
char *pos = cell->str_buffer->str;
|
|
||||||
while ((pos = strchr(pos, '\n')) != NULL) {
|
|
||||||
result++;
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
return result + 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context)
|
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context)
|
||||||
{
|
{
|
||||||
const char *space_char = " ";
|
const char *space_char = " ";
|
||||||
@ -5068,6 +5061,7 @@ clear:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
|
FT_INTERNAL
|
||||||
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context)
|
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context)
|
||||||
{
|
{
|
||||||
const char *space_char = " ";
|
const char *space_char = " ";
|
||||||
@ -5112,7 +5106,7 @@ clear:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str)
|
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str)
|
||||||
{
|
{
|
||||||
assert(str);
|
assert(str);
|
||||||
@ -5122,6 +5116,7 @@ fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str)
|
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str)
|
||||||
{
|
{
|
||||||
assert(str);
|
assert(str);
|
||||||
@ -5132,6 +5127,7 @@ fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
string_buffer_t *cell_get_string_buffer(fort_cell_t *cell)
|
string_buffer_t *cell_get_string_buffer(fort_cell_t *cell)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
|
38
src/cell.c
38
src/cell.c
@ -3,15 +3,12 @@
|
|||||||
#include "string_buffer.h"
|
#include "string_buffer.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* CELL
|
|
||||||
* ***************************************************************************/
|
|
||||||
|
|
||||||
struct fort_cell {
|
struct fort_cell {
|
||||||
string_buffer_t *str_buffer;
|
string_buffer_t *str_buffer;
|
||||||
enum CellType cell_type;
|
enum CellType cell_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_cell_t *create_cell(void)
|
fort_cell_t *create_cell(void)
|
||||||
{
|
{
|
||||||
fort_cell_t *cell = (fort_cell_t *)F_CALLOC(sizeof(fort_cell_t), 1);
|
fort_cell_t *cell = (fort_cell_t *)F_CALLOC(sizeof(fort_cell_t), 1);
|
||||||
@ -26,6 +23,7 @@ fort_cell_t *create_cell(void)
|
|||||||
return cell;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void destroy_cell(fort_cell_t *cell)
|
void destroy_cell(fort_cell_t *cell)
|
||||||
{
|
{
|
||||||
if (cell == NULL)
|
if (cell == NULL)
|
||||||
@ -34,12 +32,14 @@ void destroy_cell(fort_cell_t *cell)
|
|||||||
F_FREE(cell);
|
F_FREE(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void set_cell_type(fort_cell_t *cell, enum CellType type)
|
void set_cell_type(fort_cell_t *cell, enum CellType type)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
cell->cell_type = type;
|
cell->cell_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
enum CellType get_cell_type(const fort_cell_t *cell)
|
enum CellType get_cell_type(const fort_cell_t *cell)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
@ -47,6 +47,7 @@ enum CellType get_cell_type(const fort_cell_t *cell)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context)
|
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context)
|
||||||
{
|
{
|
||||||
/* todo:
|
/* todo:
|
||||||
@ -66,6 +67,7 @@ size_t hint_width_cell(const fort_cell_t *cell, const context_t *context)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context)
|
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
@ -82,28 +84,7 @@ size_t hint_height_cell(const fort_cell_t *cell, const context_t *context)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
FT_INTERNAL
|
||||||
* Returns number of lines in cell. If cell is empty or
|
|
||||||
* contains empty string, then 0 is returned.
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
static int lines_number_cell(fort_cell_t *cell)
|
|
||||||
{
|
|
||||||
assert(cell);
|
|
||||||
if (cell->str_buffer == NULL || cell->str_buffer->str == NULL || cell->str_buffer->str[0] == '\0') {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int result = 0;
|
|
||||||
char *pos = cell->str_buffer->str;
|
|
||||||
while ((pos = strchr(pos, '\n')) != NULL) {
|
|
||||||
result++;
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
return result + 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context)
|
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context)
|
||||||
{
|
{
|
||||||
const char *space_char = " ";
|
const char *space_char = " ";
|
||||||
@ -149,6 +130,7 @@ clear:
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
|
FT_INTERNAL
|
||||||
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context)
|
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context)
|
||||||
{
|
{
|
||||||
const char *space_char = " ";
|
const char *space_char = " ";
|
||||||
@ -193,7 +175,7 @@ clear:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str)
|
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str)
|
||||||
{
|
{
|
||||||
assert(str);
|
assert(str);
|
||||||
@ -203,6 +185,7 @@ fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str)
|
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str)
|
||||||
{
|
{
|
||||||
assert(str);
|
assert(str);
|
||||||
@ -213,6 +196,7 @@ fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
string_buffer_t *cell_get_string_buffer(fort_cell_t *cell)
|
string_buffer_t *cell_get_string_buffer(fort_cell_t *cell)
|
||||||
{
|
{
|
||||||
assert(cell);
|
assert(cell);
|
||||||
|
30
src/cell.h
30
src/cell.h
@ -3,37 +3,39 @@
|
|||||||
|
|
||||||
#include "fort_utils.h"
|
#include "fort_utils.h"
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* CELL
|
|
||||||
* ***************************************************************************/
|
|
||||||
fort_cell_t *create_cell(void);
|
fort_cell_t *create_cell(void);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void destroy_cell(fort_cell_t *cell);
|
void destroy_cell(fort_cell_t *cell);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context);
|
size_t hint_width_cell(const fort_cell_t *cell, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context);
|
size_t hint_height_cell(const fort_cell_t *cell, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
void set_cell_type(fort_cell_t *cell, enum CellType type);
|
void set_cell_type(fort_cell_t *cell, enum CellType type);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
enum CellType get_cell_type(const fort_cell_t *cell);
|
enum CellType get_cell_type(const fort_cell_t *cell);
|
||||||
|
|
||||||
/*
|
FT_INTERNAL
|
||||||
* Returns number of lines in cell. If cell is empty or
|
|
||||||
* contains empty string, then 0 is returned.
|
|
||||||
*/
|
|
||||||
/* static int lines_number_cell(fort_cell_t *cell); */
|
|
||||||
|
|
||||||
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context);
|
int cell_printf(fort_cell_t *cell, size_t row, char *buf, size_t buf_len, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str);
|
fort_status_t fill_cell_from_string(fort_cell_t *cell, const char *str);
|
||||||
|
|
||||||
#ifdef FT_HAVE_WCHAR
|
#ifdef FT_HAVE_WCHAR
|
||||||
|
FT_INTERNAL
|
||||||
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context);
|
int cell_wprintf(fort_cell_t *cell, size_t row, wchar_t *buf, size_t buf_len, const context_t *context);
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str);
|
fort_status_t fill_cell_from_wstring(fort_cell_t *cell, const wchar_t *str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FT_INTERNAL
|
||||||
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 */
|
#endif /* CELL_H */
|
||||||
|
@ -12,6 +12,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "fort.h"
|
#include "fort.h"
|
||||||
|
|
||||||
|
/* Define FT_INTERNAL to make internal libfort functions static
|
||||||
|
* in the result amalgamed source file.
|
||||||
|
*/
|
||||||
|
#ifdef FT_AMALGAMED_SOURCE
|
||||||
|
#define FT_INTERNAL static
|
||||||
|
#else
|
||||||
|
#define FT_INTERNAL
|
||||||
|
#endif /* FT_AMALGAMED_SORCE */
|
||||||
|
|
||||||
|
|
||||||
#define FORT_COL_SEPARATOR '|'
|
#define FORT_COL_SEPARATOR '|'
|
||||||
|
Loading…
Reference in New Issue
Block a user