CLI  2.9
constraints.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2006-2018, Alexis Royer, http://alexis.royer.free.fr/CLI
3 
4  All rights reserved.
5 
6  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7 
8  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
10  and/or other materials provided with the distribution.
11  * Neither the name of the CLI library project nor the names of its contributors may be used to endorse or promote products derived from this software
12  without specific prior written permission.
13 
14  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 
31 
32 #ifndef _CLI_CONSTRAINTS_H_
33 #define _CLI_CONSTRAINTS_H_
34 
35 #include "cli/namespace.h"
36 
37 
39 
40  // General.
41 
42 
43  #ifndef CLI_MAX_RESOURCE_LENGTH
44  static const unsigned int MAX_RESOURCE_LENGTH = 256;
45  #else
46  static const unsigned int MAX_RESOURCE_LENGTH = CLI_MAX_RESOURCE_LENGTH;
47  #endif
48 
50  #ifndef CLI_MAX_FILE_PATH_LENGTH
51  static const unsigned int MAX_FILE_PATH_LENGTH = 256;
52  #else
53  static const unsigned int MAX_FILE_PATH_LENGTH = CLI_MAX_FILE_PATH_LENGTH;
54  #endif
55 
56  // CLI structures.
57 
59  #ifndef CLI_MAX_MENU_PER_CLI
60  static const unsigned int MAX_MENU_PER_CLI = 50;
61  #else
62  static const unsigned int MAX_MENU_PER_CLI = CLI_MAX_MENU_PER_CLI;
63  #endif
64 
66  #ifndef CLI_MAX_WORDS_PER_NODE
67  static const unsigned int MAX_WORDS_PER_NODE = 256;
68  #else
69  static const unsigned int MAX_WORDS_PER_NODE = CLI_MAX_WORDS_PER_NODE;
70  #endif
71 
73  #ifndef CLI_MAX_COMMENT_PATTERNS_PER_CLI
74  static const unsigned int MAX_COMMENT_PATTERNS_PER_CLI = 256;
75  #else
76  static const unsigned int MAX_COMMENT_PATTERNS_PER_CLI = CLI_MAX_COMMENT_PATTERNS_PER_CLI;
77  #endif
78 
79  // Command lines.
80 
82  #ifndef CLI_MAX_CMD_LINE_LENGTH
83  static const unsigned int MAX_CMD_LINE_LENGTH = 2048;
84  #else
85  static const unsigned int MAX_CMD_LINE_LENGTH = CLI_MAX_CMD_LINE_LENGTH;
86  #endif
87 
89  #ifndef CLI_MAX_CMD_LINE_WORD_COUNT
90  static const unsigned int MAX_CMD_LINE_WORD_COUNT = 256;
91  #else
92  static const unsigned int MAX_CMD_LINE_WORD_COUNT = CLI_MAX_CMD_LINE_WORD_COUNT;
93  #endif
94 
96  #ifndef CLI_MAX_WORD_LENGTH
97  static const unsigned int MAX_WORD_LENGTH = 256;
98  #else
99  static const unsigned int MAX_WORD_LENGTH = CLI_MAX_WORD_LENGTH;
100  #endif
101 
102  // Traces / debug.
103 
105  #ifndef CLI_MAX_TRACE_DEVICE_COUNT
106  static const unsigned int MAX_TRACE_DEVICE_COUNT = 128;
107  #else
108  static const unsigned int MAX_TRACE_DEVICE_COUNT = CLI_MAX_TRACE_DEVICE_COUNT;
109  #endif
110 
112  #ifndef CLI_MAX_TRACE_CLASS_COUNT
113  static const unsigned int MAX_TRACE_CLASS_COUNT = 1024;
114  #else
115  static const unsigned int MAX_TRACE_CLASS_COUNT = CLI_MAX_TRACE_CLASS_COUNT;
116  #endif
117 
119  #ifndef CLI_MAX_TRACE_CLASS_NAME_LENGTH
120  static const unsigned int MAX_TRACE_CLASS_NAME_LENGTH = MAX_WORD_LENGTH;
121  #else
122  static const unsigned int MAX_TRACE_CLASS_NAME_LENGTH = CLI_MAX_TRACE_CLASS_NAME_LENGTH;
123  #endif
124 
126  #ifndef CLI_MAX_DEVICE_NAME_LENGTH
127  static const unsigned int MAX_DEVICE_NAME_LENGTH = 256;
128  #else
129  static const unsigned int MAX_DEVICE_NAME_LENGTH = CLI_MAX_DEVICE_NAME_LENGTH;
130  #endif
131 
132  // Misc
133 
135  #ifndef CLI_MAX_CLI_REGISTRY_COUNT
136  static const unsigned int MAX_CLI_REGISTRY_COUNT = 10;
137  #else
138  static const unsigned int MAX_CLI_REGISTRY_COUNT = MAX_CLI_CLI_REGISTRY_COUNT;
139  #endif
140 
142  #ifndef CLI_MAX_IO_MUX_INPUTS
143  static const unsigned int MAX_IO_MUX_INPUTS = 100;
144  #else
145  static const unsigned int MAX_IO_MUX_INPUTS = CLI_MAX_IO_MUX_INPUTS;
146  #endif
147 
149  #ifndef CLI_MAX_EXECUTION_CONTEXTS
150  static const unsigned int MAX_EXECUTION_CONTEXTS = 10;
151  #else
152  static const unsigned int MAX_EXECUTION_CONTEXTS = CLI_MAX_EXECUTION_CONTEXTS;
153  #endif
154 
156 
157 #endif // _CLI_CONSTRAINTS_H_
#define CLI_MAX_CMD_LINE_WORD_COUNT
Maximum number of words per command line.
Definition: preprocessing.h:96
#define CLI_MAX_FILE_PATH_LENGTH
Maximum file path length.
Main namespace of the CLI library.
#define CLI_MAX_DEVICE_NAME_LENGTH
Maximum device name length.
#define CLI_MAX_RESOURCE_LENGTH
Maximum resource string length.
#define CLI_MAX_TRACE_CLASS_NAME_LENGTH
Maximum length of trace class names.
#define CLI_NS_END(__ns)
End a namespace definition.
Definition: namespace.h:45
#define CLI_MAX_CMD_LINE_LENGTH
Maximum length of command lines.
Definition: preprocessing.h:91
#define CLI_MAX_TRACE_CLASS_COUNT
Maximum number of trace classes managed by the trace system.
Namespace management.
#define CLI_MAX_WORDS_PER_NODE
Maximum number of words per syntax node.
#define CLI_NS_BEGIN(__ns)
Begin a namespace definition.
Definition: namespace.h:38
#define CLI_MAX_MENU_PER_CLI
Maximum number of menus per Cli object.
Definition: preprocessing.h:86
#define CLI_MAX_WORD_LENGTH
Maximum length of each word.
#define CLI_MAX_IO_MUX_INPUTS
Maximum input devices per IO Multiplexer device.