run_time_functions.cpp
Go to the documentation of this file.
1 
9 /*****************************************************************************
10 ** Includes
11 *****************************************************************************/
12 
13 #include <cstdio>
14 #include "../../include/ecl/errors/run_time_functions.hpp"
15 #include "../../include/ecl/errors/handlers.hpp"
16 
17 /*****************************************************************************
18 ** Function Implementation [assert]
19 *****************************************************************************/
20 
21 #if defined(NDEBUG) || defined(ECL_NDEBUG)
22 #else
23  void ecl_run_time_assert ( bool requirement, const char* location, const char* msg)
24  {
25  if ( !requirement )
26  {
27  fputs ("Location : ", stderr);
28  fputs ( location ,stderr);
29  fputs ("\n", stderr);
30  fputs ("Message : ", stderr);
31  fputs ( msg, stderr);
32  fputs ( "\n", stderr);
33  ::abort();
34  }
35  }
36  void ecl_run_time_assert ( bool requirement, const char* location, ecl::ErrorFlag type)
37  {
38  if ( !requirement )
39  {
40  fputs ("Location : ", stderr);
41  fputs ( location ,stderr);
42  fputs ("\n", stderr);
43  fputs ("Message : ", stderr);
44  fputs ( ecl::Error(type).what(), stderr);
45  fputs ( "\n", stderr);
46  ::abort();
47  }
48  }
49 #endif
50 
51 
52 /*****************************************************************************
53 ** Function Implementation [abort]
54 *****************************************************************************/
55 
56 void ecl_run_time_abort ( const char* location, const char* msg)
57 {
58  fputs ( "Location : ", stderr);
59  fputs ( location, stderr);
60  fputs ("\nMessage : ", stderr);
61  fputs ( msg, stderr);
62  fputs ( "\n", stderr);
63  ::abort();
64 }
65 
66 void ecl_run_time_abort ( const char* location, ecl::ErrorFlag type )
67 {
68  fputs ( "Location : ", stderr);
69  fputs ( location,stderr);
70  fputs ("\nMessage : ", stderr);
71  fputs ( ecl::Error(type).what(), stderr);
72  fputs ( "\n", stderr);
73  ::abort();
74 }
75 
ErrorFlag
Enumerated flags for error message handling.
Definition: flags.hpp:36
void ecl_run_time_assert(bool requirement, const char *location, const char *msg)
Condition test, aborts with a programmable error string if it fails.
void ecl_run_time_abort(const char *location, const char *msg)
Puts a customised error string to stderr before aborting the program.
The primary error handler for ecl libraries.
Definition: handlers.hpp:58


ecl_errors
Author(s): Daniel Stonier
autogenerated on Fri Jun 7 2019 21:52:44