/* * MPSCommon.h * MPSLinkProcessor * * Created by Stephen Norum. * Copyright 2007 Stanford Linear Accelerator Center. All rights reserved. * */ #ifndef MPSCOMMON_H #define MPSCOMMON_H #ifdef __cplusplus extern "C" { #endif /**************************************************************************************** * Special Values ***************************************************************************************/ #ifndef NULL #define NULL ('\0') #endif #ifndef FALSE #define FALSE (0) #endif #ifndef TRUE #define TRUE (!(FALSE)) #endif #ifdef FAULTED #warning "FAULTED is already defined. It must be define as FALSE or 0." #else #define FAULTED (FALSE) #endif #ifdef OK #warning "OK is already defined. It must be define as TRUE or !(0)." #else #define OK (TRUE) #endif #ifndef NAN #define NAN (0.0/0.0) #endif #define MPSSwapu16(value) ((( (value) & 0xff ) << 8) | (( (value) >> 8 ) & 0xff)) /**************************************************************************************** * Return Values ***************************************************************************************/ enum MPSCommonReturnValues { MPS_SUCCESS = 0, MPS_ERROR = -1, MPS_ERROR_ARGUMENT_OUT_OF_RANGE = -2, MPS_ERROR_INVALID_ARGUMENT = -3, MPS_ERROR_EMPTY_LIST = -4, MPS_ERROR_ELEMENT_NOT_FOUND_IN_LIST = -5, MPS_ERROR_HOST_NOT_FOUND = -6, MPS_ERROR_SOCKET_CREATION_FAILED = -7, MPS_ERROR_QUEUE_CREATION_FAILED = -8, MPS_ERROR_THREAD_CREATION_FAILED = -9, MPS_ERROR_ENVIRONMENT_VARIABLE_NOT_SET = -10, MPS_ERROR_FILE_NOT_FOUND = -11 }; #ifdef __cplusplus } #endif #endif