home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / demos / gpc / brfexption.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-15  |  5.0 KB  |  154 lines

  1. /* $XConsortium: brfexption.h,v 5.1 91/02/16 10:07:22 rws Exp $ */
  2.  
  3. /*
  4.  */
  5.  
  6. /*--------------------------------------------------------------------*\
  7. |
  8. |  Copyright (C) 1989,1990, 1991, National Computer Graphics Association
  9. |
  10. |  Permission is granted to any individual or institution to use, copy, or
  11. |  redistribute this software so long as it is not sold for profit, provided
  12. |  this copyright notice is retained.
  13. |
  14. |                         Developed for the
  15. |                National Computer Graphics Association
  16. |                         2722 Merrilee Drive
  17. |                         Fairfax, VA  22031
  18. |                           (703) 698-9600
  19. |
  20. |                                by
  21. |                 SimGraphics Engineering Corporation
  22. |                    1137 Huntington Drive  Unit A
  23. |                      South Pasadena, CA  91030
  24. |                           (213) 255-0900
  25. |---------------------------------------------------------------------
  26. |
  27. | Author        :    mfr / SimGraphics Engineering Corportation
  28. |
  29. | File          :    brfexception.h
  30. | Date          :    2/13/20
  31. | Project       :    PLB
  32. |
  33. | Descriptioni    :    Exception handler defines
  34. |
  35. | Status        :    Version 1.0
  36. |
  37. | Revisions     :    
  38. |
  39. |      12/90            MFC Tektronix, Inc.: PEX-SI PEX5R1 Release.
  40. |
  41. \*--------------------------------------------------------------------*/
  42.  
  43. /* ---------------------------------------------------------------------*\
  44. | Local MACROS                                        
  45. \*--------------------------------------------------------------------- */
  46.  
  47. #ifdef EXTERNALNOTE
  48.     /* the following defines represent the remnants of an 
  49.     early exception reporting system. The defines have been 
  50.     left in the code along with a vestige 
  51.     of the old system to track configuration dependant errors, which
  52.     are the only exceptions which cannot be tagged with the
  53.     tools in brf_except.c. */
  54. #endif
  55.  
  56. #define POW2(n) (1<<(n))
  57. #define NUM_GLOBAL_ERRORS 6
  58.  
  59.  
  60. #define BIF_EX_NONSUP POW2(0)         /* non-supported function */
  61. #define BIF_EX_BADOPT POW2(1)         /* non-supported option for this function */
  62. #define BIF_EX_NOTRUECOLOR POW2(2)     /* true color call in pseudo color mode */
  63. #define BIF_EX_BUFFMODE POW2(3)         /* user changed buffer mode */
  64. #define BIF_EX_WINSIZE POW2(4)         /* user changed window size */
  65. #define BIF_EX_BACKCOLOR POW2(5)    /* user changed background color */
  66.  
  67. /* Note that there is a text string for each defined exception above */
  68.  
  69. static char *brf_exception_txt[] = 
  70. {
  71.  
  72. "|  Non-supported function.                                             |\n",
  73. "|  Non-supported funtion for this option.                              |\n",
  74. "|  True Color called on Pseudo Color Config.                           |\n",
  75. "|  User preference replaced BUFFER_MODE.                               |\n",
  76. "|  User preference replaced WINDOW_SIZE.                               |\n",
  77. "|  User preference replaced BACKGROUND_COLOR.                          |\n",
  78. };
  79.  
  80. /* end old stuff */
  81.  
  82. #define PLB_EXCEPTION(plberror) \
  83. {\
  84.     plb_exception = plb_exception | plberror;\
  85. } /* End macro PLB_EXCEPTION */
  86.  
  87. #define EXCEPTION(ent,plberror) \
  88. {\
  89.     ent->exception = ent->exception | plberror;\
  90. } /* End macro EXCEPTION */
  91.  
  92. #define MAX_EXCEPTION 200
  93.  
  94.  
  95.  
  96. VGLOBAL int brf_num_ex_tests; /* number of exception tests we are doing.*/
  97. VGLOBAL int num_exception; /* how many exception messages are stored */
  98. /* newer exception handler stuff */
  99.  
  100. VGLOBAL int brf_num_ex_tests;/*number of known exceptions we are testing for*/
  101.  
  102. /* define the structure for the exception reporter */
  103.  
  104. #define RANGESTART 0
  105. #define RANGESTOP 1
  106. #define BRF_OK 0
  107. #define BRF_WARNING 1
  108. #define BRF_ERROR 2
  109. #define BRF_FAILURE 3
  110. #define BRF_UNBELIEVABLE_NIGHTMARE 4
  111. #define BRF_TOTAL_DISASTER 5
  112. #define NO_RANGE_DATA -999
  113.  
  114.  
  115. #ifdef EXTERNALNOTE
  116.     /* the following structure represents an exceptions test.
  117.     The first 4 fields to which tests are applied.
  118.     If a field is filled with a 0 or NULL, then the test
  119.     does not apply to the entity. In the case of range
  120.     data, where 0 and negative numbers are possible, the
  121.     value of -999 or -999.0 are considered non-tested
  122.     values. 
  123.     The fifth field holds a degree of error value,
  124.     which modifies the status of the exceptions output,
  125.     and can control execution of the PLB i so desired.
  126.     Feilds 6 and 7 hold a pointer to
  127.     a custom testing routine, and a text message. Both are
  128.     used if the above tests all test TRUE. brf_ex_numhits
  129.     counts how many times that specific exception occured.
  130.     brf_ex_logic contains logical operator codes to
  131.     invert, or otherwise modify the actions of special handlers
  132.      */
  133. #endif
  134.  
  135.  
  136. typedef struct
  137. {
  138.         int     brf_ex_type;         /* entity type */
  139.         int     brf_ex_optional[7];    /* seperate exception flags */
  140.         int     brf_ex_range[2];    /* Range integers */
  141.         float   brf_ex_rrange[2];    /* Range floats */
  142.         int     brf_ex_flag;         /* degree of error */
  143.         int     (*brf_ex_custom_handler)(); /* pointer to custom handler */
  144.         char    *brf_ex_message;    /* text of message for this exception */
  145.         int     brf_ex_logic;       /* logical operator */
  146.         int     brf_ex_numhits;      /* number of hits */
  147. } BRF_exception;
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.