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