Nothing in it depends on level 2.
Move it to level 1, making it available to all level 2 projects.
This renames the structure from fll_color_context to fl_color_context.
Appropriate initializers and memory related macros are renamed accordingly.
extern "C"{
#endif
+#ifndef _di_fl_color_context_
+ typedef struct {
+ f_colors color_list;
+ f_colors_format color_format;
+ f_dynamic_string reset;
+ f_dynamic_string warning;
+ f_dynamic_string error;
+ f_dynamic_string title;
+ f_dynamic_string notable;
+ f_dynamic_string important;
+ f_dynamic_string standout;
+ f_dynamic_string normal;
+ f_dynamic_string normal_reset;
+ } fl_color_context;
+
+ #define fl_color_context_initialize { f_colors_initialize_linux, f_colors_format_initialize_linux, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize }
+
+ #define fl_new_color_context(status, color_context) \
+ f_resize_dynamic_string(status, color_context.reset, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.warning, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.error, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.title, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.notable, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.important, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.standout, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.normal, f_color_max_size + 1); \
+ if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.normal_reset, f_color_max_size + 1);
+
+ #define fl_delete_color_context(status, color_context) \
+ f_delete_dynamic_string(status, color_context.reset); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.warning); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.error); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.title); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.notable); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.important); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.standout); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.normal); \
+ if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.normal_reset);
+
+ #define fl_destroy_color_context(status, color_context, size) \
+ f_destroy_dynamic_string(status, color_context.reset); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.warning, size); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.error, size); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.title, size); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.notable, size); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.important, size); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.standout, size); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.normal); \
+ if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.normal_reset);
+#endif // _di_fl_color_context_
+
#ifndef _di_fl_set_color_
// this will accept some file or standard io, and push color information to that file or standard io
extern f_return_status fl_set_color(f_file_type file, const f_colors_format format, const f_autochar *color1, const f_autochar *color2, const f_autochar *color3, const f_autochar *color4, const f_autochar *color5);
#endif
#ifndef _di_fll_colors_load_context_
- f_return_status fll_colors_load_context(fll_color_context *data, f_bool use_light_colors) {
+ f_return_status fll_colors_load_context(fl_color_context *data, f_bool use_light_colors) {
#ifndef _di_level_2_parameter_checking_
if (data == 0) return f_error_set_error(f_invalid_parameter);
#endif // _di_level_2_parameter_checking_
extern "C"{
#endif
-#ifndef _di_fll_color_context_
- typedef struct {
- f_colors color_list;
- f_colors_format color_format;
- f_dynamic_string reset;
- f_dynamic_string warning;
- f_dynamic_string error;
- f_dynamic_string title;
- f_dynamic_string notable;
- f_dynamic_string important;
- f_dynamic_string standout;
- f_dynamic_string normal;
- f_dynamic_string normal_reset;
- } fll_color_context;
-
- #define fll_color_context_initialize { f_colors_initialize_linux, f_colors_format_initialize_linux, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize, f_dynamic_string_initialize }
-
- #define fll_new_color_context(status, color_context) \
- f_resize_dynamic_string(status, color_context.reset, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.warning, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.error, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.title, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.notable, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.important, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.standout, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.normal, f_color_max_size + 1); \
- if (f_error_is_not_error(status)) f_resize_dynamic_string(status, color_context.normal_reset, f_color_max_size + 1);
-
- #define fll_delete_color_context(status, color_context) \
- f_delete_dynamic_string(status, color_context.reset); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.warning); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.error); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.title); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.notable); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.important); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.standout); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.normal); \
- if (f_error_is_not_error(status)) f_delete_dynamic_string(status, color_context.normal_reset);
-
- #define fll_destroy_color_context(status, color_context, size) \
- f_destroy_dynamic_string(status, color_context.reset); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.warning, size); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.error, size); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.title, size); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.notable, size); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.important, size); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.standout, size); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.normal); \
- if (f_error_is_not_error(status)) f_destroy_dynamic_string(status, color_context.normal_reset);
-#endif // _di_fll_color_context_
-
#ifndef _di_fll_colors_load_context_
// For any application that uses the standard color contexts, this function will load the appropriate colors to the structure
// This will handle the difference betweem xorg terminals and linux consoles
// If you wish to use non-standard colors either redefine this function or don't use it
- extern f_return_status fll_colors_load_context(fll_color_context *data, f_bool use_light_colors);
+ extern f_return_status fll_colors_load_context(fl_color_context *data, f_bool use_light_colors);
#endif // _di_fll_colors_load_context_
#ifdef __cplusplus
# fss-0000
-project_name fll_colors
+project_name fll_print
project_level 2
version_major 0
build_compiler gcc
build_libraries -lc
-build_sources_library colors.c
+build_sources_library print.c
build_sources_program
-build_sources_headers colors.h
+build_sources_headers print.h
build_shared yes
flags_all -z now
// load colors when not told to show no colors
if (data->parameters[firewall_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (status2 == f_none) {
fll_colors_load_context(&data->context, data->parameters[firewall_parameter_light].result == f_console_result_found);
f_delete_string_lengths(status, data->remaining);
f_delete_dynamic_strings(status, data->devices);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_dynamic_strings devices;
- fll_color_context context;
+ fl_color_context context;
} firewall_data;
#define firewall_data_initialize \
f_dynamic_strings_initialize, \
f_string_lengths_initialize, \
f_dynamic_strings_initialize, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_firewall_data_
// load colors when not told to show no colors
if (data->parameters[fss_basic_list_read_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (f_error_is_error(status2)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
f_delete_dynamic_string(status, data->buffer);
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_basic_list_read_data;
#define fss_basic_list_read_data_initialize \
f_file_position_initialize, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_basic_list_read_data_
// load colors when not told to show no colors
if (data->parameters[fss_basic_list_write_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (f_error_is_error(status2)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
} // while
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_basic_list_write_data;
#define fss_basic_list_write_data_initialize \
f_console_parameter_initialize_fss_basic_list_write, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_basic_list_write_data_
// load colors when not told to show no colors
if (data->parameters[fss_basic_read_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (f_error_is_error(status2)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
f_delete_dynamic_string(status, data->buffer);
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_basic_read_data;
#define fss_basic_read_data_initialize \
f_file_position_initialize, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_basic_read_data_
// load colors when not told to show no colors
if (data->parameters[fss_basic_write_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (f_error_is_error(status2)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
} // while
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_basic_write_data;
#define fss_basic_write_data_initialize \
f_console_parameter_initialize_fss_basic_write, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_basic_write_data_
// load colors when not told to show no colors
if (data->parameters[fss_extended_read_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (f_error_is_error(status2)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
f_delete_dynamic_string(status, data->buffer);
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_extended_read_data;
#define fss_extended_read_data_initialize \
f_file_position_initialize, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_extended_read_data_
// load colors when not told to show no colors
if (data->parameters[fss_extended_write_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(status2, data->context);
+ fl_new_color_context(status2, data->context);
if (f_error_is_error(status2)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
} // while
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_extended_write_data;
#define fss_extended_write_data_initialize \
f_console_parameter_initialize_fss_extended_write, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_extended_write_data_
// load colors when not told to show no colors
if (data->parameters[fss_return_code_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(allocation_status, data->context);
+ fl_new_color_context(allocation_status, data->context);
if (f_error_is_error(allocation_status)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
} // while
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} fss_return_code_data;
#define fss_return_code_data_initialize \
f_console_parameter_initialize_fss_return_code, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_fss_return_code_data_
// load colors when not told to show no colors
if (data->parameters[return_code_parameter_no_color].result == f_console_result_none) {
- fll_new_color_context(allocation_status, data->context);
+ fl_new_color_context(allocation_status, data->context);
if (f_error_is_error(allocation_status)) {
fprintf(f_standard_error, "Critical Error: unable to allocate memory\n");
} // while
f_delete_string_lengths(status, data->remaining);
- fll_delete_color_context(status, data->context);
+ fl_delete_color_context(status, data->context);
return f_none;
}
f_string_lengths remaining;
f_bool process_pipe;
- fll_color_context context;
+ fl_color_context context;
} return_code_data;
#define return_code_data_initialize \
f_console_parameter_initialize_return_code, \
f_string_lengths_initialize, \
f_false, \
- fll_color_context_initialize, \
+ fl_color_context_initialize, \
}
#endif // _di_return_code_data_