diff options
author | Shaheed Haque <srhaque@theiet.org> | 2017-01-31 00:47:08 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2017-01-31 00:57:29 +0000 |
commit | 88662e587871c4b162ac097fccb799f8a1b0dfd3 (patch) | |
tree | 609a7f268eb2c4f8b071be04d3a0018ce8b42da4 /find-modules/rules_engine.py | |
parent | 2cbc7897ddec6369c83a04483d956e456114cf13 (diff) | |
download | extra-cmake-modules-88662e587871c4b162ac097fccb799f8a1b0dfd3.tar.gz extra-cmake-modules-88662e587871c4b162ac097fccb799f8a1b0dfd3.tar.bz2 |
Update some documenation for the ModuleCodeDb
Diffstat (limited to 'find-modules/rules_engine.py')
-rwxr-xr-x | find-modules/rules_engine.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/find-modules/rules_engine.py b/find-modules/rules_engine.py index 65525527..d1eacf7e 100755 --- a/find-modules/rules_engine.py +++ b/find-modules/rules_engine.py @@ -748,7 +748,7 @@ class ModuleCodeDb(AbstractCompiledCodeDb): The raw rule database must be a dictionary as follows: - 0. Each key is the basenanme of a module file. + 0. Each key is the basename of a header file. 1. Each value has entries which update the declaration as follows: @@ -762,8 +762,9 @@ class ModuleCodeDb(AbstractCompiledCodeDb): Return a string to insert for the file. :param filename: The filename. - :param sip: A dict with the key "name" for the module name - plus the "code" key described above. + :param sip: A dict with the key "name" for the filename, + "decl" for the module body plus the "code" key + described above. :param entry: The dictionary entry. :return: A string. @@ -776,7 +777,7 @@ class ModuleCodeDb(AbstractCompiledCodeDb): def __init__(self, db): super(ModuleCodeDb, self).__init__(db) # - # Add a usage count for each item in the database. + # Add a usage count and other diagnostic support for each item in the database. # for k, v in self.db.items(): v["usage"] = 0 @@ -792,6 +793,13 @@ class ModuleCodeDb(AbstractCompiledCodeDb): return entry def apply(self, filename, sip): + """ + Walk over the code database for modules, applying the first matching transformation. + + :param filename: The file for the module. + :param sip: The SIP dict (may be modified on return). + :return: Modifying rule or None (even if a rule matched, it may not modify things). + """ entry = self._get(filename) sip.setdefault("code", "") if entry: |