home *** CD-ROM | disk | FTP | other *** search
/ vis-ftp.cs.umass.edu / vis-ftp.cs.umass.edu.tar / vis-ftp.cs.umass.edu / pub / Software / ASCENDER / ascendMar8.tar / UMass / Triangulate / error_message.c < prev    next >
C/C++ Source or Header  |  1995-04-13  |  6KB  |  225 lines

  1.   static char sccsid[] = "@(#)error_message.c    1.8 1/18/95";
  2.  
  3. /*
  4.  * Module Purpose: Contains the standard error routine used by the parser.
  5.  *
  6.  * Creation Date:  87/10/23
  7.  *
  8.  * Compiler Version:
  9.  *
  10.  * Hardware Used:  SUN 3
  11.  *
  12.  * Operating Systems:  UNIX -- SUN Release 3.4
  13.  *
  14.  *
  15.  * Class 3: General Electric Proprietary Data
  16.  * Copyright (C) 1987 General Electric Company
  17.  *
  18.  * Modified: 2/15/94 Bob Collins @ UMass
  19.  *           modified variable args to work for our site
  20.  */
  21.  
  22. #include "cvar.h"
  23. #include <stdio.h>
  24. #include "rh_util.h"
  25.  
  26. #ifndef CPARSE_RIH
  27. /*#   include <varargs.h>*/                                    /* BobC 2/15 */
  28. #   include <stdarg.h>                                         /* BobC 2/15 */
  29. #else
  30. #   include "varargs_parse.h"
  31. #endif
  32.  
  33. static BOOLEAN output_informative_messages = FALSE;
  34. static BOOLEAN output_warning_messages = TRUE;
  35. static BOOLEAN output_error_messages = TRUE;
  36. static BOOLEAN output_debugging_messages = FALSE;
  37.  
  38. /* Routines for setting the error enable flags */
  39.  
  40. FUNCTION_DEF ( void enable_debugging_messages, ())
  41.    {
  42.    output_debugging_messages = TRUE;
  43.    }
  44.  
  45. FUNCTION_DEF ( void enable_informative_messages, ())
  46.    { 
  47.    output_informative_messages = TRUE; 
  48.    }
  49.  
  50. FUNCTION_DEF ( void enable_warning_messages, ())
  51.    { 
  52.    output_warning_messages = TRUE; 
  53.    }
  54.  
  55. FUNCTION_DEF ( void enable_error_messages, ())
  56.    { 
  57.    output_error_messages = TRUE; 
  58.    }
  59.  
  60. FUNCTION_DEF ( void disable_informative_messages, ())
  61.    { 
  62.    output_informative_messages = FALSE; 
  63.    }
  64.  
  65. FUNCTION_DEF ( void disable_warning_messages, ())
  66.    { 
  67.    output_warning_messages = FALSE; 
  68.    }
  69.  
  70. FUNCTION_DEF ( void disable_error_messages, ())
  71.    { 
  72.    output_error_messages = FALSE; 
  73.    }
  74.  
  75. FUNCTION_DEF ( void disable_debugging_messages, ())
  76.    {
  77.    output_debugging_messages = FALSE;
  78.    }
  79.  
  80. /*>>
  81. Routines for outputting the messages.
  82. <<*/
  83.  
  84. /* void debugging_message (va_alist) */
  85. FUNCTION_DEF ( void debugging_message, (char* fmt, DOTDOTDOT))
  86.    {
  87.    /* Get the message and print the specific error message */
  88.  
  89.    /* Check to see whether we should output the message */
  90.    if (! output_debugging_messages) return;
  91.  
  92.    /* Output the message */
  93.       {
  94.       va_list args;
  95.  
  96.       /* Initialize the parameter list */
  97.       va_start (args, fmt);                                    /* BobC 2/15 */
  98.  
  99.       /* Print the message */
  100.       /* vfprintf is basically the same as _doprnt */
  101.       vfprintf (stderr, fmt, args);
  102.  
  103.       /* Print a line feed */
  104.       fprintf (stderr, "\n");
  105.  
  106.       /* Finish with the arguments */
  107.       va_end (args);
  108.       }
  109.    }
  110.  
  111. /* void informative_message (va_alist) */
  112. FUNCTION_DEF ( void informative_message, (char* fmt, DOTDOTDOT))
  113.    {
  114.    /* Get the message and print the specific error message */
  115.  
  116.    /* Check to see whether we should output the message */
  117.    if (! output_informative_messages) return;
  118.  
  119.    /* Output the message */
  120.       {
  121.       va_list args;
  122.  
  123.       /* Initialize the parameter list */
  124.       va_start (args, fmt);                                    /* BobC 2/15 */
  125.  
  126.       /* Print the message */
  127.       /* vfprintf is basically the same as _doprnt */
  128.       vfprintf (stderr, fmt, args);
  129.  
  130.       /* Print a line feed */
  131.       fprintf (stderr, "\n");
  132.  
  133.       /* Finish with the arguments */
  134.       va_end (args);
  135.       }
  136.    }
  137.  
  138. /* void warning_message (va_alist) */
  139. FUNCTION_DEF ( void warning_message, (char* fmt, DOTDOTDOT))
  140.    {
  141.    /* Print the general message header */
  142.  
  143.    /* Check to see whether we should output the message */
  144.    if (! output_warning_messages) return;
  145.  
  146.    fprintf (stderr, "Warning : ");
  147.  
  148.    /* Get the message and print the specific error message */
  149.       {
  150.       va_list args;
  151.  
  152.       /* Initialize the parameter list */
  153.       va_start (args, fmt);                                    /* BobC 2/15 */
  154.  
  155.       /* Print the message */
  156.       /* vfprintf is basically the same as _doprnt */
  157.       vfprintf (stderr, fmt, args);
  158.  
  159.       /* Print a line feed */
  160.       fprintf (stderr, "\n");
  161.  
  162.       /* Finish with the arguments */
  163.       va_end (args);
  164.       }
  165.    }
  166.  
  167. /* void error_message (va_alist) */
  168. FUNCTION_DEF ( void error_message, (char* fmt, DOTDOTDOT))
  169.    {
  170.    /* Print the general message header */
  171.  
  172.    /* Check to see whether we should output the message */
  173.    if (! output_error_messages) return;
  174.  
  175.    fprintf (stderr,"Error : ");
  176.  
  177.    /* Get the message and print the specific error message */
  178.       {
  179.       va_list args;
  180.  
  181.       /* Initialize the parameter list */
  182.       va_start (args, fmt);                                    /* BobC 2/15 */
  183.  
  184.       /* Print the message */
  185.       /* vfprintf is basically the same as _doprnt */
  186.       vfprintf (stderr, fmt, args);
  187.  
  188.       /* Print a line feed */
  189.       fprintf (stderr, "\n");
  190.  
  191.       /* Finish with the arguments */
  192.       va_end (args);
  193.       }
  194.    }
  195.  
  196. /* void nerror (va_alist) */
  197. FUNCTION_DEF ( void nerror, (char* fmt, DOTDOTDOT))
  198.    {
  199.    /* Print the general message header */
  200.    fprintf (stderr,"Numerical Recipes run-time error ...\n");
  201.  
  202.    /* Get the message and print the specific error message */
  203.       {  
  204.       va_list args;
  205.  
  206.       /* Initialize the parameter list */
  207.       va_start (args, fmt);                                    /* BobC 2/15 */
  208.  
  209.       /* Print the message */
  210.       /* vfprintf is basically the same as _doprnt */
  211.       vfprintf (stderr, fmt, args);
  212.  
  213.       /* Print a line feed */
  214.       fprintf (stderr, "\n");
  215.  
  216.       /* Finish with the arguments */
  217.       va_end (args);
  218.       }  
  219.  
  220.    /* Exit the program */
  221.    fprintf (stderr, "\t... Exiting numerical routine ...\n");
  222.    bail_out (1);
  223.    }
  224.    
  225.