Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
param_parsers.h
Go to the documentation of this file.
1 //===================================================
2 // Project:TestSystem Author: Peter Armianov
3 //===================================================
4 //
5 // PARAM_PARSERS.H
6 //
7 // Defines some macro definitions for automatic
8 // registration of command parameter functions
9 // prototypes of this functions and enum entries
10 //
11 // Revision history:
12 // 2007-05-14 - file created
13 // 2007-07-12 - additional comments in Doxygen style
14 //===================================================
15 
16 #if defined(_MSC_VER)
17 # pragma once
18 #endif
19 
20 #ifndef __PARAM_PARSERS_H_931B1AE_9DFE_4E4C_8DCE_A9F2C60DD39D_INCLUDED
21 #define __PARAM_PARSERS_H_931B1AE_9DFE_4E4C_8DCE_A9F2C60DD39D_INCLUDED
22 
23 //----------------------------------------------------
29 //----------------------------------------------------
31 
32 /* Macros that generate enum for parsers */
33 #define MAKE_ONE_ENUM_ENTRY(entry_name) entry_name,
34 #define MAKE_PARSERS_ENUM(List) \
35  enum REGISTERED_PARSERS_TAG \
36  { \
37  List(MAKE_ONE_ENUM_ENTRY) \
38  PARSERS_COUNT \
39  };
40 typedef enum REGISTERED_PARSERS_TAG RegisteredParsers;
41 
42 /* Macros that generate prototypes for parser functions */
43 #define MAKE_ONE_PROTOTYPE(param_name) \
44  extern RESULT param_name##_parser(const TCHAR * parameter_name, \
45  const TCHAR * parameter_optipons, \
46  test_case_info * test_case_params);
47 #define MAKE_PROTOTYPES(List) List(MAKE_ONE_PROTOTYPE)
48 
49 
50 /* Macros that generate code thar register parser functions */
51 #define MAKE_ONE_PARSER_REGISTRATION(param_name) \
52  { \
53  g_parsers[ind++] = param_name##_parser; \
54  }
55 
56 #define IMPLEMENT_PARSERS_REGISTER_FUNCTION(List) \
57  RESULT init_param_parsers() \
58  { \
59  UINT32 ind = 0; \
60  List(MAKE_ONE_PARSER_REGISTRATION) \
61  return SUCCESS_FULL; \
62  }
63 
64 
65 /*
66 * Adding new parameter parser must start with adding line for it here.
67 * _(parser_name)
68 * From this line automatically will be generated for it:
69 * enum entry,
70 * prototype of parser function
71 * code that register the function in the global array
72 */
73 #define PARSERS_LIST(_) \
74  _(name) \
75  _(cmd)
76 
77 
78 /* Generate parser function prototypes */
80 
81 /* Generate enum with all parsers and calculate their count */
83 
84 /* Global array with pointers to all parser functions */
87 
88 //----------------------------------------------------
90 //----------------------------------------------------
92 RESULT extract_string(const TCHAR * parameter_optipons, TCHAR ** extracted_value);
94 
95 #endif /* __PARAM_PARSERS_H_931B1AE_9DFE_4E4C_8DCE_A9F2C60DD39D_INCLUDED */
96 

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