libStatGen Software  1
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 #include "PhoneHome.h"
00024 
00025 // Declare a dummy class to ensure that compilers recognize this as C++ code
00026 class String;
00027 
00028 void error(const char * msg, ...)
00029 {
00030     va_list  ap;
00031 
00032     va_start(ap, msg);
00033 
00034     printf("\nFATAL ERROR - \n");
00035     vprintf(msg, ap);
00036     printf("\n\n");
00037 
00038     va_end(ap);
00039 
00040     PhoneHome::completionStatus("error: Exiting due to Fatal Error"); 
00041     exit(EXIT_FAILURE);
00042 }
00043 
00044 void warning(const char * msg, ...)
00045 {
00046     va_list  ap;
00047 
00048     va_start(ap, msg);
00049 
00050     printf("\n\aWARNING - \n");
00051     vprintf(msg, ap);
00052     printf("\n");
00053 
00054     va_end(ap);
00055 }
00056 
00057 void numerror(const char * msg , ...)
00058 {
00059     va_list  ap;
00060 
00061     va_start(ap, msg);
00062 
00063     printf("\nFATAL NUMERIC ERROR - ");
00064     vprintf(msg, ap);
00065     printf("\n\n");
00066 
00067     va_end(ap);
00068 
00069     exit(EXIT_FAILURE);
00070 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends