| 1 | :- module(module_information,[module_info/2,module_info/3,get_module_info/3,number_of_groups/1,number_of_modules/1,number_of_modules/2]). | |
| 2 | ||
| 3 | % a simple mechanism to provide annotations for various modules | |
| 4 | % examples: | |
| 5 | % :- module_info(description,'....'). | |
| 6 | % :- module_info(group,kernel). | |
| 7 | :- meta_predicate module_info(:,*). | |
| 8 | :- dynamic get_module_info/3. | |
| 9 | module_info(Module:Attribute,Value) :- | |
| 10 | !,%print(describe_module(Module,Attribute,Value)),nl, | |
| 11 | assert(get_module_info(Module,Attribute,Value)). | |
| 12 | module_info(Attribute,Value) :- nl,print('### Attribute has no module prefix: '), Attribute,nl, | |
| 13 | print('### Value: '), print(Value),nl. | |
| 14 | % called for non-module prolog files | |
| 15 | module_info(Module,Attribute,Value) :- | |
| 16 | assert(get_module_info(Module,Attribute,Value)). | |
| 17 | ||
| 18 | :- module_info(group,infrastructure). | |
| 19 | :- module_info(description,'This module contains functionality to store basic documentation and information about all modules in ProB.'). | |
| 20 | ||
| 21 | :- use_module(library(lists)). | |
| 22 | ||
| 23 | % module_information:get_maximal_module_info(revision,X). | |
| 24 | % module_information:get_maximal_module_info(lastchanged,X). | |
| 25 | ||
| 26 | number_of_groups(X) :- | |
| 27 | findall(Group,get_module_info(_Module,group,Group),List), | |
| 28 | remove_dups(List,NList), | |
| 29 | length(NList,X). | |
| 30 | ||
| 31 | number_of_modules(X) :- | |
| 32 | findall(Module,get_module_info(Module,_A,_B),List), | |
| 33 | remove_dups(List,NList), | |
| 34 | length(NList,X). | |
| 35 | ||
| 36 | number_of_modules(Group,X) :- | |
| 37 | findall(Module,get_module_info(Module,group,Group),List), | |
| 38 | remove_dups(List,NList), | |
| 39 | length(NList,X). | |
| 40 | ||
| 41 |