<commit_before>/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015  <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kernel/access.h>
#include <kernel/kernel.h>
#include <kotaka/assert.h>
#include <kotaka/log.h>
#include <kotaka/paths/bigstruct.h>
#include <kotaka/paths/channel.h>
#include <kotaka/paths/system.h>
#include <kotaka/privilege.h>
#include <status.h>

inherit SECOND_AUTO;
inherit LIB_SYSTEM;

string compiling;	/* path of object we are currently compiling */
string *includes;	/* include files of currently compiling object */
int upgrading;		/* are we upgrading or making a new compile? */
mapping old_inherits;	/* list of old inherits */
int is_initd;		/* current compilation is for an initd */
int is_kernel;		/* current compilation is for a kernel object */
int is_auto;		/* current compilation is for a second auto support library */
object upgrades;	/* list of objects needing upgrade */

static void create()
{
	DRIVER->set_object_manager(this_object());
}

/* private */

private string *fetch_from_initd(object initd, string path)
{
	string ctor, dtor, patcher;

	ctor = initd->query_constructor(path);
	dtor = initd->query_destructor(path);

	if (function_object("query_toucher", initd)) {
		patcher = initd->query_toucher(path);

		LOGD->post_message("debug", LOG_DEBUG,
			object_name(initd) + " is using the obsolete query_toucher interface");
	} else if (function_object("query_patcher", initd)) {
		patcher = initd->query_patcher(path);
	}

	return ({ ctor, dtor, patcher });
}

private mixed query_include_file(string compiled, string from, string path)
{
	string creator;
	object initd;

	/* don't allow bypass of standard file */
	if (path == "/include/std.h") {
		return path;
	}

	creator = find_object(DRIVER)->creator(compiled);

	/* System has to be direct */
	if (creator == "System") {
		return path;
	}

	/* don't allow bypass of standard auto */
	if (path == "/include/AUTO" &&<commit_msg>Tweak ObjectD's detection of the obsolete API a little better<commit_after>/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015  <NAME>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kernel/access.h>
#include <kernel/kernel.h>
#include <kotaka/assert.h>
#include <kotaka/log.h>
#include <kotaka/paths/bigstruct.h>
#include <kotaka/paths/channel.h>
#include <kotaka/paths/system.h>
#include <kotaka/privilege.h>
#include <status.h>

inherit SECOND_AUTO;
inherit LIB_SYSTEM;

string compiling;	/* path of object we are currently compiling */
string *includes;	/* include files of currently compiling object */
int upgrading;		/* are we upgrading or making a new compile? */
mapping old_inherits;	/* list of old inherits */
int is_initd;		/* current compilation is for an initd */
int is_kernel;		/* current compilation is for a kernel object */
int is_auto;		/* current compilation is for a second auto support library */
object upgrades;	/* list of objects needing upgrade */

static void create()
{
	DRIVER->set_object_manager(this_object());
}

/* private */

private string *fetch_from_initd(object initd, string path)
{
	int has_toucher;
	int has_patcher;
	string ctor, dtor, patcher;

	ctor = initd->query_constructor(path);
	dtor = initd->query_destructor(path);

	if (function_object("query_toucher", initd) == object_name(initd)) {
		has_toucher = 1;
	}

	if (function_object("query_patcher", initd) == object_name(initd)) {
		has_patcher = 1;
	}

	if (has_patcher) {
		patcher = initd->query_patcher(path);
	} else if (has_toucher) {
		patcher = initd->query_toucher(path);

		LOGD->post_message("debug", LOG_DEBUG,
			object_name(initd) + " is using the obsolete query_toucher interface");
	}

	return ({ ctor, dtor, patcher });
}

private mixed query_include_file(string compiled, string from, string path)
{
	string creator;
	object initd;

	/* don't allow bypass of standard file */
	if (path == "/include/std.h") {
		return path;
	}

	creator = find_object(DRIVER)->creator(compiled);

	/* System has to be direct */
	if (creator == "System") {
		return path;
	}

	/* don't allow bypass of standard auto */
	if (path == "/include/AUTO" &&
{'fraction_non_alphanumeric': 0.11217140799423839, 'fraction_numerical': 0.009362621534029529, 'mean_word_length': 4.181902985074627, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 39, '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': '1183019', 'n_tokens_mistral': 1843, 'n_tokens_neox': 1710, 'n_words': 625}