FE_error.cpp
上传用户:italyroyal
上传日期:2013-05-06
资源大小:473k
文件大小:3k
- ///////////////////////////////////////////////////////////////////////////////
- // This is a part of the Feature program.
- // Version: 1.0
- // Date: February 22, 2003
- // Programmer: Oh-Wook Kwon
- // Copyright(c) 2003 Oh-Wook Kwon. All rights reserved. owkwon@ucsd.edu
- ///////////////////////////////////////////////////////////////////////////////
- /**********************************
- * Error handling routines *
- **********************************/
- #include "StdAfx.h"
- #include <stdlib.h>
- #include <stdarg.h>
- #include "FE_feature.h"
- int Fe::FE_INFO (char *fmt, ... )
- {
- fprintf(stderr, "INFO(%s, %s): ", __FILE__,__LINE__);
- va_list args;
- va_start (args, fmt);
- err_ret(fmt, args);
- va_end (args);
- return 1;
- }
- int Fe::FE_WARN (char *fmt, ... )
- {
- fprintf(stderr, "WARN(%s, %s): ", __FILE__,__LINE__);
- va_list args;
- va_start (args, fmt);
- err_ret(fmt, args);
- va_end (args);
- return 1;
- }
- int Fe::FE_ERROR (char *fmt, ... )
- {
- fprintf(stderr, "ERROR(%s, %s): ", __FILE__,__LINE__);
- va_list args;
- va_start (args, fmt);
- err_quit(fmt, args);
- va_end (args);
- return 1;
- }
- int Fe::FE_FATAL (char *fmt, ... )
- {
- fprintf(stderr, "FATAL(%s, %s): ", __FILE__,__LINE__);
- va_list args;
- va_start (args, fmt);
- err_quit(fmt, args);
- va_end (args);
- return 1;
- }
- /*
- * Fatal error. Print a message and terminate.
- * err_quit(format,arg1,arg2, ...)
- * The string "format" must specify the conversion specification for any args.
- */
- int Fe::err_quit (char *fmt, ... )
- {
- va_list args;
- va_start (args, fmt);
- //int *next_int = va_arg (args, int *);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
- #ifndef _WIN32
- exit (1);
- #endif
- return 1;
- }
- /*
- * Recoverable error. Print a message, and return to caller.
- * err_ret(format,arg1,arg2, ...)
- * The string "format" must specify the conversion specification for any args.
- */
- int Fe::err_ret (char *fmt, ... )
- {
- va_list args;
- va_start (args, fmt);
- //int *next_int = va_arg (args, int *);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
- return (1);
- }
- /*
- * Fatal error. Print a message, dump core (for debugging) and terminate.
- * err_dump(format,arg1,arg2, ...)
- * The string "format" must specify the conversion specification for any args.
- */
- int Fe::err_dump (char *fmt, ... )
- {
- va_list args;
- va_start (args, fmt);
- //int *next_int = va_arg (args, int *);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
- abort (); /* dump core and terminate */
- #ifndef _WIN32
- exit (1); /* shouldn't get here */
- #endif
- return 1;
- }
- int Fe::err_fopen (const char *s)
- {
- fprintf (stderr, "nFile open error (%s) !!! n", s);
- assert(0);
- //exit (1);
- return 0;
- }