]> git.donarmstrong.com Git - genome.git/blob - Error.cpp
add cxflags and debugging flags
[genome.git] / Error.cpp
1 ////////////////////////////////////////////////////////////////////// \r
2 // Error.cpp \r
3 //////////////////////////////////////////////////////////////////////////////\r
4 //              COPYRIGHT NOTICE FOR GENOME CODE\r
5 //\r
6 // Copyright (C) 2006 - 2009, Liming Liang and Goncalo Abecasis,\r
7 // All rights reserved.\r
8 //\r
9 //   Redistribution and use in source and binary forms, with or without\r
10 //   modification, are permitted provided that the following conditions\r
11 //   are met:\r
12 //\r
13 //     1. Redistributions of source code must retain the above copyright\r
14 //        notice, this list of conditions and the following disclaimer.\r
15 //\r
16 //     2. Redistributions in binary form must reproduce the above copyright\r
17 //        notice, this list of conditions and the following disclaimer in the\r
18 //        documentation and/or other materials provided with the distribution.\r
19 //\r
20 //     3. The names of its contributors may not be used to endorse or promote\r
21 //        products derived from this software without specific prior written\r
22 //        permission.\r
23 //\r
24 //   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
25 //   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
26 //   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
27 //   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR\r
28 //   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\r
29 //   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
30 //   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\r
31 //   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
32 //   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
33 //   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
34 //   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
35 //\r
36 ///////////////////////////////////////////////////////////////////////////////\r
37 \r
38 #include "Error.h"\r
39 \r
40 #include "stdlib.h"\r
41 #include "stdarg.h"\r
42 #include "stdio.h"\r
43 \r
44 // Declare a dummy class to ensure that compilers recognize this as C++ code\r
45 class String;\r
46 \r
47 void error ( const char * msg, ... )\r
48    {\r
49    va_list  ap;\r
50 \r
51    va_start(ap, msg);\r
52 \r
53    printf("\nFATAL ERROR - \n");\r
54    vprintf(msg, ap);\r
55    printf("\n\n");\r
56 \r
57    va_end(ap);\r
58 \r
59    exit(EXIT_FAILURE);\r
60    }\r
61 \r
62 void warning ( const char * msg, ... )\r
63    {\r
64    va_list  ap;\r
65 \r
66    va_start(ap, msg);\r
67 \r
68    printf("\n\aWARNING - \n");\r
69    vprintf(msg, ap);\r
70    printf("\n");\r
71 \r
72    va_end(ap);\r
73    }\r
74 \r
75 void numerror ( const char * msg , ... )\r
76    {\r
77    va_list  ap;\r
78 \r
79    va_start(ap, msg);\r
80 \r
81    printf("\nFATAL NUMERIC ERROR - ");\r
82    vprintf(msg, ap);\r
83    printf("\n\n");\r
84 \r
85    va_end(ap);\r
86 \r
87    exit(EXIT_FAILURE);\r
88    }\r