]> Kevux Git Server - fll/commitdiff
Cleanup: The fl_conversion re-used functions should be within private files.
authorKevin Day <thekevinday@gmail.com>
Thu, 7 Oct 2021 02:53:18 +0000 (21:53 -0500)
committerKevin Day <thekevinday@gmail.com>
Thu, 7 Oct 2021 02:53:18 +0000 (21:53 -0500)
The practice is to maintain functional isolated even within a projects own sources.
The private sources are the method intended to re-use the functions within the same file.

Update some comments.

build/level_1/settings
build/monolithic/settings
level_0/f_conversion/c/private-conversion.h
level_1/fl_conversion/c/conversion.c
level_1/fl_conversion/c/private-conversion.c [new file with mode: 0644]
level_1/fl_conversion/c/private-conversion.h [new file with mode: 0644]
level_1/fl_conversion/data/build/settings

index e19cbc1547569395823b9f97b9afdf7fccd9f1cf..66e8161047e719f9b32fe4c59da97ba5bc9e00d4 100644 (file)
@@ -22,7 +22,7 @@ build_language c
 build_libraries -lc -lcap
 build_libraries-level -lfll_0
 build_libraries-level_threadless -lfll_0
-build_sources_library console.c control_group.c conversion.c directory.c private-directory.c environment.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c iki.c print.c private-print.c signal.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c
+build_sources_library console.c control_group.c conversion.c private-conversion.c directory.c private-directory.c environment.c private-fss.c fss_basic.c fss_basic_list.c fss_embedded_list.c fss_extended.c fss_extended_list.c iki.c print.c private-print.c signal.c status.c string.c private-string.c utf.c private-utf.c utf_file.c private-utf_file.c
 build_sources_library-level
 build_sources_program
 build_sources_headers console.h control_group.h conversion.h directory.h environment.h execute.h execute-common.h fss.h fss_basic.h fss_basic_list.h fss_embedded_list.h fss_extended.h fss_extended_list.h fss_status.h iki.h print.h signal.h signal-common.h status.h string.h utf.h utf_file.h
index afb0876d4e601c4b0023f4a3741d00d9031665f8..4a0410437082d9ab3abbbcc71a82b68fa493a41a 100644 (file)
@@ -22,7 +22,7 @@ build_language c
 build_libraries -lc -lcap
 build_libraries-monolithic
 build_libraries-monolithic_threadless
-build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/conversion-common.c level_0/private-conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss-common.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/print-common.c level_0/private-print.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/private-utf.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_triple.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/signal.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/print.c level_2/program.c level_2/status.c
+build_sources_library level_0/account.c level_0/private-account.c level_0/capability.c level_0/color.c level_0/color-common.c level_0/console.c level_0/console-common.c level_0/control_group.c level_0/control_group-common.c level_0/conversion.c level_0/conversion-common.c level_0/private-conversion.c level_0/directory.c level_0/private-directory.c level_0/environment.c level_0/private-environment.c level_0/file.c level_0/file-common.c level_0/private-file.c level_0/fss.c level_0/private-fss.c level_0/fss-common.c level_0/fss_named.c level_0/fss_nest.c level_0/fss_set.c level_0/iki.c level_0/iki-common.c level_0/private-iki.c level_0/limit.c level_0/memory.c level_0/memory_structure.c level_0/private-memory.c level_0/path.c level_0/path-common.c level_0/private-path.c level_0/pipe.c level_0/print.c level_0/print-common.c level_0/private-print.c level_0/serialize.c level_0/serialize-common.c level_0/private-serialize.c level_0/signal.c level_0/socket.c level_0/string.c level_0/string-common.c level_0/private-string.c level_0/string_dynamic.c level_0/string_map.c level_0/string_quantity.c level_0/string_range.c level_0/string_triple.c level_0/type_array.c level_0/private-type_array.c level_0/utf.c level_0/utf-common.c level_0/private-utf.c level_0/utf_dynamic.c level_0/utf_map.c level_0/utf_triple.c level_1/console.c level_1/control_group.c level_1/conversion.c level_1/private-conversion.c level_1/directory.c level_1/private-directory.c level_1/environment.c level_1/private-fss.c level_1/fss_basic.c level_1/fss_basic_list.c level_1/fss_embedded_list.c level_1/fss_extended.c level_1/fss_extended_list.c level_1/iki.c level_1/print.c level_1/private-print.c level_1/signal.c level_1/status.c level_1/string.c level_1/private-string.c level_1/utf.c level_1/private-utf.c level_1/utf_file.c level_1/private-utf_file.c level_2/control_group.c level_2/error.c level_2/error-common.c level_2/private-error.c level_2/execute.c level_2/private-execute.c level_2/file.c level_2/private-file.c level_2/fss.c level_2/private-fss.c level_2/fss_basic.c level_2/fss_basic_list.c level_2/fss_embedded_list.c level_2/fss_extended.c level_2/fss_extended_list.c level_2/fss_status.c level_2/iki.c level_2/private-iki.c level_2/path.c level_2/print.c level_2/program.c level_2/status.c
 build_sources_library-monolithic level_0/thread.c level_0/private-thread.c
 build_sources_program
 build_sources_headers level_0/account.h level_0/account-common.h level_0/capability.h level_0/capability-common.h level_0/color.h level_0/color-common.h level_0/console.h level_0/console-common.h level_0/control_group.h level_0/control_group-common.h level_0/conversion.h level_0/conversion-common.h level_0/directory.h level_0/directory_type.h level_0/directory-common.h level_0/environment.h level_0/environment-common.h level_0/execute.h level_0/execute-common.h level_0/file.h level_0/file-common.h level_0/fss.h level_0/fss-common.h level_0/fss_comment.h level_0/fss_delimit.h level_0/fss_named.h level_0/fss_nest.h level_0/fss_quote.h level_0/fss_set.h level_0/iki.h level_0/iki-common.h level_0/limit.h level_0/limit-common.h level_0/memory.h level_0/memory_structure.h level_0/memory-common.h level_0/path.h level_0/path-common.h level_0/pipe.h level_0/print.h level_0/print-common.h level_0/serialize.h level_0/serialize-common.h level_0/signal.h level_0/signal-common.h level_0/socket.h level_0/socket-common.h level_0/status.h level_0/string.h level_0/string-common.h level_0/string_dynamic.h level_0/string_map.h level_0/string_quantity.h level_0/string_range.h level_0/string_triple.h level_0/type.h level_0/type_array.h level_0/type_array-common.h level_0/utf.h level_0/utf-common.h level_0/utf_dynamic.h level_0/utf_map.h level_0/utf_triple.h level_1/console.h level_1/control_group.h level_1/conversion.h level_1/directory.h level_1/environment.h level_1/execute.h level_1/execute-common.h level_1/fss.h level_1/fss_basic.h level_1/fss_basic_list.h level_1/fss_embedded_list.h level_1/fss_extended.h level_1/fss_extended_list.h level_1/fss_status.h level_1/iki.h level_1/print.h level_1/signal.h level_1/signal-common.h level_1/status.h level_1/string.h level_1/utf.h level_1/utf_file.h level_2/control_group.h level_2/error.h level_2/error-common.h level_2/execute.h level_2/file.h level_2/fss.h level_2/fss_basic.h level_2/fss_basic_list.h level_2/fss_embedded_list.h level_2/fss_extended.h level_2/fss_extended_list.h level_2/fss_status.h level_2/iki.h level_2/path.h level_2/print.h level_2/program.h level_2/status.h
index 437496d85aaffb0b678c99cf7807277416fbd696..3a5eee3589e527a9a67900f7fa9686bf00a672aa 100644 (file)
@@ -5,7 +5,8 @@
  * API Version: 0.5
  * Licenses: lgplv2.1
  *
- * Provide means to convert one data type to another, such as a string to an integer.
+ * These are provided for internal reduction in redundant code.
+ * These should not be exposed/used outside of this project.
  */
 #ifndef _PRIVATE_F_conversion_h
 #define _PRIVATE_F_conversion_h
index e7366f89d1b97c227838ac89dd2a7af149ec00f6..2533c948438bd23f9fe9e14cbfa1e995c1db7ace 100644 (file)
@@ -1,4 +1,5 @@
 #include "conversion.h"
+#include "private-conversion.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -12,59 +13,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_binary(string[i], &digit) == F_none) {
-        if (digits) {
-          ++digits;
-
-          if (negative) {
-            if (digits > f_conversion_digits_binary_signed) {
-              return F_status_set_error(F_number_underflow);
-            }
-
-            converted <<= 1;
-            converted -= digit;
-          }
-          else {
-            if (digits > f_conversion_digits_binary_signed) {
-              return F_status_set_error(F_number_overflow);
-            }
-
-            converted <<= 1;
-            converted += digit;
-          }
-        }
-        else if (digit) {
-          digits = 1;
-
-          if (negative) {
-            converted = (f_number_unsigned_t) (0 - digit);
-          }
-          else {
-            converted = (f_number_unsigned_t) digit;
-          }
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_binary_signed(string, range, negative, number);
   }
 #endif // _di_fl_conversion_string_to_binary_signed_
 
@@ -76,43 +25,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_binary(string[i], &digit) == F_none) {
-        if (digits) {
-          ++digits;
-
-          if (digits > f_conversion_digits_binary_unsigned) {
-            return F_status_set_error(F_number_overflow);
-          }
-
-          converted <<= 1;
-          converted += digit;
-        }
-        else if (digit) {
-          digits = 1;
-          converted = (f_number_unsigned_t) digit;
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_binary_unsigned(string, range, number);
   }
 #endif // _di_fl_conversion_string_to_binary_unsigned_
 
@@ -124,64 +37,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_decimal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (negative) {
-            if (digits > f_conversion_digits_decimal_signed) {
-              if ((converted * 10) - digit < f_number_t_size_negative || (converted * 10) - digit > converted) {
-                return F_status_set_error(F_number_underflow);
-              }
-            }
-
-            converted *= 10;
-            converted -= digit;
-          }
-          else {
-            if (digits > f_conversion_digits_decimal_signed) {
-              if ((converted * 10) + digit > f_number_t_size_positive || (converted * 10) + digit < converted) {
-                return F_status_set_error(F_number_overflow);
-              }
-            }
-
-            converted *= 10;
-            converted += digit;
-          }
-        }
-        else if (digit) {
-          digits = 1;
-
-          if (negative) {
-            converted = (f_number_unsigned_t) (0 - digit);
-          }
-          else {
-            converted = (f_number_unsigned_t) digit;
-          }
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_decimal_signed(string, range, negative, number);
   }
 #endif // _di_fl_conversion_string_to_decimal_signed_
 
@@ -193,46 +49,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_decimal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (digits > f_conversion_digits_decimal_unsigned) {
-            if ((converted * 10) + digit > f_number_t_size_unsigned || (converted * 10) + digit < converted) {
-              return F_status_set_error(F_number_overflow);
-            }
-          }
-
-          converted *= 10;
-          converted += digit;
-        }
-        else if (digit) {
-          digits = 1;
-          converted = (f_number_unsigned_t) digit;
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_decimal_unsigned(string, range, number);
   }
 #endif // _di_fl_conversion_string_to_decimal_unsigned_
 
@@ -244,64 +61,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (negative) {
-            if (digits > f_conversion_digits_duodecimal_signed) {
-              if ((converted * 12) - digit < f_number_t_size_negative || (converted * 12) - digit > converted) {
-                return F_status_set_error(F_number_underflow);
-              }
-            }
-
-            converted *= 12;
-            converted -= digit;
-          }
-          else {
-            if (digits > f_conversion_digits_duodecimal_signed) {
-              if ((converted * 12) + digit > f_number_t_size_positive || (converted * 12) + digit < converted) {
-                return F_status_set_error(F_number_overflow);
-              }
-            }
-
-            converted *= 12;
-            converted += digit;
-          }
-        }
-        else if (digit) {
-          digits = 1;
-
-          if (negative) {
-            converted = (f_number_unsigned_t) (0 - digit);
-          }
-          else {
-            converted = (f_number_unsigned_t) digit;
-          }
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_duodecimal_signed(string, range, negative, number);
   }
 #endif // _di_fl_conversion_string_to_duodecimal_signed_
 
@@ -313,46 +73,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (digits > f_conversion_digits_duodecimal_unsigned) {
-            if ((converted * 12) + digit > f_number_t_size_unsigned || (converted * 12) + digit < converted) {
-              return F_status_set_error(F_number_overflow);
-            }
-          }
-
-          converted *= 12;
-          converted += digit;
-        }
-        else if (digit) {
-          digits = 1;
-          converted = (f_number_unsigned_t) digit;
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_duodecimal_unsigned(string, range, number);
   }
 #endif // _di_fl_conversion_string_to_duodecimal_unsigned_
 
@@ -364,64 +85,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (negative) {
-            if (digits > f_conversion_digits_hexidecimal_signed) {
-              if ((converted << 4) - digit < f_number_t_size_negative || (converted << 4) - digit > converted) {
-                return F_status_set_error(F_number_underflow);
-              }
-            }
-
-            converted <<= 4;
-            converted -= digit;
-          }
-          else {
-            if (digits > f_conversion_digits_hexidecimal_signed) {
-              if ((converted << 4) + digit > f_number_t_size_positive || (converted << 4) + digit < converted) {
-                return F_status_set_error(F_number_overflow);
-              }
-            }
-
-            converted <<= 4;
-            converted += digit;
-          }
-        }
-        else if (digit) {
-          digits = 1;
-
-          if (negative) {
-            converted = (f_number_unsigned_t) (0 - digit);
-          }
-          else {
-            converted = (f_number_unsigned_t) digit;
-          }
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_hexidecimal_signed(string, range, negative, number);
   }
 #endif // _di_fl_conversion_string_to_hexidecimal_signed_
 
@@ -433,46 +97,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (digits > f_conversion_digits_hexidecimal_unsigned) {
-            if ((converted << 4) + digit > f_number_t_size_unsigned || (converted << 4) + digit < converted) {
-              return F_status_set_error(F_number_overflow);
-            }
-          }
-
-          converted <<= 4;
-          converted += digit;
-        }
-        else if (digit) {
-          digits = 1;
-          converted = (f_number_unsigned_t) digit;
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_hexidecimal_unsigned(string, range, number);
   }
 #endif // _di_fl_conversion_string_to_hexidecimal_unsigned_
 
@@ -484,64 +109,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_octal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (negative) {
-            if (digits > f_conversion_digits_octal_signed) {
-              if ((converted << 3) - digit < f_number_t_size_negative || (converted << 3) - digit > converted) {
-                return F_status_set_error(F_number_underflow);
-              }
-            }
-
-            converted <<= 3;
-            converted -= digit;
-          }
-          else {
-            if (digits > f_conversion_digits_octal_signed) {
-              if ((converted << 3) + digit > f_number_t_size_positive || (converted << 3) + digit < converted) {
-                return F_status_set_error(F_number_overflow);
-              }
-            }
-
-            converted <<= 3;
-            converted += digit;
-          }
-        }
-        else if (digit) {
-          digits = 1;
-
-          if (negative) {
-            converted = (f_number_unsigned_t) (0 - digit);
-          }
-          else {
-            converted = (f_number_unsigned_t) digit;
-          }
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_octal_signed(string, range, negative, number);
   }
 #endif // _di_fl_conversion_string_to_octal_signed_
 
@@ -553,46 +121,7 @@ extern "C" {
       if (!number) return F_status_set_error(F_parameter);
     #endif // _di_level_1_parameter_checking_
 
-    if (!string[0]) {
-      return F_data_not;
-    }
-
-    uint8_t digits = 0;
-    uint8_t digit = 0;
-    f_number_unsigned_t converted = 0;
-
-    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
-
-      if (string[i] == 0x2e) {
-        return F_status_set_error(F_number_decimal);
-      }
-
-      if (f_conversion_character_to_octal(string[i], &digit) == F_none) {
-
-        if (digits) {
-          ++digits;
-
-          if (digits > f_conversion_digits_octal_unsigned) {
-            if ((converted << 3) + digit > f_number_t_size_unsigned || (converted << 3) + digit < converted) {
-              return F_status_set_error(F_number_overflow);
-            }
-          }
-
-          converted <<= 3;
-          converted += digit;
-        }
-        else if (digit) {
-          digits = 1;
-          converted = (f_number_unsigned_t) digit;
-        }
-      }
-      else if (string[i]) {
-        return F_status_set_error(F_number);
-      }
-    } // for
-
-    *number = converted;
-    return F_none;
+    return private_fl_conversion_string_to_octal_unsigned(string, range, number);
   }
 #endif // _di_fl_conversion_string_to_octal_unsigned_
 
@@ -739,22 +268,22 @@ extern "C" {
     }
 
     if (mode == 10) {
-      return fl_conversion_string_to_decimal_signed(string, location_offset, vector == -1, number);
+      return private_fl_conversion_string_to_decimal_signed(string, location_offset, vector == -1, number);
     }
 
     if (mode == 16) {
-      return fl_conversion_string_to_hexidecimal_signed(string, location_offset, vector == -1, number);
+      return private_fl_conversion_string_to_hexidecimal_signed(string, location_offset, vector == -1, number);
     }
 
     if (mode == 12) {
-      return fl_conversion_string_to_duodecimal_signed(string, location_offset, vector == -1, number);
+      return private_fl_conversion_string_to_duodecimal_signed(string, location_offset, vector == -1, number);
     }
 
     if (mode == 8) {
-      return fl_conversion_string_to_octal_signed(string, location_offset, vector == -1, number);
+      return private_fl_conversion_string_to_octal_signed(string, location_offset, vector == -1, number);
     }
 
-    return fl_conversion_string_to_binary_signed(string, location_offset, vector == -1, number);
+    return private_fl_conversion_string_to_binary_signed(string, location_offset, vector == -1, number);
   }
 #endif // _di_fl_conversion_string_to_number_signed_
 
@@ -889,19 +418,19 @@ extern "C" {
     }
 
     if (mode == 10) {
-      status = fl_conversion_string_to_decimal_unsigned(string, location_offset, number);
+      status = private_fl_conversion_string_to_decimal_unsigned(string, location_offset, number);
     }
     else if (mode == 16) {
-      status = fl_conversion_string_to_hexidecimal_unsigned(string, location_offset, number);
+      status = private_fl_conversion_string_to_hexidecimal_unsigned(string, location_offset, number);
     }
     else if (mode == 12) {
-      status = fl_conversion_string_to_duodecimal_unsigned(string, location_offset, number);
+      status = private_fl_conversion_string_to_duodecimal_unsigned(string, location_offset, number);
     }
     else if (mode == 8) {
-      status = fl_conversion_string_to_octal_unsigned(string, location_offset, number);
+      status = private_fl_conversion_string_to_octal_unsigned(string, location_offset, number);
     }
     else {
-      status = fl_conversion_string_to_binary_unsigned(string, location_offset, number);
+      status = private_fl_conversion_string_to_binary_unsigned(string, location_offset, number);
     }
 
     // +/- signs are not allowed.
diff --git a/level_1/fl_conversion/c/private-conversion.c b/level_1/fl_conversion/c/private-conversion.c
new file mode 100644 (file)
index 0000000..0736800
--- /dev/null
@@ -0,0 +1,552 @@
+#include "conversion.h"
+#include "private-conversion.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_number_unsigned_)
+  f_status_t private_fl_conversion_string_to_binary_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_binary(string[i], &digit) == F_none) {
+        if (digits) {
+          ++digits;
+
+          if (negative) {
+            if (digits > f_conversion_digits_binary_signed) {
+              return F_status_set_error(F_number_underflow);
+            }
+
+            converted <<= 1;
+            converted -= digit;
+          }
+          else {
+            if (digits > f_conversion_digits_binary_signed) {
+              return F_status_set_error(F_number_overflow);
+            }
+
+            converted <<= 1;
+            converted += digit;
+          }
+        }
+        else if (digit) {
+          digits = 1;
+
+          if (negative) {
+            converted = (f_number_unsigned_t) (0 - digit);
+          }
+          else {
+            converted = (f_number_unsigned_t) digit;
+          }
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_signed_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_unsigned_)
+  f_status_t private_fl_conversion_string_to_binary_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_binary(string[i], &digit) == F_none) {
+        if (digits) {
+          ++digits;
+
+          if (digits > f_conversion_digits_binary_unsigned) {
+            return F_status_set_error(F_number_overflow);
+          }
+
+          converted <<= 1;
+          converted += digit;
+        }
+        else if (digit) {
+          digits = 1;
+          converted = (f_number_unsigned_t) digit;
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_binary_unsigned_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_signed_)
+  f_status_t private_fl_conversion_string_to_decimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_decimal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (negative) {
+            if (digits > f_conversion_digits_decimal_signed) {
+              if ((converted * 10) - digit < f_number_t_size_negative || (converted * 10) - digit > converted) {
+                return F_status_set_error(F_number_underflow);
+              }
+            }
+
+            converted *= 10;
+            converted -= digit;
+          }
+          else {
+            if (digits > f_conversion_digits_decimal_signed) {
+              if ((converted * 10) + digit > f_number_t_size_positive || (converted * 10) + digit < converted) {
+                return F_status_set_error(F_number_overflow);
+              }
+            }
+
+            converted *= 10;
+            converted += digit;
+          }
+        }
+        else if (digit) {
+          digits = 1;
+
+          if (negative) {
+            converted = (f_number_unsigned_t) (0 - digit);
+          }
+          else {
+            converted = (f_number_unsigned_t) digit;
+          }
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_signed_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_unsigned_)
+  f_status_t private_fl_conversion_string_to_decimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_decimal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (digits > f_conversion_digits_decimal_unsigned) {
+            if ((converted * 10) + digit > f_number_t_size_unsigned || (converted * 10) + digit < converted) {
+              return F_status_set_error(F_number_overflow);
+            }
+          }
+
+          converted *= 10;
+          converted += digit;
+        }
+        else if (digit) {
+          digits = 1;
+          converted = (f_number_unsigned_t) digit;
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_decimal_unsigned_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_signed_)
+  f_status_t private_fl_conversion_string_to_duodecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (negative) {
+            if (digits > f_conversion_digits_duodecimal_signed) {
+              if ((converted * 12) - digit < f_number_t_size_negative || (converted * 12) - digit > converted) {
+                return F_status_set_error(F_number_underflow);
+              }
+            }
+
+            converted *= 12;
+            converted -= digit;
+          }
+          else {
+            if (digits > f_conversion_digits_duodecimal_signed) {
+              if ((converted * 12) + digit > f_number_t_size_positive || (converted * 12) + digit < converted) {
+                return F_status_set_error(F_number_overflow);
+              }
+            }
+
+            converted *= 12;
+            converted += digit;
+          }
+        }
+        else if (digit) {
+          digits = 1;
+
+          if (negative) {
+            converted = (f_number_unsigned_t) (0 - digit);
+          }
+          else {
+            converted = (f_number_unsigned_t) digit;
+          }
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_signed_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_unsigned_)
+  f_status_t private_fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_duodecimal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (digits > f_conversion_digits_duodecimal_unsigned) {
+            if ((converted * 12) + digit > f_number_t_size_unsigned || (converted * 12) + digit < converted) {
+              return F_status_set_error(F_number_overflow);
+            }
+          }
+
+          converted *= 12;
+          converted += digit;
+        }
+        else if (digit) {
+          digits = 1;
+          converted = (f_number_unsigned_t) digit;
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_duodecimal_unsigned_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_signed_)
+  f_status_t private_fl_conversion_string_to_hexidecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (negative) {
+            if (digits > f_conversion_digits_hexidecimal_signed) {
+              if ((converted << 4) - digit < f_number_t_size_negative || (converted << 4) - digit > converted) {
+                return F_status_set_error(F_number_underflow);
+              }
+            }
+
+            converted <<= 4;
+            converted -= digit;
+          }
+          else {
+            if (digits > f_conversion_digits_hexidecimal_signed) {
+              if ((converted << 4) + digit > f_number_t_size_positive || (converted << 4) + digit < converted) {
+                return F_status_set_error(F_number_overflow);
+              }
+            }
+
+            converted <<= 4;
+            converted += digit;
+          }
+        }
+        else if (digit) {
+          digits = 1;
+
+          if (negative) {
+            converted = (f_number_unsigned_t) (0 - digit);
+          }
+          else {
+            converted = (f_number_unsigned_t) digit;
+          }
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_signed_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_unsigned_)
+  f_status_t private_fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_hexidecimal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (digits > f_conversion_digits_hexidecimal_unsigned) {
+            if ((converted << 4) + digit > f_number_t_size_unsigned || (converted << 4) + digit < converted) {
+              return F_status_set_error(F_number_overflow);
+            }
+          }
+
+          converted <<= 4;
+          converted += digit;
+        }
+        else if (digit) {
+          digits = 1;
+          converted = (f_number_unsigned_t) digit;
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_hexidecimal_unsigned_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_signed_)
+  f_status_t private_fl_conversion_string_to_octal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_octal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (negative) {
+            if (digits > f_conversion_digits_octal_signed) {
+              if ((converted << 3) - digit < f_number_t_size_negative || (converted << 3) - digit > converted) {
+                return F_status_set_error(F_number_underflow);
+              }
+            }
+
+            converted <<= 3;
+            converted -= digit;
+          }
+          else {
+            if (digits > f_conversion_digits_octal_signed) {
+              if ((converted << 3) + digit > f_number_t_size_positive || (converted << 3) + digit < converted) {
+                return F_status_set_error(F_number_overflow);
+              }
+            }
+
+            converted <<= 3;
+            converted += digit;
+          }
+        }
+        else if (digit) {
+          digits = 1;
+
+          if (negative) {
+            converted = (f_number_unsigned_t) (0 - digit);
+          }
+          else {
+            converted = (f_number_unsigned_t) digit;
+          }
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_signed_)
+
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_unsigned_)
+  f_status_t private_fl_conversion_string_to_octal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number) {
+
+    if (!string[0]) {
+      return F_data_not;
+    }
+
+    uint8_t digits = 0;
+    uint8_t digit = 0;
+    f_number_unsigned_t converted = 0;
+
+    for (f_array_length_t i = range.start; i <= range.stop; ++i) {
+
+      if (string[i] == 0x2e) {
+        return F_status_set_error(F_number_decimal);
+      }
+
+      if (f_conversion_character_to_octal(string[i], &digit) == F_none) {
+
+        if (digits) {
+          ++digits;
+
+          if (digits > f_conversion_digits_octal_unsigned) {
+            if ((converted << 3) + digit > f_number_t_size_unsigned || (converted << 3) + digit < converted) {
+              return F_status_set_error(F_number_overflow);
+            }
+          }
+
+          converted <<= 3;
+          converted += digit;
+        }
+        else if (digit) {
+          digits = 1;
+          converted = (f_number_unsigned_t) digit;
+        }
+      }
+      else if (string[i]) {
+        return F_status_set_error(F_number);
+      }
+    } // for
+
+    *number = converted;
+    return F_none;
+  }
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !defined(_di_fl_conversion_string_to_octal_unsigned_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_1/fl_conversion/c/private-conversion.h b/level_1/fl_conversion/c/private-conversion.h
new file mode 100644 (file)
index 0000000..84a46d7
--- /dev/null
@@ -0,0 +1,296 @@
+/**
+ * FLL - Level 1
+ *
+ * Project: Conversion
+ * API Version: 0.5
+ * Licenses: lgplv2.1
+ *
+ * These are provided for internal reduction in redundant code.
+ * These should not be exposed/used outside of this project.
+ */
+#ifndef _PRIVATE_FL_conversion_h
+#define _PRIVATE_FL_conversion_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Private implementation of fl_conversion_string_to_binary_signed().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param location
+ *   The start/stop range to convert.
+ * @param negative
+ *   Set to 0 to treat string as a positive number, 1 for as a negative number.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the binary string was converted to an signed long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-binary values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_number_underflow (with error bit) on integer underflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_signed_)
+  extern f_status_t private_fl_conversion_string_to_binary_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_signed_)
+
+/**
+ * Private implementation of fl_conversion_string_to_binary_unsigned().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the binary string was converted to an unsigned long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-binary values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_unsigned_)
+  extern f_status_t private_fl_conversion_string_to_binary_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_binary_unsigned_)
+
+/**
+ * Private implementation of fl_conversion_string_to_decimal_signed().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param negative
+ *   Set to 0 to treat string as a positive number, 1 for as a negative number.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the decimal string was converted to an signed long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-decimal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_number_underflow (with error bit) on integer underflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_signed_)
+  extern f_status_t private_fl_conversion_string_to_decimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_signed_)
+
+/**
+ * Private implementation of fl_conversion_string_to_decimal_unsigned().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the decimal string was converted to an unsigned long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-decimal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_unsigned_)
+  extern f_status_t private_fl_conversion_string_to_decimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_decimal_unsigned_)
+
+/**
+ * Private implementation of fl_conversion_string_to_duodecimal_signed().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param negative
+ *   Set to 0 to treat string as a positive number, 1 for as a negative number.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the duodecimal string was converted to an signed long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-duodecimal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_number_underflow (with error bit) on integer underflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_signed_)
+  extern f_status_t private_fl_conversion_string_to_duodecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_signed_)
+
+/**
+ * Private implementation of fl_conversion_string_to_duodecimal_unsigned().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the duodecimal string was converted to an unsigned long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-duodecimal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_unsigned_)
+  extern f_status_t private_fl_conversion_string_to_duodecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_duodecimal_unsigned_)
+
+/**
+ * Private implementation of fl_conversion_string_to_hexidecimal_signed().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param negative
+ *   Set to 0 to treat string as a positive number, 1 for as a negative number.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the hexidecimal string was converted to an signed long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-hexidecimal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_number_underflow (with error bit) on integer underflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_signed_)
+  extern f_status_t private_fl_conversion_string_to_hexidecimal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_signed_)
+
+/**
+ * Private implementation of fl_conversion_string_to_hexidecimal_unsigned().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the hexidecimal string was converted to an unsigned long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-hexidecimal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_unsigned_)
+  extern f_status_t private_fl_conversion_string_to_hexidecimal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_hexidecimal_unsigned_)
+
+/**
+ * Private implementation of fl_conversion_string_to_octal_signed().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param negative
+ *   Set to 0 to treat string as a positive number, 1 for as a negative number.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the octal string was converted to an signed long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-octal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_signed_)
+  extern f_status_t private_fl_conversion_string_to_octal_signed(const f_string_t string, const f_string_range_t range, const bool negative, f_number_signed_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_signed_)
+
+/**
+ * Private implementation of fl_conversion_string_to_octal_unsigned().
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param string
+ *   The string to convert.
+ * @param range
+ *   The start/stop range to convert.
+ * @param number
+ *   This will store the value of the converted string.
+ *   This value is only changed on success.
+ *
+ * @return
+ *   F_none if the octal string was converted to an unsigned long.
+ *   F_data_not if string starts with a null (length is 0).
+ *
+ *   F_number (with error bit) if no conversion was made due to non-octal values being found.
+ *   F_number_decimal (with error bit) if number has a decimal digit.
+ *   F_number_overflow (with error bit) on integer overflow.
+ *   F_parameter (with error bit) if a parameter is invalid.
+ */
+#if !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_unsigned_)
+  extern f_status_t private_fl_conversion_string_to_octal_unsigned(const f_string_t string, const f_string_range_t range, f_number_unsigned_t *number);
+#endif // !defined(_di_fl_conversion_string_to_binary_signed_) || !defined(_di_fl_conversion_string_to_number_signed_) || !(_di_fl_conversion_string_to_octal_unsigned_)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _PRIVATE_FL_conversion_h
index 2ff927910b3067c3d7dd0cc8974de44f4916d3d3..604204a2668fe2863ddc7441fb21c92037a7fb4a 100644 (file)
@@ -21,7 +21,7 @@ build_indexer ar
 build_language c
 build_libraries -lc
 build_libraries-individual -lf_conversion -lf_memory -lf_string -lf_utf
-build_sources_library conversion.c
+build_sources_library conversion.c private-conversion.c
 build_sources_program
 build_sources_headers conversion.h
 build_sources_script