]> rtime.felk.cvut.cz Git - frescor/frsh-include.git/blobdiff - frsh_error.h
const
[frescor/frsh-include.git] / frsh_error.h
index 32765e20224c8ba2f64dce16aa8670700e9a6188..cb3ab06f1d2f4428c323be6c666d1aec300629f0 100644 (file)
 #define FRSH_WRN_MODULE_NOT_SUPPORTED            0x0200401E
 #define FRSH_ERR_NOT_INITIALIZED                 0x0200401F
 #define FRSH_ERR_TOO_MANY_SHARED_OBJS            0x02004020
-#define FRSH_ERR_CONTRACT_ID_ALREADY_EXISTS      0x02004021
+#define FRSH_ERR_CONTRACT_LABEL_ALREADY_EXISTS   0x02004021
 #define FRSH_ERR_BUDGET_EXPIRED                  0x02004022
 #define FRSH_ERR_SHARED_OBJECT_NOT_PROTECTED     0x02004023
 #define FRSH_ERR_NOT_IMPLEMENTED                 0x02004024
 #define FRSH_ERR_CONTRACT_TYPE_NOT_COMPATIBLE    0x02004025
 #define FRSH_ERR_CAPACITY_NOT_DECREASING         0x02004026
+#define FRSH_ERR_CONTRACT_LABEL_UNKNOWN          0x02004027
 
-#define FRSH_ERR_LAST_VALUE                      0x02004027
+#define FRSH_ERR_LAST_VALUE                      0x02004028
 
 #define ERROR(nn,ss) do {if(nn>FRSH_ERR_BASE_VALUE) my_frsh_strerror(nn, ss); else perror(ss); exit (nn);} while (0)
 
 
+
+
 int frsh_strerror (int error, char *message, size_t size);
 void my_frsh_strerror(int error, char *sss);
 
@@ -153,7 +156,7 @@ void my_frsh_strerror(int error, char *sss);
  \
         char error_string[1024]; \
  \
-        sprintf(error_string,  "File: %s, at line %d, error %d: %s", __FILE__, __LINE__, (_nn_), _ss_); \
+        sprintf(error_string,  "File: %s, in function %s at line %d, error %d: %s\n", __FILE__, __FUNCTION__, __LINE__, (_nn_), _ss_); \
  \
                if( (_nn_)>FRSH_ERR_BASE_VALUE ) {      \
                        my_frsh_strerror( (_nn_), error_string);        \
@@ -162,28 +165,6 @@ void my_frsh_strerror(int error, char *sss);
                }                                       \
 } while(0) 
 
-/**
- * PERROR_FRESCOR_FUNCNAME
- *
- * This macro checks the given error number and composes a messages accordingly.
- *
- * FUNCNAME (char *) has to point to the current function name.
- *
- * @param nn  Error number
- * @param ss  Error string (to be appended to FRSH or system error string)
- *
- **/
-#define PERROR_FRESCOR_FUNCNAME(_nn_,_ss_) do {        \
- \
-     char error_string[1024]; \
- \
-     sprintf(error_string,  "File: %s, in function %s at line %d, error %d: %s", __FILE__, FUNCNAME, __LINE__, (_nn_), _ss_); \
-               if( (_nn_) > FRSH_ERR_BASE_VALUE ) {    \
-                       my_frsh_strerror( (_nn_), error_string);        \
-               } else {                                \
-                       perror(error_string);                   \
-               }                                       \
-} while(0) 
 
 
 /**
@@ -200,22 +181,6 @@ void my_frsh_strerror(int error, char *sss);
                return (nn);                            \
        } while (0)
 
-/**
- * PERROR_AND_RETURN_FUNCNAME
- *
- * Macro that displays an error code and message and then returns from
- * the current function
- *
- * FUNCNAME (char *) has to point to the current function name.
- * 
- * @param nn  Error number
- * @param ss  Error string (to be appended to FRSH or system error string)
- **/
-#define PERROR_AND_RETURN_FUNCNAME(nn,ss) do {                 \
-        PERROR_FRESCOR_FUNCNAME(nn, ss); \
-               return (nn);                            \
-       } while (0)
-
 
 
 
@@ -234,22 +199,6 @@ void my_frsh_strerror(int error, char *sss);
        } while (0)
 
 
-/**
- * PERROR_AND_EXIT_FUNCNAME
- *
- * Macro that displays an error code and message and then aborts the
- * program.
- *
- * FUNCNAME (char *) has to point to the current function name.
- * 
- * @param nn  Error number
- * @param ss  Error string (to be appended to FRSH or system error string)
- **/
-#define PERROR_AND_EXIT_FUNCNAME(nn,ss) do {   \
-               PERROR_FRESCOR_FUNCNAME(nn,ss);         \
-               exit(nn);               \
-       } while (0)
-
 /**
  * PRW:  Perror and Return Wrapper
  *
@@ -270,22 +219,6 @@ void my_frsh_strerror(int error, char *sss);
 } while(0)
 
 
-/**
- * PRFW:  Perror and Return Funcname Wrapper
- *
- * Function that displays an error code and message and then returns from
- * the current function and returns from the function..
- *
- * @param nn  Error number
- * @param ss  Error string (to be appended to FRSH or system error string)
- **/
-#define PRFW(funccall)  do { \
-  if ( (terror = funccall ) != 0) \
-  { \
-     PERROR_AND_RETURN_FUNCNAME( terror, STR_HELPER(funccall) ); \
-  } \
-} while(0)
-
 
 /**
  * PXW:  Perror and eXit Wrapper
@@ -308,23 +241,6 @@ void my_frsh_strerror(int error, char *sss);
 
 
 
-/**
- * PXFW:  Perror and eXit Funcname Wrapper
- *
- * Function that displays an error code and message and then returns from
- * the current function
- *
- * @param nn  Error number
- * @param ss  Error string (to be appended to FRSH or system error string)
- **/
-#define PXFW(funccall)  do { \
-  if ( (terror = funccall ) != 0) \
-  { \
-     PERROR_AND_EXIT_FUNCNAME( terror, STR_HELPER(funccall) ); \
-  } \
-} while(0)
-
-
 /**
  * PERROR_KERN_AND_EXIT
  *