<commit_before>#ifndef UTIL_H_LBLH2YH8
#define UTIL_H_LBLH2YH8

namespace snot {
	void warn(const char* msg, ...);
	void error(const char* msg, ...);
	
	void print_mem_raw(void* start, void* end);
	
	template<typename X, typename Y>
	void print_mem(X* start, Y* end) {
		print_mem_raw((void*)start, (void*)end);
	}
}

#endif /* end of include guard: UTIL_H_LBLH2YH8 */<commit_msg>typesafe printf... dunno, might be useful<commit_after>#ifndef UTIL_H_LBLH2YH8
#define UTIL_H_LBLH2YH8

#include <ostream>
#include <stdexcept>

namespace snot {
	void warn(const char* msg, ...);
	void error(const char* msg, ...);
	
	void print_mem_raw(void* start, void* end);
	
	template<typename X, typename Y>
	void print_mem(X* start, Y* end) {
		print_mem_raw((void*)start, (void*)end);
	}
	
	inline void stream_printf(std::ostream& o, const char* s) {
		while (*s) {
			if (*s == '%' && *++s != '%')
				throw std::runtime_error("invalid format string: missing arguments");
			o << *s++;
		}
	}
	
	template <typename T, typename... A>
	void stream_printf(std::ostream& o, const char* s, const T& value, const A&... args) {
		while (*s) {
			if (*s == '%' && *++s != '%') {
				o << value;
				return stream_printf(o, ++s, args...);
			}
			o << *s++;
		}
		throw std::runtime_error("extra arguments passed to stream_printf");
	}
}

#endif /* end of include guard: UTIL_H_LBLH2YH8 */
{'fraction_non_alphanumeric': 0.1745799853907962, 'fraction_numerical': 0.008765522279035792, 'mean_word_length': 3.9280575539568345, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '590453', 'n_tokens_mistral': 566, 'n_tokens_neox': 523, 'n_words': 137}