<commit_before>// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
#include "sfiwrapper.hh"
#include "sficxx.hh"
#include <sfi/sfi.hh>
#include <rapicorn-test.hh>
#include <errno.h>

namespace Bse {

/// Caching flag to inhibit useless bse_debug() calls.
bool volatile _cached_bse_debug = true;

/// Issue a debugging message, configurable via #$BSE_DEBUG.
void
bse_debug (const char *key, const char *file_path, const int line, const char *format, ...)
{
  va_list vargs;
  va_start (vargs, format);
  envkey_debug_message ("BSE_DEBUG", key, file_path, line, format, vargs, &_cached_rapicorn_debug);
  va_end (vargs);
}

#ifdef DOXYGEN
/** Check if debugging is enabled for @a key.
 * This function checks if #$BSE_DEBUG contains @a key or "all" and returns true
 * if debugging is enabled for the given key. The @a key argument may be NULL in which
 * case the function checks if general debugging is enabled.
 */
bool bse_debug_enabled (const char *key);
#endif // DOXYGEN

bool
_bse_debug_enabled (const char *key)
{
  return envkey_debug_check ("BSE_DEBUG", key, &_cached_bse_debug);
}

/// Check if the feature toggle @a key is enabled in #$BSE_FLIPPER.
bool
bse_flipper_check (const char *key)
{
  return envkey_flipper_check ("BSE_FLIPPER", key);
}

} // Bse

/* --- initialization --- */
void
sfi_init (int *argcp, char **argv, const char *app_name, const Bse::StringVector &args)<commit_msg>SFI: fix use of wrong caching variable<commit_after>// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
#include "sfiwrapper.hh"
#include "sficxx.hh"
#include <sfi/sfi.hh>
#include <rapicorn-test.hh>
#include <errno.h>

namespace Bse {

/// Caching flag to inhibit useless bse_debug() calls.
bool volatile _cached_bse_debug = true;

/// Issue a debugging message, configurable via #$BSE_DEBUG.
void
bse_debug (const char *key, const char *file_path, const int line, const char *format, ...)
{
  va_list vargs;
  va_start (vargs, format);
  envkey_debug_message ("BSE_DEBUG", key, file_path, line, format, vargs, &_cached_bse_debug);
  va_end (vargs);
}

#ifdef DOXYGEN
/** Check if debugging is enabled for @a key.
 * This function checks if #$BSE_DEBUG contains @a key or "all" and returns true
 * if debugging is enabled for the given key. The @a key argument may be NULL in which
 * case the function checks if general debugging is enabled.
 */
bool bse_debug_enabled (const char *key);
#endif // DOXYGEN

bool
_bse_debug_enabled (const char *key)
{
  return envkey_debug_check ("BSE_DEBUG", key, &_cached_bse_debug);
}

/// Check if the feature toggle @a key is enabled in #$BSE_FLIPPER.
bool
bse_flipper_check (const char *key)
{
  return envkey_flipper_check ("BSE_FLIPPER", key);
}

} // Bse

/* --- initialization --- */
void
sfi_init (int *argcp, char **argv, const char *app_name, const Bse::StringVector &args)
{'fraction_non_alphanumeric': 0.11828332170272156, 'fraction_numerical': 0.0013956734124214933, 'mean_word_length': 4.378986866791744, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3051928', 'n_tokens_mistral': 1005, 'n_tokens_neox': 991, 'n_words': 339}