]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/blob - rpp/blocks/rpp_update_doc.m
Add function that updates documentation of RPP blocks
[pes-rpp/rpp-simulink.git] / rpp / blocks / rpp_update_doc.m
1 function rpp_update_doc
2 % RPP_UPDATE_DOC Update built-in S-functions documentation.
3 %    The documentation is updated based on the YAML comment in .c files.
4 set_param('rpp_lib', 'Lock', 'off');
5 blocks = find_system('rpp_lib', 'Type', 'block');
6 for i=1:length(blocks),
7     params = get_param(blocks{i}, 'ObjectParameters');
8     fields = fieldnames(params);
9     fn = get_param(blocks{i}, 'FunctionName');
10     % We have to unset Matlab's library path in order to run pandoc - it
11     % needs newer libc than the one shipped with Matlab
12     [rc, new_help] = system(['unset LD_LIBRARY_PATH; scripts/doc_parse.py --html ' fn '.c']);
13     if rc ~= 0,
14         disp(new_help)
15         throw(MException('rpp:pandoc_failure', ['Failed to extract doc from ' fn '.c']))
16     end
17     old_help = get_param(blocks{i}, 'MaskHelp');
18     if ~strcmp(old_help, new_help),
19         disp([blocks{i} ': Help not up-to-date - upating'])
20         set_param(blocks{i}, 'MaskHelp', new_help)
21     else
22         disp([blocks{i} ': Help up-to-date'])
23     end
24 end
25 set_param('rpp_lib', 'Lock', 'on');