// -----------------------------------------------------------------------
-// Copyright (C) 2006 - 2008 FRESCOR consortium partners:
+// Copyright (C) 2006 - 2009 FRESCOR consortium partners:
//
// Universidad de Cantabria, SPAIN
// University of York, UK
// by the GNU General Public License. This exception does not
// however invalidate any other reasons why the executable file might be
// covered by the GNU Public License.
-// As a special exception, if you include this header file into source
-// files to be compiled, this header file does not by itself cause
-// the resulting executable to be covered by the GNU General Public
-// License. This exception does not however invalidate any other
-// reasons why the executable file might be covered by the GNU General
-// Public License.
// -----------------------------------------------------------------------
//frsh_error.h
//==============================================
// **//// /**///** ////////** /**//////**
// ** /** //** /** /** /**
// ** /** //** ******** /** /**
-// // // // //////// // //
+// // // // //////// // //
//
// FRSH(FRescor ScHeduler), pronounced "fresh"
//==============================================
#ifndef FRSH_ERROR_H_
#define FRSH_ERROR_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* @file frsh_error.h
**/
#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_OUT_OF_BUDGET 0x02004028
+#define FRSH_ERR_ALREADY_IN_FRSH 0x02004029
+
+#define FRSH_ERR_LAST_VALUE 0x02004030
-#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)
+#ifdef AQuoSA
+#define my_frsh_perror(nn,ss) do { errno = nn; perror(ss); } while(0)
+#else
+#define my_frsh_perror(nn,ss) do { perror(ss); } while(0)
+#endif
+#define ERROR(nn,ss) do {if(nn>FRSH_ERR_BASE_VALUE) my_frsh_strerror(nn, ss); else { my_frsh_perror(nn, ss); } exit (nn);} while (0)
int frsh_strerror (int error, char *message, size_t size);
void my_frsh_strerror(int error, char *sss);
-
/**
* This str_helper is needed to ensure argument expansion,
* see http://www.iar.com/p180591/p180591_eng.php
if( (_nn_)>FRSH_ERR_BASE_VALUE ) { \
my_frsh_strerror( (_nn_), error_string); \
} else { \
- perror(error_string); \
+ my_frsh_perror(_nn_, error_string); \
} \
-} while(0)
+} while(0)
* terror (int) needs to be visible in the point of call.
*
* @param funccall Code to execute that should return 0 in a non error
- * case.
+ * case.
**/
#define PRW(funccall) do { \
if ( (terror = funccall ) != 0) \
* terror (int) needs to be visible in the point of call.
*
* @param funccall Code to execute that should return 0 in a non error
- * case.
+ * case.
**/
#define PXW(funccall) do { \
if ( (terror = funccall ) != 0) \
/*}*/
+#ifdef __cplusplus
+}
+#endif
+
+
#endif /* !FRSH_ERROR_H_ */