plugins/include/core.inc
changeset 1952 b7aa2b626807
child 2105 ad190b9bb5af
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/plugins/include/core.inc	Sun Mar 30 07:00:22 2008 +0000
     1.3 @@ -0,0 +1,137 @@
     1.4 +/**
     1.5 + * vim: set ts=4 :
     1.6 + * =============================================================================
     1.7 + * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
     1.8 + * =============================================================================
     1.9 + *
    1.10 + * This file is part of the SourceMod/SourcePawn SDK.
    1.11 + *
    1.12 + * This program is free software; you can redistribute it and/or modify it under
    1.13 + * the terms of the GNU General Public License, version 3.0, as published by the
    1.14 + * Free Software Foundation.
    1.15 + * 
    1.16 + * This program is distributed in the hope that it will be useful, but WITHOUT
    1.17 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.18 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    1.19 + * details.
    1.20 + *
    1.21 + * You should have received a copy of the GNU General Public License along with
    1.22 + * this program.  If not, see <http://www.gnu.org/licenses/>.
    1.23 + *
    1.24 + * As a special exception, AlliedModders LLC gives you permission to link the
    1.25 + * code of this program (as well as its derivative works) to "Half-Life 2," the
    1.26 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    1.27 + * by the Valve Corporation.  You must obey the GNU General Public License in
    1.28 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
    1.29 + * this exception to all derivative works.  AlliedModders LLC defines further
    1.30 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.31 + * or <http://www.sourcemod.net/license.php>.
    1.32 + *
    1.33 + * Version: $Id$
    1.34 + */
    1.35 +
    1.36 +#if defined _core_included
    1.37 + #endinput
    1.38 +#endif
    1.39 +#define _core_included
    1.40 +
    1.41 +#include <version>
    1.42 +
    1.43 +#define SOURCEMOD_PLUGINAPI_VERSION		2
    1.44 +struct PlVers
    1.45 +{
    1.46 +	version,
    1.47 +	String:filevers[],
    1.48 +};
    1.49 +
    1.50 +/**
    1.51 + * Function helper values.
    1.52 + */
    1.53 +enum Function
    1.54 +{
    1.55 +     INVALID_FUNCTION = -1,
    1.56 +};
    1.57 +
    1.58 +/**
    1.59 + * Specifies what to do after a hook completes.
    1.60 + */
    1.61 +enum Action
    1.62 +{
    1.63 +	Plugin_Continue = 0,	/**< Continue with the original action */
    1.64 +	Plugin_Changed = 1,		/**< Inputs or outputs have been overridden with new values */
    1.65 +	Plugin_Handled = 3,		/**< Handle the action at the end (don't call it) */
    1.66 +	Plugin_Stop = 4,		/**< Immediately stop the hook chain and handle the original */
    1.67 +};
    1.68 +
    1.69 +/**
    1.70 + * Specifies identity types.
    1.71 + */
    1.72 +enum Identity
    1.73 +{
    1.74 +	Identity_Core = 0,
    1.75 +	Identity_Extension = 1,
    1.76 +	Identity_Plugin = 2
    1.77 +};
    1.78 +
    1.79 +public PlVers:__version = 
    1.80 +{
    1.81 +	version = SOURCEMOD_PLUGINAPI_VERSION,
    1.82 +	filevers = SOURCEMOD_VERSION
    1.83 +};
    1.84 +
    1.85 +/**
    1.86 + * Plugin status values.
    1.87 + */
    1.88 +enum PluginStatus
    1.89 +{
    1.90 +	Plugin_Running=0,		/**< Plugin is running */
    1.91 +	/* All states below are "temporarily" unexecutable */
    1.92 +	Plugin_Paused,			/**< Plugin is loaded but paused */
    1.93 +	Plugin_Error,			/**< Plugin is loaded but errored/locked */
    1.94 +	/* All states below do not have all natives */
    1.95 +	Plugin_Loaded,			/**< Plugin has passed loading and can be finalized */
    1.96 +	Plugin_Failed,			/**< Plugin has a fatal failure */
    1.97 +	Plugin_Created,			/**< Plugin is created but not initialized */
    1.98 +	Plugin_Uncompiled,		/**< Plugin is not yet compiled by the JIT */
    1.99 +	Plugin_BadLoad,			/**< Plugin failed to load */
   1.100 +};
   1.101 +
   1.102 +/**
   1.103 + * Plugin information properties.
   1.104 + */
   1.105 +enum PluginInfo
   1.106 +{
   1.107 +	PlInfo_Name,			/**< Plugin name */
   1.108 +	PlInfo_Author,			/**< Plugin author */
   1.109 +	PlInfo_Description,		/**< Plugin description */
   1.110 +	PlInfo_Version,			/**< Plugin verison */
   1.111 +	PlInfo_URL,				/**< Plugin URL */
   1.112 +};
   1.113 +
   1.114 +/**
   1.115 + * Defines how an extension must expose itself for autoloading.
   1.116 + */
   1.117 +struct Extension
   1.118 +{
   1.119 +	const String:name[],	/**< Short name */
   1.120 +	const String:file[],	/**< Default file name */
   1.121 +	bool:autoload,			/**< Whether or not to auto-load */
   1.122 +	bool:required,			/**< Whether or not to require */
   1.123 +};
   1.124 +
   1.125 +/**
   1.126 + * Defines how a plugin must expose itself for native requiring.
   1.127 + */
   1.128 +struct SharedPlugin
   1.129 +{
   1.130 +	const String:name[],	/**< Short name */
   1.131 +	const String:file[],	/**< File name */
   1.132 +	bool:required,			/**< Whether or not to require */
   1.133 +};
   1.134 +
   1.135 +public Float:NULL_VECTOR[3];		/**< Pass this into certain functions to act as a C++ NULL */
   1.136 +public const String:NULL_STRING[1];	/**< pass this into certain functions to act as a C++ NULL */
   1.137 +
   1.138 +#define AUTOLOAD_EXTENSIONS
   1.139 +#define REQUIRE_EXTENSIONS
   1.140 +#define REQUIRE_PLUGIN