myassertP.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: myassertP.h /main/4 1995/10/26 15:14:54 rswiston $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. **
  27. ** File: myassertP.h
  28. **
  29. ** Project: DT
  30. **
  31. ** Description: Private include file for the Action Library.
  32. **
  33. **
  34. ** (c) Copyright 1993 by Hewlett-Packard Company
  35. **
  36. **
  37. **
  38. ****************************************************************************
  39. ************************************<+>*************************************/
  40. #ifndef MY_ASSERT_INCLUDED
  41. # define MY_ASSERT_INCLUDED
  42. # ifndef NDEBUG
  43. # if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
  44. /* ANSI Version */
  45. # define myassert(EX) \
  46. ((EX)? 1 : (fprintf(stderr,"STDC Assertion failed: \""#EX"\"\n\tFile: %s\n\tLine: %d\n",__FILE__,__LINE__),0))
  47. # else
  48. /* NON-ANSI C */
  49. # define myassert(EX) \
  50. ((EX)? 1 : (fprintf(stderr,"NOSTDC Assertion failed: \"EX\"\n\tFile: %s\n\tLine: %d\n",__FILE__,__LINE__),0))
  51. # endif /* STD_C */
  52. # else
  53. # define myassert(EX) (1)
  54. # endif
  55. #endif /* MY_ASSERT_INCLUDED */