I intend to begin transitioning from the core types like 'int', 'char', etc...
As part of this, I need to remove a number of the type #define wrappers.
This is also done, in part, because I learned that there are some equivalents to f_min_s_int.
Using explicit types is safer and better designed than something like 'char'.
The goal will be to replace 'char' with uint8_t (or int8_t as needed).
Furthermore, specifying int32_t and int64_t (and similar) should improve the code quality.
The use of types like "wchar", is dangerous because some systems use different sizes.
Instead, for something like "wchar", an uint32_t, might be used.
(although this project is to be designed around UTF-8 so the use of wchar is wrong anyway but it does make good example.)
#endif // _di_f_color_max_size_
#ifndef _di_f_color_types_
- typedef f_min_u_int f_color_id;
+ typedef unsigned short f_color_id;
// f_color_id codes
#define f_color_code_linux 0
* - other: parameters using neither minus nor plus sign, such as 'build'.
*/
#ifndef _di_f_console_types_
- typedef f_min_u_short f_console_id;
+ typedef unsigned short f_console_id;
enum {
f_console_result_none,
#endif // _di_f_is_hexidecimal_
#ifndef _di_f_character_to_digit_
- f_return_status f_character_to_digit(const char character, f_u_long *digit) {
+ f_return_status f_character_to_digit(const char character, unsigned long *digit) {
#ifndef _di_level_0_parameter_checking_
if (digit == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_character_to_digit_
#ifndef _di_f_character_to_hexdecimal_
- f_return_status f_character_to_hexdecimal(const char character, f_u_long *digit) {
+ f_return_status f_character_to_hexdecimal(const char character, unsigned long *digit) {
#ifndef _di_level_0_parameter_checking_
if (digit == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_character_to_hexdecimal_
#ifndef _di_f_string_to_decimal_
- f_return_status f_string_to_decimal(const f_string string, f_u_long *digit, const f_string_location location) {
+ f_return_status f_string_to_decimal(const f_string string, unsigned long *digit, const f_string_location location) {
#ifndef _di_level_0_parameter_checking_
if (digit == 0) return f_status_set_error(f_invalid_parameter);
if (location.start < 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
f_string_length current_location = location.start;
- f_u_long scale = 0;
- f_u_long temp_digit = 0;
+ unsigned long scale = 0;
+ unsigned long temp_digit = 0;
while (current_location < location.stop) {
if (f_character_to_digit(string[current_location], &temp_digit) == f_none) {
#endif // _di_f_string_to_decimal_
#ifndef _di_f_string_to_hexidecimal_
- f_return_status f_string_to_hexidecimal(const f_string string, f_u_long *digit, const f_string_location location) {
+ f_return_status f_string_to_hexidecimal(const f_string string, unsigned long *digit, const f_string_location location) {
#ifndef _di_level_0_parameter_checking_
if (digit == 0) return f_status_set_error(f_invalid_parameter);
if (location.start < 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
f_string_length current_location = location.start;
- f_u_long scale = 0;
- f_u_long temp_digit = 0;
+ unsigned long scale = 0;
+ unsigned long temp_digit = 0;
while (current_location < location.stop) {
if (f_character_to_hexdecimal(string[current_location], &temp_digit) == f_none) {
/**
* convert a single character into the digit that it represents.
*/
- extern f_return_status f_character_to_digit(const char character, f_u_long *digit);
+ extern f_return_status f_character_to_digit(const char character, unsigned long *digit);
#endif // _di_f_character_to_digit_
#ifndef _di_f_character_to_hexdecimal_
/**
*convert a single character into the hexidecimal digit that it represents.
*/
- extern f_return_status f_character_to_hexdecimal(const char character, f_u_long *digit);
+ extern f_return_status f_character_to_hexdecimal(const char character, unsigned long *digit);
#endif // _di_f_character_to_hexdecimal_
#ifndef _di_f_string_to_decimal_
* convert a series of positive numbers into a string, stopping at one of the following: EOS, max_length, or a non-digit.
* will not process signed statuses (+/-).
*/
- extern f_return_status f_string_to_decimal(const f_string string, f_u_long *digit, const f_string_location location);
+ extern f_return_status f_string_to_decimal(const f_string string, unsigned long *digit, const f_string_location location);
#endif // _di_f_string_to_decimal_
#ifndef _di_f_string_to_hexidecimal_
* convert a series of positive numbers into a string, stopping at one of the following: EOS, max_length, or a non-hexdigit.
* will not process signed statuses (+/-).
*/
- extern f_return_status f_string_to_hexidecimal(const f_string string, f_u_long *digit, const f_string_location location);
+ extern f_return_status f_string_to_hexidecimal(const f_string string, unsigned long *digit, const f_string_location location);
#endif // _di_f_string_to_hexidecimal_
#ifdef __cplusplus
if (file->address == 0) return f_status_set_error(f_file_not_open);
// first seek to 'where' we need to begin the read
- f_u_long current_file_position = ftell(file->address);
- if (current_file_position == (f_u_long) -1) return f_status_set_error(f_file_seek_error);
+ unsigned long current_file_position = ftell(file->address);
+ if (current_file_position == (unsigned long) -1) return f_status_set_error(f_file_seek_error);
- f_s_int result = 0;
+ int result = 0;
if (current_file_position > location.file_start) {
result = f_file_seek_from_current(file->address, file->byte_size * (0 - (current_file_position - location.file_start)));
if (file->address == 0) return f_status_set_error(f_file_not_open);
- f_s_int result = 0;
+ int result = 0;
// now do the actual read
result = fread(buffer->string + buffer->used, file->byte_size, buffer->size - buffer->used - 1, file->address);
#endif // _di_f_file_stat_
#ifndef _di_f_file_stat_by_id_
- f_return_status f_file_stat_by_id(const f_s_int file_id, struct stat *file_stat) {
+ f_return_status f_file_stat_by_id(const int file_id, struct stat *file_stat) {
#ifndef _di_level_0_parameter_checking_
if (file_id <= 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
return f_none;
}
- f_s_int result = 0;
+ int result = 0;
result = fstat(file_id, file_stat);
if (result < 0) {
#endif
#ifndef _di_f_file_types_
- typedef f_s_int f_file_id;
+ typedef int f_file_id;
typedef f_string f_file_mode;
typedef mode_t f_file_mask;
/**
* read file statistics by file id.
*/
- extern f_return_status f_file_stat_by_id(const f_s_int file_id, struct stat *file_stat);
+ extern f_return_status f_file_stat_by_id(const int file_id, struct stat *file_stat);
#endif // _di_f_file_stat_by_id_
#ifdef __cplusplus
#define f_fss_type_header_part5 '-'
#define f_fss_type_header_close '\n'
- #define f_fss_id f_u_long
+ #define f_fss_id unsigned long
#define f_fss_checksum f_string_dynamic
#define f_fss_header_length f_string_length
#endif
#ifndef _di_f_socket_types_
- #define f_socket_id f_s_int
- #define f_socket_close_id f_u_short
+ #define f_socket_id int
+ #define f_socket_close_id unsigned short
enum {
f_socket_close_fast, // As in close();
#endif // _di_f_string_
#ifndef _di_f_string_length_
- typedef f_s_long f_string_length;
+ typedef long f_string_length;
#define f_string_length_printf string_format_long_integer
extern "C" {
#endif
-#ifndef _di_f_types_normal
- #define f_s_int signed int
- #define f_s_long signed long
- #define f_s_short signed short
- #define f_s_long_long signed long long
- #define f_s_short_short signed short
- #define f_s_double double
- #define f_s_long_double long double
- #define f_u_int unsigned int
- #define f_u_short unsigned short
- #define f_u_short_short unsigned short
- #define f_u_long unsigned long
- #define f_u_long_long unsigned long long
- #define f_u_double double
- #define f_u_long_double long double
- #define f_bool unsigned short
-#endif // _di_f_types_normal
+#ifndef _di_f_type_bool_
+ typedef unsigned short f_bool;
+#endif // _di_f_type_bool_
-/**
- * The minimal types represent to the system admin or whomever else handles compilation that the data type should NOT be smaller than the specified size, but can be any size larger.
- */
-#ifndef _di_f_types_min
- #define f_min_s_int f_s_int
- #define f_min_s_short f_s_short
- #define f_min_s_long f_s_long
- #define f_min_s_short_short f_s_short_short
- #define f_min_s_long_long f_s_long_long
- #define f_min_s_double f_s_double
- #define f_min_s_long_double f_s_long_double
- #define f_min_u_int f_u_int
- #define f_min_u_short f_u_short
- #define f_min_u_long f_u_long
- #define f_min_u_short_short f_u_short_short
- #define f_min_u_long_long f_u_long_long
- #define f_min_u_double f_u_double
- #define f_min_u_long_double f_u_long_double
-#endif // _di_f_types_min
-
-/**
- * The maximum types represent to the system admin or whomever else handles compilation that the data type should NOT be larger than the specified size, but can be any size smaller.
- */
-#ifndef _di_f_types_max
- #define f_max_s_int f_s_int
- #define f_max_s_short f_s_short
- #define f_max_s_long f_s_long
- #define f_max_s_short_short f_s_short_short
- #define f_max_s_long_long f_s_long_long
- #define f_max_s_double f_s_double
- #define f_max_s_long_double f_s_long_double
- #define f_max_u_int f_u_int
- #define f_max_u_short f_u_short
- #define f_max_u_long f_u_long
- #define f_max_u_short_short f_u_short_short
- #define f_max_u_long_long f_u_long_long
- #define f_max_u_double f_u_double
- #define f_max_u_long_double f_u_long_double
-#endif // _di_f_types_max
-
-#ifndef _di_f_status_
+#ifndef _di_f_type_status_
typedef uint16_t f_status;
// The c language gives warnings about return types of constants.
#else
#define f_return_status f_status
#endif // __cplusplus
-#endif // _di_f_status_
+#endif // _di_f_type_status_
/**
* Defines the maximum size to be supported.
- * Ideally these don't get optimized away and are detected at runtime as a result of the bitwise operator.
+ *
+ * The max size is to be the (max supported size - 1) such that that last number can be used for overflow operations.
*/
-#ifndef _di_f_types_sizes_
- #define f_unsigned_char_size ((unsigned char) -1)
- #define f_unsigned_short_size ((unsigned short) -1)
- #define f_unsigned_int_size ((unsigned int) -1)
- #define f_unsigned_long_size ((unsigned long) -1)
- #define f_unsigned_long_long_size ((unsigned long long) -1)
- #define f_unsigned_double_size ((unsigned double) -1)
- #define f_unsigned_long_double_size ((unsigned double) -1)
- #define f_signed_char_size (((unsigned char) -1) / 2)
- #define f_signed_short_size (((unsigned short) -1) / 2)
- #define f_signed_int_size (((unsigned int) -1) / 2)
- #define f_signed_long_size (((unsigned long) -1) / 2)
- #define f_signed_long_long_size (((unsigned long long) -1) / 2)
-#endif // _di_f_types_sizes_
+#ifndef _di_f_type_sizes_
+ #define f_unsigned_char_size (((unsigned char) -1) - 1)
+ #define f_unsigned_short_size (((unsigned short) -1) - 1)
+ #define f_unsigned_int_size (((unsigned int) -1) - 1)
+ #define f_unsigned_long_size (((unsigned long) -1) - 1)
+ #define f_unsigned_long_long_size (((unsigned long long) -1) - 1)
+ #define f_unsigned_double_size (((unsigned double) -1) - 1)
+ #define f_unsigned_long_double_size (((unsigned double) -1) - 1)
+ #define f_signed_char_size ((((unsigned char) -1) / 2) - 1)
+ #define f_signed_short_size ((((unsigned short) -1) / 2) - 1)
+ #define f_signed_int_size ((((unsigned int) -1) / 2) - 1)
+ #define f_signed_long_size ((((unsigned long) -1) / 2) - 1)
+ #define f_signed_long_long_size ((((unsigned long long) -1) / 2) - 1)
+#endif // _di_f_type_sizes_
+
-#ifndef _di_f_types_standard_output_
+#ifndef _di_f_type_standard_output_
#define f_standard_debug stdout
#define f_standard_error stderr
#define f_standard_input stdin
#define f_standard_output stdout
#define f_standard_warning stdout
-#endif // _di_f_types_standard_output_
+#endif // _di_f_type_standard_output_
/**
* Defines a variable to be used by arrays.
*/
#ifndef _di_f_array_length_
- typedef f_s_long f_array_length;
- typedef f_s_int f_array_length_short;
- typedef f_s_long_long f_array_length_long;
+ typedef long f_array_length;
+ typedef int f_array_length_short;
+ typedef long long f_array_length_long;
#endif // _di_f_array_length_
#ifndef _di_f_gcc_specific_
#endif // _di_f_utf_is_big_endian_
#ifndef _di_f_utf_is_
- f_return_status f_utf_is(const f_string character, const f_u_short max_width) {
+ f_return_status f_utf_is(const f_string character, const unsigned short max_width) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- f_u_short width = f_macro_utf_byte_width_is(*character);
+ unsigned short width = f_macro_utf_byte_width_is(*character);
if (width == 0) {
return f_false;
#endif // _di_f_utf_is_
#ifndef _di_f_utf_is_bom_
- f_return_status f_utf_is_bom(const f_string character, const f_u_short max_width) {
+ f_return_status f_utf_is_bom(const f_string character, const unsigned short max_width) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- f_u_short width = f_macro_utf_byte_width_is(*character);
+ unsigned short width = f_macro_utf_byte_width_is(*character);
if (width == 0) {
return f_false;
#ifndef _di_f_utf_is_character_
f_return_status f_utf_is_character(const f_utf_character character) {
- f_u_short width = f_macro_utf_character_width_is(character);
+ unsigned short width = f_macro_utf_character_width_is(character);
if (width == 0) {
return f_false;
#endif // _di_f_utf_is_
#ifndef _di_f_utf_is_graph_
- f_return_status f_utf_is_graph(const f_string character, const f_u_short max_width) {
+ f_return_status f_utf_is_graph(const f_string character, const unsigned short max_width) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
#endif // _di_f_utf_is_graph_
#ifndef _di_f_utf_is_space_
- f_return_status f_utf_is_space(const f_string character, const f_u_short max_width) {
+ f_return_status f_utf_is_space(const f_string character, const unsigned short max_width) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- f_u_short width = f_macro_utf_byte_width_is(*character);
+ unsigned short width = f_macro_utf_byte_width_is(*character);
if (width == 0) {
if (isspace(*character)) {
#endif // _di_f_utf_is_space_
#ifndef _di_f_utf_is_substitute_
- f_return_status f_utf_is_substitute(const f_string character, const f_u_short max_width) {
+ f_return_status f_utf_is_substitute(const f_string character, const unsigned short max_width) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- f_u_short width = f_macro_utf_byte_width_is(*character);
+ unsigned short width = f_macro_utf_byte_width_is(*character);
if (width == 0) {
// there is no substitute character in ASCII.
#endif // _di_f_utf_is_substitute_
#ifndef _di_f_utf_is_whitespace_
- f_return_status f_utf_is_whitespace(const f_string character, const f_u_short max_width) {
+ f_return_status f_utf_is_whitespace(const f_string character, const unsigned short max_width) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- f_u_short width = f_macro_utf_byte_width_is(*character);
+ unsigned short width = f_macro_utf_byte_width_is(*character);
if (width == 0) {
if (isspace(*character)) {
#ifndef _di_f_utf_is_space_character_
f_return_status f_utf_is_space_character(const f_utf_character character) {
- f_u_short width = f_macro_utf_character_width_is(character);
+ unsigned short width = f_macro_utf_character_width_is(character);
if (width == 0) {
char ascii = character >> 24;
#ifndef _di_f_utf_is_substitute_character_
f_return_status f_utf_is_substitute_character(const f_utf_character character) {
- f_u_short width = f_macro_utf_character_width_is(character);
+ unsigned short width = f_macro_utf_character_width_is(character);
if (width == 0) {
// there is no substitute character in ASCII.
#ifndef _di_f_utf_is_whitespace_character_
f_return_status f_utf_is_whitespace_character(const f_utf_character character) {
- f_u_short width = f_macro_utf_character_width_is(character);
+ unsigned short width = f_macro_utf_character_width_is(character);
if (width == 0) {
char ascii = character >> 24;
#endif // _di_f_utf_is_whitespace_character_
#ifndef _di_f_utf_char_to_character_
- f_return_status f_utf_char_to_character(const f_string character, const f_u_short max_width, f_utf_character *utf_character) {
+ f_return_status f_utf_char_to_character(const f_string character, const unsigned short max_width, f_utf_character *utf_character) {
#ifndef _di_level_0_parameter_checking_
if (max_width < 1) return f_status_set_error(f_invalid_parameter);
if (utf_character == 0) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_0_parameter_checking_
- f_u_short width = f_macro_utf_byte_width_is(*character);
+ unsigned short width = f_macro_utf_byte_width_is(*character);
if (width == 0) {
*utf_character = f_macro_utf_character_from_char_1(character[0]);
#endif // _di_f_utf_char_to_character_
#ifndef _di_f_utf_character_to_char_
- f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, f_u_short *max_width) {
+ f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, unsigned short *max_width) {
#ifndef _di_level_0_parameter_checking_
if (utf_character == 0) return f_status_set_error(f_invalid_parameter);
if (max_width == 0 && *character != 0) return f_status_set_error(f_invalid_parameter);
f_status status = f_none;
- f_u_short width = f_macro_utf_character_width_is(utf_character);
+ unsigned short width = f_macro_utf_character_width_is(utf_character);
if (max_width == 0) {
f_macro_string_new(status, *character, width);
* Provide a type specifically for UTF-8 strings.
*/
#ifndef _di_f_utf_string_length_
- typedef f_s_long f_utf_string_length;
+ typedef long f_utf_string_length;
#define f_macro_utf_string_length_new(status, string, length) status = f_memory_new((void **) & string, sizeof(f_utf_string_length), length)
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_is_
- extern f_return_status f_utf_is(const f_string character, const f_u_short max_width);
+ extern f_return_status f_utf_is(const f_string character, const unsigned short max_width);
#endif // _di_f_utf_is_
/**
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_is_bom_
- extern f_return_status f_utf_is_bom(const f_string character, const f_u_short max_width);
+ extern f_return_status f_utf_is_bom(const f_string character, const unsigned short max_width);
#endif // _di_f_utf_is_bom_
/**
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_is_graph_
- extern f_return_status f_utf_is_graph(const f_string character, const f_u_short max_width);
+ extern f_return_status f_utf_is_graph(const f_string character, const unsigned short max_width);
#endif // _di_f_utf_is_graph_
/**
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_is_space_
- extern f_return_status f_utf_is_space(const f_string character, const f_u_short max_width);
+ extern f_return_status f_utf_is_space(const f_string character, const unsigned short max_width);
#endif // _di_f_utf_is_space_
/**
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_is_substitute_
- extern f_return_status f_utf_is_substitute(const f_string character, const f_u_short max_width);
+ extern f_return_status f_utf_is_substitute(const f_string character, const unsigned short max_width);
#endif // _di_f_utf_is_substitute_
/**
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_is_whitespace_
- extern f_return_status f_utf_is_whitespace(const f_string character, const f_u_short max_width);
+ extern f_return_status f_utf_is_whitespace(const f_string character, const unsigned short max_width);
#endif // _di_f_utf_is_whitespace_
/**
* f_invalid_parameter (with error bit) if a parameter is invalid.
*/
#ifndef _di_f_utf_char_to_character_
- extern f_return_status f_utf_char_to_character(const f_string character, const f_u_short max_width, f_utf_character *utf_character);
+ extern f_return_status f_utf_char_to_character(const f_string character, const unsigned short max_width, f_utf_character *utf_character);
#endif // _di_f_utf_char_to_character_
/**
* f_failure (with error bit) if width is not long enough to convert.
*/
#ifndef _di_f_utf_character_to_char_
- extern f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, f_u_short *max_width);
+ extern f_return_status f_utf_character_to_char(const f_utf_character utf_character, f_string *character, unsigned short *max_width);
#endif // _di_f_utf_character_to_char_
#ifdef __cplusplus
f_string_length string_length = 0;
f_array_length parameter_counter = 0;
- f_u_short console_short = f_console_none;
- f_u_short console_long = f_console_none;
- f_u_short console_type = f_console_type_normal;
+ unsigned short console_short = f_console_none;
+ unsigned short console_long = f_console_none;
+ unsigned short console_type = f_console_type_normal;
f_string_lengths needs_additional = f_string_lengths_initialize;
#endif // _di_level_1_parameter_checking_
struct dirent **listing = 0;
- f_s_int length = 0;
- f_s_int counter = 0;
+ int length = 0;
+ int counter = 0;
f_string_length size = 0;
f_status status = f_none;
if (input->start < 1) return f_none_on_eos;
f_string_length i = 0;
- f_u_short width = 0;
+ unsigned short width = 0;
do {
width = f_macro_utf_byte_width(buffer.string[input->start - 1]);
// make sure we are in the proper location in the file
{
- f_s_int seek_result = f_file_seek_from_beginning(file->address, 0);
+ int seek_result = f_file_seek_from_beginning(file->address, 0);
if (seek_result != 0) return f_status_set_error(f_file_seek_error);
}
#endif // _di_level_1_parameter_checking_
f_string_length i = 0;
- f_u_short width = 0;
+ unsigned short width = 0;
do {
width = f_macro_utf_byte_width(buffer.string[input->start]);
#endif // _di_level_1_parameter_checking_
f_status status = f_none;
- f_u_short width = 0;
+ unsigned short width = 0;
f_string_length max_width = (input->stop - input->start) + 1;
#endif // _di_level_1_parameter_checking_
f_status status = f_none;
- f_u_short width = 0;
+ unsigned short width = 0;
f_string_length max_width = (input->stop - input->start) + 1;
f_string_length position = 0;
f_string_length distance = 0;
- f_u_short utf_width = 0;
- f_u_short i = 0;
+ unsigned short utf_width = 0;
+ unsigned short i = 0;
position = input.start;
f_array_length i = 0;
f_array_length start = 0;
- f_u_short width = 0;
+ unsigned short width = 0;
while (i < serialized.used) {
width = f_macro_utf_byte_width(serialized.string[i]);
f_array_length start = 0;
f_array_length current = 0;
- f_u_short width = 0;
+ unsigned short width = 0;
while (i < serialized.used) {
width = f_macro_utf_byte_width(serialized.string[i]);
#endif // _di_fl_socket_file_bind_
#ifndef _di_fl_socket_listen_
- f_return_status fl_socket_listen(const f_socket_id socket_id, const f_u_int socket_backlog) {
+ f_return_status fl_socket_listen(const f_socket_id socket_id, const unsigned int socket_backlog) {
if (listen(socket_id, socket_backlog) < 0) {
if (errno == EADDRINUSE) {
return f_busy;
#ifndef _di_fl_socket_close_client_
// terminate a socket connection.
f_return_status fl_socket_close_client(const f_socket_id socket_id_client, const f_socket_close_id close_action) {
- f_u_int error_code = 0;
+ unsigned int error_code = 0;
if (close_action == f_socket_close_fast) {
if (close(socket_id_client) < 0) {
* terminate a socket connection.
* suggested socket_backlog default setting = 8.
*/
- extern f_return_status fl_socket_listen(const f_socket_id socket_id, const f_u_int socket_backlog);
+ extern f_return_status fl_socket_listen(const f_socket_id socket_id, const unsigned int socket_backlog);
#endif // _di_fl_socket_listen_
#ifndef _di_fl_socket_close_client_
#endif // _di_level_1_parameter_checking_
f_status status = f_none;
- f_u_short width = 0;
+ unsigned short width = 0;
f_string_length max_width = (location->stop - location->start) + 1;
#endif // _di_level_1_parameter_checking_
f_status status = f_none;
- f_u_short width = 0;
+ unsigned short width = 0;
f_string_length max_width = (location->stop - location->start) + 1;
if (location->start >= buffer.used) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- const f_u_short seek_width = f_macro_utf_character_width(seek_to_this);
+ const unsigned short seek_width = f_macro_utf_character_width(seek_to_this);
f_status status = f_none;
- f_u_short width = 0;
+ unsigned short width = 0;
f_string_length max_width = 0;
if (location->start >= buffer.used) return f_status_set_error(f_invalid_parameter);
#endif // _di_level_1_parameter_checking_
- const f_u_short seek_width = f_macro_utf_character_width(seek_to_this);
+ const unsigned short seek_width = f_macro_utf_character_width(seek_to_this);
f_status status = f_none;
- f_u_short width = 0;
+ unsigned short width = 0;
f_string_length max_width = 0;
#endif
#ifndef _di_fll_execute_path_
- f_return_status fll_execute_path(const f_string program_path, const f_string_dynamics arguments, f_s_int *results) {
+ f_return_status fll_execute_path(const f_string program_path, const f_string_dynamics arguments, int *results) {
#ifndef _di_level_2_parameter_checking_
if (results == 0) return f_status_set_error(f_invalid_parameter);
fixed_arguments[arguments.used + 2] = 0;
// TODO: validate that the file at program_path actually exists before attempting to fork and execute
- f_s_int process_id = 0;
+ int process_id = 0;
process_id = vfork();
#endif // _di_fll_execute_path_
#ifndef _di_fll_execute_program_
- f_return_status fll_execute_program(const f_string program_name, const f_string_dynamics arguments, f_s_int *results) {
+ f_return_status fll_execute_program(const f_string program_name, const f_string_dynamics arguments, int *results) {
#ifndef _di_level_2_parameter_checking_
if (results == 0) return f_status_set_error(f_invalid_parameter);
fixed_arguments[arguments.used + 2] = 0;
// TODO: validate that the file at program_path actually exists before attempting to fork and execute
- f_s_int process_id = 0;
+ int process_id = 0;
process_id = vfork();
/**
* This will execute a program given some path + program name (such as "/bin/bash").
*/
- extern f_return_status fll_execute_path(const f_string program_path, const f_string_dynamics arguments, f_s_int *results);
+ extern f_return_status fll_execute_path(const f_string program_path, const f_string_dynamics arguments, int *results);
#endif // _di_fll_execute_path_
#ifndef _di_fll_execute_program_
/**
* This will find the program based on PATH environment so that static paths do not have to be used as with f_execute_path.
*/
- extern f_return_status fll_execute_program(const f_string program_name, const f_string_dynamics arguments, f_s_int *results);
+ extern f_return_status fll_execute_program(const f_string program_name, const f_string_dynamics arguments, int *results);
#endif // _di_fll_execute_program_
#ifdef __cplusplus
else {
// now determine which command was placed first
f_bool found_command = f_false;
- f_u_int command = 0;
+ unsigned int command = 0;
if (data->parameters[firewall_parameter_command_start].result == f_console_result_found) {
command = firewall_parameter_command_start;
f_bool show_ports = f_true;
f_string_dynamics parameters = f_string_dynamics_initialize;
- f_s_int results = 0;
+ int results = 0;
if (data->remaining.used > 0) {
show_nat = f_false;
#include <level_0/status.h>
#include <level_3/firewall.h>
-int main(const f_s_int argc, const f_string *argv) {
+int main(const int argc, const f_string *argv) {
const f_console_arguments arguments = { argc, argv };
firewall_data data = firewall_data_initialize;
f_string_dynamics arguments = f_string_dynamics_initialize;
f_string_dynamic argument = f_string_dynamic_initialize;
- f_s_int results = 0;
+ int results = 0;
f_string_length length = 0;
f_bool invalid = f_false;
f_bool is_ip_list = f_false;
uint8_t tool = firewall_program_iptables;
f_bool new_chain = f_false;
f_bool create_chain = f_false;
- f_s_int results = 0;
+ int results = 0;
f_array_length i = 0;
f_array_length j = 0;
for (f_string_length i = 0; i < 2; i++) {
f_string_dynamics arguments = f_string_dynamics_initialize;
f_string_dynamic argument[1] = f_string_dynamic_initialize;
- f_s_int results = 0;
+ int results = 0;
argument[0].string = (f_string) "-F";
argument[0].size = 2;
for (f_string_length i = 0; i < 2; i++) {
f_string_dynamics arguments = f_string_dynamics_initialize;
f_string_dynamic argument[1] = f_string_dynamic_initialize;
- f_s_int results = 0;
+ int results = 0;
argument[0].string = (f_string) firewall_chain_delete_command;
argument[0].size = firewall_chain_delete_command_length;
arguments.array[2].size = arguments.array[2].used;
for (f_string_length j = 0; j < 2; j++) {
- f_s_int results = 0;
+ int results = 0;
// print command when debugging.
#ifdef _en_firewall_debug_
f_array_length counter = 0;
f_status code = f_none;
- f_u_int true = 0;
+ unsigned int true = 0;
for (; counter < data->remaining.used; counter++) {
// only numbers are valid status codes.
f_array_length counter = 0;
f_status code = f_none;
- f_u_int true = 0;
+ unsigned int true = 0;
for (; counter < data->remaining.used; counter++) {
// only numbers are valid status codes.
f_array_length counter = 0;
f_status code = f_none;
- f_u_int true = 0;
+ unsigned int true = 0;
for (; counter < data->remaining.used; counter++) {
// only numbers are valid status codes.
memset(run_level, 0, sizeof(f_autochar) * init_kernel_runlevel_buffer);
- f_u_short do_socket_file = f_true;
- f_u_short do_socket_port = f_false;
+ unsigned short do_socket_file = f_true;
+ unsigned short do_socket_port = f_false;
{
f_console_parameters parameters = { data->parameters, init_total_parameters };
if (argument->parameters[init_parameter_runlevel].result == f_console_result_found) {
- const f_u_int parameter_length = strlen(arguments.argv[argument->parameters[init_parameter_runlevel].additional.array[0]]);
+ const unsigned int parameter_length = strlen(arguments.argv[argument->parameters[init_parameter_runlevel].additional.array[0]]);
// if the run_level value is greater than the static buffer size, ignore the entire string rather than process a cut off value.
if (parameter_length > 0 && parameter_length < init_kernel_runlevel_buffer) {
if (kernel_command_line_length > 0) {
regex_t expression;
regmatch_t match;
- f_u_int reg_result = 0;
- f_u_int string_length = 0;
+ unsigned int reg_result = 0;
+ unsigned int string_length = 0;
reg_result = do_regex_match(&expression, &match, kernel_command_line_string, init_kernel_runlevel);
#ifndef _di_init_data_
typedef struct {
f_string socket_file;
- f_u_int socket_port;
- f_u_int socket_id_target;
- f_u_int socket_id_client;
+ unsigned int socket_port;
+ unsigned int socket_id_target;
+ unsigned int socket_id_client;
- f_u_short timeout_start;
- f_u_short timeout_stop;
- f_u_short timeout_kill;
+ unsigned short timeout_start;
+ unsigned short timeout_stop;
+ unsigned short timeout_kill;
init_rules main_rules;
init_categorys main_categorys;
f_array_length counter = 0;
f_status code = f_none;
- f_u_short true = 0;
+ unsigned short true = 0;
for (; counter < data->remaining.used; counter++) {
// only numbers are valid status codes.
f_array_length counter = 0;
f_status code = f_none;
- f_u_short true = 0;
+ unsigned short true = 0;
for (; counter < data->remaining.used; counter++) {
// only numbers are valid status codes.
f_array_length counter = 0;
f_status code = f_none;
- f_u_short true = 0;
+ unsigned short true = 0;
for (; counter < data->remaining.used; counter++) {
// only numbers are valid status codes.