Error.cpp

00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #include "Error.h"
00019 
00020 #include <stdlib.h>
00021 #include <stdarg.h>
00022 #include <stdio.h>
00023 
00024 // Declare a dummy class to ensure that compilers recognize this as C++ code
00025 class String;
00026 
00027 void error(const char * msg, ...)
00028 {
00029     va_list  ap;
00030 
00031     va_start(ap, msg);
00032 
00033     printf("\nFATAL ERROR - \n");
00034     vprintf(msg, ap);
00035     printf("\n\n");
00036 
00037     va_end(ap);
00038 
00039     exit(EXIT_FAILURE);
00040 }
00041 
00042 void warning(const char * msg, ...)
00043 {
00044     va_list  ap;
00045 
00046     va_start(ap, msg);
00047 
00048     printf("\n\aWARNING - \n");
00049     vprintf(msg, ap);
00050     printf("\n");
00051 
00052     va_end(ap);
00053 }
00054 
00055 void numerror(const char * msg , ...)
00056 {
00057     va_list  ap;
00058 
00059     va_start(ap, msg);
00060 
00061     printf("\nFATAL NUMERIC ERROR - ");
00062     vprintf(msg, ap);
00063     printf("\n\n");
00064 
00065     va_end(ap);
00066 
00067     exit(EXIT_FAILURE);
00068 }
Generated on Wed Nov 17 15:38:28 2010 for StatGen Software by  doxygen 1.6.3