<commit_before>//Note: this header is included by plugins, not by code that wants to interact
//with plugins.  Code that wants to interact with plugins should call
//load_plugin().
#ifndef LIRCH_PLUGIN_H_
#define LIRCH_PLUGIN_H_

#include "message_view.h"
#include "required_messages.h"

//Why windows, why?
#if defined(_WIN32)
#	if defined(_WIN64)
#		pragma comment(linker, "/EXPORT:plugin_version")
#		pragma comment(linker, "/EXPORT:plugin_init")
#	else
#		pragma comment(linker, "/EXPORT:plugin_version=_plugin_version")
#		pragma comment(linker, "/EXPORT:plugin_init=_plugin_init")
#	endif
#else

void run(plugin_pipe);

extern "C"
{
	int
#ifdef _WIN32
		//We need this to ensure semi-consistent name mangling and APIs
		__cdecl
#endif
		plugin_version()
	{
		return 0;
	}

	void
#ifdef _WIN32
		//We need this to ensure semi-consistent name mangling
		__cdecl
#endif
		plugin_init(plugin_pipe p)
	{
		//Generic initialization code will go here

		//This calls the plugin-defined initialization code
		run(p);
	}
}

#endif<commit_msg>Catch plugin-generated exceptions so they don't terminate the main program<commit_after>//Note: this header is included by plugins, not by code that wants to interact
//with plugins.  Code that wants to interact with plugins should call
//load_plugin().
#ifndef LIRCH_PLUGIN_H_
#define LIRCH_PLUGIN_H_

#include "message_view.h"
#include "required_messages.h"

//Why windows, why?
#if defined(_WIN32)
#	if defined(_WIN64)
#		pragma comment(linker, "/EXPORT:plugin_version")
#		pragma comment(linker, "/EXPORT:plugin_init")
#	else
#		pragma comment(linker, "/EXPORT:plugin_version=_plugin_version")
#		pragma comment(linker, "/EXPORT:plugin_init=_plugin_init")
#	endif
#else

void run(plugin_pipe);

extern "C"
{
	int
#ifdef _WIN32
		//We need this to ensure semi-consistent name mangling and APIs
		__cdecl
#endif
		plugin_version()
	{
		return 0;
	}

	void
#ifdef _WIN32
		//We need this to ensure semi-consistent name mangling
		__cdecl
#endif
		plugin_init(plugin_pipe p)
	{
		//Generic initialization code will go here
		try 
		{
			//This calls the plugin-defined initialization code
			run(p);
		}
		catch (...)
		{
			//Catch every exception, since uncaught exceptions will terminate the program
			//We might want to put some logging here
		}
	}
}

#endif
{'fraction_non_alphanumeric': 0.0999131190269331, 'fraction_numerical': 0.007819287576020852, 'mean_word_length': 4.34338747099768, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1946532', 'n_tokens_mistral': 834, 'n_tokens_neox': 768, 'n_words': 242}