plugins/include/core.inc
author David Anderson <dvander@alliedmods.net>
Sun Apr 06 08:20:02 2008 +0000 (2008-04-06)
changeset 1970 316eff8d8164
parent 1952 b7aa2b626807
child 2105 ad190b9bb5af
permissions -rw-r--r--
added regex versioning to windows
ds@1952
     1
/**
ds@1952
     2
 * vim: set ts=4 :
ds@1952
     3
 * =============================================================================
ds@1952
     4
 * SourceMod (C)2004-2008 AlliedModders LLC.  All rights reserved.
ds@1952
     5
 * =============================================================================
ds@1952
     6
 *
ds@1952
     7
 * This file is part of the SourceMod/SourcePawn SDK.
ds@1952
     8
 *
ds@1952
     9
 * This program is free software; you can redistribute it and/or modify it under
ds@1952
    10
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1952
    11
 * Free Software Foundation.
ds@1952
    12
 * 
ds@1952
    13
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1952
    14
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1952
    15
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1952
    16
 * details.
ds@1952
    17
 *
ds@1952
    18
 * You should have received a copy of the GNU General Public License along with
ds@1952
    19
 * this program.  If not, see <http://www.gnu.org/licenses/>.
ds@1952
    20
 *
ds@1952
    21
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1952
    22
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1952
    23
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1952
    24
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1952
    25
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1952
    26
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1952
    27
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1952
    28
 * or <http://www.sourcemod.net/license.php>.
ds@1952
    29
 *
ds@1952
    30
 * Version: $Id$
ds@1952
    31
 */
ds@1952
    32
ds@1952
    33
#if defined _core_included
ds@1952
    34
 #endinput
ds@1952
    35
#endif
ds@1952
    36
#define _core_included
ds@1952
    37
ds@1952
    38
#include <version>
ds@1952
    39
ds@1952
    40
#define SOURCEMOD_PLUGINAPI_VERSION		2
ds@1952
    41
struct PlVers
ds@1952
    42
{
ds@1952
    43
	version,
ds@1952
    44
	String:filevers[],
ds@1952
    45
};
ds@1952
    46
ds@1952
    47
/**
ds@1952
    48
 * Function helper values.
ds@1952
    49
 */
ds@1952
    50
enum Function
ds@1952
    51
{
ds@1952
    52
     INVALID_FUNCTION = -1,
ds@1952
    53
};
ds@1952
    54
ds@1952
    55
/**
ds@1952
    56
 * Specifies what to do after a hook completes.
ds@1952
    57
 */
ds@1952
    58
enum Action
ds@1952
    59
{
ds@1952
    60
	Plugin_Continue = 0,	/**< Continue with the original action */
ds@1952
    61
	Plugin_Changed = 1,		/**< Inputs or outputs have been overridden with new values */
ds@1952
    62
	Plugin_Handled = 3,		/**< Handle the action at the end (don't call it) */
ds@1952
    63
	Plugin_Stop = 4,		/**< Immediately stop the hook chain and handle the original */
ds@1952
    64
};
ds@1952
    65
ds@1952
    66
/**
ds@1952
    67
 * Specifies identity types.
ds@1952
    68
 */
ds@1952
    69
enum Identity
ds@1952
    70
{
ds@1952
    71
	Identity_Core = 0,
ds@1952
    72
	Identity_Extension = 1,
ds@1952
    73
	Identity_Plugin = 2
ds@1952
    74
};
ds@1952
    75
ds@1952
    76
public PlVers:__version = 
ds@1952
    77
{
ds@1952
    78
	version = SOURCEMOD_PLUGINAPI_VERSION,
ds@1952
    79
	filevers = SOURCEMOD_VERSION
ds@1952
    80
};
ds@1952
    81
ds@1952
    82
/**
ds@1952
    83
 * Plugin status values.
ds@1952
    84
 */
ds@1952
    85
enum PluginStatus
ds@1952
    86
{
ds@1952
    87
	Plugin_Running=0,		/**< Plugin is running */
ds@1952
    88
	/* All states below are "temporarily" unexecutable */
ds@1952
    89
	Plugin_Paused,			/**< Plugin is loaded but paused */
ds@1952
    90
	Plugin_Error,			/**< Plugin is loaded but errored/locked */
ds@1952
    91
	/* All states below do not have all natives */
ds@1952
    92
	Plugin_Loaded,			/**< Plugin has passed loading and can be finalized */
ds@1952
    93
	Plugin_Failed,			/**< Plugin has a fatal failure */
ds@1952
    94
	Plugin_Created,			/**< Plugin is created but not initialized */
ds@1952
    95
	Plugin_Uncompiled,		/**< Plugin is not yet compiled by the JIT */
ds@1952
    96
	Plugin_BadLoad,			/**< Plugin failed to load */
ds@1952
    97
};
ds@1952
    98
ds@1952
    99
/**
ds@1952
   100
 * Plugin information properties.
ds@1952
   101
 */
ds@1952
   102
enum PluginInfo
ds@1952
   103
{
ds@1952
   104
	PlInfo_Name,			/**< Plugin name */
ds@1952
   105
	PlInfo_Author,			/**< Plugin author */
ds@1952
   106
	PlInfo_Description,		/**< Plugin description */
ds@1952
   107
	PlInfo_Version,			/**< Plugin verison */
ds@1952
   108
	PlInfo_URL,				/**< Plugin URL */
ds@1952
   109
};
ds@1952
   110
ds@1952
   111
/**
ds@1952
   112
 * Defines how an extension must expose itself for autoloading.
ds@1952
   113
 */
ds@1952
   114
struct Extension
ds@1952
   115
{
ds@1952
   116
	const String:name[],	/**< Short name */
ds@1952
   117
	const String:file[],	/**< Default file name */
ds@1952
   118
	bool:autoload,			/**< Whether or not to auto-load */
ds@1952
   119
	bool:required,			/**< Whether or not to require */
ds@1952
   120
};
ds@1952
   121
ds@1952
   122
/**
ds@1952
   123
 * Defines how a plugin must expose itself for native requiring.
ds@1952
   124
 */
ds@1952
   125
struct SharedPlugin
ds@1952
   126
{
ds@1952
   127
	const String:name[],	/**< Short name */
ds@1952
   128
	const String:file[],	/**< File name */
ds@1952
   129
	bool:required,			/**< Whether or not to require */
ds@1952
   130
};
ds@1952
   131
ds@1952
   132
public Float:NULL_VECTOR[3];		/**< Pass this into certain functions to act as a C++ NULL */
ds@1952
   133
public const String:NULL_STRING[1];	/**< pass this into certain functions to act as a C++ NULL */
ds@1952
   134
ds@1952
   135
#define AUTOLOAD_EXTENSIONS
ds@1952
   136
#define REQUIRE_EXTENSIONS
ds@1952
   137
#define REQUIRE_PLUGIN