comparison bwa-0.6.2/utils.h @ 2:a294fbfcb1db draft default tip

Uploaded BWA
author ashvark
date Fri, 18 Jul 2014 07:55:59 -0400
parents dd1186b11b3b
children
comparison
equal deleted inserted replaced
1:a9636dc1e99a 2:a294fbfcb1db
1 /* The MIT License
2
3 Copyright (c) 2008 Genome Research Ltd (GRL).
4
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
12
13 The above copyright notice and this permission notice shall be
14 included in all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 */
25
26 /* Contact: Heng Li <lh3@sanger.ac.uk> */
27
28 #ifndef LH3_UTILS_H
29 #define LH3_UTILS_H
30
31 #include <stdio.h>
32 #include <zlib.h>
33
34 #ifdef __GNUC__
35 // Tell GCC to validate printf format string and args
36 #define ATTRIBUTE(list) __attribute__ (list)
37 #else
38 #define ATTRIBUTE(list)
39 #endif
40
41
42
43 #define err_fatal_simple(msg) err_fatal_simple_core(__func__, msg)
44 #define xopen(fn, mode) err_xopen_core(__func__, fn, mode)
45 #define xreopen(fn, mode, fp) err_xreopen_core(__func__, fn, mode, fp)
46 #define xzopen(fn, mode) err_xzopen_core(__func__, fn, mode)
47 #define xassert(cond, msg) if ((cond) == 0) err_fatal_simple_core(__func__, msg)
48
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52
53 void err_fatal(const char *header, const char *fmt, ...);
54 void err_fatal_simple_core(const char *func, const char *msg);
55 FILE *err_xopen_core(const char *func, const char *fn, const char *mode);
56 FILE *err_xreopen_core(const char *func, const char *fn, const char *mode, FILE *fp);
57 gzFile err_xzopen_core(const char *func, const char *fn, const char *mode);
58 size_t err_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
59 int err_fprintf(FILE *stream, const char *format, ...)
60 ATTRIBUTE((format(printf, 2, 3)));
61 int err_printf(const char *format, ...)
62 ATTRIBUTE((format(printf, 1, 2)));
63 int err_fflush(FILE *stream);
64 int err_fclose(FILE *stream);
65
66 double cputime();
67 double realtime();
68
69 #ifdef __cplusplus
70 }
71 #endif
72
73 #endif