|
Lhogho
0.0.027
|
Functions | |
| RESULT | name_parser (const TCHAR *parameter_name, const TCHAR *parameter_optipons, test_case_info *test_case_params) |
| Parse name pameter. | |
| RESULT | cmd_parser (const TCHAR *parameter_name, const TCHAR *parameter_optipons, test_case_info *test_case_params) |
| Parse commands for compiler. | |
| RESULT | extract_string (const TCHAR *parameter_optipons, TCHAR **extracted_value) |
| Extracts a string to space form parameter buffer. | |
| RESULT name_parser | ( | const TCHAR * | parameter_name, |
| const TCHAR * | parameter_optipons, | ||
| test_case_info * | test_case_params | ||
| ) |
| parameter_name | name of the parameter to parse |
| parameter_optipons | the text passed for parsing |
| test_case_params | palce where extracted name will be stored |
Exract the name of the test case.
{
/* if this is not parameter that can be handled here */
if (m_strcmp(parameter_name, TEXT("name")))
{
return ERR_INVALID_ARG;
}
return extract_string(parameter_optipons, &test_case_params->test_name);
}
| RESULT cmd_parser | ( | const TCHAR * | parameter_name, |
| const TCHAR * | parameter_optipons, | ||
| test_case_info * | test_case_params | ||
| ) |
| parameter_name | name of the parameter to parse |
| parameter_optipons | the text passed for parsing |
| test_case_params | palce where extracted comand options will be stored |
Exract the name of the test case.
{
/* if this is not parameter that can be handled here */
if (m_strcmp(parameter_name, TEXT("cmd")))
{
return ERR_INVALID_ARG;
}
return extract_string(parameter_optipons, &test_case_params->command_line_param);
}
| RESULT extract_string | ( | const TCHAR * | parameter_optipons, |
| TCHAR ** | extracted_value | ||
| ) |
| parameter_optipons | input string |
| extracted_value | result value. Memory is allocated for it |
Exract the the data to the first space. If space is between " " it is ecraned. Allocate memory for result string
{
UINT32 start = 0;
UINT32 end = 0;
BOOL escape_spaces = FALSE;
while (parameter_optipons[start] && m_isspace(parameter_optipons[start]))
++start;
if (parameter_optipons[start] == SPACE_ESC_SYMBOL)
{
++start;
escape_spaces = TRUE;
}
end = start;
while (parameter_optipons[end] &&
!((escape_spaces && parameter_optipons[end] == SPACE_ESC_SYMBOL) ||
(!escape_spaces && m_isspace(parameter_optipons[end]))))
++end;
return m_strndup(extracted_value, parameter_optipons + start, end - start);
}