Audacity 3.2.0
common.h
Go to the documentation of this file.
1/*
2 Copyright 2011 David Robillard <http://drobilla.net>
3
4 Permission to use, copy, modify, and/or distribute this software for any
5 purpose with or without fee is hereby granted, provided that the above
6 copyright notice and this permission notice appear in all copies.
7
8 THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
17#ifndef ZIX_COMMON_H
18#define ZIX_COMMON_H
19
26#ifdef ZIX_SHARED
27# ifdef _WIN32
28# define ZIX_LIB_IMPORT __declspec(dllimport)
29# define ZIX_LIB_EXPORT __declspec(dllexport)
30# else
31# define ZIX_LIB_IMPORT __attribute__((visibility("default")))
32# define ZIX_LIB_EXPORT __attribute__((visibility("default")))
33# endif
34# ifdef ZIX_INTERNAL
35# define ZIX_API ZIX_LIB_EXPORT
36# else
37# define ZIX_API ZIX_LIB_IMPORT
38# endif
39# define ZIX_PRIVATE static
40#elif defined(ZIX_INLINE)
41# define ZIX_API static inline
42# define ZIX_PRIVATE static inline
43#else
44# define ZIX_API
45# define ZIX_PRIVATE static
46#endif
49#ifdef __cplusplus
50extern "C" {
51#else
52# include <stdbool.h>
53#endif
54
55typedef enum {
63} ZixStatus;
64
65static inline const char*
67{
68 switch (status) {
69 case ZIX_STATUS_SUCCESS: return "Success";
70 case ZIX_STATUS_ERROR: return "Unknown error";
71 case ZIX_STATUS_NO_MEM: return "Out of memory";
72 case ZIX_STATUS_NOT_FOUND: return "Not found";
73 case ZIX_STATUS_EXISTS: return "Exists";
74 case ZIX_STATUS_BAD_ARG: return "Bad argument";
75 case ZIX_STATUS_BAD_PERMS: return "Bad permissions";
76 }
77 return "Unknown error";
78}
79
83typedef int (*ZixComparator)(const void* a, const void* b, void* user_data);
84
88typedef bool (*ZixEqualFunc)(const void* a, const void* b);
89
93typedef void (*ZixDestroyFunc)(void* ptr);
94
99#ifdef __cplusplus
100} /* extern "C" */
101#endif
102
103#endif /* ZIX_COMMON_H */
void(* ZixDestroyFunc)(void *ptr)
Definition: common.h:93
static const char * zix_strerror(const ZixStatus status)
Definition: common.h:66
bool(* ZixEqualFunc)(const void *a, const void *b)
Definition: common.h:88
ZixStatus
Definition: common.h:55
int(* ZixComparator)(const void *a, const void *b, void *user_data)
Definition: common.h:83
@ ZIX_STATUS_EXISTS
Definition: common.h:60
@ ZIX_STATUS_BAD_ARG
Definition: common.h:61
@ ZIX_STATUS_NOT_FOUND
Definition: common.h:59
@ ZIX_STATUS_ERROR
Definition: common.h:57
@ ZIX_STATUS_NO_MEM
Definition: common.h:58
@ ZIX_STATUS_SUCCESS
Definition: common.h:56
@ ZIX_STATUS_BAD_PERMS
Definition: common.h:62