<commit_before>#include <exception>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>

#ifdef linux
#include <execinfo.h>
#include <signal.h>
#endif

#include "exception.h"

namespace tinfra {

void populate_stacktrace(stacktrace_t& dest,int ignore_stacks)
{
    // Reeference
    // http://www-128.ibm.com/developerworks/library/l-cppexcep.html?ca=dnt-68
    // http://www.delorie.com/gnu/docs/glibc/libc_665.html
    //
    void* addresses[256];
    int size = ::backtrace(addresses, 256);
    char** symbols = ::backtrace_symbols(addresses,size);
    for( int i = ignore_stacks; i < size; i++ ) {
	stackentry a;
	a.address = addresses[i];
	a.symbol = symbols[i];
	dest.push_back(a);
    }
    ::free(symbols);
}

//
// generic_exception implementation<commit_msg>* linux-related code protected with #ifdefs<commit_after>#include <exception>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>

#ifdef linux
#include <execinfo.h>
#include <signal.h>
#define HAVE_BACKTRACE
#endif

#include "exception.h"

namespace tinfra {

void populate_stacktrace(stacktrace_t& dest,int ignore_stacks)
{
#ifdef HAVE_BACKTRACE
    // Reference
    // http://www-128.ibm.com/developerworks/library/l-cppexcep.html?ca=dnt-68
    // http://www.delorie.com/gnu/docs/glibc/libc_665.html
    //
    void* addresses[256];
    int size = ::backtrace(addresses, 256);
    char** symbols = ::backtrace_symbols(addresses,size);
    for( int i = ignore_stacks; i < size; i++ ) {
	stackentry a;
	a.address = addresses[i];
	a.symbol = symbols[i];
	dest.push_back(a);
    }
    ::free(symbols);
#endif
}

//
// generic_exception implementation
{'fraction_non_alphanumeric': 0.1539386650631389, 'fraction_numerical': 0.01683704149128082, 'mean_word_length': 4.073170731707317, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '7619479', 'n_tokens_mistral': 634, 'n_tokens_neox': 600, 'n_words': 117}