Skip to content

Commit

Permalink
ENH - add ft_debug, ft_notice, and ft_info to the private directory o…
Browse files Browse the repository at this point in the history
…f modules

also updated ft_version not to give an error when only a single FT module is on the path
  • Loading branch information
robertoostenveld committed Feb 9, 2024
1 parent d7aee08 commit c2e049f
Show file tree
Hide file tree
Showing 30 changed files with 1,456 additions and 45 deletions.
85 changes: 56 additions & 29 deletions bin/synchronize-private.sh
Expand Up @@ -833,20 +833,6 @@ ARRAY+=(forward/ft_estimate_units.m)
ARRAY+=(plotting/private/ft_estimate_units.m)
sync ${ARRAY[*]}

################################################################################
# ft_error.m, should be consistent with ft_notification and ft_warning

ARRAY=()
ARRAY+=(connectivity/private/ft_error.m)
ARRAY+=(fileio/private/ft_error.m)
ARRAY+=(forward/private/ft_error.m)
ARRAY+=(inverse/private/ft_error.m)
ARRAY+=(plotting/private/ft_error.m)
ARRAY+=(preproc/private/ft_error.m)
ARRAY+=(specest/private/ft_error.m)
ARRAY+=(utilities/ft_error.m)
sync ${ARRAY[*]}

################################################################################
# ft_fetch_data.m

Expand Down Expand Up @@ -1040,7 +1026,7 @@ ARRAY+=(inverse/private/ft_inv.m)
sync ${ARRAY[*]}

################################################################################
# ft_notification.m, should be consistent with ft_warning and ft_error
# ft_notification.m, should be consistent with ft_warning etc

ARRAY=()
ARRAY+=(connectivity/private/ft_notification.m)
Expand All @@ -1053,6 +1039,61 @@ ARRAY+=(specest/private/ft_notification.m)
ARRAY+=(utilities/private/ft_notification.m)
sync ${ARRAY[*]}

ARRAY=()
ARRAY+=(connectivity/private/ft_warning.m)
ARRAY+=(fileio/private/ft_warning.m)
ARRAY+=(forward/private/ft_warning.m)
ARRAY+=(inverse/private/ft_warning.m)
ARRAY+=(plotting/private/ft_warning.m)
ARRAY+=(preproc/private/ft_warning.m)
ARRAY+=(specest/private/ft_warning.m)
ARRAY+=(utilities/ft_warning.m)
sync ${ARRAY[*]}

ARRAY=()
ARRAY+=(connectivity/private/ft_error.m)
ARRAY+=(fileio/private/ft_error.m)
ARRAY+=(forward/private/ft_error.m)
ARRAY+=(inverse/private/ft_error.m)
ARRAY+=(plotting/private/ft_error.m)
ARRAY+=(preproc/private/ft_error.m)
ARRAY+=(specest/private/ft_error.m)
ARRAY+=(utilities/ft_error.m)
sync ${ARRAY[*]}

ARRAY=()
ARRAY+=(connectivity/private/ft_notice.m)
ARRAY+=(fileio/private/ft_notice.m)
ARRAY+=(forward/private/ft_notice.m)
ARRAY+=(inverse/private/ft_notice.m)
ARRAY+=(plotting/private/ft_notice.m)
ARRAY+=(preproc/private/ft_notice.m)
ARRAY+=(specest/private/ft_notice.m)
ARRAY+=(utilities/ft_notice.m)
sync ${ARRAY[*]}

ARRAY=()
ARRAY+=(connectivity/private/ft_info.m)
ARRAY+=(fileio/private/ft_info.m)
ARRAY+=(forward/private/ft_info.m)
ARRAY+=(inverse/private/ft_info.m)
ARRAY+=(plotting/private/ft_info.m)
ARRAY+=(preproc/private/ft_info.m)
ARRAY+=(specest/private/ft_info.m)
ARRAY+=(utilities/ft_info.m)
sync ${ARRAY[*]}

ARRAY=()
ARRAY+=(connectivity/private/ft_debug.m)
ARRAY+=(fileio/private/ft_debug.m)
ARRAY+=(forward/private/ft_debug.m)
ARRAY+=(inverse/private/ft_debug.m)
ARRAY+=(plotting/private/ft_debug.m)
ARRAY+=(preproc/private/ft_debug.m)
ARRAY+=(specest/private/ft_debug.m)
ARRAY+=(utilities/ft_debug.m)
sync ${ARRAY[*]}

################################################################################
# ft_platform_supports.m

Expand Down Expand Up @@ -1148,20 +1189,6 @@ ARRAY+=(specest/private/ft_version.m)
ARRAY+=(utilities/ft_version.m)
sync ${ARRAY[*]}

################################################################################
# ft_warning.m, should be consistent with ft_notification and ft_error

ARRAY=()
ARRAY+=(connectivity/private/ft_warning.m)
ARRAY+=(fileio/private/ft_warning.m)
ARRAY+=(forward/private/ft_warning.m)
ARRAY+=(inverse/private/ft_warning.m)
ARRAY+=(plotting/private/ft_warning.m)
ARRAY+=(preproc/private/ft_warning.m)
ARRAY+=(specest/private/ft_warning.m)
ARRAY+=(utilities/ft_warning.m)
sync ${ARRAY[*]}

################################################################################
# ft_warp_apply.m

Expand Down
64 changes: 64 additions & 0 deletions connectivity/private/ft_debug.m
@@ -0,0 +1,64 @@
function varargout = ft_debug(varargin)

% FT_DEBUG prints a debug message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_debug(...)
% with arguments similar to fprintf, or
% ft_debug(msgId, ...)
% with arguments similar to warning.
%
% You can switch of all messages using
% ft_debug off
% or for specific ones using
% ft_debug off msgId
%
% To switch them back on, you would use
% ft_debug on
% or for specific ones using
% ft_debug on msgId
%
% Messages are only printed once per timeout period using
% ft_debug timeout 60
% ft_debug once
% or for specific ones using
% ft_debug once msgId
%
% You can see the most recent messages and identifier using
% ft_debug last
%
% You can query the current on/off/once state for all messages using
% ft_debug query
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end

64 changes: 64 additions & 0 deletions connectivity/private/ft_info.m
@@ -0,0 +1,64 @@
function varargout = ft_info(varargin)

% FT_INFO prints an info message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_info(...)
% with arguments similar to fprintf, or
% ft_info(msgId, ...)
% with arguments similar to warning.
%
% You can switch of all messages using
% ft_info off
% or for specific ones using
% ft_info off msgId
%
% To switch them back on, you would use
% ft_info on
% or for specific ones using
% ft_info on msgId
%
% Messages are only printed once per timeout period using
% ft_info timeout 60
% ft_info once
% or for specific ones using
% ft_info once msgId
%
% You can see the most recent messages and identifier using
% ft_info last
%
% You can query the current on/off/once state for all messages using
% ft_info query
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end

64 changes: 64 additions & 0 deletions connectivity/private/ft_notice.m
@@ -0,0 +1,64 @@
function varargout = ft_notice(varargin)

% FT_NOTICE prints a notice message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_notice(...)
% with arguments similar to fprintf, or
% ft_notice(msgId, ...)
% with arguments similar to warning.
%
% You can switch of all messages using
% ft_notice off
% or for specific ones using
% ft_notice off msgId
%
% To switch them back on, you would use
% ft_notice on
% or for specific ones using
% ft_notice on msgId
%
% Messages are only printed once per timeout period using
% ft_notice timeout 60
% ft_notice once
% or for specific ones using
% ft_notice once msgId
%
% You can see the most recent messages and identifier using
% ft_notice last
%
% You can query the current on/off/once state for all messages using
% ft_notice query
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end

9 changes: 7 additions & 2 deletions connectivity/private/ft_version.m
Expand Up @@ -157,8 +157,13 @@
else
% get it from the Contents.m file in the FieldTrip directory
if ~isdeployed
tmp = ver(ftpath);
ftver = tmp.Version;
try
tmp = ver(ftpath);
ftver = tmp.Version;
catch
% this fails when Contents.m is not properly formatted
ftver = 'unknown';
end
else
ftver = 'deployed';
end
Expand Down
64 changes: 64 additions & 0 deletions fileio/private/ft_debug.m
@@ -0,0 +1,64 @@
function varargout = ft_debug(varargin)

% FT_DEBUG prints a debug message on screen, depending on the verbosity
% settings of the calling high-level FieldTrip function.
%
% Use as
% ft_debug(...)
% with arguments similar to fprintf, or
% ft_debug(msgId, ...)
% with arguments similar to warning.
%
% You can switch of all messages using
% ft_debug off
% or for specific ones using
% ft_debug off msgId
%
% To switch them back on, you would use
% ft_debug on
% or for specific ones using
% ft_debug on msgId
%
% Messages are only printed once per timeout period using
% ft_debug timeout 60
% ft_debug once
% or for specific ones using
% ft_debug once msgId
%
% You can see the most recent messages and identifier using
% ft_debug last
%
% You can query the current on/off/once state for all messages using
% ft_debug query
%
% See also FT_ERROR, FT_WARNING, FT_NOTICE, FT_INFO, FT_DEBUG, ERROR, WARNING

% Copyright (C) 2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
% FieldTrip is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% FieldTrip is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

if nargout
[varargout{1:nargout}] = ft_notification(varargin{:});
elseif isequal(varargin, {'last'})
% return an answer anyway
varargout{1} = ft_notification(varargin{:});
else
ft_notification(varargin{:});
end

0 comments on commit c2e049f

Please sign in to comment.