sourcemm/util.h
author David Anderson <dvander@alliedmods.net>
Sun Aug 07 03:26:58 2005 +0000 (2005-08-07)
changeset 95 beffdec7d04c
parent 84 3f77bc9e64d8
child 122 7c36121e2dfe
permissions -rw-r--r--
Bumped version number
     1 /* ======== SourceMM ========
     2 * Copyright (C) 2004-2005 Metamod:Source Development Team
     3 * No warranties of any kind
     4 *
     5 * License: zlib/libpng
     6 *
     7 * Author(s): David "BAILOPAN" Anderson
     8 * ============================
     9 */
    10 
    11 #ifndef _INCLUDE_UTIL_H
    12 #define _INCLUDE_UTIL_H
    13 
    14 /**
    15  * @brief Utility functons
    16  * @file util.h
    17  */
    18 
    19 const char *UTIL_GetExtension(const char *file);
    20 void UTIL_TrimLeft(char *buffer);
    21 void UTIL_TrimRight(char *buffer);
    22 
    23 #define META_INTERFACE_MACRO(type, final) \
    24 	PluginIter i; \
    25 	void *mret=NULL, *d; \
    26 	META_RES mres, high=MRES_IGNORED; \
    27 	g_SmmAPI.SetLastMetaReturn(MRES_IGNORED); \
    28 	for (i=g_PluginMngr._begin(); i!=g_PluginMngr._end(); i++) \
    29 	{ \
    30 		if ( (*i) && (*i)->fac_list. type ) \
    31 		{ \
    32 			d = ((*i)->fac_list. type)(name, ret); \
    33 			mres = g_SmmAPI.GetLastMetaReturn(); \
    34 			if (mres > high) \
    35 				high = mres; \
    36 			if (mres >= MRES_OVERRIDE) \
    37 				mret = d; \
    38 		} \
    39 	} \
    40 	if (high == MRES_OVERRIDE) \
    41 	{ \
    42 		(final)(name, ret); \
    43 		return mret; \
    44 	} else if (high == MRES_SUPERCEDE) { \
    45 		return mret; \
    46 	} else { \
    47 		return (final)(name, ret); \
    48 	} 
    49 
    50 #endif //_INCLUDE_UTIL_H