<commit_before>//	@file Version: 1.0
//	@file Name: globalCompile.sqf
//	@file Author: AgentRev, MercyfulFate
//	@file Created: 07/09/2013 15:06

// The purpose of this script is to compile certain functions both on client and server.

private "_DEBUG";
_DEBUG = _this select 0;

// Compile a function from a file.
// if in debug mode, the function will be dyncamically compiled every call.
// if not in debug mode, the function will be compileFinal'd
// example1: my_fnc_name = ["path/to/folder", "my_fnc.sqf"] call mf_compile;
// example1: my_fnc_name = ["path/to/folder/my_fnc.sqf"] call mf_compile;
// later in the code you can simply use call my_fnc_name;
mf_compile = compileFinal
('
	private "_path";
	_path = "";
	if (typeName _this == "STRING") then {
		_path = _this;
	} else {
		_path = format["%1\%2", _this select 0, _this select 1];
	};
	
	if (' + str _DEBUG + ') then {
		compile format["call compile preProcessFileLineNumbers ""%1""", _path];
	} else {
		compileFinal preProcessFileLineNumbers _path;
	};
');

// Simple command I use to make initialization scripts clean and simple.
// uses mf_ namespace to avoid any issues.
// TODO compilefinal this shit.
mf_init = compileFinal
'
	private "_path";
	_path = "";
	if (typeName _this == "STRING") then {
		_path = _this;
	} else {
		_path = format["%1\%2", _this select 0, _this select 1];
	};
	_path call compile preProcessFileLineNumbers format["%1\init.sqf", _path];
';

detachTowedObject = "server\functions\detachTowedObject.sqf" call mf_compile;
findSafePos = "server\functions\findSafePos.sqf" call mf_compile;
fn_vehicleInit = "server\functions\fn_vehicleInit.sqf" call mf_compile;
generateKey = "server\functions\network\generateKey.sqf" call mf_compile;
getPublicVar = "server\functions\getPublicVar.sqf" call mf_compile;
removeNegativeScore = "server\functions\removeNegativeScore.sqf" call mf_compile;

if (isNil "fn_findString") then { fn_findString = "server\functions\fn_findString.sqf" call mf_compile };
if (isNil "fn_filterString") then { fn_filterString = "server\functions\fn_filterString.sqf" call mf_compile };

"requestDetachTowedObject" addPublicVariableEventHandler { [_this select 1] call detachTowedObject };<commit_msg>Improved globalCompile.sqf<commit_after>//	@file Version: 1.0
//	@file Name: globalCompile.sqf
//	@file Author: AgentRev, MercyfulFate
//	@file Created: 07/09/2013 15:06

// The purpose of this script is to compile certain functions both on client and server.

private ["_DEBUG", "_path"];
_DEBUG = _this select 0;

// Compile a function from a file.
// if in debug mode, the function will be dyncamically compiled every call.
// if not in debug mode, the function will be compileFinal'd
// example1: my_fnc_name = ["path/to/folder", "my_fnc.sqf"] call mf_compile;
// example1: my_fnc_name = ["path/to/folder/my_fnc.sqf"] call mf_compile;
// later in the code you can simply use call my_fnc_name;
mf_compile = compileFinal
('
	private "_path";
	_path = "";
	if (typeName _this == "STRING") then {
		_path = _this;
	} else {
		_path = format["%1\%2", _this select 0, _this select 1];
	};
	
	if (' + str _DEBUG + ') then {
		compile format["_this call compile preProcessFileLineNumbers ""%1""", _path];
	} else {
		compileFinal preProcessFileLineNumbers _path;
	};
');

// Simple command I use to make initialization scripts clean and simple.
// uses mf_ namespace to avoid any issues.
mf_init = compileFinal
'
	private "_path";
	_path = "";
	if (typeName _this == "STRING") then {
		_path = _this;
	} else {
		_path = format["%1\%2", _this select 0, _this select 1];
	};
	_path call compile preProcessFileLineNumbers format["%1\init.sqf", _path];
';

_path = "server\functions";
detachTowedObject = [_path, "detachTowedObject.sqf"] call mf_compile;
findSafePos = [_path, "findSafePos.sqf"] call mf_compile;
fn_vehicleInit = [_path, "fn_vehicleInit.sqf"] call mf_compile;
generateKey = [_path, "network\generateKey.sqf"] call mf_compile;
getPublicVar = [_path, "getPublicVar.sqf"] call mf_compile;
removeNegativeScore = [_path, "removeNegativeScore.sqf"] call mf_compile;

if (isNil "fn_findString") then { fn_findString = [_path, "fn_findString.sqf"] call mf_compile };
if (isNil "fn_filterString") then { fn_filterString = [_path, "fn_filterString.sqf"] call mf_compile };

"requestDetachTowedObject" addPublicVariableEventHandler { (_this select 1) call detachTowedObject };
{'fraction_non_alphanumeric': 0.12397447584320875, 'fraction_numerical': 0.01276207839562443, 'mean_word_length': 4.737254901960784, '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': '3901300', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1467, 'n_words': 441}