From 9af1e7dab2bf37b40b809cd96632dc313a2a67e3 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Sat, 10 Mar 2012 22:34:17 -0600 Subject: [PATCH] Update: add fss_error level 2 functions Provide fss-specific error code to string translation. --- level_2/fll_fss/c/fss_errors.c | 72 +++++++++++++++++++++++++++++++++++++ level_2/fll_fss/c/fss_errors.h | 40 +++++++++++++++++++++ level_2/fll_fss/data/build/settings | 8 ++--- 3 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 level_2/fll_fss/c/fss_errors.c create mode 100644 level_2/fll_fss/c/fss_errors.h diff --git a/level_2/fll_fss/c/fss_errors.c b/level_2/fll_fss/c/fss_errors.c new file mode 100644 index 0000000..4ac8e25 --- /dev/null +++ b/level_2/fll_fss/c/fss_errors.c @@ -0,0 +1,72 @@ +/* FLL - Level 2 + * Project: FSS + * Version: 0.3.x + * Licenses: lgplv2.1 + * Programmers: Kevin Day + */ +#include + +#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 index 0000000..adc4f7a --- /dev/null +++ b/level_2/fll_fss/c/fss_errors.h @@ -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 +#include +#include +#include +#include + +// fll-1 includes +#include +#include +#include +#include +#include + +#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 diff --git a/level_2/fll_fss/data/build/settings b/level_2/fll_fss/data/build/settings index 3011773..e9b5a37 100644 --- a/level_2/fll_fss/data/build/settings +++ b/level_2/fll_fss/data/build/settings @@ -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 -- 1.8.3.1