(file) Return to PegasusAssertZOS.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 martin 1.4 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.5 //
  3 martin 1.4 // Licensed to The Open Group (TOG) under one or more contributor license
  4            // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5            // this work for additional information regarding copyright ownership.
  6            // Each contributor licenses this file to you under the OpenPegasus Open
  7            // Source License; you may not use this file except in compliance with the
  8            // License.
  9 martin 1.5 //
 10 martin 1.4 // Permission is hereby granted, free of charge, to any person obtaining a
 11            // copy of this software and associated documentation files (the "Software"),
 12            // to deal in the Software without restriction, including without limitation
 13            // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14            // and/or sell copies of the Software, and to permit persons to whom the
 15            // Software is furnished to do so, subject to the following conditions:
 16 martin 1.5 //
 17 martin 1.4 // The above copyright notice and this permission notice shall be included
 18            // in all copies or substantial portions of the Software.
 19 martin 1.5 //
 20 martin 1.4 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.5 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.4 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23            // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24            // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25            // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26            // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.5 //
 28 martin 1.4 //////////////////////////////////////////////////////////////////////////
 29 thilo.boehm 1.1 //
 30                 //%/////////////////////////////////////////////////////////////////////////////
 31                 #ifndef Pegasus_Assert_ZOS_h
 32                 #define Pegasus_Assert_ZOS_h
 33                 
 34                 #include <ctest.h>
 35                 #include <signal.h>
 36 marek       1.2 #include <unistd.h>
 37                 #include <stdio.h>
 38 thilo.boehm 1.1 
 39 kumpf       1.6 /*
 40                    This function is executing a number of assertaion task.
 41                    In differnet to the standard assert() function,
 42 thilo.boehm 1.1    this function does not abort the server!
 43                 
 44                    1) Print a statement to stderr
 45                    2) Create a stack trace
 46                    3) Create a system dump
 47 kumpf       1.6 
 48 thilo.boehm 1.1 */
 49                 
 50                 void __pegasus_assert_zOS(const char* file, int line, const char* cond);
 51                 
 52 kumpf       1.6 /*
 53 thilo.boehm 1.1    Define PEGASUS_ASSERT assertion statement.  This statement tests the
 54                    condition defined by the parameters and if not True executes an number
 55                    of tasks.
 56                 */
 57                 
 58                 # define PEGASUS_ASSERT(COND)                                               \
 59                       do                                                                    \
 60                       {                                                                     \
 61                           if (!(COND))                                                      \
 62                           {                                                                 \
 63                              __pegasus_assert_zOS( __FILE__, __LINE__, #COND );             \
 64                           }                                                                 \
 65 r.kieninger 1.3       } while (0)
 66 thilo.boehm 1.1 
 67 kumpf       1.6 /*
 68                    Define PEGASUS_DEBUG_ASSERT assertion statement.
 69 thilo.boehm 1.1    It only generates code if PEGASUS_DEBUG is defined
 70 kumpf       1.6    This statement tests the condition defined by the parameters and
 71 thilo.boehm 1.1    if not True executes an number of tasks and abort the server !
 72                 */
 73                 
 74                 #ifdef PEGASUS_DEBUG
 75                 # define PEGASUS_DEBUG_ASSERT(COND)                                         \
 76                       do                                                                    \
 77                       {                                                                     \
 78                           if (!(COND))                                                      \
 79                           {                                                                 \
 80                              fprintf(stderr,                                                \
 81                                   "\nPEGASUS_DEBUG_ASSERT: Assertation \'%s\' failed "      \
 82                                   "in file %s ,line %d\n",#COND,__FILE__,__LINE__);         \
 83                              ctrace("PEGASUS_DEBUG_ASSERT: Assertation \'"                  \
 84                                   #COND"\' failed.");                                       \
 85                              kill(getpid(),SIGDUMP);                                        \
 86                              abort();                                                       \
 87                           }                                                                 \
 88 r.kieninger 1.3       } while (0)
 89 thilo.boehm 1.1 #else
 90                 # define PEGASUS_DEBUG_ASSERT(COND)
 91                 #endif
 92                 
 93                 #define PEGASUS_TEST_ASSERT(COND)                                          \
 94                     do                                                                     \
 95                     {                                                                      \
 96                         if (!(COND))                                                       \
 97                         {                                                                  \
 98                             fprintf(stderr,                                                \
 99                                  "\nPEGASUS_TEST_ASSERT: Assertation \'%s\' failed "       \
100                                  "in file %s ,line %d\n",#COND,__FILE__,__LINE__);         \
101                             ctrace("PEGASUS_TEST_ASSERT: Assertation \'"                   \
102                                  #COND"\' failed.");                                       \
103                             kill(getpid(),SIGDUMP);                                        \
104                             abort();                                                       \
105                         }                                                                  \
106 r.kieninger 1.3     } while (0)
107 thilo.boehm 1.1 #endif  /* Pegasus_Assert_ZOS_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2