function ret = addPreincludeFiles(h, varargin)
% ADDPREINCLUDEFILES The addPreincludeFiles function adds specified include files to
% the model's build information and sets the "Preinclude" flag for the file to true.
%    
% Argument    description
% buildinfo   Build information handle returned by RTW.Buildinfo.
%
% filenames   A character array or cell array of character arrays that
%             specifies names of include files to be added to the build
%             information. The function adds the filenames to the end of a
%             vector in the order that you specify them.
%             The function removes duplicate preinclude file entries that
%               - Already exist in the include file vector
%               - Have a path that matches the path of a matching filename
%             A duplicate entry consists of an exact match of a path string and
%             corresponding filename.
%
% paths       (optional) A character array or cell array of character arrays
%             that specifies paths to the include files. The function adds the
%             paths to the end of a vector in the order that you specify
%             them. If you specify a single path as a character array, the
%             function uses that path for all files.
%
% groups      (optional) A character array or cell array of character arrays
%             that groups specified include files
%
% example 1:
%   myModelBuildInfo = RTW.BuildInfo;
%   addPreincludeFiles(myModelBuildInfo,... 
%                   {'etc.h' 'etc_private.h'}, 'AppFiles');
%
% example 1:
%   myModelBuildInfo = RTW.BuildInfo;
%   addPreincludeFiles(myModelBuildInfo,... 
%                   {'etc.h' 'etc_private.h' 'mytypes.h'},... 
%                   {'AppFiles' 'AppFiles' 'SysFiles'})
%

% Copyright 2023 The MathWorks, Inc.
[varargin{:}] = convertStringsToChars(varargin{:});
ret = h.addFiles('preinclude', varargin{:});

