image thumbnail
from Growing a Compiler by Bill McKeeman
Bootstrap compilers starting from a tiny compiler-compiler.

makePublish(varargin)
% FILE:    makePublish.m
% PURPOSE: rebuild HTML publish files
% METHOD:  use MATALB publish
% EXAMPLE: 
%   makePublish()                      % publish GrowingCompiler*.m
%   makePublish GrowingCompilerCh5.m   % compile selected chapter(s) 

% COPYRIGHT:   2009 W. M. McKeeman.  See license.txt.

function makePublish(varargin)
  % make HTML presentation
  
  if nargin == 0
    dirc = dir('GrowingCompiler*.m');
    pfiles = {dirc.name};                        % all C file
  else
    pfiles = {};                                 % none yet
    for i = 1:numel(varargin)
      f = varargin{i};
      if numel(f) > 2 && ~strcmp(f(end-1:end), '.m')
        pfiles{i} = [f '.c'];                    %#ok<AGROW> 
      else
        pfiles{i} = f;                           %#ok<AGROW>
      end
    end
  end

  disp 'publishing: be patient.'
  for i = 1:numel(pfiles)
    f = pfiles{i};
    display(['publish ' f])
    publish(f);
  end
end

Contact us at files@mathworks.com