]> Kevux Git Server - fll/commitdiff
Update: add fss_error level 2 functions
authorKevin Day <kevin@kevux.org>
Sun, 11 Mar 2012 04:34:17 +0000 (22:34 -0600)
committerKevin Day <kevin@kevux.org>
Sun, 11 Mar 2012 04:34:17 +0000 (22:34 -0600)
Provide fss-specific error code to string translation.

level_2/fll_fss/c/fss_errors.c [new file with mode: 0644]
level_2/fll_fss/c/fss_errors.h [new file with mode: 0644]
level_2/fll_fss/data/build/settings

diff --git a/level_2/fll_fss/c/fss_errors.c b/level_2/fll_fss/c/fss_errors.c
new file mode 100644 (file)
index 0000000..4ac8e25
--- /dev/null
@@ -0,0 +1,72 @@
+/* FLL - Level 2
+ * Project:       FSS
+ * Version:       0.3.x
+ * Licenses:      lgplv2.1
+ * Programmers:   Kevin Day
+ */
+#include <level_2/fss_errors.h>
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef _di_fll_fss_errors_to_string_
+  // Convert error codes to their string equivalents.
+  f_return_status fll_fss_errors_to_string(const f_status error, f_string *string) {
+    #ifndef _di_level_2_parameter_checking_
+      if (string == f_null) return f_invalid_parameter;
+    #endif // _di_level_2_parameter_checking_
+
+    switch(error){
+      #ifndef _di_fll_fss_errors_error_
+        case fl_fss_invalid_format:
+          *string = "fss invalid format";
+          break;
+        case fl_fss_invalid_format_eos:
+          *string = "fss invalid format eos";
+          break;
+      #endif // _di_fll_fss_errors_error_
+
+      #ifndef _di_fll_fss_errors_warning_
+        case fl_fss_no_header:
+          *string = "fss no header";
+          break;
+        case fl_fss_accepted_but_invalid:
+          *string = "fss accepted but invalid";
+          break;
+        case fl_fss_no_header_eos:
+          *string = "fss no header eos";
+          break;
+        case fl_fss_accepted_but_invalid_eos:
+          *string = "fss accepted but invalid eos";
+          break;
+      #endif // _di_fll_fss_errors_warning_
+
+      #ifndef _di_fll_fss_errors_success_
+        case fl_fss_found_object:
+          *string = "fss found object";
+          break;
+        case fl_fss_found_content:
+          *string = "fss found content";
+          break;
+        case fl_fss_found_no_object:
+          *string = "fss found no object";
+          break;
+        case fl_fss_found_no_content:
+          *string = "fss found no content";
+          break;
+        case fl_fss_found_object_no_content:
+          *string = "fss found object no content";
+          break;
+      #endif // _di_fll_fss_errors_success_
+    default:
+        return fl_errors_to_string(error, string);
+    }
+
+    return f_none;
+  }
+#endif // _di_fll_errors_to_string_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
diff --git a/level_2/fll_fss/c/fss_errors.h b/level_2/fll_fss/c/fss_errors.h
new file mode 100644 (file)
index 0000000..adc4f7a
--- /dev/null
@@ -0,0 +1,40 @@
+/* FLL - Level 2
+ * Project:       FSS
+ * Version:       0.3.x
+ * Licenses:      lgplv2.1
+ * Programmers:   Kevin Day
+ * Documentation:
+ *
+ * This provides fss error code translation.
+ */
+#ifndef _FLL_fss_errors_h
+#define _FLL_fss_errors_h
+
+// fll-0 includes
+#include <level_0/strings.h>
+#include <level_0/errors.h>
+#include <level_0/types.h>
+#include <level_0/memory.h>
+#include <level_0/fss.h>
+
+// fll-1 includes
+#include <level_1/errors.h>
+#include <level_1/fss.h>
+#include <level_1/fss_macro.h>
+#include <level_1/fss_errors.h>
+#include <level_1/fss_basic.h>
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+#ifndef _di_fll_fss_errors_to_string_
+  // Convert error codes to their string equivalents.
+  extern f_return_status fll_fss_errors_to_string(const f_status error, f_string *string);
+#endif // _di_fll_errors_to_string_
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // _FLL_fss_errors_h
index 3011773d166818d62436f966af636b9361305a8e..e9b5a37cfc5e951ba8da8b6730c555efe0a60026 100644 (file)
@@ -8,10 +8,10 @@ version_minor 3
 version_micro 0
 
 build_compiler gcc
-build_libraries -lc -lf_memory -lf_file -lf_conversion -lfl_fss
-build_sources_library fss_basic.c fss_basic_list.c fss_extended.c
-build_sources_program 
-build_sources_headers fss_basic.h fss_basic_list.h fss_extended.h
+build_libraries -lc -lf_memory -lf_file -lf_conversion -lfl_fss -lfl_errors
+build_sources_library fss_basic.c fss_basic_list.c fss_extended.c fss_errors.c
+build_sources_program
+build_sources_headers fss_basic.h fss_basic_list.h fss_extended.h fss_errors.h
 build_shared yes
 
 flags_all -z now