/*
 *  dsp_fixpt_err.h
 *  Macros for common fixed-point data type error checking for DSP Blockset.
 *
 *  Copyright 1995-2000 The MathWorks, Inc.
 *  $Revision: 1.4 $ $Date: 2000/03/01 23:01:35 $
 */

#ifndef dsp_fixpt_err_h
#define dsp_fixpt_err_h

#include "dsp_fixpt_sim.h"

/****************************************************/
/*         DEFAULT ERROR MESSAGES                   */
/****************************************************/

#define InputMustBeFixedPoint            "Input must be fixed-point."
#define OutputMustBeFixedPoint           "Output must be fixed-point."

#define InputCannotBeFixedPoint          "Input cannot be fixed-point."
#define OutputCannotBeFixedPoint         "Output cannot be fixed-point."

#define InputMustBeSignedFixedPoint      "Input must be signed fixed-point."
#define OutputMustBeSignedFixedPoint     "Output must be signed fixed-point."

#define InputCannotBeSignedFixedPoint    "Input cannot be signed fixed-point."
#define OutputCannotBeSignedFixedPoint   "Output cannot be signed fixed-point."

#define InputMustBeUnsignedFixedPoint    "Input must be unsigned fixed-point."
#define OutputMustBeUnsignedFixedPoint   "Output must be unsigned fixed-point."

#define InputCannotBeUnsignedFixedPoint  "Input cannot be unsigned fixed-point."
#define OutputCannotBeUnsignedFixedPoint "Output cannot be unsigned fixed-point."


/****************************************************/
/*              ERROR CHECKING                      */
/****************************************************/

#define ErrorIfInputIsNotFixedPoint(S, port)        \
    if (!isInputFixedPoint(S, port)) {              \
        THROW_ERROR(S, InputMustBeFixedPoint);      \
    }

#define ErrorIfOutputIsNotFixedPoint(S, port)       \
    if (!isOutputFixedPoint(S, port)) {             \
        THROW_ERROR(S, OutputMustBeFixedPoint);     \
    }

#define ErrorIfInputIsFixedPoint(S, port)           \
    if (isInputFixedPoint(S, port)) {               \
        THROW_ERROR(S, InputCannotBeFixedPoint);    \
    }

#define ErrorIfOutputIsFixedPoint(S, port)          \
    if (isOutputFixedPoint(S, port)) {              \
        THROW_ERROR(S, OutputCannotBeFixedPoint);   \
    }

#define ErrorIfInputIsNotSignedFixedPoint(S, port)        \
    if (!isInputSignedFixedPoint(S, port)) {              \
        THROW_ERROR(S, InputMustBeSignedFixedPoint);      \
    }

#define ErrorIfOutputIsNotSignedFixedPoint(S, port)       \
    if (!isOutputSignedFixedPoint(S, port)) {             \
        THROW_ERROR(S, OutputMustBeSignedFixedPoint);     \
    }

#define ErrorIfInputIsSignedFixedPoint(S, port)           \
    if (isInputSignedFixedPoint(S, port)) {               \
        THROW_ERROR(S, InputCannotBeSignedFixedPoint);    \
    }

#define ErrorIfOutputIsSignedFixedPoint(S, port)          \
    if (isOutputSignedFixedPoint(S, port)) {              \
        THROW_ERROR(S, OutputCannotBeSignedFixedPoint);   \
    }

#define ErrorIfInputIsNotUnsignedFixedPoint(S, port)        \
    if (!isInputUnsignedFixedPoint(S, port)) {              \
        THROW_ERROR(S, InputMustBeUnsignedFixedPoint);      \
    }

#define ErrorIfOutputIsNotUnsignedFixedPoint(S, port)       \
    if (!isOutputUnsignedFixedPoint(S, port)) {             \
        THROW_ERROR(S, OutputMustBeUnsignedFixedPoint);     \
    }

#define ErrorIfInputIsUnsignedFixedPoint(S, port)           \
    if (isInputUnsignedFixedPoint(S, port)) {               \
        THROW_ERROR(S, InputCannotBeUnsignedFixedPoint);    \
    }

#define ErrorIfOutputIsUnsignedFixedPoint(S, port)          \
    if (isOutputUnsignedFixedPoint(S, port)) {              \
        THROW_ERROR(S, OutputCannotBeUnsignedFixedPoint);   \
    }

#endif /* dsp_fixpt_err_h */

/* [EOF] dsp_fixpt_err.c */
