Home | History | Annotate | Download | only in inc
      1 /*
      2  *  Copyright 2001-2008 Texas Instruments - http://www.ti.com/
      3  *
      4  *  Licensed under the Apache License, Version 2.0 (the "License");
      5  *  you may not use this file except in compliance with the License.
      6  *  You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  *  Unless required by applicable law or agreed to in writing, software
     11  *  distributed under the License is distributed on an "AS IS" BASIS,
     12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  *  See the License for the specific language governing permissions and
     14  *  limitations under the License.
     15  */
     16 
     17 
     18 /*
     19  *  ======== dbc.h ========
     20  *  DSP-BIOS Bridge driver support functions for TI OMAP processors.
     21  *  Purpose:
     22  *      "Design by Contract" programming macros.
     23  *
     24  *  Public Functions:
     25  *      DBC_Assert
     26  *      DBC_Require
     27  *      DBC_Ensure
     28  *
     29  *  Notes:
     30  *      Requires that the GT->ERROR function has been defaulted to a valid
     31  *      error handler for the given execution environment.
     32  *
     33  *      Does not require that GT_init() be called.
     34  *
     35  *! Revision History:
     36  *! ================
     37  *! 11-Aug-2000 ag: Removed include <std.h>
     38  *! 22-Apr-1996 gp: Created.
     39  */
     40 
     41 #ifndef DBC_
     42 #define DBC_
     43 
     44 #ifdef __cplusplus
     45 extern "C" {
     46 #endif
     47 
     48 /* Assertion Macros: */
     49 #if GT_TRACE
     50 
     51 #include <gt.h>
     52 
     53 #define DBC_Assert( exp ) \
     54     if (!(exp)) \
     55             (*GT->ERRORFXN)("%s, line %d: Assertion (" #exp ") failed.\n", \
     56             __FILE__, __LINE__)
     57 #define DBC_Require DBC_Assert	/* Function Precondition.  */
     58 #define DBC_Ensure  DBC_Assert	/* Function Postcondition. */
     59 
     60 #else
     61 
     62 #define DBC_Assert(exp)
     63 #define DBC_Require(exp)
     64 #define DBC_Ensure(exp)
     65 
     66 #endif				/* DEBUG */
     67 
     68 #ifdef __cplusplus
     69 }
     70 #endif
     71 #endif				/* DBC_ */
     72