msa
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@102253 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,100 @@ |
1 |
+/***************************************************************** |
|
2 |
+ * SQUID - a library of functions for biological sequence analysis |
|
3 |
+ * Copyright (C) 1992-2002 Washington University School of Medicine |
|
4 |
+ * |
|
5 |
+ * This source code is freely distributed under the terms of the |
|
6 |
+ * GNU General Public License. See the files COPYRIGHT and LICENSE |
|
7 |
+ * for details. |
|
8 |
+ *****************************************************************/ |
|
9 |
+ |
|
10 |
+/* sqerror.c |
|
11 |
+ * |
|
12 |
+ * error handling for the squid library |
|
13 |
+ * RCS $Id: sqerror.c 217 2011-03-19 10:27:10Z andreas $ (Original squid RCS Id: sqerror.c,v 1.4 1999/07/15 22:28:31 eddy Exp) |
|
14 |
+ */ |
|
15 |
+ |
|
16 |
+ /* a global errno equivalent */ |
|
17 |
+int squid_errno; |
|
18 |
+ |
|
19 |
+#include <stdio.h> |
|
20 |
+#include <stdlib.h> |
|
21 |
+#include <stdarg.h> |
|
22 |
+ |
|
23 |
+#include "../exceptions4c/e4c_lite.h" |
|
24 |
+ |
|
25 |
+#ifdef MEMDEBUG |
|
26 |
+#include "dbmalloc.h" |
|
27 |
+#endif |
|
28 |
+ |
|
29 |
+/* Function: Die() |
|
30 |
+ * |
|
31 |
+ * Purpose: Print an error message and die. The arguments |
|
32 |
+ * are formatted exactly like arguments to printf(). |
|
33 |
+ * |
|
34 |
+ * Return: None. Exits the program. |
|
35 |
+ */ |
|
36 |
+/* VARARGS0 */ |
|
37 |
+void |
|
38 |
+Die(char *format, ...) |
|
39 |
+{ |
|
40 |
+ va_list argp; |
|
41 |
+ /* format the error mesg */ |
|
42 |
+ fprintf(stderr, "\nFATAL: "); |
|
43 |
+ va_start(argp, format); |
|
44 |
+ vfprintf(stderr, format, argp); |
|
45 |
+ va_end(argp); |
|
46 |
+ fprintf(stderr, "\n"); |
|
47 |
+ fflush(stderr); |
|
48 |
+ /* exit */ |
|
49 |
+ throw(ClustalOmegaException, "1"); |
|
50 |
+} |
|
51 |
+ |
|
52 |
+ |
|
53 |
+ |
|
54 |
+/* Function: Warn() |
|
55 |
+ * |
|
56 |
+ * Purpose: Print an error message and return. The arguments |
|
57 |
+ * are formatted exactly like arguments to printf(). |
|
58 |
+ * |
|
59 |
+ * Return: (void) |
|
60 |
+ */ |
|
61 |
+/* VARARGS0 */ |
|
62 |
+void |
|
63 |
+#ifdef CLUSTALO |
|
64 |
+Warning(char *format, ...) |
|
65 |
+#else |
|
66 |
+Warn(char *format, ...) |
|
67 |
+#endif |
|
68 |
+{ |
|
69 |
+ va_list argp; |
|
70 |
+ /* format the error mesg */ |
|
71 |
+ fprintf(stderr, "WARNING: "); |
|
72 |
+ va_start(argp, format); |
|
73 |
+ vfprintf(stderr, format, argp); |
|
74 |
+ va_end(argp); |
|
75 |
+ fprintf(stderr, "\n"); |
|
76 |
+ fflush(stderr); |
|
77 |
+} |
|
78 |
+ |
|
79 |
+/* Function: Panic() |
|
80 |
+ * |
|
81 |
+ * Purpose: Die from a lethal error that's not my problem, |
|
82 |
+ * but instead a failure of a StdC/POSIX call that |
|
83 |
+ * shouldn't fail. Call perror() to get the |
|
84 |
+ * errno flag, then die. |
|
85 |
+ * |
|
86 |
+ * Usually called by the PANIC macro which adds |
|
87 |
+ * the __FILE__ and __LINE__ information; see |
|
88 |
+ * structs.h. |
|
89 |
+ * |
|
90 |
+ * Inspired by code in Donald Lewine's book, _POSIX |
|
91 |
+ * Programmer's Guide_. |
|
92 |
+ */ |
|
93 |
+void |
|
94 |
+Panic(char *file, int line) |
|
95 |
+{ |
|
96 |
+ (void) fprintf(stderr, "\nPANIC [%s line %d] ", file, line); |
|
97 |
+ (void) perror("Unusual error"); |
|
98 |
+ throw(ClustalOmegaException, "1"); |
|
99 |
+} |
|
100 |
+ |