1 function updated = 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 % The number of updated blocks is returned.
5 set_param('rpp_lib', 'Lock', 'off');
6 blocks = find_system('rpp_lib', 'Type', 'block');
8 for i=1:length(blocks),
9 params = get_param(blocks{i}, 'ObjectParameters');
10 fields = fieldnames(params);
11 fn = get_param(blocks{i}, 'FunctionName');
12 % We have to unset Matlab's library path in order to run pandoc - it
13 % needs newer libc than the one shipped with Matlab
14 [rc, new_help] = system(['unset LD_LIBRARY_PATH; scripts/doc_parse.py --html ' fn '.c']);
17 throw(MException('rpp:pandoc_failure', ['Failed to extract doc from ' fn '.c']))
19 old_help = get_param(blocks{i}, 'MaskHelp');
20 if ~strcmp(old_help, new_help),
21 disp([blocks{i} ': Help not up-to-date - upating'])
22 set_param(blocks{i}, 'MaskHelp', new_help)
23 updated = updated + 1;
25 disp([blocks{i} ': Help up-to-date'])
28 set_param('rpp_lib', 'Lock', 'on');