BitPunch McEliece  v0.0.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
debugio.h
Go to the documentation of this file.
1 /*
2  This file is part of BitPunch
3  Copyright (C) 2014-2015 Frantisek Uhrecky <frantisek.uhrecky[what here]gmail.com>
4  Copyright (C) 2014 Andrej Gulyas <andrej.guly[what here]gmail.com>
5  Copyright (C) 2014 Marek Klein <kleinmrk[what here]gmail.com>
6  Copyright (C) 2014 Filip Machovec <filipmachovec[what here]yahoo.com>
7  Copyright (C) 2014 Jozef Kudlac <jozef[what here]kudlac.sk>
8 
9  This program is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
25 #ifndef DEBUGIO_H
26 #define DEBUGIO_H
27 
28 #include <stdio.h>
29 
30 #ifndef _WIN32
31  #include <inttypes.h>
32 
34  #define BPU_PRINT_U_64 PRIu64
35 #else
36  #define BPU_PRINT_U_64 "I64u"
37 #endif
38 
39 #if defined(DEBUG_L) || defined(WARNING_L) || defined(ERROR_L)
40  #include <stdlib.h>
41  #include <errno.h>
42 
44 #define BPU_printError(fmt, ...) fprintf(stderr, "ERROR::%s::%s::%d: "fmt"\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__); if (errno) {perror("ERROR MSG:"); errno = 0;}
45 #else
46  #define BPU_printError(fmt, ...)
48 #endif
49 
50 #if defined(DEBUG_L) || defined(WARNING_L)
51  #define BPU_printWarning(fmt, ...) fprintf(stderr, "WARNING::%s::%s::%d: "fmt"\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__); if (errno) {perror("ERROR MSG:"); errno = 0;}
53 #else
54  #define BPU_printWarning(fmt, ...)
56 #endif
57 
58 #if defined(DEBUG_L)
59  #define BPU_printDebug(fmt, ...) fprintf(stderr, "DEBUG::%s::%s::%d: "fmt"\n", __FILE__, __func__, __LINE__, ##__VA_ARGS__)
61 #else
62  #define BPU_printDebug(fmt, ...)
64 #endif
65 
66 #endif // DEBUGIO_H