Пример #1
0
/// Function name  : findNextNonEscapedCharacters
// Description     : Search for the next character occurence of any character in a specified string that is
//                     not preceeded by a backslash.
// 
// CONST TCHAR*  szString      : [in] String to search
// CONST TCHAR*  szCharacters  : [in] String containing the characters to search for
// 
// Return Value   : Position if found, otherwise NULL
// 
CONST TCHAR*  findNextNonEscapedCharacters(CONST TCHAR*  szString, CONST TCHAR*  szCharacters)
{
   CONST TCHAR*  szOutput;

   // Search through all the matching characters in the string
   for (szOutput = StrPBrk(szString, szCharacters); szOutput; szOutput = StrPBrk(szOutput+1, szCharacters))
   {
      // [CHECK] Is first character a match?  Is a subsequent character preceeded by a backslash?
      if (szOutput == szString OR szOutput[-1] != '\\')
         /// [FOUND] Return current position
         return szOutput;  
   }

   /// [NOT FOUND] Return NULL
   return NULL;
}
Пример #2
0
/// Function name  : verifyScriptFileArgumentName
// Description     : Verifies a ScriptFile argument name is unique and contains no unsupported symbols
// 
// CONST SCRIPT_FILE*  pScriptFile      : [in]           ScriptFile containing the Arguments to check
// CONST TCHAR*        szArgumentName   : [in]           Name to verify
// CONST ARGUMENT*     pExcludeArgument : [in][optional] ScriptFile Argument to exclude from the check (Used when updating the name of an existing argument)
// 
// Return Value   : TRUE if name is unique and contains no unsupported symbols, otherwise FALSE
// 
BearScriptAPI 
BOOL  verifyScriptFileArgumentName(CONST SCRIPT_FILE*  pScriptFile, CONST TCHAR*  szArgumentName, CONST ARGUMENT*  pExcludeArgument)
{
   ARGUMENT*  pArgument;      // ScriptFile ARGUMENT iterator
   BOOL       bResult;        // Verification result

   // [CHECK] Ensure name is not empty or has perculiar symbols
   bResult = lstrlen(szArgumentName) AND !StrPBrk(szArgumentName, TEXT("|!`£$%^&*()[]{}-_=+:;@'#~<>,/? \"\\"));

   /// Iterate through ScriptFile's ARGUMENTs
   for (UINT  iArgument = 0; bResult AND findArgumentInScriptFileByIndex(pScriptFile, iArgument, pArgument); iArgument++)
   {
      // [CHECK] Exclude the input Argument (if any) from checking
      if (pArgument == pExcludeArgument)
         continue;

      // [CHECK] Ensure name is unique
      bResult = !utilCompareStringVariables(szArgumentName, pArgument->szName);
   }

   // Return result
   return bResult;
}
Пример #3
0
char *StrTok_us( char *str, const char *delim )
{
	static char *last=NULL;
	char* found;
	
	if( str == NULL )
	{
		str = last;
	}
	
	found = StrPBrk( str, delim );

	if( found == NULL )
	{
		last = NULL;
		return NULL;
	}
	else
	{
		last = found + 1;
		*found = STREND;
		return str;
	}
}