-
Notifications
You must be signed in to change notification settings - Fork 0
/
carp.h
55 lines (48 loc) · 4.07 KB
/
carp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef __CARP_H__
#define __CARP_H__
#include <stdio.h>
#include <errno.h>
#define warn(...) warn_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define ewarn(...) warn_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define die(...) die_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define edie(...) die_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define carp(...) carp_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define ecarp(...) carp_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define croak(...) croak_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define ecroak(...) croak_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define cluck(...) cluck_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define ecluck(...) cluck_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define confess(...) confess_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define econfess(...) confess_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define swarn(...) swarn_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define eswarn(...) swarn_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define sdie(...) sdie_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define esdie(...) sdie_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define scarp(...) scarp_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define escarp(...) scarp_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define scroak(...) scroak_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define escroak(...) scroak_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define scluck(...) scluck_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define escluck(...) scluck_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#define sconfess(...) sconfess_at_loc (__FILE__, __FUNCTION__, __LINE__, 0, ## __VA_ARGS__, NULL)
#define esconfess(...) sconfess_at_loc (__FILE__, __FUNCTION__, __LINE__, errno, ## __VA_ARGS__, NULL)
#ifdef _WIN32
# define CARP_EXP __declspec(dllexport)
#else
# define CARP_EXP
#endif
CARP_EXP void warn_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP void die_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP void carp_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP void croak_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP void cluck_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP void confess_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP char *swarn_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP char *sdie_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP char *scarp_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP char *scroak_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP char *scluck_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
CARP_EXP char *sconfess_at_loc (const char *file, const char *func, int line, int errnum, const char *fmt, ...);
typedef void (*CarpOutputFunc) (const char *mesg);
CARP_EXP void carp_set (const char *key, ...);
#endif