BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
sfiwrapper.hh
Go to the documentation of this file.
00001  // Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
00002 #ifndef __SFI_WRAPPER_H__
00003 #define __SFI_WRAPPER_H__
00004 #include <stdbool.h>
00005 #include <sfi/glib-extra.hh>
00006 #include <rapicorn-core.hh>
00007 
00008 namespace Bse {
00009 using namespace Rapicorn;
00010 
00011 // == Likelyness Hinting ==
00012 #define BSE_ISLIKELY(expr)      RAPICORN_ISLIKELY(expr) ///< Compiler hint that @a expr is likely to be true.
00013 #define BSE_UNLIKELY(expr)      RAPICORN_UNLIKELY(expr) ///< Compiler hint that @a expr is unlikely to be true.
00014 #define BSE_LIKELY              BSE_ISLIKELY            ///< Compiler hint that @a expr is likely to be true.
00015 
00016 // == Debugging ==
00018 #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)
00019 
00020 #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)
00021 extern bool volatile _cached_bse_debug;
00022 void        bse_debug         (const char*, const char*, int, const String&);
00023 bool       _bse_debug_enabled (const char *key);
00024 inline bool bse_debug_enabled (const char *key = NULL) { return BSE_UNLIKELY (_cached_bse_debug) && _bse_debug_enabled (key); }
00025 bool        bse_flipper_check (const char *key);
00026 
00027 } // Bse
00028 
00029 // sfiwrapper.h is a thin C language wrapper around C++ features
00030 
00031 /* --- short integer types --- */
00032 using Rapicorn::uint8;
00033 using Rapicorn::uint16;
00034 using Rapicorn::uint32;
00035 using Rapicorn::uint64;
00036 using Rapicorn::int8;
00037 using Rapicorn::int16;
00038 using Rapicorn::int32;
00039 using Rapicorn::int64;
00040 using Rapicorn::unichar;
00041 
00042 extern "C" {
00043 
00044 /* --- initialization --- */
00045 typedef struct
00046 {
00047   const char *value_name;       /* value list ends with value_name == NULL */
00048   const char *value_string;
00049   long double value_num;        /* valid if value_string == NULL */
00050 } SfiInitValue;
00051 void sfi_init (int *argcp, char **argv, const char *app_name, const Bse::StringVector &args = Bse::StringVector());
00052 
00053 /* --- file tests --- */
00054 bool    birnet_file_check (const char *file,
00055                            const char *mode);
00056 bool    birnet_file_equals (const char *file1,
00057                             const char *file2);
00058 /* --- messaging --- */
00059 #define         sfi_error(...)                   RAPICORN_FATAL (__VA_ARGS__)
00060 #define         sfi_warning(...)                 RAPICORN_CRITICAL (__VA_ARGS__)
00061 #define         sfi_info(...)                    BSE_DEBUG (__VA_ARGS__)
00062 #define         sfi_diag(...)                    BSE_DEBUG (__VA_ARGS__)
00063 
00064 /* --- url handling --- */
00065 void sfi_url_show                       (const char           *url);
00066 void sfi_url_show_with_cookie           (const char           *url,
00067                                          const char           *url_title,
00068                                          const char           *cookie);
00069 bool sfi_url_test_show                  (const char           *url);
00070 bool sfi_url_test_show_with_cookie      (const char           *url,
00071                                          const char           *url_title,
00072                                          const char           *cookie);
00073 
00074 } // "C"
00075 
00076 #endif /* __SFI_WRAPPER_H__ */
00077 /* vim:set ts=8 sts=2 sw=2: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines