BEAST/BSE - Better Audio System and Sound Engine  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sfiwrapper.hh
Go to the documentation of this file.
1  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
2 #ifndef __SFI_WRAPPER_H__
3 #define __SFI_WRAPPER_H__
4 #include <stdbool.h>
5 #include <sfi/glib-extra.hh>
6 #include <rapicorn-core.hh>
7 
8 namespace Bse {
9 using namespace Rapicorn;
10 
11 // == Likelyness Hinting ==
12 #define BSE_ISLIKELY(expr) RAPICORN_ISLIKELY(expr)
13 #define BSE_UNLIKELY(expr) RAPICORN_UNLIKELY(expr)
14 #define BSE_LIKELY BSE_ISLIKELY
15 
16 // == Debugging ==
18 #define BSE_DEBUG(...) do { if (BSE_UNLIKELY (Bse::_cached_bse_debug)) Bse::bse_debug (NULL, RAPICORN_PRETTY_FILE, __LINE__, Rapicorn::string_format (__VA_ARGS__)); } while (0)
19 #define BSE_KEY_DEBUG(key,...) do { if (BSE_UNLIKELY (Bse::_cached_bse_debug)) Bse::bse_debug (key, RAPICORN_PRETTY_FILE, __LINE__, Rapicorn::string_format (__VA_ARGS__)); } while (0)
21 extern bool volatile _cached_bse_debug;
22 void bse_debug (const char*, const char*, int, const String&);
23 bool _bse_debug_enabled (const char *key);
24 inline bool bse_debug_enabled (const char *key = NULL) { return BSE_UNLIKELY (_cached_bse_debug) && _bse_debug_enabled (key); }
25 bool bse_flipper_check (const char *key);
26 
27 } // Bse
28 
29 // sfiwrapper.h is a thin C language wrapper around C++ features
30 
31 /* --- short integer types --- */
32 using Rapicorn::uint8;
33 using Rapicorn::uint16;
34 using Rapicorn::uint32;
35 using Rapicorn::uint64;
36 using Rapicorn::int8;
37 using Rapicorn::int16;
38 using Rapicorn::int32;
39 using Rapicorn::int64;
40 using Rapicorn::unichar;
41 
42 extern "C" {
43 
44 /* --- initialization --- */
45 typedef struct
46 {
47  const char *value_name; /* value list ends with value_name == NULL */
48  const char *value_string;
49  long double value_num; /* valid if value_string == NULL */
50 } SfiInitValue;
51 void sfi_init (int *argcp, char **argv, const char *app_name, const Bse::StringVector &args = Bse::StringVector());
52 
53 /* --- file tests --- */
54 bool birnet_file_check (const char *file,
55  const char *mode);
56 bool birnet_file_equals (const char *file1,
57  const char *file2);
58 /* --- messaging --- */
59 #define sfi_error(...) RAPICORN_FATAL (__VA_ARGS__)
60 #define sfi_warning(...) RAPICORN_CRITICAL (__VA_ARGS__)
61 #define sfi_info(...) BSE_DEBUG (__VA_ARGS__)
62 #define sfi_diag(...) BSE_DEBUG (__VA_ARGS__)
63 
64 /* --- url handling --- */
65 void sfi_url_show (const char *url);
66 
67 } // "C"
68 
69 #endif /* __SFI_WRAPPER_H__ */
70 /* vim:set ts=8 sts=2 sw=2: */
uint16_t uint16
int32_t int32
bool bse_flipper_check(const char *key)
Check if the feature toggle key is enabled in #$BSE_FLIPPER.
Definition: sfiwrapper.cc:37
Definition: sfiwrapper.hh:45
uint32_t unichar
std::string String
bool volatile _cached_bse_debug
Caching flag to inhibit useless bse_debug() calls.
Definition: sfiwrapper.cc:11
vector< String > StringVector
int64_t int64
void bse_debug(const char *key, const char *file_path, const int line, const String &message)
Issue a debugging message, configurable via #$BSE_DEBUG.
Definition: sfiwrapper.cc:15
uint8_t uint8
int8_t int8
uint64_t uint64
int16_t int16
bool bse_debug_enabled(const char *key)
Check if debugging is enabled for key.
Definition: sfiwrapper.hh:24
#define BSE_UNLIKELY(expr)
Compiler hint that expr is unlikely to be true.
Definition: sfiwrapper.hh:13
uint32_t uint32