Lines Matching full:name
32 * name: the symbol name ('MBEDTLS_xxx').
35 * active: True if name is defined, False if a #define for name is
37 * section: the name of the section that contains this symbol.
40 def __init__(self, active, name, value='', section=None): argument
42 self.name = name
54 * `name in config` is `True` if the symbol `name` is active, `False`
55 otherwise (whether `name` is inactive or not known).
56 * `config[name]` is the value of the macro `name`. If `name` is inactive,
57 raise `KeyError` (even if `name` is known).
58 * `config[name] = value` sets the value associated to `name`. `name`
60 name to become set.
66 def __contains__(self, name): argument
72 return name in self.settings and self.settings[name].active
76 return all(self.__contains__(name) for name in names)
80 return any(self.__contains__(name) for name in names)
82 def known(self, name): argument
83 """True if a #define for name is present, whether it's commented out or not."""
84 return name in self.settings
86 def __getitem__(self, name): argument
87 """Get the value of name, i.e. what the preprocessor symbol expands to.
89 If name is not known, raise KeyError. name does not need to be active.
91 return self.settings[name].value
93 def get(self, name, default=None): argument
94 """Get the value of name. If name is inactive (not set), return default.
96 If a #define for name is present and not commented out, return
99 If a #define for name is present but commented out, return default.
101 if name in self.settings:
102 return self.settings[name].value
106 def __setitem__(self, name, value): argument
107 """If name is known, set its value.
109 If name is not known, raise KeyError.
111 self.settings[name].value = value
113 def set(self, name, value=None): argument
114 """Set name to the given value and make it active.
116 If value is None and name is already known, don't change its value.
117 If value is None and name is not known, set its value to the empty
120 if name in self.settings:
122 self.settings[name].value = value
123 self.settings[name].active = True
125 self.settings[name] = Setting(True, name, value=value)
127 def unset(self, name): argument
128 """Make name unset (inactive).
130 name remains known if it was known before.
132 if name not in self.settings:
134 self.settings[name].active = False
140 `adapter(name, active, section)` for each setting, where `active` is
141 `True` if `name` is set and `False` if `name` is known but unset,
142 and `section` is the name of the section containing `name`. If
143 `adapter` returns `True`, then set `name` (i.e. make it active),
144 otherwise unset `name` (i.e. make it known but inactive).
147 setting.active = adapter(setting.name, setting.active,
203 def is_seamless_alt(name): argument
215 if name == 'MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT':
218 return name.startswith('MBEDTLS_PLATFORM_')
220 def include_in_full(name): argument
222 if name in EXCLUDE_FROM_FULL:
224 if name.endswith('_ALT'):
225 return is_seamless_alt(name)
228 def full_adapter(name, active, section): argument
232 return include_in_full(name)
258 def keep_in_baremetal(name): argument
260 if name in EXCLUDE_FROM_BAREMETAL:
264 def baremetal_adapter(name, active, section): argument
268 if name == 'MBEDTLS_NO_PLATFORM_ENTROPY':
271 return include_in_full(name) and keep_in_baremetal(name)
273 def include_in_crypto(name): argument
275 if name.startswith('MBEDTLS_X509_') or \
276 name.startswith('MBEDTLS_SSL_') or \
277 name.startswith('MBEDTLS_KEY_EXCHANGE_'):
279 if name in [
291 ``crypto_adapter(adapter)(name, active, section)`` is like
292 ``adapter(name, active, section)``, but unsets all X.509 and TLS symbols.
294 def continuation(name, active, section): argument
295 if not include_in_crypto(name):
299 return adapter(name, active, section)
310 ``no_deprecated_adapter(adapter)(name, active, section)`` is like
311 ``adapter(name, active, section)``, but unsets all deprecated symbols
314 def continuation(name, active, section): argument
315 if name == 'MBEDTLS_DEPRECATED_REMOVED':
317 if name in DEPRECATED:
321 return adapter(name, active, section)
356 def set(self, name, value=None): argument
357 if name not in self.settings:
358 self.templates.append((name, '', '#define ' + name + ' '))
359 super().set(name, value)
364 r'(?P<name>\w+)' +
368 _section_line_regexp = (r'\s*/?\*+\s*[\\@]name\s+SECTION:\s*' +
383 name = m.group('name')
385 template = (name,
387 m.group('define') + name +
389 self.settings[name] = Setting(active, name, value,
393 def _format_template(self, name, indent, middle): argument
396 The line has the form "<indent>#define <name> <value>"
397 where <middle> is "#define <name> ".
399 setting = self.settings[name]
403 # Normally the whitespace to separte the symbol name from the
478 def add_adapter(name, function, description): argument
479 subparser = subparsers.add_parser(name, help=description)