/** * @file alias.h * * Alias definitions and routines. * * @author Geoff Davis <geoff@circlemudsquared.org> * @ingroup alias * @license All rights reserved. See license.doc for complete information. * @package cs * @since v1.0 * * Copyright (C) 2006 Geoff Davis <geoff@circlemudsquared.org> * Greg Buxton <greg@circlemudsquared.org> * * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. */ #ifndef __ALIAS_H__ #define __ALIAS_H__ #include "base.h" /** * The alias type constants. * @see struct _aliasData_t * @{ */ #define ALIAS_SIMPLE (0) /**< The alias is simple. */ #define ALIAS_COMPLEX (1) /**< The alias is complex. */ /** @} */ /** * The command seperator character. * @def ';' */ #define ALIAS_SEP_CHAR ';' /** * The variable identifier character. * @def '$' */ #define ALIAS_VAR_CHAR '$' /** * The alias glob character. * @def '*' */ #define ALIAS_GLOB_CHAR '*' /** * The alias structure. * @{ */ struct _aliasData_t { char *alias; /**< The alias' pattern string. */ char *replacement; /**< The alias' replacement string. */ int type; /**< The type of alias: ALIAS_xxx. */ aliasData_t *next; /**< The next alias in the list. */ }; /** @} */ /** * Deletes the aliases file for the named player. * @param charname the name of the player whose alias file is to be deleted * @return none */ void delete_aliases(const char *charname); /** * Reads a player's aliases from disk. * @param ch the player whose aliases are to be read from disk * @return none */ void read_aliases(charData_t *ch); /** * Writes a player's aliases to disk. * @param ch the player whose aliases are to be written to disk * @return none */ void write_aliases(charData_t *ch); /** * Searches for an alias by name. * @param aliases the list of aliases to be searched * @param str the name of the alias for which to search * @return the named alias, or NULL if the alias cannot be found */ aliasData_t *find_alias(aliasData_t *alias_list, const char *str); /** * Frees an alias. * @param alias the alias to be freed * @return none */ void free_alias(aliasData_t *a); /** * Performs a complex alias replacement. * @param input_q the character's input queue * @param orig the original string to be processed * @param alias the corresponding alias * @return none */ void perform_complex_alias(textQueue_t *input_q, char *orig, aliasData_t *alias); /** * Performs an alias replacement on a given string. * @param d the descriptor at which the alias replacement occurs * @param orig the original string to be processed * @param maxlen the maximum length of the resulting string * @return 0 if the string was modified in place; * 1 if the string was _not_ modified in place and expanded aliases * have been placed at the front of the character's input queue */ int perform_alias(descriptorData_t *d, char *orig, size_t maxlen); #endif /* __ALIAS_H__ */