Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
param_parsers.c File Reference

Go to the source code of this file.

Functions

RESULT name_parser (const TCHAR *parameter_name, const TCHAR *parameter_optipons, test_case_info *test_case_params)
 Parse name pameter. More...
 
RESULT cmd_parser (const TCHAR *parameter_name, const TCHAR *parameter_optipons, test_case_info *test_case_params)
 Parse commands for compiler. More...
 
RESULT extract_string (const TCHAR *parameter_optipons, TCHAR **extracted_value)
 Extracts a string to space form parameter buffer. More...
 

Function Documentation

RESULT name_parser ( const TCHAR parameter_name,
const TCHAR parameter_optipons,
test_case_info test_case_params 
)
Parameters
parameter_namename of the parameter to parse
parameter_optiponsthe text passed for parsing
test_case_paramspalce where extracted name will be stored
Returns
RESULT code (see error.h)

Exract the name of the test case.

Definition at line 40 of file param_parsers.c.

43 {
44  /* if this is not parameter that can be handled here */
45  if (m_strcmp(parameter_name, TEXT("name")))
46  {
47  return ERR_INVALID_ARG;
48  }
49 
50  return extract_string(parameter_optipons, &test_case_params->test_name);
51 }
RESULT cmd_parser ( const TCHAR parameter_name,
const TCHAR parameter_optipons,
test_case_info test_case_params 
)
Parameters
parameter_namename of the parameter to parse
parameter_optiponsthe text passed for parsing
test_case_paramspalce where extracted comand options will be stored
Returns
RESULT code (see error.h)

Exract the name of the test case.

Definition at line 62 of file param_parsers.c.

65 {
66  /* if this is not parameter that can be handled here */
67  if (m_strcmp(parameter_name, TEXT("cmd")))
68  {
69  return ERR_INVALID_ARG;
70  }
71 
72  return extract_string(parameter_optipons, &test_case_params->command_line_param);
73 }
RESULT extract_string ( const TCHAR parameter_optipons,
TCHAR **  extracted_value 
)
Parameters
parameter_optiponsinput string
extracted_valueresult value. Memory is allocated for it
Returns
RESULT code (see error.h)

Exract the the data to the first space. If space is between " " it is ecraned. Allocate memory for result string

Definition at line 91 of file param_parsers.c.

92 {
93  UINT32 start = 0;
94  UINT32 end = 0;
95  BOOL escape_spaces = FALSE;
96 
97  while (parameter_optipons[start] && m_isspace(parameter_optipons[start]))
98  ++start;
99 
100  if (parameter_optipons[start] == SPACE_ESC_SYMBOL)
101  {
102  ++start;
103  escape_spaces = TRUE;
104  }
105  end = start;
106 
107  while (parameter_optipons[end] &&
108  !((escape_spaces && parameter_optipons[end] == SPACE_ESC_SYMBOL) ||
109  (!escape_spaces && m_isspace(parameter_optipons[end]))))
110  ++end;
111 
112  return m_strndup(extracted_value, parameter_optipons + start, end - start);
113 }

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013