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 ANSI_ENDGOAL_LEAK 2 |
| #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 | ( | x | ) | (mux_AttrNameInitialSet[(unsigned char)(x)]) |
Definition at line 45 of file stringutil.h.
Referenced by FUNCTION(), getboolexp1(), init_attrtab(), and MakeCanonicalAttributeName().
| #define mux_AttrNameSet | ( | x | ) | (mux_AttrNameSet[(unsigned char)(x)]) |
Definition at line 46 of file stringutil.h.
Referenced by init_attrtab(), and MakeCanonicalAttributeName().
| #define mux_hex2dec | ( | x | ) | (mux_hex2dec[(unsigned char)(x)]) |
Definition at line 41 of file stringutil.h.
| #define mux_isalnum | ( | x | ) | (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 | ( | x | ) | (mux_isalpha[(unsigned char)(x)]) |
Definition at line 36 of file stringutil.h.
Referenced by FUNCTION(), main(), MakeCanonicalMailAlias(), and ParseThreeLetters().
| #define mux_isazAZ | ( | x | ) | (mux_isazAZ[(unsigned char)(x)]) |
| #define mux_isdigit | ( | x | ) | (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 | ( | x | ) | (mux_isescape[(unsigned char)(x)]) |
Definition at line 34 of file stringutil.h.
| #define mux_islower | ( | x | ) | (mux_islower[(unsigned char)(x)]) |
| #define mux_isprint | ( | x | ) | (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 | ( | x | ) | (mux_issecure[(unsigned char)(x)]) |
| #define mux_isspace | ( | x | ) | (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 | ( | x | ) | (mux_isupper[(unsigned char)(x)]) |
| #define mux_ObjectNameSet | ( | x | ) | (mux_ObjectNameSet[(unsigned char)(x)]) |
| #define mux_PlayerNameSet | ( | x | ) | (mux_PlayerNameSet[(unsigned char)(x)]) |
| #define mux_StripAccents | ( | x | ) | (mux_StripAccents[(unsigned char)(x)]) |
| #define mux_tolower | ( | x | ) | (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 | ( | x | ) | (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 |
| #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().
| 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