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

Go to the source code of this file.

Macros

#define __PARAM_PARSERS_H_931B1AE_9DFE_4E4C_8DCE_A9F2C60DD39D_INCLUDED
 

Macro definition for parser registers

These macro definitions automatically generates enum entries and prototypes of function parsing test arguments. Also generate function that register function callbacks

#define MAKE_ONE_ENUM_ENTRY(entry_name)   entry_name,
 
#define MAKE_PARSERS_ENUM(List)
 
#define MAKE_ONE_PROTOTYPE(param_name)
 
#define MAKE_PROTOTYPES(List)   List(MAKE_ONE_PROTOTYPE)
 
#define MAKE_ONE_PARSER_REGISTRATION(param_name)
 
#define IMPLEMENT_PARSERS_REGISTER_FUNCTION(List)
 
#define PARSERS_LIST(_)
 
typedef enum REGISTERED_PARSERS_TAG RegisteredParsers
 
parse_config_attribute_function g_parsers [PARSERS_COUNT]
 
 MAKE_PROTOTYPES (PARSERS_LIST)
 
 MAKE_PARSERS_ENUM (PARSERS_LIST)
 

Basic functions prototypes

RESULT extract_string (const TCHAR *parameter_optipons, TCHAR **extracted_value)
 Extracts a string to space form parameter buffer. More...
 

Macro Definition Documentation

#define __PARAM_PARSERS_H_931B1AE_9DFE_4E4C_8DCE_A9F2C60DD39D_INCLUDED

Definition at line 21 of file param_parsers.h.

#define MAKE_ONE_ENUM_ENTRY (   entry_name)    entry_name,

Definition at line 33 of file param_parsers.h.

#define MAKE_PARSERS_ENUM (   List)
Value:
enum REGISTERED_PARSERS_TAG \
{ \
PARSERS_COUNT \
};

Definition at line 34 of file param_parsers.h.

#define MAKE_ONE_PROTOTYPE (   param_name)
Value:
extern RESULT param_name##_parser(const TCHAR * parameter_name, \
const TCHAR * parameter_optipons, \
test_case_info * test_case_params);

Definition at line 43 of file param_parsers.h.

#define MAKE_PROTOTYPES (   List)    List(MAKE_ONE_PROTOTYPE)

Definition at line 47 of file param_parsers.h.

#define MAKE_ONE_PARSER_REGISTRATION (   param_name)
Value:
{ \
g_parsers[ind++] = param_name##_parser; \
}

Definition at line 51 of file param_parsers.h.

#define IMPLEMENT_PARSERS_REGISTER_FUNCTION (   List)
Value:
RESULT init_param_parsers() \
{ \
UINT32 ind = 0; \
return SUCCESS_FULL; \
}

Definition at line 56 of file param_parsers.h.

#define PARSERS_LIST (   _)
Value:
_(name) \
_(cmd)

Definition at line 73 of file param_parsers.h.

Typedef Documentation

typedef enum REGISTERED_PARSERS_TAG RegisteredParsers

Definition at line 40 of file param_parsers.h.

Function Documentation

MAKE_PROTOTYPES ( PARSERS_LIST  )
MAKE_PARSERS_ENUM ( PARSERS_LIST  )
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 }

Variable Documentation

parse_config_attribute_function g_parsers[PARSERS_COUNT]

Definition at line 85 of file param_parsers.h.


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