mux/src/stringutil.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  MUX_STRTOK_STATE
struct  ANSI_ColorState
struct  ANSI_In_Context
struct  ANSI_Out_Context
struct  tag_itl
struct  BMH_State
struct  ArtRuleset
struct  PARSE_FLOAT_RESULT

Defines

#define mux_isprint(x)   (mux_isprint[(unsigned char)(x)])
#define mux_isdigit(x)   (mux_isdigit[(unsigned char)(x)])
#define mux_ishex(x)   (mux_ishex[(unsigned char)(x)])
#define mux_isazAZ(x)   (mux_isazAZ[(unsigned char)(x)])
#define mux_isalpha(x)   (mux_isalpha[(unsigned char)(x)])
#define mux_isalnum(x)   (mux_isalnum[(unsigned char)(x)])
#define mux_islower(x)   (mux_islower[(unsigned char)(x)])
#define mux_isupper(x)   (mux_isupper[(unsigned char)(x)])
#define mux_isspace(x)   (mux_isspace[(unsigned char)(x)])
#define mux_hex2dec(x)   (mux_hex2dec[(unsigned char)(x)])
#define mux_toupper(x)   (mux_toupper[(unsigned char)(x)])
#define mux_tolower(x)   (mux_tolower[(unsigned char)(x)])
#define mux_AttrNameInitialSet(x)   (mux_AttrNameInitialSet[(unsigned char)(x)])
#define mux_AttrNameSet(x)   (mux_AttrNameSet[(unsigned char)(x)])
#define mux_ObjectNameSet(x)   (mux_ObjectNameSet[(unsigned char)(x)])
#define mux_PlayerNameSet(x)   (mux_PlayerNameSet[(unsigned char)(x)])
#define mux_issecure(x)   (mux_issecure[(unsigned char)(x)])
#define mux_isescape(x)   (mux_isescape[(unsigned char)(x)])
#define mux_StripAccents(x)   (mux_StripAccents[(unsigned char)(x)])
#define TOKEN_TEXT_ANSI   0
#define TOKEN_ANSI   1
#define ANSI_ENDGOAL_NORMAL   0
#define ANSI_ENDGOAL_NOBLEED   1
#define ANSI_ENDGOAL_LEAK   2

Typedefs

typedef tag_itl ITL

Functions

int ANSI_lex (int nString, const char *pString, int *nLengthToken0, int *nLengthToken1)
void mux_strtok_src (MUX_STRTOK_STATE *tts, char *pString)
void mux_strtok_ctl (MUX_STRTOK_STATE *tts, char *pControl)
char * mux_strtok_parseLEN (MUX_STRTOK_STATE *tts, int *pnLen)
char * mux_strtok_parse (MUX_STRTOK_STATE *tts)
char * RemoveSetOfCharacters (char *pString, char *pSetToRemove)
size_t mux_ltoa (long val, char *buf)
char * mux_ltoa_t (long val)
void safe_ltoa (long val, char *buff, char **bufc)
size_t mux_i64toa (INT64 val, char *buf)
char * mux_i64toa_t (INT64 val)
void safe_i64toa (INT64 val, char *buff, char **bufc)
long mux_atol (const char *pString)
INT64 mux_atoi64 (const char *pString)
double mux_atof (char *szString, bool bStrict=true)
char * mux_ftoa (double r, bool bRounded, int frac)
bool is_integer (char *, int *)
bool is_rational (char *)
bool is_real (char *)
void ANSI_String_In_Init (struct ANSI_In_Context *pacIn, const char *szString, int iEndGoal)
void ANSI_String_Out_Init (struct ANSI_Out_Context *pacOut, char *pField, int nField, int vwMax, int iEndGoal)
void ANSI_String_Skip (struct ANSI_In_Context *pacIn, int maxVisualWidth, int *pnVisualWidth)
void ANSI_String_Copy (struct ANSI_Out_Context *pacOut, struct ANSI_In_Context *pacIn, int vwMax)
int ANSI_String_Finalize (struct ANSI_Out_Context *pacOut, int *pnVisualWidth)
char * ANSI_TruncateAndPad_sbuf (const char *pString, int nMaxVisualWidth, char fill= ' ')
int ANSI_TruncateToField (const char *szString, int nField, char *pField, int maxVisual, int *nVisualWidth, int iEndGoal)
char * strip_ansi (const char *szString, size_t *pnString=0)
char * strip_accents (const char *szString, size_t *pnString=0)
char * normal_to_white (const char *)
char * munge_space (const char *)
char * trim_spaces (char *)
char * grabto (char **, char)
int string_compare (const char *, const char *)
int string_prefix (const char *, const char *)
const char * string_match (const char *, const char *)
char * replace_string (const char *, const char *, const char *)
char * replace_tokens (const char *s, const char *pBound, const char *pListPlace, const char *pSwitch)
bool minmatch (char *str, char *target, int min)
char * StringCloneLen (const char *str, size_t nStr)
char * StringClone (const char *str)
void safe_copy_str (const char *src, char *buff, char **bufp, int max)
void safe_copy_str_lbuf (const char *src, char *buff, char **bufp)
size_t safe_copy_buf (const char *src, size_t nLen, char *buff, char **bufp)
size_t safe_fill (char *buff, char **bufc, char chFile, size_t nSpaces)
bool matches_exit_from_list (char *, const char *)
char * translate_string (const char *, bool)
int mux_stricmp (const char *a, const char *b)
int mux_memicmp (const void *p1_arg, const void *p2_arg, size_t n)
void mux_strlwr (char *tp)
void mux_strupr (char *a)
void ItemToList_Init (ITL *pContext, char *arg_buff, char **arg_bufc, char arg_chPrefix=0, char arg_chSep= ' ')
bool ItemToList_AddInteger (ITL *pContext, int i)
bool ItemToList_AddString (ITL *pContext, char *pStr)
bool ItemToList_AddStringLEN (ITL *pContext, size_t nStr, char *pStr)
void ItemToList_Final (ITL *pContext)
int DCL_CDECL mux_vsnprintf (char *buff, int count, const char *fmt, va_list va)
int GetLineTrunc (char *Buffer, size_t nBuffer, FILE *fp)
void BMH_Prepare (BMH_State *bmhs, int nPat, const char *pPat)
int BMH_Execute (BMH_State *bmhs, int nPat, const char *pPat, int nSrc, const char *pSrc)
int BMH_StringSearch (int nPat, const char *pPat, int nSrc, const char *pSrc)
void BMH_PrepareI (BMH_State *bmhs, int nPat, const char *pPat)
int BMH_ExecuteI (BMH_State *bmhs, int nPat, const char *pPat, int nSrc, const char *pSrc)
int BMH_StringSearchI (int nPat, const char *pPat, int nSrc, const char *pSrc)
bool ParseFloat (PARSE_FLOAT_RESULT *pfr, const char *str, bool bStrict=true)

Variables

const bool mux_isprint [256]
const bool mux_isdigit [256]
const bool mux_ishex [256]
const bool mux_isazAZ [256]
const bool mux_isalpha [256]
const bool mux_isalnum [256]
const bool mux_islower [256]
const bool mux_isupper [256]
const bool mux_isspace [256]
bool mux_AttrNameInitialSet [256]
bool mux_AttrNameSet [256]
const bool mux_ObjectNameSet [256]
bool mux_PlayerNameSet [256]
const bool mux_issecure [256]
const bool mux_isescape [256]
const unsigned char mux_hex2dec [256]
const unsigned char mux_toupper [256]
const unsigned char mux_tolower [256]
const unsigned char mux_StripAccents [256]


Define Documentation

#define ANSI_ENDGOAL_LEAK   2

Definition at line 120 of file stringutil.h.

Referenced by centerjustcombo().

#define ANSI_ENDGOAL_NOBLEED   1

Definition at line 119 of file stringutil.h.

Referenced by ANSI_String_Copy(), ANSI_String_Finalize(), normal_to_white(), and translate_string().

#define ANSI_ENDGOAL_NORMAL   0

Definition at line 118 of file stringutil.h.

Referenced by ANSI_Parse_m(), ANSI_String_Out_Init(), ANSI_TransitionColorBinary(), ANSI_TransitionColorEscape(), ANSI_TruncateAndPad_sbuf(), centerjustcombo(), db_read(), do_addcom(), do_cheader(), do_createchannel(), do_mail_list(), do_mail_proof(), do_mail_read(), do_mail_review(), FUNCTION(), load_comsystem(), MakeCanonicalDoing(), MakeCanonicalExitName(), MakeCanonicalMailAliasDesc(), MakeCanonicalObjectName(), mux_exec(), RestrictTitleValue(), tcache_add(), trimmed_name(), unparse_object(), and unparse_object_numonly().

#define mux_AttrNameInitialSet (  )     (mux_AttrNameInitialSet[(unsigned char)(x)])

Definition at line 45 of file stringutil.h.

Referenced by FUNCTION(), getboolexp1(), init_attrtab(), and MakeCanonicalAttributeName().

#define mux_AttrNameSet (  )     (mux_AttrNameSet[(unsigned char)(x)])

Definition at line 46 of file stringutil.h.

Referenced by init_attrtab(), and MakeCanonicalAttributeName().

#define mux_hex2dec (  )     (mux_hex2dec[(unsigned char)(x)])

Definition at line 41 of file stringutil.h.

#define mux_isalnum (  )     (mux_isalnum[(unsigned char)(x)])

Definition at line 37 of file stringutil.h.

Referenced by CF_HAND(), do_log(), do_mail_change_folder(), and string_match().

#define mux_isalpha (  )     (mux_isalpha[(unsigned char)(x)])

Definition at line 36 of file stringutil.h.

Referenced by FUNCTION(), main(), MakeCanonicalMailAlias(), and ParseThreeLetters().

#define mux_isazAZ (  )     (mux_isazAZ[(unsigned char)(x)])

Definition at line 35 of file stringutil.h.

Referenced by mux_exec().

#define mux_isdigit (  )     (mux_isdigit[(unsigned char)(x)])

Definition at line 33 of file stringutil.h.

Referenced by ANSI_Parse_m(), atr_decode_flags_owner(), CF_HAND(), db_read(), decode_flags(), do_mail_stub(), FUNCTION(), fwdlist_load(), getboolexp1(), is_integer(), is_rational(), make_namelist(), MakeCanonicalMailAlias(), mux_atoi64(), mux_atol(), parse_dbref(), parse_folder(), parse_msglist(), ParseFloat(), ParseFractionalSecondsString(), CSpellNum::SpellNum(), test_atr(), and wild_match().

#define mux_isescape (  )     (mux_isescape[(unsigned char)(x)])

Definition at line 50 of file stringutil.h.

Referenced by FUNCTION().

#define mux_ishex (  )     (mux_ishex[(unsigned char)(x)])

Definition at line 34 of file stringutil.h.

#define mux_islower (  )     (mux_islower[(unsigned char)(x)])

Definition at line 38 of file stringutil.h.

Referenced by ok_password().

#define mux_isprint (  )     (mux_isprint[(unsigned char)(x)])

Definition at line 32 of file stringutil.h.

Referenced by db_read(), FUNCTION(), MakeCanonicalComAlias(), ok_password(), and process_input_helper().

#define mux_issecure (  )     (mux_issecure[(unsigned char)(x)])

Definition at line 49 of file stringutil.h.

Referenced by FUNCTION().

#define mux_isspace (  )     (mux_isspace[(unsigned char)(x)])

Definition at line 40 of file stringutil.h.

Referenced by add_folder_name(), CF_HAND(), cmdtest(), do_command(), do_force_prefixed(), do_icmd(), do_setvattr(), dump_users(), flag_set(), FUNCTION(), fwdlist_load(), get_folder_number(), helpindex_read(), is_integer(), is_rational(), MakeCanonicalObjectName(), match_player(), matches_exit_from_list(), munge_space(), munge_space_for_match(), mux_atoi64(), mux_atol(), mux_exec(), ok_password(), parse_boolexp_L(), parse_connect(), parse_msglist(), parse_range(), parse_to(), parse_to_cleanup(), ParseChannelLine(), ParseFloat(), ParseFractionalSecondsString(), power_set(), process_command(), set_userstring(), skip_whitespace(), CSpellNum::SpellNum(), string_compare(), trim_spaces(), ValidatePlayerName(), and xlate().

#define mux_isupper (  )     (mux_isupper[(unsigned char)(x)])

Definition at line 39 of file stringutil.h.

Referenced by ok_password().

#define mux_ObjectNameSet (  )     (mux_ObjectNameSet[(unsigned char)(x)])

Definition at line 47 of file stringutil.h.

Referenced by MakeCanonicalObjectName().

#define mux_PlayerNameSet (  )     (mux_PlayerNameSet[(unsigned char)(x)])

Definition at line 48 of file stringutil.h.

Referenced by ValidatePlayerName().

#define mux_StripAccents (  )     (mux_StripAccents[(unsigned char)(x)])

Definition at line 51 of file stringutil.h.

Referenced by strip_accents().

#define mux_tolower (  )     (mux_tolower[(unsigned char)(x)])

Definition at line 43 of file stringutil.h.

Referenced by BMH_PrepareI(), CF_HAND(), ConvertR2RDG(), ConvertRDG2R(), DecodeN(), do_icmd(), FUNCTION(), get_gender(), get_list_type(), MakeCanonicalAttributeCommand(), MakeCanonicalFlagName(), matches_exit_from_list(), minmatch(), mux_exec(), mux_memicmp(), mux_stricmp(), mux_strlwr(), process_command(), string_compare(), and string_prefix().

#define mux_toupper (  )     (mux_toupper[(unsigned char)(x)])

Definition at line 42 of file stringutil.h.

Referenced by add_folder_name(), BMH_ExecuteI(), BMH_PrepareI(), do_examine(), FUNCTION(), get_folder_number(), MakeCanonicalAttributeName(), mux_exec(), mux_strupr(), parse_msglist(), ParseFloat(), and ParseThreeLetters().

#define TOKEN_ANSI   1

Definition at line 55 of file stringutil.h.

Referenced by ANSI_lex().

#define TOKEN_TEXT_ANSI   0

Definition at line 54 of file stringutil.h.

Referenced by ANSI_lex(), ANSI_String_Copy(), ANSI_String_Skip(), ANSI_TransformTextReverseWithFunction(), ANSI_TransformTextWithTable(), FUNCTION(), strip_ansi(), and translate_string().


Typedef Documentation

typedef struct tag_itl ITL


Function Documentation

int ANSI_lex ( int  nString,
const char *  pString,
int *  nLengthToken0,
int *  nLengthToken1 
)

Definition at line 499 of file stringutil.cpp.

References ANSI_TokenTerminatorTable, ESC_CHAR, TOKEN_ANSI, and TOKEN_TEXT_ANSI.

Referenced by ANSI_String_Copy(), ANSI_String_Skip(), ANSI_TransformTextReverseWithFunction(), ANSI_TransformTextWithTable(), FUNCTION(), strip_ansi(), and translate_string().

00500 {
00501     *nLengthToken0 = 0;
00502     *nLengthToken1 = 0;
00503 
00504     const char *p = pString;
00505 
00506     for (;;)
00507     {
00508         // Look for an ESC_CHAR
00509         //
00510         p = strchr(p, ESC_CHAR);
00511         if (!p)
00512         {
00513             // This is the most common case by far.
00514             //
00515             *nLengthToken0 = nString;
00516             return TOKEN_TEXT_ANSI;
00517         }
00518 
00519         // We have an ESC_CHAR. Let's look at the next character.
00520         //
00521         if (p[1] != '[')
00522         {
00523             // Could be a '\0' or another non-'[' character.
00524             // Move the pointer to position ourselves over it.
00525             // And continue looking for an ESC_CHAR.
00526             //
00527             p = p + 1;
00528             continue;
00529         }
00530 
00531         // We found the beginning of an ANSI sequence.
00532         // Find the terminating character.
00533         //
00534         const char *q = p+2;
00535         while (ANSI_TokenTerminatorTable[(unsigned char)*q] == 0)
00536         {
00537             q++;
00538         }
00539         if (q[0] == '\0')
00540         {
00541             // There was no good terminator. Treat everything like text.
00542             // Also, we are at the end of the string, so just return.
00543             //
00544             *nLengthToken0 = q - pString;
00545             return TOKEN_TEXT_ANSI;
00546         }
00547         else
00548         {
00549             // We found an ANSI sequence.
00550             //
00551             if (p == pString)
00552             {
00553                 // The ANSI sequence started it.
00554                 //
00555                 *nLengthToken0 = q - pString + 1;
00556                 return TOKEN_ANSI;
00557             }
00558             else
00559             {
00560                 // We have TEXT followed by an ANSI sequence.
00561                 //
00562                 *nLengthToken0 = p - pString;
00563                 *nLengthToken1 = q - p + 1;
00564                 return TOKEN_TEXT_ANSI;
00565             }
00566         }
00567     }
00568 }

void ANSI_String_Copy ( struct ANSI_Out_Context pacOut,
struct ANSI_In_Context pacIn,
int  vwMax 
)

Definition at line 1055 of file stringutil.cpp.

References acsRestingStates, ANSI_ENDGOAL_NOBLEED, ANSI_lex(), ANSI_Parse_m(), ANSI_TransitionColorBinary(), ANSI_Out_Context::m_acs, ANSI_In_Context::m_acs, ANSI_Out_Context::m_bDone, ANSI_In_Context::m_bSawNormal, ANSI_Out_Context::m_iEndGoal, ANSI_Out_Context::m_n, ANSI_In_Context::m_n, ANSI_Out_Context::m_nMax, ANSI_In_Context::m_p, ANSI_Out_Context::m_p, ANSI_Out_Context::m_vw, ANSI_Out_Context::m_vwMax, and TOKEN_TEXT_ANSI.

Referenced by ANSI_TruncateToField(), centerjustcombo(), FUNCTION(), and mux_exec().

01060 {
01061     // Check whether we have previous struck the session limits (given
01062     // by ANSI_String_Out_Init() for field size or visual width.
01063     //
01064     if (pacOut->m_bDone)
01065     {
01066         return;
01067     }
01068 
01069     // What is the working limit for visual width.
01070     //
01071     int vw = 0;
01072     int vwMax = pacOut->m_vwMax;
01073     if (maxVisualWidth0 < vwMax)
01074     {
01075         vwMax = maxVisualWidth0;
01076     }
01077 
01078     // What is the working limit for field size.
01079     //
01080     int nMax = pacOut->m_nMax;
01081 
01082     char *pField = pacOut->m_p;
01083     while (pacIn->m_n)
01084     {
01085         int nTokenLength0;
01086         int nTokenLength1;
01087         int iType = ANSI_lex(pacIn->m_n, pacIn->m_p, &nTokenLength0,
01088             &nTokenLength1);
01089 
01090         if (iType == TOKEN_TEXT_ANSI)
01091         {
01092             // We have a TEXT+[ANSI] phrase. The text length is given
01093             // by nTokenLength0, and the ANSI characters that follow
01094             // (if present) are of length nTokenLength1.
01095             //
01096             // Process TEXT part first.
01097             //
01098             // TODO: If there is a maximum size for the transitions,
01099             // and we have gobs of space, don't bother calculating
01100             // sizes so carefully. It might be faster
01101 
01102             // nFieldEffective is used to allocate and plan space for
01103             // the rest of the physical field (given by the current
01104             // nField length).
01105             //
01106             int nFieldEffective = nMax - 1; // Leave room for '\0'.
01107 
01108             int nTransitionFinal = 0;
01109             if (pacOut->m_iEndGoal <= ANSI_ENDGOAL_NOBLEED)
01110             {
01111                 // If we lay down -any- of the TEXT part, we need to make
01112                 // sure we always leave enough room to get back to the
01113                 // required final ANSI color state.
01114                 //
01115                 if (memcmp( &(pacIn->m_acs),
01116                             &acsRestingStates[pacOut->m_iEndGoal],
01117                             sizeof(ANSI_ColorState)) != 0)
01118                 {
01119                     // The color state of the TEXT isn't the final state,
01120                     // so how much room will the transition back to the
01121                     // final state take?
01122                     //
01123                     ANSI_TransitionColorBinary( &(pacIn->m_acs),
01124                                                 &acsRestingStates[pacOut->m_iEndGoal],
01125                                                 &nTransitionFinal,
01126                                                 pacOut->m_iEndGoal);
01127 
01128                     nFieldEffective -= nTransitionFinal;
01129                 }
01130             }
01131 
01132             // If we lay down -any- of the TEXT part, it needs to be
01133             // the right color.
01134             //
01135             int nTransition = 0;
01136             char *pTransition =
01137                 ANSI_TransitionColorBinary( &(pacOut->m_acs),
01138                                             &(pacIn->m_acs),
01139                                             &nTransition,
01140                                             pacOut->m_iEndGoal);
01141             nFieldEffective -= nTransition;
01142 
01143             // If we find that there is no room for any of the TEXT,
01144             // then we're done.
01145             //
01146             // TODO: The visual width test can be done further up to save time.
01147             //
01148             if (  nFieldEffective <= nTokenLength0
01149                || vw + nTokenLength0 > vwMax)
01150             {
01151                 // We have reached the limits of the field.
01152                 //
01153                 if (nFieldEffective > 0)
01154                 {
01155                     // There was enough physical room in the field, but
01156                     // we would have exceeded the maximum visual width
01157                     // if we used all the text.
01158                     //
01159                     if (nTransition)
01160                     {
01161                         // Encode the TEXT color.
01162                         //
01163                         memcpy(pField, pTransition, nTransition);
01164                         pField += nTransition;
01165                     }
01166 
01167                     // Place just enough of the TEXT in the field.
01168                     //
01169                     int nTextToAdd = vwMax - vw;
01170                     if (nTextToAdd < nFieldEffective)
01171                     {
01172                         nFieldEffective = nTextToAdd;
01173                     }
01174                     memcpy(pField, pacIn->m_p, nFieldEffective);
01175                     pField += nFieldEffective;
01176                     pacIn->m_p += nFieldEffective;
01177                     pacIn->m_n -= nFieldEffective;
01178                     vw += nFieldEffective;
01179                     pacOut->m_acs = pacIn->m_acs;
01180 
01181                     // Was this visual width limit related to the session or
01182                     // the call?
01183                     //
01184                     if (vwMax != maxVisualWidth0)
01185                     {
01186                         pacOut->m_bDone = true;
01187                     }
01188                 }
01189                 else
01190                 {
01191                     // Was size limit related to the session or the call?
01192                     //
01193                     pacOut->m_bDone = true;
01194                 }
01195                 pacOut->m_n += pField - pacOut->m_p;
01196                 pacOut->m_nMax -= pField - pacOut->m_p;
01197                 pacOut->m_p  = pField;
01198                 pacOut->m_vw += vw;
01199                 return;
01200             }
01201 
01202             if (nTransition)
01203             {
01204                 memcpy(pField, pTransition, nTransition);
01205                 pField += nTransition;
01206                 nMax   -= nTransition;
01207             }
01208             memcpy(pField, pacIn->m_p, nTokenLength0);
01209             pField  += nTokenLength0;
01210             nMax    -= nTokenLength0;
01211             pacIn->m_p += nTokenLength0;
01212             pacIn->m_n -= nTokenLength0;
01213             vw += nTokenLength0;
01214             pacOut->m_acs = pacIn->m_acs;
01215 
01216             if (nTokenLength1)
01217             {
01218                 // Process ANSI
01219                 //
01220                 ANSI_Parse_m(&(pacIn->m_acs), nTokenLength1, pacIn->m_p, &(pacIn->m_bSawNormal));
01221                 pacIn->m_p += nTokenLength1;
01222                 pacIn->m_n -= nTokenLength1;
01223             }
01224         }
01225         else
01226         {
01227             // Process ANSI
01228             //
01229             ANSI_Parse_m(&(pacIn->m_acs), nTokenLength0, pacIn->m_p, &(pacIn->m_bSawNormal));
01230             pacIn->m_n -= nTokenLength0;
01231             pacIn->m_p += nTokenLength0;
01232         }
01233     }
01234     pacOut->m_n += pField - pacOut->m_p;
01235     pacOut->m_nMax -= pField - pacOut->m_p;
01236     pacOut->m_p  = pField;
01237     pacOut->m_vw += vw;
01238 }

int ANSI_String_Finalize ( struct ANSI_Out_Context pacOut,
int *  pnVisualWidth 
)

Definition at line 1241 of file stringutil.cpp.

References acsRestingStates, ANSI_ENDGOAL_NOBLEED, ANSI_TransitionColorBinary(), ANSI_Out_Context::m_acs, ANSI_Out_Context::m_iEndGoal, ANSI_Out_Context::m_n, ANSI_Out_Context::m_p, and ANSI_Out_Context::m_vw.

Referenced by ANSI_TruncateToField(), centerjustcombo(), FUNCTION(), and mux_exec().

01245 {
01246     char *pField = pacOut->m_p;
01247     if (pacOut->m_iEndGoal <= ANSI_ENDGOAL_NOBLEED)
01248     {
01249         int nTransition = 0;
01250         char *pTransition =
01251             ANSI_TransitionColorBinary( &(pacOut->m_acs),
01252                                         &acsRestingStates[pacOut->m_iEndGoal],
01253                                         &nTransition, pacOut->m_iEndGoal);
01254         if (nTransition)
01255         {
01256             memcpy(pField, pTransition, nTransition);
01257             pField += nTransition;
01258         }
01259     }
01260     *pField = '\0';
01261     pacOut->m_n += pField - pacOut->m_p;
01262     pacOut->m_p  = pField;
01263     *pnVisualWidth = pacOut->m_vw;
01264     return pacOut->m_n;
01265 }

void ANSI_String_In_Init ( struct ANSI_In_Context pacIn,
const char *  szString,
int  iEndGoal 
)

Definition at line 948 of file stringutil.cpp.

References acsRestingStates, ANSI_In_Context::m_acs, ANSI_In_Context::m_bSawNormal, ANSI_In_Context::m_n, and ANSI_In_Context::m_p.

Referenced by ANSI_TruncateToField(), centerjustcombo(), FUNCTION(), and mux_exec().

00953 {
00954     pacIn->m_acs = acsRestingStates[iEndGoal];
00955     pacIn->m_p   = szString;
00956     pacIn->m_n   = strlen(szString);
00957     pacIn->m_bSawNormal = false;
00958 }

void ANSI_String_Out_Init ( struct ANSI_Out_Context pacOut,
char *  pField,
int  nField,
int  vwMax,
int  iEndGoal 
)

Definition at line 961 of file stringutil.cpp.

References acsRestingStates, ANSI_ENDGOAL_NORMAL, ANSI_Out_Context::m_acs, ANSI_Out_Context::m_bDone, ANSI_Out_Context::m_iEndGoal, ANSI_Out_Context::m_n, ANSI_Out_Context::m_nMax, ANSI_Out_Context::m_p, ANSI_Out_Context::m_vw, and ANSI_Out_Context::m_vwMax.

Referenced by ANSI_TruncateToField(), centerjustcombo(), FUNCTION(), and mux_exec().

00968 {
00969     pacOut->m_acs      = acsRestingStates[ANSI_ENDGOAL_NORMAL];
00970     pacOut->m_bDone    = false;
00971     pacOut->m_iEndGoal = iEndGoal;
00972     pacOut->m_n        = 0;
00973     pacOut->m_nMax     = nField;
00974     pacOut->m_p        = pField;
00975     pacOut->m_vw       = 0;
00976     pacOut->m_vwMax    = vwMax;
00977 }

void ANSI_String_Skip ( struct ANSI_In_Context pacIn,
int  maxVisualWidth,
int *  pnVisualWidth 
)

Definition at line 980 of file stringutil.cpp.

References ANSI_lex(), ANSI_Parse_m(), ANSI_In_Context::m_acs, ANSI_In_Context::m_bSawNormal, ANSI_In_Context::m_n, ANSI_In_Context::m_p, and TOKEN_TEXT_ANSI.

Referenced by centerjustcombo(), and FUNCTION().

00984 {
00985     *pnVisualWidth = 0;
00986     while (pacIn->m_n)
00987     {
00988         int nTokenLength0;
00989         int nTokenLength1;
00990         int iType = ANSI_lex(pacIn->m_n, pacIn->m_p, &nTokenLength0, &nTokenLength1);
00991 
00992         if (iType == TOKEN_TEXT_ANSI)
00993         {
00994             // Process TEXT
00995             //
00996             int nTextToSkip = maxVisualWidth - *pnVisualWidth;
00997             if (nTokenLength0 > nTextToSkip)
00998             {
00999                 // We have reached the limits of the field
01000                 //
01001                 *pnVisualWidth += nTextToSkip;
01002                 pacIn->m_p     += nTextToSkip;
01003                 pacIn->m_n     -= nTextToSkip;
01004                 return;
01005             }
01006 
01007             pacIn->m_p     += nTokenLength0;
01008             pacIn->m_n     -= nTokenLength0;
01009             *pnVisualWidth += nTokenLength0;
01010 
01011             if (nTokenLength1)
01012             {
01013                 // Process ANSI
01014                 //
01015                 ANSI_Parse_m(&(pacIn->m_acs), nTokenLength1, pacIn->m_p, &(pacIn->m_bSawNormal));
01016                 pacIn->m_p     += nTokenLength1;
01017                 pacIn->m_n     -= nTokenLength1;
01018             }
01019         }
01020         else
01021         {
01022             // Process ANSI
01023             //
01024             ANSI_Parse_m(&(pacIn->m_acs), nTokenLength0, pacIn->m_p, &(pacIn->m_bSawNormal));
01025             pacIn->m_n     -= nTokenLength0;
01026             pacIn->m_p     += nTokenLength0;
01027         }
01028     }
01029 }

char* ANSI_TruncateAndPad_sbuf ( const char *  pString,
int  nMaxVisualWidth,
char  fill = ' ' 
)

Definition at line 1294 of file stringutil.cpp.

References alloc_sbuf, ANSI_ENDGOAL_NORMAL, ANSI_TruncateToField(), and SBUF_SIZE.

Referenced by do_chanlist().

01295 {
01296     char *pStringModified = alloc_sbuf("ANSI_TruncateAndPad_sbuf");
01297     int nAvailable = SBUF_SIZE - nMaxVisualWidth;
01298     int nVisualWidth;
01299     int nLen = ANSI_TruncateToField(pString, nAvailable,
01300         pStringModified, nMaxVisualWidth, &nVisualWidth, ANSI_ENDGOAL_NORMAL);
01301     for (int i = nMaxVisualWidth - nVisualWidth; i > 0; i--)
01302     {
01303         pStringModified[nLen] = fill;
01304         nLen++;
01305     }
01306     pStringModified[nLen] = '\0';
01307     return pStringModified;
01308 }

int ANSI_TruncateToField ( const char *  szString,
int  nField,
char *  pField,
int  maxVisual,
int *  nVisualWidth,
int  iEndGoal 
)

Definition at line 1272 of file stringutil.cpp.

References ANSI_String_Copy(), ANSI_String_Finalize(), ANSI_String_In_Init(), and ANSI_String_Out_Init().

Referenced by ANSI_TruncateAndPad_sbuf(), centerjustcombo(), db_read(), do_addcom(), do_cheader(), do_createchannel(), do_mail_list(), do_mail_proof(), do_mail_read(), do_mail_review(), FUNCTION(), load_comsystem(), MakeCanonicalDoing(), MakeCanonicalExitName(), MakeCanonicalMailAliasDesc(), MakeCanonicalObjectName(), normal_to_white(), RestrictTitleValue(), tcache_add(), trimmed_name(), unparse_object(), and unparse_object_numonly().

01280 {
01281     if (!szString)
01282     {
01283         pField0[0] = '\0';
01284         return 0;
01285     }
01286     struct ANSI_In_Context aic;
01287     struct ANSI_Out_Context aoc;
01288     ANSI_String_In_Init(&aic, szString, iEndGoal);
01289     ANSI_String_Out_Init(&aoc, pField0, nField, maxVisualWidth, iEndGoal);
01290     ANSI_String_Copy(&aoc, &aic, maxVisualWidth);
01291     return ANSI_String_Finalize(&aoc, pnVisualWidth);
01292 }

int BMH_Execute ( BMH_State bmhs,
int  nPat,
const char *  pPat,
int  nSrc,
const char *  pSrc 
)

Definition at line 3302 of file stringutil.cpp.

References BMH_LARGE, BMH_State::m_d, and BMH_State::m_skip2.

Referenced by add_folder_name(), BMH_StringSearch(), and grep_util().

03303 {
03304     if (nPat <= 0)
03305     {
03306         return -1;
03307     }
03308     for (int i = nPat-1; i < nSrc; i += bmhs->m_skip2)
03309     {
03310         while ((i += bmhs->m_d[(unsigned char)(pSrc[i])]) < nSrc)
03311         {
03312             ; // Nothing.
03313         }
03314         if (i < BMH_LARGE)
03315         {
03316             break;
03317         }
03318         i -= BMH_LARGE;
03319         int j = nPat - 1;
03320         const char *s = pSrc + (i - j);
03321         while (--j >= 0 && s[j] == pPat[j])
03322         {
03323             ; // Nothing.
03324         }
03325         if (j < 0)
03326         {
03327             return s-pSrc;
03328         }
03329     }
03330     return -1;
03331 }

int BMH_ExecuteI ( BMH_State bmhs,
int  nPat,
const char *  pPat,
int  nSrc,
const char *  pSrc 
)

Definition at line 3367 of file stringutil.cpp.

References BMH_LARGE, BMH_State::m_d, BMH_State::m_skip2, and mux_toupper.

Referenced by BMH_StringSearchI(), and grep_util().

03368 {
03369     if (nPat <= 0)
03370     {
03371         return -1;
03372     }
03373     for (int i = nPat-1; i < nSrc; i += bmhs->m_skip2)
03374     {
03375         while ((i += bmhs->m_d[(unsigned char)(pSrc[i])]) < nSrc)
03376         {
03377             ; // Nothing.
03378         }
03379         if (i < BMH_LARGE)
03380         {
03381             break;
03382         }
03383         i -= BMH_LARGE;
03384         int j = nPat - 1;
03385         const char *s = pSrc + (i - j);
03386         while (  --j >= 0
03387               && mux_toupper(s[j]) == mux_toupper(pPat[j]))
03388         {
03389             ; // Nothing.
03390         }
03391         if (j < 0)
03392         {
03393             return s-pSrc;
03394         }
03395     }
03396     return -1;
03397 }

void BMH_Prepare ( BMH_State bmhs,
int  nPat,
const char *  pPat 
)

Definition at line 3277 of file stringutil.cpp.

References BMH_LARGE, BMH_State::m_d, and BMH_State::m_skip2.

Referenced by add_folder_name(), BMH_StringSearch(), and grep_util().

03278 {
03279     if (nPat <= 0)
03280     {
03281         return;
03282     }
03283     int k;
03284     for (k = 0; k < 256; k++)
03285     {
03286         bmhs->m_d[k] = nPat;
03287     }
03288 
03289     char chLastPat = pPat[nPat-1];
03290     bmhs->m_skip2 = nPat;
03291     for (k = 0; k < nPat - 1; k++)
03292     {
03293         bmhs->m_d[(unsigned char)pPat[k]] = nPat - k - 1;
03294         if (pPat[k] == chLastPat)
03295         {
03296             bmhs->m_skip2 = nPat - k - 1;
03297         }
03298     }
03299     bmhs->m_d[(unsigned char)chLastPat] = BMH_LARGE;
03300 }

void BMH_PrepareI ( BMH_State bmhs,
int  nPat,
const char *  pPat 
)

Definition at line 3340 of file stringutil.cpp.

References BMH_LARGE, BMH_State::m_d, BMH_State::m_skip2, mux_tolower, and mux_toupper.

Referenced by BMH_StringSearchI(), and grep_util().

03341 {
03342     if (nPat <= 0)
03343     {
03344         return;
03345     }
03346     int k;
03347     for (k = 0; k < 256; k++)
03348     {
03349         bmhs->m_d[k] = nPat;
03350     }
03351 
03352     char chLastPat = pPat[nPat-1];
03353     bmhs->m_skip2 = nPat;
03354     for (k = 0; k < nPat - 1; k++)
03355     {
03356         bmhs->m_d[mux_toupper(pPat[k])] = nPat - k - 1;
03357         bmhs->m_d[mux_tolower(pPat[k])] = nPat - k - 1;
03358         if (pPat[k] == chLastPat)
03359         {
03360             bmhs->m_skip2 = nPat - k - 1;
03361         }
03362     }
03363     bmhs->m_d[mux_toupper(chLastPat)] = BMH_LARGE;
03364     bmhs->m_d[mux_tolower(chLastPat)] = BMH_LARGE;
03365 }

int BMH_StringSearch ( int  nPat,
const char *  pPat,
int  nSrc,
const char *  pSrc 
)

Definition at line 3333 of file stringutil.cpp.

References BMH_Execute(), and BMH_Prepare().

Referenced by FUNCTION(), get_folder_name(), and get_folder_number().

03334 {
03335     BMH_State bmhs;
03336     BMH_Prepare(&bmhs, nPat, pPat);
03337     return BMH_Execute(&bmhs, nPat, pPat, nSrc, pSrc);
03338 }

int BMH_StringSearchI ( int  nPat,
const char *  pPat,
int  nSrc,
const char *  pSrc 
)

Definition at line 3399 of file stringutil.cpp.

References BMH_ExecuteI(), and BMH_PrepareI().

03400 {
03401     BMH_State bmhs;
03402     BMH_PrepareI(&bmhs, nPat, pPat);
03403     return BMH_ExecuteI(&bmhs, nPat, pPat, nSrc, pSrc);
03404 }

int GetLineTrunc ( char *  Buffer,
size_t  nBuffer,
FILE *  fp 
)

Definition at line 3235 of file stringutil.cpp.

References SBUF_SIZE.

Referenced by load_channels(), load_comsystem(), and malias_read().

03236 {
03237     size_t lenBuffer = 0;
03238     if (fgets(Buffer, nBuffer, fp))
03239     {
03240         lenBuffer = strlen(Buffer);
03241     }
03242     if (lenBuffer <= 0)
03243     {
03244         memcpy(Buffer, "\n", 2);
03245         return 1;
03246     }
03247     if (Buffer[lenBuffer-1] != '\n')
03248     {
03249         // The line was too long for the buffer. Continue reading until the
03250         // end of the line.
03251         //
03252         char TruncBuffer[SBUF_SIZE];
03253         size_t lenTruncBuffer;
03254         do
03255         {
03256             if (!fgets(TruncBuffer, sizeof(TruncBuffer), fp))
03257             {
03258                 break;
03259             }
03260             lenTruncBuffer = strlen(TruncBuffer);
03261         }
03262         while (TruncBuffer[lenTruncBuffer-1] != '\n');
03263     }
03264     return lenBuffer;
03265 }

char* grabto ( char **  ,
char   
)

Definition at line 1576 of file stringutil.cpp.

Referenced by decrypt_logindata().

01577 {
01578     char *savec, *cp;
01579 
01580     if (!str || !*str || !**str)
01581         return NULL;
01582 
01583     savec = cp = *str;
01584     while (*cp && *cp != targ)
01585         cp++;
01586     if (*cp)
01587         *cp++ = '\0';
01588     *str = cp;
01589     return savec;
01590 }

bool is_integer ( char *  ,
int *   
)

Definition at line 2713 of file stringutil.cpp.

References mux_isdigit, and mux_isspace.

Referenced by autodetect_list(), centerjustcombo(), CF_HAND(), do_boot(), do_chanlog(), do_processcom(), FUNCTION(), and lookup_player().

02714 {
02715     int nDigits = 0;
02716     if (pDigits)
02717     {
02718         *pDigits = 0;
02719     }
02720 
02721     // Leading spaces.
02722     //
02723     while (mux_isspace(*str))
02724     {
02725         str++;
02726     }
02727 
02728     // Leading minus or plus
02729     //
02730     if (*str == '-' || *str == '+')
02731     {
02732         str++;
02733 
02734         // Just a sign by itself isn't an integer.
02735         //
02736         if (!*str)
02737         {
02738             return false;
02739         }
02740     }
02741 
02742     // Need at least 1 integer
02743     //
02744     if (!mux_isdigit(*str))
02745     {
02746         return false;
02747     }
02748 
02749     // The number (int)
02750     //
02751     do
02752     {
02753         str++;
02754         nDigits++;
02755     } while (mux_isdigit(*str));
02756 
02757     if (pDigits)
02758     {
02759         *pDigits = nDigits;
02760     }
02761 
02762     // Trailing Spaces.
02763     //
02764     while (mux_isspace(*str))
02765     {
02766         str++;
02767     }
02768 
02769     return (!*str);
02770 }

bool is_rational ( char *   ) 

Definition at line 2772 of file stringutil.cpp.

References mux_isdigit, and mux_isspace.

Referenced by do_give(), do_poor(), do_wait(), and FUNCTION().

02773 {
02774     // Leading spaces.
02775     //
02776     while (mux_isspace(*str))
02777     {
02778         str++;
02779     }
02780 
02781     // Leading minus or plus sign.
02782     //
02783     if (*str == '-' || *str == '+')
02784     {
02785         str++;
02786 
02787         // But not if just a sign.
02788         //
02789         if (!*str)
02790         {
02791             return false;
02792         }
02793     }
02794 
02795     // Need at least one digit.
02796     //
02797     bool got_one = false;
02798     if (mux_isdigit(*str))
02799     {
02800         got_one = true;
02801     }
02802 
02803     // The number (int)
02804     //
02805     while (mux_isdigit(*str))
02806     {
02807         str++;
02808     }
02809 
02810     // Decimal point.
02811     //
02812     if (*str == '.')
02813     {
02814         str++;
02815     }
02816 
02817     // Need at least one digit
02818     //
02819     if (mux_isdigit(*str))
02820     {
02821         got_one = true;
02822     }
02823 
02824     if (!got_one)
02825     {
02826         return false;
02827     }
02828 
02829     // The number (fract)
02830     //
02831     while (mux_isdigit(*str))
02832     {
02833         str++;
02834     }
02835 
02836     // Trailing spaces.
02837     //
02838     while (mux_isspace(*str))
02839     {
02840         str++;
02841     }
02842 
02843     // There must be nothing else after the trailing spaces.
02844     //
02845     return (!*str);
02846 }

bool is_real ( char *   ) 

Definition at line 2848 of file stringutil.cpp.

References ParseFloat().

Referenced by autodetect_list(), and FUNCTION().

02849 {
02850     PARSE_FLOAT_RESULT pfr;
02851     return ParseFloat(&pfr, str);
02852 }

bool ItemToList_AddInteger ( ITL pContext,
int  i 
)

Definition at line 3011 of file stringutil.cpp.

References tag_itl::bFirst, tag_itl::bufc, tag_itl::chPrefix, tag_itl::chSep, mux_ltoa(), tag_itl::nBufferAvailable, and SBUF_SIZE.

Referenced by do_page(), FUNCTION(), fwdlist_rewrite(), internalPlayerFind(), look_contents(), look_exits(), make_numlist(), make_portlist(), make_ulist(), and scan_zone().

03012 {
03013     char smbuf[SBUF_SIZE];
03014     char *p = smbuf;
03015     if (  !pContext->bFirst
03016        && pContext->chSep)
03017     {
03018         *p++ = pContext->chSep;
03019     }
03020     if (pContext->chPrefix)
03021     {
03022         *p++ = pContext->chPrefix;
03023     }
03024     p += mux_ltoa(i, p);
03025     size_t nLen = p - smbuf;
03026     if (nLen > pContext->nBufferAvailable)
03027     {
03028         // Out of room.
03029         //
03030         return false;
03031     }
03032     if (pContext->bFirst)
03033     {
03034         pContext->bFirst = false;
03035     }
03036     memcpy(*(pContext->bufc), smbuf, nLen);
03037     *(pContext->bufc) += nLen;
03038     pContext->nBufferAvailable -= nLen;
03039     return true;
03040 }

bool ItemToList_AddString ( ITL pContext,
char *  pStr 
)

Definition at line 3079 of file stringutil.cpp.

References ItemToList_AddStringLEN().

Referenced by cf_list(), FUNCTION(), list_attrtable(), and list_cmdtable().

03080 {
03081     size_t nStr = strlen(pStr);
03082     return ItemToList_AddStringLEN(pContext, nStr, pStr);
03083 }

bool ItemToList_AddStringLEN ( ITL pContext,
size_t  nStr,
char *  pStr 
)

Definition at line 3042 of file stringutil.cpp.

References tag_itl::bFirst, tag_itl::bufc, tag_itl::chPrefix, tag_itl::chSep, and tag_itl::nBufferAvailable.

Referenced by ItemToList_AddString(), and make_port_ulist().

03043 {
03044     size_t nLen = nStr;
03045     if (  !pContext->bFirst
03046        && pContext->chSep)
03047     {
03048         nLen++;
03049     }
03050     if (pContext->chPrefix)
03051     {
03052         nLen++;
03053     }
03054     if (nLen > pContext->nBufferAvailable)
03055     {
03056         // Out of room.
03057         //
03058         return false;
03059     }
03060     char *p = *(pContext->bufc);
03061     if (pContext->bFirst)
03062     {
03063         pContext->bFirst = false;
03064     }
03065     else if (pContext->chSep)
03066     {
03067         *p++ = pContext->chSep;
03068     }
03069     if (pContext->chPrefix)
03070     {
03071         *p++ = pContext->chPrefix;
03072     }
03073     memcpy(p, pStr, nStr);
03074     *(pContext->bufc) += nLen;
03075     pContext->nBufferAvailable -= nLen;
03076     return true;
03077 }

void ItemToList_Final ( ITL pContext  ) 

Definition at line 3085 of file stringutil.cpp.

References tag_itl::bufc.

Referenced by do_page(), FUNCTION(), fwdlist_rewrite(), internalPlayerFind(), list_attrtable(), look_contents(), look_exits(), make_numlist(), make_port_ulist(), make_portlist(), make_ulist(), and scan_zone().

03086 {
03087     **(pContext->bufc) = '\0';
03088 }

void ItemToList_Init ( ITL pContext,
char *  arg_buff,
char **  arg_bufc,
char  arg_chPrefix = 0,
char  arg_chSep = ' ' 
)

Definition at line 3000 of file stringutil.cpp.

References tag_itl::bFirst, tag_itl::bufc, tag_itl::buff, tag_itl::chPrefix, tag_itl::chSep, LBUF_SIZE, and tag_itl::nBufferAvailable.

Referenced by cf_list(), do_page(), FUNCTION(), fwdlist_rewrite(), internalPlayerFind(), list_attrtable(), list_cmdtable(), look_contents(), look_exits(), make_numlist(), make_port_ulist(), make_portlist(), make_ulist(), and scan_zone().

03002 {
03003     p->bFirst = true;
03004     p->chPrefix = arg_chPrefix;
03005     p->chSep = arg_chSep;
03006     p->buff = arg_buff;
03007     p->bufc = arg_bufc;
03008     p->nBufferAvailable = LBUF_SIZE - (*arg_bufc - arg_buff) - 1;
03009 }

bool matches_exit_from_list ( char *  ,
const char *   
)

Definition at line 1992 of file stringutil.cpp.

References EXIT_DELIMITER, mux_isspace, and mux_tolower.

Referenced by match_exit_internal(), and process_command().

01993 {
01994     char *s;
01995 
01996     while (*pattern)
01997     {
01998         for (s = str;   // check out this one
01999              ( *s
02000              && (mux_tolower(*s) == mux_tolower(*pattern))
02001              && *pattern
02002              && (*pattern != EXIT_DELIMITER));
02003              s++, pattern++) ;
02004 
02005         // Did we match it all?
02006         //
02007         if (*s == '\0')
02008         {
02009             // Make sure nothing afterwards
02010             //
02011             while (mux_isspace(*pattern))
02012             {
02013                 pattern++;
02014             }
02015 
02016             // Did we get it?
02017             //
02018             if (  !*pattern
02019                || (*pattern == EXIT_DELIMITER))
02020             {
02021                 return true;
02022             }
02023         }
02024         // We didn't get it, find next string to test
02025         //
02026         while (  *pattern
02027               && *pattern++ != EXIT_DELIMITER)
02028         {
02029             ; // Nothing.
02030         }
02031         while (mux_isspace(*pattern))
02032         {
02033             pattern++;
02034         }
02035     }
02036     return false;
02037 }

bool minmatch ( char *  str,
char *  target,
int  min 
)

Definition at line 1877 of file stringutil.cpp.

References mux_tolower.

Referenced by CF_HAND(), find_nametab_ent(), and search_nametab().

01878 {
01879     while (*str && *target
01880           && (mux_tolower(*str) == mux_tolower(*target)))
01881     {
01882         str++;
01883         target++;
01884         min--;
01885     }
01886     if (*str)
01887     {
01888         return false;
01889     }
01890     if (!*target)
01891     {
01892         return true;
01893     }
01894     return (min <= 0);
01895 }

char* munge_space ( const char *   ) 

Definition at line 1487 of file stringutil.cpp.

References alloc_lbuf, and mux_isspace.

Referenced by create_obj().

01488 {
01489     char *buffer = alloc_lbuf("munge_space");
01490     const char *p = string;
01491     char *q = buffer;
01492 
01493     if (p)
01494     {
01495         // Remove initial spaces.
01496         //
01497         while (mux_isspace(*p))
01498             p++;
01499 
01500         while (*p)
01501         {
01502             while (*p && !mux_isspace(*p))
01503                 *q++ = *p++;
01504 
01505             while (mux_isspace(*p))
01506             {
01507                 p++;
01508             }
01509 
01510             if (*p)
01511                 *q++ = ' ';
01512         }
01513     }
01514 
01515     // Remove terminal spaces and terminate string.
01516     //
01517     *q = '\0';
01518     return buffer;
01519 }

double mux_atof ( char *  szString,
bool  bStrict = true 
)

Definition at line 2494 of file stringutil.cpp.

References alloc_lbuf, ATOF_LIMIT, free_lbuf, PARSE_FLOAT_RESULT::iLeadingSign, PARSE_FLOAT_RESULT::iString, MakeSpecialFloat(), mux_atol(), mux_strtod(), PARSE_FLOAT_RESULT::nDigitsA, PARSE_FLOAT_RESULT::nDigitsB, PARSE_FLOAT_RESULT::nDigitsC, PARSE_FLOAT_RESULT::nMeat, ParseFloat(), PARSE_FLOAT_RESULT::pDigitsA, PARSE_FLOAT_RESULT::pDigitsB, and PARSE_FLOAT_RESULT::pMeat.

Referenced by do_asort(), FUNCTION(), and handle_vectors().

02495 {
02496     PARSE_FLOAT_RESULT pfr;
02497     if (!ParseFloat(&pfr, szString, bStrict))
02498     {
02499         return 0.0;
02500     }
02501 
02502     if (pfr.iString)
02503     {
02504         // Return the double value which corresponds to the
02505         // string when HAVE_IEEE_FORMAT.
02506         //
02507 #ifdef HAVE_IEEE_FP_FORMAT
02508         return MakeSpecialFloat(pfr.iString);
02509 #else // HAVE_IEEE_FP_FORMAT
02510         return 0.0;
02511 #endif // HAVE_IEEE_FP_FORMAT
02512     }
02513 
02514     // See if we can shortcut the decoding process.
02515     //
02516     double ret;
02517     if (  pfr.nDigitsA <= 9
02518        && pfr.nDigitsC == 0)
02519     {
02520         if (pfr.nDigitsB <= 9)
02521         {
02522             if (pfr.nDigitsB == 0)
02523             {
02524                 // This 'floating-point' number is just an integer.
02525                 //
02526                 ret = (double)mux_atol(pfr.pDigitsA);
02527             }
02528             else
02529             {
02530                 // This 'floating-point' number is fixed-point.
02531                 //
02532                 double rA = (double)mux_atol(pfr.pDigitsA);
02533                 double rB = (double)mux_atol(pfr.pDigitsB);
02534                 double rScale = powerstab[pfr.nDigitsB];
02535                 ret = rA + rB/rScale;
02536 
02537                 // As it is, ret is within a single bit of what a
02538                 // a call to atof would return. However, we can
02539                 // achieve that last lowest bit of precision by
02540                 // computing a residual.
02541                 //
02542                 double residual = (ret - rA)*rScale;
02543                 ret += (rB - residual)/rScale;
02544             }
02545             if (pfr.iLeadingSign == '-')
02546             {
02547                 ret = -ret;
02548             }
02549             return ret;
02550         }
02551     }
02552 
02553     const char *p = pfr.pMeat;
02554     size_t n = pfr.nMeat;
02555 
02556     // We need to protect certain libraries from going nuts from being
02557     // force fed lots of ASCII.
02558     //
02559     char *pTmp = NULL;
02560     if (n > ATOF_LIMIT)
02561     {
02562         pTmp = alloc_lbuf("mux_atof");
02563         memcpy(pTmp, p, ATOF_LIMIT);
02564         pTmp[ATOF_LIMIT] = '\0';
02565         p = pTmp;
02566     }
02567 
02568     ret = mux_strtod(p, NULL);
02569 
02570     if (pTmp)
02571     {
02572         free_lbuf(pTmp);
02573     }
02574 
02575     return ret;
02576 }

INT64 mux_atoi64 ( const char *  pString  ) 

Definition at line 2249 of file stringutil.cpp.

References mux_isdigit, and mux_isspace.

Referenced by do_asort(), CSpellNum::FractionalDigits(), FUNCTION(), and ParseFractionalSecondsString().

02250 {
02251     INT64 sum = 0;
02252     int LeadingCharacter = 0;
02253 
02254     // Convert ASCII digits
02255     //
02256     unsigned int c1;
02257     unsigned int c0 = pString[0];
02258     if (!mux_isdigit(c0))
02259     {
02260         while (mux_isspace(pString[0]))
02261         {
02262             pString++;
02263         }
02264         LeadingCharacter = pString[0];
02265         if (  LeadingCharacter == '-'
02266            || LeadingCharacter == '+')
02267         {
02268             pString++;
02269         }
02270         c0 = pString[0];
02271         if (!mux_isdigit(c0))
02272         {
02273             return 0;
02274         }
02275     }
02276 
02277     do
02278     {
02279         c1 = pString[1];
02280         if (mux_isdigit(c1))
02281         {
02282             sum = 100 * sum + TableATOI[c0-'0'][c1-'0'];
02283             pString += 2;
02284         }
02285         else
02286         {
02287             sum = 10 * sum + (c0-'0');
02288             break;
02289         }
02290     } while (mux_isdigit(c0 = pString[0]));
02291 
02292     // Interpret sign
02293     //
02294     if (LeadingCharacter == '-')
02295     {
02296         sum = -sum;
02297     }
02298     return sum;
02299 }

long mux_atol ( const char *  pString  ) 

Definition at line 2197 of file stringutil.cpp.

References mux_isdigit, and mux_isspace.

Referenced by add_quota(), add_to(), announce_connect(), centerjustcombo(), CF_HAND(), connect_player(), dbnum(), decrypt_logindata(), desc_reload(), did_it(), do_boot(), do_chanlog(), do_clone(), do_comlast(), do_convtime(), do_create(), do_editchannel(), do_expmail_stop(), do_fixdb(), do_give(), do_kill(), do_mail_fwd(), do_mail_reply(), do_mail_stats(), do_malias_create(), do_notify(), do_page(), do_poor(), do_processcom(), do_queue(), do_quota(), do_timewarp(), fetch_ConnectionInfoField(), fetch_ConnectionInfoFields(), FUNCTION(), fwdlist_load(), get_exit_dest(), get_folder_number(), get_malias(), getref(), give_money(), idle_timeout_val(), iter_value(), load_comsystem(), load_mail_V5(), lookup_player(), mail_to_list(), make_namelist(), malias_read(), mung_quotas(), mux_atof(), nfy_que(), parse_boolexp_L(), parse_dbref(), parse_folder(), parse_msglist(), parse_range(), ParseDecimalSeconds(), pay_quota(), pcache_reload1(), PD_ScanNextToken(), Pennies(), player_folder(), purge_going(), search_setup(), SendChannelMessage(), show_quota(), test_atr(), u_comp(), and wild_match().

02198 {
02199     long sum = 0;
02200     int LeadingCharacter = 0;
02201 
02202     // Convert ASCII digits
02203     //
02204     unsigned int c1;
02205     unsigned int c0 = pString[0];
02206     if (!mux_isdigit(c0))
02207     {
02208         while (mux_isspace(pString[0]))
02209         {
02210             pString++;
02211         }
02212         LeadingCharacter = pString[0];
02213         if (  LeadingCharacter == '-'
02214            || LeadingCharacter == '+')
02215         {
02216             pString++;
02217         }
02218         c0 = pString[0];
02219         if (!mux_isdigit(c0))
02220         {
02221             return 0;
02222         }
02223     }
02224 
02225     do
02226     {
02227         c1 = pString[1];
02228         if (mux_isdigit(c1))
02229         {
02230             sum = 100 * sum + TableATOI[c0-'0'][c1-'0'];
02231             pString += 2;
02232         }
02233         else
02234         {
02235             sum = 10 * sum + (c0-'0');
02236             break;
02237         }
02238     } while (mux_isdigit(c0 = pString[0]));
02239 
02240     // Interpret sign
02241     //
02242     if (LeadingCharacter == '-')
02243     {
02244         sum = -sum;
02245     }
02246     return sum;
02247 }

char* mux_ftoa ( double  r,
bool  bRounded,
int  frac 
)

Definition at line 2578 of file stringutil.cpp.

References mux_dtoa(), and mux_ltoa().

Referenced by FUNCTION(), and fval().

02579 {
02580     static char buffer[100];
02581     char *q = buffer;
02582     char *rve = NULL;
02583     int iDecimalPoint = 0;
02584     int bNegative = 0;
02585     int mode = 0;
02586     int nRequest = 50;
02587 
02588     if (bRounded)
02589     {
02590         mode = 3;
02591         nRequest = frac;
02592         if (50 < nRequest)
02593         {
02594             nRequest = 50;
02595         }
02596         else if (nRequest < -20)
02597         {
02598             nRequest = -20;
02599         }
02600     }
02601     char *p = mux_dtoa(r, mode, nRequest, &iDecimalPoint, &bNegative, &rve);
02602     int nSize = rve - p;
02603     if (nSize > 50)
02604     {
02605         nSize = 50;
02606     }
02607 
02608     if (bNegative)
02609     {
02610         *q++ = '-';
02611     }
02612 
02613     if (iDecimalPoint == 9999)
02614     {
02615         // Inf or NaN
02616         //
02617         memcpy(q, p, nSize);
02618         q += nSize;
02619     }
02620     else if (nSize <= 0)
02621     {
02622         // Zero
02623         //
02624         if (bNegative)
02625         {
02626             // If we laid down a minus sign, we should remove it.
02627             //
02628             q--;
02629         }
02630         *q++ = '0';
02631         if (  bRounded
02632            && 0 < nRequest)
02633         {
02634             *q++ = '.';
02635             memset(q, '0', nRequest);
02636             q += nRequest;
02637         }
02638     }
02639     else if (  iDecimalPoint <= -6
02640             || 18 <= iDecimalPoint)
02641     {
02642         *q++ = *p++;
02643         if (1 < nSize)
02644         {
02645             *q++ = '.';
02646             memcpy(q, p, nSize-1);
02647             q += nSize-1;
02648         }
02649         *q++ = 'E';
02650         q += mux_ltoa(iDecimalPoint-1, q);
02651     }
02652     else if (iDecimalPoint <= 0)
02653     {
02654         // iDecimalPoint = -5 to 0
02655         //
02656         *q++ = '0';
02657         *q++ = '.';
02658         memset(q, '0', -iDecimalPoint);
02659         q += -iDecimalPoint;
02660         memcpy(q, p, nSize);
02661         q += nSize;
02662         if (bRounded)
02663         {
02664             int nPad = nRequest - (nSize - iDecimalPoint);
02665             if (0 < nPad)
02666             {
02667                 memset(q, '0', nPad);
02668                 q += nPad;
02669             }
02670         }
02671     }
02672     else
02673     {
02674         // iDecimalPoint = 1 to 17
02675         //
02676         if (nSize <= iDecimalPoint)
02677         {
02678             memcpy(q, p, nSize);
02679             q += nSize;
02680             memset(q, '0', iDecimalPoint - nSize);
02681             q += iDecimalPoint - nSize;
02682             if (  bRounded
02683                && 0 < nRequest)
02684             {
02685                 *q++ = '.';
02686                 memset(q, '0', nRequest);
02687                 q += nRequest;
02688             }
02689         }
02690         else
02691         {
02692             memcpy(q, p, iDecimalPoint);
02693             q += iDecimalPoint;
02694             p += iDecimalPoint;
02695             *q++ = '.';
02696             memcpy(q, p, nSize - iDecimalPoint);
02697             q += nSize - iDecimalPoint;
02698             if (bRounded)
02699             {
02700                 int nPad = nRequest - (nSize - iDecimalPoint);
02701                 if (0 < nPad)
02702                 {
02703                     memset(q, '0', nPad);
02704                     q += nPad;
02705                 }
02706             }
02707         }
02708     }
02709     *q = '\0';
02710     return buffer;
02711 }

size_t mux_i64toa ( INT64  val,
char *  buf 
)

Definition at line 2113 of file stringutil.cpp.

Referenced by ConvertToSecondsString(), list_bufstats(), put_ConnectionInfoFields(), RightJustifyNumber(), and safe_i64toa().

02114 {
02115     char *p = buf;
02116 
02117     if (val < 0)
02118     {
02119         *p++ = '-';
02120         val = -val;
02121     }
02122     UINT64 uval = (UINT64)val;
02123 
02124     char *q = p;
02125 
02126     const char *z;
02127     while (uval > 99)
02128     {
02129         z = Digits100 + ((uval % 100) << 1);
02130         uval /= 100;
02131         *p++ = *z;
02132         *p++ = *(z+1);
02133     }
02134     z = Digits100 + (uval << 1);
02135     *p++ = *z;
02136     if (uval > 9)
02137     {
02138         *p++ = *(z+1);
02139     }
02140 
02141     size_t nLength = p - buf;
02142     *p-- = '\0';
02143 
02144     // The digits are in reverse order with a possible leading '-'
02145     // if the value was negative. q points to the first digit,
02146     // and p points to the last digit.
02147     //
02148     while (q < p)
02149     {
02150         // Swap characters are *p and *q
02151         //
02152         char temp = *p;
02153         *p = *q;
02154         *q = temp;
02155 
02156         // Move p and first digit towards the middle.
02157         //
02158         --p;
02159         ++q;
02160 
02161         // Stop when we reach or pass the middle.
02162         //
02163     }
02164     return nLength;
02165 }

char* mux_i64toa_t ( INT64  val  ) 

size_t mux_ltoa ( long  val,
char *  buf 
)

Definition at line 2045 of file stringutil.cpp.

Referenced by add_folder_name(), add_quota(), add_to(), create_obj(), db_write(), db_write_object(), did_it(), do_apply_marked(), do_dig(), do_open(), fcache_load(), FUNCTION(), GeneralTimeConversion(), get_folder_name(), ItemToList_AddInteger(), list_costs(), look_contents(), make_port_ulist(), mux_exec(), mux_ftoa(), mux_ltoa_t(), pay_quota(), pcache_save(), put_ConnectionInfoFields(), putref(), s_Pennies(), s_PenniesDirect(), safe_ltoa(), search_perform(), set_player_folder(), and CLogFile::WriteInteger().

02046 {
02047     char *p = buf;
02048 
02049     if (val < 0)
02050     {
02051         *p++ = '-';
02052         val = -val;
02053     }
02054     unsigned long uval = (unsigned long)val;
02055 
02056     char *q = p;
02057 
02058     const char *z;
02059     while (uval > 99)
02060     {
02061         z = Digits100 + ((uval % 100) << 1);
02062         uval /= 100;
02063         *p++ = *z;
02064         *p++ = *(z+1);
02065     }
02066     z = Digits100 + (uval << 1);
02067     *p++ = *z;
02068     if (uval > 9)
02069     {
02070         *p++ = *(z+1);
02071     }
02072 
02073     size_t nLength = p - buf;
02074     *p-- = '\0';
02075 
02076     // The digits are in reverse order with a possible leading '-'
02077     // if the value was negative. q points to the first digit,
02078     // and p points to the last digit.
02079     //
02080     while (q < p)
02081     {
02082         // Swap characters are *p and *q
02083         //
02084         char temp = *p;
02085         *p = *q;
02086         *q = temp;
02087 
02088         // Move p and first digit towards the middle.
02089         //
02090         --p;
02091         ++q;
02092 
02093         // Stop when we reach or pass the middle.
02094         //
02095     }
02096     return nLength;
02097 }

char* mux_ltoa_t ( long  val  ) 

Definition at line 2099 of file stringutil.cpp.

References mux_ltoa().

Referenced by bind_and_queue(), do_chanlog(), do_destroy(), do_mail_fwd(), do_mail_reply(), dump_users(), FUNCTION(), mung_quotas(), and SendChannelMessage().

02100 {
02101     static char buff[12];
02102     mux_ltoa(val, buff);
02103     return buff;
02104 }

int mux_memicmp ( const void *  p1_arg,
const void *  p2_arg,
size_t  n 
)

Definition at line 3119 of file stringutil.cpp.

References mux_tolower.

Referenced by PD_ScanNextToken().

03120 {
03121     unsigned char *p1 = (unsigned char *)p1_arg;
03122     unsigned char *p2 = (unsigned char *)p2_arg;
03123     while (  n
03124           && mux_tolower(*p1) == mux_tolower(*p2))
03125     {
03126         n--;
03127         p1++;
03128         p2++;
03129     }
03130     if (n)
03131     {
03132         int c1 = mux_tolower(*p1);
03133         int c2 = mux_tolower(*p2);
03134         if (c1 < c2)
03135         {
03136             return -1;
03137         }
03138         else if (c1 > c2)
03139         {
03140             return 1;
03141         }
03142     }
03143     return 0;
03144 }

int mux_stricmp ( const char *  a,
const char *  b 
)

Definition at line 3092 of file stringutil.cpp.

References mux_tolower.

Referenced by a_casecomp(), add_mail_message(), cf_display(), CF_HAND(), chanlist_comp(), do_chzone(), do_flag(), do_mail_stats(), do_mail_stub(), do_malias_create(), FUNCTION(), main(), and string_compare().

03093 {
03094     while (  *a
03095           && *b
03096           && mux_tolower(*a) == mux_tolower(*b))
03097     {
03098         a++;
03099         b++;
03100     }
03101     int c1 = mux_tolower(*a);
03102     int c2 = mux_tolower(*b);
03103     if (c1 < c2)
03104     {
03105         return -1;
03106     }
03107     else if (c1 > c2)
03108     {
03109         return 1;
03110     }
03111     else
03112     {
03113         return 0;
03114     }
03115 }

void mux_strlwr ( char *  tp  ) 

Definition at line 3148 of file stringutil.cpp.

References mux_tolower.

Referenced by add_player_name(), CF_HAND(), delete_player_name(), do_addcommand(), do_delcommand(), do_destroy(), do_function(), do_listcommands(), find_power(), FUNCTION(), function_add(), functions_add(), helpindex_read(), init_flagtab(), init_powertab(), lookup_player(), MakeCanonicalTopicName(), and search_setup().

03149 {
03150     while (*a)
03151     {
03152         *a = mux_tolower(*a);
03153         a++;
03154     }
03155 }

void mux_strtok_ctl ( MUX_STRTOK_STATE tts,
char *  pControl 
)

Definition at line 2876 of file stringutil.cpp.

References MUX_STRTOK_STATE::aControl.

Referenced by add_helpfile(), CF_HAND(), do_attribute(), do_list(), do_mail_reply(), do_page(), do_pemit_list(), do_teleport(), make_namelist(), ParseConnectionInfoString(), process_command(), and RemoveSetOfCharacters().

02877 {
02878     if (!tts || !pControl) return;
02879 
02880     // No character is a control character.
02881     //
02882     memset(tts->aControl, 0, sizeof(tts->aControl));
02883 
02884     // The NULL character is always a control character.
02885     //
02886     tts->aControl[0] = 1;
02887 
02888     // Record the user-specified control characters.
02889     //
02890     while (*pControl)
02891     {
02892         tts->aControl[(unsigned char)*pControl] = 1;
02893         pControl++;
02894     }
02895 }

char* mux_strtok_parse ( MUX_STRTOK_STATE tts  ) 

Definition at line 2959 of file stringutil.cpp.

References mux_strtok_parseLEN().

Referenced by add_helpfile(), CF_HAND(), do_attribute(), do_list(), do_mail_reply(), do_page(), do_pemit_list(), do_teleport(), make_namelist(), ParseConnectionInfoString(), and process_command().

02960 {
02961     int nLen;
02962     char *p = mux_strtok_parseLEN(tts, &nLen);
02963     if (p)
02964     {
02965         p[nLen] = '\0';
02966     }
02967     return p;
02968 }

char* mux_strtok_parseLEN ( MUX_STRTOK_STATE tts,
int *  pnLen 
)

Definition at line 2897 of file stringutil.cpp.

References MUX_STRTOK_STATE::aControl, and MUX_STRTOK_STATE::pString.

Referenced by mux_strtok_parse(), and RemoveSetOfCharacters().

02898 {
02899     *pnLen = 0;
02900     if (!tts)
02901     {
02902         return NULL;
02903     }
02904     char *p = tts->pString;
02905     if (!p)
02906     {
02907         return NULL;
02908     }
02909 
02910     // Skip over leading control characters except for the NUL character.
02911     //
02912     while (tts->aControl[(unsigned char)*p] && *p)
02913     {
02914         p++;
02915     }
02916 
02917     char *pReturn = p;
02918 
02919     // Skip over non-control characters.
02920     //
02921     while (tts->aControl[(unsigned char)*p] == 0)
02922     {
02923         p++;
02924     }
02925 
02926     // What is the length of this token?
02927     //
02928     *pnLen = p - pReturn;
02929 
02930     // Terminate the token with a NUL.
02931     //
02932     if (p[0])
02933     {
02934         // We found a non-NUL delimiter, so the next call will begin parsing
02935         // on the character after this one.
02936         //
02937         tts->pString = p+1;
02938     }
02939     else
02940     {
02941         // We hit the end of the string, so the end of the string is where
02942         // the next call will begin.
02943         //
02944         tts->pString = p;
02945     }
02946 
02947     // Did we find a token?
02948     //
02949     if (*pnLen > 0)
02950     {
02951         return pReturn;
02952     }
02953     else
02954     {
02955         return NULL;
02956     }
02957 }

void mux_strtok_src ( MUX_STRTOK_STATE tts,
char *  pString 
)

Definition at line 2867 of file stringutil.cpp.

References MUX_STRTOK_STATE::pString.

Referenced by add_helpfile(), CF_HAND(), do_attribute(), do_list(), do_mail_reply(), do_page(), do_pemit_list(), do_teleport(), make_namelist(), ParseConnectionInfoString(), process_command(), and RemoveSetOfCharacters().

02868 {
02869     if (!tts || !arg_pString) return;
02870 
02871     // Remember the string to parse.
02872     //
02873     tts->pString = arg_pString;
02874 }

void mux_strupr ( char *  a  ) 

Definition at line 3159 of file stringutil.cpp.

References mux_toupper.

Referenced by CF_HAND(), dbclean_CheckATtoANH(), do_attribute(), do_function(), and flag_rename().

03160 {
03161     while (*a)
03162     {
03163         *a = mux_toupper(*a);
03164         a++;
03165     }
03166 }

int DCL_CDECL mux_vsnprintf ( char *  buff,
int  count,
const char *  fmt,
va_list  va 
)

Definition at line 3184 of file stringutil.cpp.

References VSNPRINTF.

Referenced by cf_log_syntax(), log_printf(), raw_broadcast(), safe_tprintf_str(), CLogFile::tinyprintf(), and tprintf().

03185 {
03186     // From the manuals:
03187     //
03188     // vsnprintf returns the number of characters written, not
03189     // including the terminating '\0' character.
03190     //
03191     // It returns a -1 if an output error occurs.
03192     //
03193     // It can return a number larger than the size of the buffer
03194     // on some systems to indicate how much space it -would- have taken
03195     // if not limited by the request.
03196     //
03197     // On Win32, it can fill the buffer completely without a
03198     // null-termination and return -1.
03199 
03200 
03201     // To favor the Unix case, if there is an output error, but
03202     // vsnprint doesn't touch the buffer, we avoid undefined trash by
03203     // null-terminating the buffer to zero-length before the call.
03204     // Not sure that this happens, but it's a cheap precaution.
03205     //
03206     buff[0] = '\0';
03207 
03208     // If Unix version does start touching the buffer, null-terminates,
03209     // and returns -1, we are still safe. However, if Unix version
03210     // touches the buffer writes garbage, and then returns -1, we may
03211     // pass garbage, but this possibility seems very unlikely.
03212     //
03213     int len = VSNPRINTF(buff, count, fmt, va);
03214     if (len < 0 || len > count-1)
03215     {
03216         if (buff[0] == '\0')
03217         {
03218             // vsnprintf did not touch the buffer.
03219             //
03220             len = 0;
03221         }
03222         else
03223         {
03224             len = count-1;
03225         }
03226     }
03227     buff[len] = '\0';
03228     return len;
03229 }

char* normal_to_white ( const char *   ) 

Definition at line 1310 of file stringutil.cpp.

References ANSI_ENDGOAL_NOBLEED, ANSI_TruncateToField(), and LBUF_SIZE.

Referenced by queue_string().

01311 {
01312     static char Buffer[LBUF_SIZE];
01313     int nVisualWidth;
01314     ANSI_TruncateToField( szString,
01315                           sizeof(Buffer),
01316                           Buffer,
01317                           sizeof(Buffer),
01318                           &nVisualWidth,
01319                           ANSI_ENDGOAL_NOBLEED
01320                         );
01321     return Buffer;
01322 }

bool ParseFloat ( PARSE_FLOAT_RESULT pfr,
const char *  str,
bool  bStrict = true 
)

Definition at line 2310 of file stringutil.cpp.

References IEEE_MAKE_IND, IEEE_MAKE_NAN, IEEE_MAKE_NINF, IEEE_MAKE_PINF, PARSE_FLOAT_RESULT::iExponentSign, PARSE_FLOAT_RESULT::iLeadingSign, PARSE_FLOAT_RESULT::iString, mux_isdigit, mux_isspace, mux_toupper, PARSE_FLOAT_RESULT::nDigitsA, PARSE_FLOAT_RESULT::nDigitsB, PARSE_FLOAT_RESULT::nDigitsC, PARSE_FLOAT_RESULT::nMeat, PARSE_FLOAT_RESULT::pDigitsA, PARSE_FLOAT_RESULT::pDigitsB, PARSE_FLOAT_RESULT::pDigitsC, and PARSE_FLOAT_RESULT::pMeat.

Referenced by is_real(), mux_atof(), and xlate().

02311 {
02312     memset(pfr, 0, sizeof(PARSE_FLOAT_RESULT));
02313 
02314     // Parse Input
02315     //
02316     unsigned char ch;
02317     pfr->pMeat = str;
02318     if (  !mux_isdigit(*str)
02319        && *str != '.')
02320     {
02321         while (mux_isspace(*str))
02322         {
02323             str++;
02324         }
02325 
02326         pfr->pMeat = str;
02327         if (*str == '-')
02328         {
02329             pfr->iLeadingSign = '-';
02330             str++;
02331         }
02332         else if (*str == '+')
02333         {
02334             pfr->iLeadingSign = '+';
02335             str++;
02336         }
02337 
02338         if (  !mux_isdigit(*str)
02339            && *str != '.')
02340         {
02341             // Look for three magic strings.
02342             //
02343             ch = mux_toupper(str[0]);
02344             if (ch == 'I')
02345             {
02346                 // Could be 'Inf' or 'Ind'
02347                 //
02348                 ch = mux_toupper(str[1]);
02349                 if (ch == 'N')
02350                 {
02351                     ch = mux_toupper(str[2]);
02352                     if (ch == 'F')
02353                     {
02354                         // Inf
02355                         //
02356                         if (pfr->iLeadingSign == '-')
02357                         {
02358                             pfr->iString = IEEE_MAKE_NINF;
02359                         }
02360                         else
02361                         {
02362                             pfr->iString = IEEE_MAKE_PINF;
02363                         }
02364                         str += 3;
02365                         goto LastSpaces;
02366                     }
02367                     else if (ch == 'D')
02368                     {
02369                         // Ind
02370                         //
02371                         pfr->iString = IEEE_MAKE_IND;
02372                         str += 3;
02373                         goto LastSpaces;
02374                     }
02375                 }
02376             }
02377             else if (ch == 'N')
02378             {
02379                 // Could be 'Nan'
02380                 //
02381                 ch = mux_toupper(str[1]);
02382                 if (ch == 'A')
02383                 {
02384                     ch = mux_toupper(str[2]);
02385                     if (ch == 'N')
02386                     {
02387                         // Nan
02388                         //
02389                         pfr->iString = IEEE_MAKE_NAN;
02390                         str += 3;
02391                         goto LastSpaces;
02392                     }
02393                 }
02394             }
02395             return false;
02396         }
02397     }
02398 
02399     // At this point, we have processed the leading sign, handled all
02400     // the magic strings, skipped the leading spaces, and best of all
02401     // we either have a digit or a decimal point.
02402     //
02403     pfr->pDigitsA = str;
02404     while (mux_isdigit(*str))
02405     {
02406         pfr->nDigitsA++;
02407         str++;
02408     }
02409 
02410     if (*str == '.')
02411     {
02412         str++;
02413     }
02414 
02415     pfr->pDigitsB = str;
02416     while (mux_isdigit(*str))
02417     {
02418         pfr->nDigitsB++;
02419         str++;
02420     }
02421 
02422     if (  pfr->nDigitsA == 0
02423        && pfr->nDigitsB == 0)
02424     {
02425         return false;
02426     }
02427 
02428     ch = mux_toupper(*str);
02429     if (ch == 'E')
02430     {
02431         // There is an exponent portion.
02432         //
02433         str++;
02434         if (*str == '-')
02435         {
02436             pfr->iExponentSign = '-';
02437             str++;
02438         }
02439         else if (*str == '+')
02440         {
02441             pfr->iExponentSign = '+';
02442             str++;
02443         }
02444         pfr->pDigitsC = str;
02445         while (mux_isdigit(*str))
02446         {
02447             pfr->nDigitsC++;
02448             str++;
02449         }
02450 
02451         if (  pfr->nDigitsC < 1
02452            || 4 < pfr->nDigitsC)
02453         {
02454             return false;
02455         }
02456     }
02457 
02458 LastSpaces:
02459 
02460     pfr->nMeat = str - pfr->pMeat;
02461 
02462     // Trailing spaces.
02463     //
02464     while (mux_isspace(*str))
02465     {
02466         str++;
02467     }
02468 
02469     if (bStrict)
02470     {
02471         return (!*str);
02472     }
02473     else
02474     {
02475         return true;
02476     }
02477 }

char* RemoveSetOfCharacters ( char *  pString,
char *  pSetToRemove 
)

Definition at line 2973 of file stringutil.cpp.

References LBUF_SIZE, mux_strtok_ctl(), mux_strtok_parseLEN(), and mux_strtok_src().

Referenced by centerjustcombo(), do_addcommand(), do_cheader(), do_lock(), FUNCTION(), MakeCanonicalDoing(), MakeCanonicalMailAliasDesc(), and RestrictTitleValue().

02974 {
02975     static char Buffer[LBUF_SIZE];
02976     char *pBuffer = Buffer;
02977 
02978     int nLen;
02979     int nLeft = sizeof(Buffer) - 1;
02980     char *p;
02981     MUX_STRTOK_STATE tts;
02982     mux_strtok_src(&tts, pString);
02983     mux_strtok_ctl(&tts, pSetToRemove);
02984     for ( p = mux_strtok_parseLEN(&tts, &nLen);
02985           p && nLeft;
02986           p = mux_strtok_parseLEN(&tts, &nLen))
02987     {
02988         if (nLeft < nLen)
02989         {
02990             nLen = nLeft;
02991         }
02992         memcpy(pBuffer, p, nLen);
02993         pBuffer += nLen;
02994         nLeft -= nLen;
02995     }
02996     *pBuffer = '\0';
02997     return Buffer;
02998 }

char* replace_string ( const char *  ,
const char *  ,
const char *   
)

Definition at line 1723 of file stringutil.cpp.

References alloc_lbuf, safe_chr, safe_copy_buf(), and safe_str.

Referenced by do_edit_msg(), edit_string(), and edit_string_ansi().

01724 {
01725     if (!s)
01726     {
01727         return NULL;
01728     }
01729     size_t olen = strlen(old);
01730     char *result = alloc_lbuf("replace_string");
01731     char *r = result;
01732     while (*s)
01733     {
01734         // Find next occurrence of the first character of OLD string.
01735         //
01736         const char *p;
01737         if (  olen
01738            && (p = strchr(s, old[0])))
01739         {
01740             // Copy up to the next occurrence of the first char of OLD.
01741             //
01742             size_t n = p - s;
01743             if (n)
01744             {
01745                 safe_copy_buf(s, n, result, &r);
01746                 s += n;
01747             }
01748 
01749             // If we are really at an complete OLD, append NEW to the result
01750             // and bump the input string past the occurrence of OLD.
01751             // Otherwise, copy the character and try matching again.
01752             //
01753             if (!strncmp(old, s, olen))
01754             {
01755                 safe_str(new0, result, &r);
01756                 s += olen;
01757             }
01758             else
01759             {
01760                 safe_chr(*s, result, &r);
01761                 s++;
01762             }
01763         }
01764         else
01765         {
01766             // Finish copying source string. No matches. No further
01767             // work to perform.
01768             //
01769             safe_str(s, result, &r);
01770             break;
01771         }
01772     }
01773     *r = '\0';
01774     return result;
01775 }

char* replace_tokens ( const char *  s,
const char *  pBound,
const char *  pListPlace,
const char *  pSwitch 
)

Definition at line 1781 of file stringutil.cpp.

References alloc_lbuf, safe_chr, safe_copy_buf(), and safe_str.

Referenced by bind_and_queue(), do_switch(), FUNCTION(), search_perform(), and switch_handler().

01787 {
01788     if (!s)
01789     {
01790         return NULL;
01791     }
01792     char *result = alloc_lbuf("replace_tokens");
01793     char *r = result;
01794 
01795     while (*s)
01796     {
01797         // Find next '#'.
01798         //
01799         const char *p = strchr(s, '#');
01800         if (p)
01801         {
01802             // Copy up to the next occurrence of the first character.
01803             //
01804             size_t n = p - s;
01805             if (n)
01806             {
01807                 safe_copy_buf(s, n, result, &r);
01808                 s += n;
01809             }
01810 
01811             if (  s[1] == '#'
01812                && pBound)
01813             {
01814                 // BOUND_VAR
01815                 //
01816                 safe_str(pBound, result, &r);
01817                 s += 2;
01818             }
01819             else if (  s[1] == '@'
01820                     && pListPlace)
01821             {
01822                 // LISTPLACE_VAR
01823                 //
01824                 safe_str(pListPlace, result, &r);
01825                 s += 2;
01826             }
01827             else if (  s[1] == '$'
01828                     && pSwitch)
01829             {
01830                 // SWITCH_VAR
01831                 //
01832                 safe_str(pSwitch, result, &r);
01833                 s += 2;
01834             }
01835             else
01836             {
01837                 safe_chr(*s, result, &r);
01838                 s++;
01839             }
01840         }
01841         else
01842         {
01843             // Finish copying source string. No matches. No further
01844             // work to perform.
01845             //
01846             safe_str(s, result, &r);
01847             break;
01848         }
01849     }
01850     *r = '\0';
01851     return result;
01852 }

size_t safe_copy_buf ( const char *  src,
size_t  nLen,
char *  buff,
char **  bufp 
)

Definition at line 1963 of file stringutil.cpp.

References LBUF_SIZE, and left.

Referenced by centerjustcombo(), do_itemfuns(), do_page(), FUNCTION(), get_handler(), mux_exec(), replace_string(), replace_tokens(), safe_i64toa(), safe_ltoa(), and translate_string().

01964 {
01965     size_t left = LBUF_SIZE - (*bufc - buff) - 1;
01966     if (left < nLen)
01967     {
01968         nLen = left;
01969     }
01970     memcpy(*bufc, src, nLen);
01971     *bufc += nLen;
01972     return nLen;
01973 }

void safe_copy_str ( const char *  src,
char *  buff,
char **  bufp,
int  max 
)

Definition at line 1934 of file stringutil.cpp.

01935 {
01936     if (src == NULL) return;
01937 
01938     char *tp = *bufp;
01939     char *maxtp = buff + nSizeOfBuffer;
01940     while (tp < maxtp && *src)
01941     {
01942         *tp++ = *src++;
01943     }
01944     *bufp = tp;
01945 }

void safe_copy_str_lbuf ( const char *  src,
char *  buff,
char **  bufp 
)

Definition at line 1947 of file stringutil.cpp.

References LBUF_SIZE.

01948 {
01949     if (src == NULL)
01950     {
01951         return;
01952     }
01953 
01954     char *tp = *bufp;
01955     char *maxtp = buff + LBUF_SIZE - 1;
01956     while (tp < maxtp && *src)
01957     {
01958         *tp++ = *src++;
01959     }
01960     *bufp = tp;
01961 }

size_t safe_fill ( char *  buff,
char **  bufc,
char  chFile,
size_t  nSpaces 
)

Definition at line 1975 of file stringutil.cpp.

References LBUF_SIZE.

Referenced by centerjustcombo(), expand_tabs(), and FUNCTION().

01976 {
01977     // Check for buffer limits.
01978     //
01979     size_t nBufferAvailable = LBUF_SIZE - (*bufc - buff) - 1;
01980     if (nSpaces > nBufferAvailable)
01981     {
01982         nSpaces = nBufferAvailable;
01983     }
01984 
01985     // Fill with spaces.
01986     //
01987     memset(*bufc, chFill, nSpaces);
01988     *bufc += nSpaces;
01989     return nSpaces;
01990 }

void safe_i64toa ( INT64  val,
char *  buff,
char **  bufc 
)

Definition at line 2176 of file stringutil.cpp.

References mux_i64toa(), and safe_copy_buf().

Referenced by FUNCTION().

02177 {
02178     static char temp[22];
02179     size_t n = mux_i64toa(val, temp);
02180     safe_copy_buf(temp, n, buff, bufc);
02181 }

void safe_ltoa ( long  val,
char *  buff,
char **  bufc 
)

Definition at line 2106 of file stringutil.cpp.

References mux_ltoa(), and safe_copy_buf().

Referenced by cf_display(), do_mail_reply(), FUNCTION(), fval(), iter_value(), unparse_boolexp1(), unparse_object(), and unparse_object_numonly().

02107 {
02108     static char temp[12];
02109     size_t n = mux_ltoa(val, temp);
02110     safe_copy_buf(temp, n, buff, bufc);
02111 }

int string_compare ( const char *  ,
const char *   
)

Definition at line 1592 of file stringutil.cpp.

References statedata::bStandAlone, mudconf, mudstate, mux_isspace, mux_stricmp(), mux_tolower, and confdata::space_compress.

Referenced by badname_remove(), do_chown(), do_icmd(), do_last(), do_move(), do_name(), do_teleport_single(), eval_boolexp(), FUNCTION(), lookup_player(), match_here(), match_home(), match_list(), match_me(), and process_command().

01593 {
01594     if (  mudstate.bStandAlone
01595        || mudconf.space_compress)
01596     {
01597         while (mux_isspace(*s1))
01598         {
01599             s1++;
01600         }
01601         while (mux_isspace(*s2))
01602         {
01603             s2++;
01604         }
01605 
01606         while (  *s1 && *s2
01607               && (  (mux_tolower(*s1) == mux_tolower(*s2))
01608                  || (mux_isspace(*s1) && mux_isspace(*s2))))
01609         {
01610             if (mux_isspace(*s1) && mux_isspace(*s2))
01611             {
01612                 // skip all other spaces.
01613                 //
01614                 do
01615                 {
01616                     s1++;
01617                 } while (mux_isspace(*s1));
01618 
01619                 do
01620                 {
01621                     s2++;
01622                 } while (mux_isspace(*s2));
01623             }
01624             else
01625             {
01626                 s1++;
01627                 s2++;
01628             }
01629         }
01630         if (  *s1
01631            && *s2)
01632         {
01633             return 1;
01634         }
01635 
01636         if (mux_isspace(*s1))
01637         {
01638             while (mux_isspace(*s1))
01639             {
01640                 s1++;
01641             }
01642             return *s1;
01643         }
01644         if (mux_isspace(*s2))
01645         {
01646             while (mux_isspace(*s2))
01647             {
01648                 s2++;
01649             }
01650             return *s2;
01651         }
01652         if (  *s1
01653            || *s2)
01654         {
01655             return 1;
01656         }
01657         return 0;
01658     }
01659     else
01660     {
01661         return mux_stricmp(s1, s2);
01662     }
01663 }

const char* string_match ( const char *  ,
const char *   
)

Definition at line 1690 of file stringutil.cpp.

References mux_isalnum, and string_prefix().

Referenced by do_find(), and match_list().

01691 {
01692     if ((*sub != '\0') && (src))
01693     {
01694         while (*src)
01695         {
01696             if (string_prefix(src, sub))
01697             {
01698                 return src;
01699             }
01700 
01701             // else scan to beginning of next word
01702             //
01703             while (mux_isalnum(*src))
01704             {
01705                 src++;
01706             }
01707             while (*src && !mux_isalnum(*src))
01708             {
01709                 src++;
01710             }
01711         }
01712     }
01713     return 0;
01714 }

int string_prefix ( const char *  ,
const char *   
)

Definition at line 1665 of file stringutil.cpp.

References mux_tolower.

Referenced by atr_has_flag(), check_connect(), do_mail_debug(), dump_users(), find_connected_name(), search_perform(), search_setup(), and string_match().

01666 {
01667     int count = 0;
01668 
01669     while (*string && *prefix
01670           && (mux_tolower(*string) == mux_tolower(*prefix)))
01671     {
01672         string++, prefix++, count++;
01673     }
01674     if (*prefix == '\0')
01675     {
01676         // Matched all of prefix.
01677         //
01678         return count;
01679     }
01680     else
01681     {
01682         return 0;
01683     }
01684 }

char* StringClone ( const char *  str  ) 

Definition at line 1912 of file stringutil.cpp.

References StringCloneLen().

Referenced by add_helpfile(), badname_add(), CF_HAND(), cf_init(), do_addcommand(), do_function(), do_joinchannel(), do_setnewtitle(), dup_bool(), getboolexp1(), init_cmdtab(), load_mail_V5(), main(), MessageAddWithNumber(), Moniker(), ParseChannelLine(), s_Name(), send_mail(), CLogFile::SetBasename(), and test_atr().

01913 {
01914     return StringCloneLen(str, strlen(str));
01915 }

char* StringCloneLen ( const char *  str,
size_t  nStr 
)

Definition at line 1900 of file stringutil.cpp.

References ISOUTOFMEMORY, and MEMALLOC.

Referenced by atr_add_raw_LEN(), CF_HAND(), do_malias_create(), do_malias_desc(), do_malias_rename(), flag_rename(), helpindex_read(), load_comsystem(), malias_read(), Moniker(), Name(), PureName(), and StringClone().

01901 {
01902     char *buff = (char *)MEMALLOC(nStr+1);
01903     ISOUTOFMEMORY(buff);
01904     memcpy(buff, str, nStr);
01905     buff[nStr] = '\0';
01906     return buff;
01907 }

char* strip_accents ( const char *  szString,
size_t *  pnString = 0 
)

Definition at line 618 of file stringutil.cpp.

References LBUF_SIZE, and mux_StripAccents.

Referenced by FUNCTION(), Moniker(), and queue_string().

00619 {
00620     static char Buffer[LBUF_SIZE];
00621     char *pBuffer = Buffer;
00622 
00623     const char *pString = szString;
00624     if (pString)
00625     {
00626         while (*pString)
00627         {
00628             *pBuffer = mux_StripAccents(*pString);
00629             pBuffer++;
00630             pString++;
00631         }
00632     }
00633     if (pnString)
00634     {
00635         *pnString = pBuffer - Buffer;
00636     }
00637     *pBuffer = '\0';
00638     return Buffer;
00639 }

char* strip_ansi ( const char *  szString,
size_t *  pnString = 0 
)

Definition at line 570 of file stringutil.cpp.

References ANSI_lex(), LBUF_SIZE, and TOKEN_TEXT_ANSI.

Referenced by atr_match(), CF_HAND(), crypt_code(), decompile_flags(), do_addcommand(), do_channelwho(), do_createchannel(), do_decomp(), do_log(), FUNCTION(), GenCode(), log_name(), log_text(), MakeCanonicalExitName(), MakeCanonicalObjectName(), Moniker(), process_sex(), PureName(), and queue_string().

00571 {
00572     static char Buffer[LBUF_SIZE];
00573     char *pBuffer = Buffer;
00574 
00575     const char *pString = szString;
00576     if (!pString)
00577     {
00578         if (pnString)
00579         {
00580             *pnString = 0;
00581         }
00582         *pBuffer = '\0';
00583         return Buffer;
00584     }
00585     size_t nString = strlen(szString);
00586 
00587     while (nString)
00588     {
00589         int nTokenLength0;
00590         int nTokenLength1;
00591         int iType = ANSI_lex(nString, pString, &nTokenLength0, &nTokenLength1);
00592 
00593         if (iType == TOKEN_TEXT_ANSI)
00594         {
00595             memcpy(pBuffer, pString, nTokenLength0);
00596             pBuffer += nTokenLength0;
00597 
00598             int nSkipLength = nTokenLength0 + nTokenLength1;
00599             nString -= nSkipLength;
00600             pString += nSkipLength;
00601         }
00602         else
00603         {
00604             // TOKEN_ANSI
00605             //
00606             nString -= nTokenLength0;
00607             pString += nTokenLength0;
00608         }
00609     }
00610     if (pnString)
00611     {
00612         *pnString = pBuffer - Buffer;
00613     }
00614     *pBuffer = '\0';
00615     return Buffer;
00616 }

char* translate_string ( const char *  ,
bool   
)

Definition at line 1397 of file stringutil.cpp.

References acsRestingStates, ANSI_ENDGOAL_NOBLEED, ANSI_lex(), ANSI_Parse_m(), ANSI_TransitionColorEscape(), LBUF_SIZE, MU_Substitutes, safe_chr, safe_copy_buf(), safe_str, and TOKEN_TEXT_ANSI.

Referenced by do_decomp(), and FUNCTION().

01398 {
01399     static char szTranslatedString[LBUF_SIZE];
01400     char *pTranslatedString = szTranslatedString;
01401 
01402     const char *pString = szString;
01403     if (!szString)
01404     {
01405         *pTranslatedString = '\0';
01406         return szTranslatedString;
01407     }
01408     size_t nString = strlen(szString);
01409 
01410     ANSI_ColorState acsCurrent;
01411     ANSI_ColorState acsPrevious;
01412     acsCurrent = acsRestingStates[ANSI_ENDGOAL_NOBLEED];
01413     acsPrevious = acsCurrent;
01414     bool bSawNormal = false;
01415     const unsigned char *MU_EscapeChar = (bConvert)? MU_EscapeConvert : MU_EscapeNoConvert;
01416     while (nString)
01417     {
01418         int nTokenLength0;
01419         int nTokenLength1;
01420         int iType = ANSI_lex(nString, pString, &nTokenLength0, &nTokenLength1);
01421 
01422         if (iType == TOKEN_TEXT_ANSI)
01423         {
01424             // Process TEXT
01425             //
01426             int nTransition = 0;
01427             if (bConvert)
01428             {
01429                 char *pTransition = ANSI_TransitionColorEscape(&acsPrevious, &acsCurrent, &nTransition);
01430                 safe_str(pTransition, szTranslatedString, &pTranslatedString);
01431             }
01432             nString -= nTokenLength0;
01433 
01434             while (nTokenLength0--)
01435             {
01436                 unsigned char ch = *pString++;
01437                 unsigned char code = MU_EscapeChar[ch];
01438                 if (code)
01439                 {
01440                     // The following can look one ahead off the end of the
01441                     // current token (and even at the '\0' at the end of the
01442                     // string, but this is acceptable. An extra look will
01443                     // always see either ESC from the next ANSI sequence,
01444                     // or the '\0' on the end of the string. No harm done.
01445                     //
01446                     if (ch == ' ' && pString[0] == ' ')
01447                     {
01448                         code = 5;
01449                     }
01450                     safe_copy_buf(MU_Substitutes[code].p,
01451                         MU_Substitutes[code].len, szTranslatedString,
01452                         &pTranslatedString);
01453                 }
01454                 else
01455                 {
01456                     safe_chr(ch, szTranslatedString, &pTranslatedString);
01457                 }
01458             }
01459             acsPrevious = acsCurrent;
01460 
01461             if (nTokenLength1)
01462             {
01463                 // Process ANSI
01464                 //
01465                 ANSI_Parse_m(&acsCurrent, nTokenLength1, pString, &bSawNormal);
01466                 pString += nTokenLength1;
01467                 nString -= nTokenLength1;
01468             }
01469         }
01470         else
01471         {
01472             // Process ANSI
01473             //
01474             ANSI_Parse_m(&acsCurrent, nTokenLength0, pString, &bSawNormal);
01475             nString -= nTokenLength0;
01476             pString += nTokenLength0;
01477         }
01478     }
01479     *pTranslatedString = '\0';
01480     return szTranslatedString;
01481 }

char* trim_spaces ( char *   ) 

Definition at line 1524 of file stringutil.cpp.

References alloc_lbuf, and mux_isspace.

Referenced by create_player(), do_alias(), and do_name().

01525 {
01526     char *buffer = alloc_lbuf("trim_spaces");
01527     char *p = string;
01528     char *q = buffer;
01529 
01530     if (p)
01531     {
01532         // Remove initial spaces.
01533         //
01534         while (mux_isspace(*p))
01535         {
01536             p++;
01537         }
01538 
01539         while (*p)
01540         {
01541             // Copy non-space characters.
01542             //
01543             while (*p && !mux_isspace(*p))
01544             {
01545                 *q++ = *p++;
01546             }
01547 
01548             // Compress spaces.
01549             //
01550             while (mux_isspace(*p))
01551             {
01552                 p++;
01553             }
01554 
01555             // Leave one space.
01556             //
01557             if (*p)
01558             {
01559                 *q++ = ' ';
01560             }
01561         }
01562     }
01563 
01564     // Terminate string.
01565     //
01566     *q = '\0';
01567     return buffer;
01568 }


Variable Documentation

bool mux_AttrNameInitialSet[256]

Definition at line 231 of file stringutil.cpp.

bool mux_AttrNameSet[256]

Definition at line 254 of file stringutil.cpp.

const unsigned char mux_hex2dec[256]

Definition at line 404 of file stringutil.cpp.

const bool mux_isalnum[256]

Definition at line 132 of file stringutil.cpp.

const bool mux_isalpha[256]

Definition at line 109 of file stringutil.cpp.

const bool mux_isazAZ[256]

Definition at line 86 of file stringutil.cpp.

const bool mux_isdigit[256]

Definition at line 40 of file stringutil.cpp.

const bool mux_isescape[256]

Definition at line 358 of file stringutil.cpp.

const bool mux_ishex[256]

Definition at line 63 of file stringutil.cpp.

const bool mux_islower[256]

Definition at line 178 of file stringutil.cpp.

const bool mux_isprint[256]

Definition at line 17 of file stringutil.cpp.

const bool mux_issecure[256]

Definition at line 332 of file stringutil.cpp.

const bool mux_isspace[256]

Definition at line 201 of file stringutil.cpp.

const bool mux_isupper[256]

Definition at line 155 of file stringutil.cpp.

const bool mux_ObjectNameSet[256]

Definition at line 280 of file stringutil.cpp.

bool mux_PlayerNameSet[256]

Definition at line 306 of file stringutil.cpp.

const unsigned char mux_StripAccents[256]

Definition at line 472 of file stringutil.cpp.

const unsigned char mux_tolower[256]

Definition at line 449 of file stringutil.cpp.

const unsigned char mux_toupper[256]

Definition at line 426 of file stringutil.cpp.


Generated on Mon May 28 04:40:22 2007 for MUX by  doxygen 1.4.7