-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Nelson-numerical-software/validators
Validators
- Loading branch information
Showing
11 changed files
with
101 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
//============================================================================= | ||
// Copyright (c) 2018-present Allan CORNET (Nelson) | ||
// | ||
// This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
//============================================================================= | ||
%============================================================================= | ||
% Copyright (c) 2018-present Allan CORNET (Nelson) | ||
% | ||
% This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
%============================================================================= | ||
MODULE_NAME = 'module_skeleton'; | ||
//============================================================================= | ||
%============================================================================= | ||
if ismodule(MODULE_NAME) | ||
error(_('Module already loaded.')); | ||
end | ||
//============================================================================= | ||
%============================================================================= | ||
if ~havecompiler() | ||
error(_('Please install and configure a C/C++ compiler')); | ||
end | ||
//============================================================================= | ||
%============================================================================= | ||
fprintf(_('Building ''%s'' dependencies.\n'), MODULE_NAME); | ||
nmm_build_dependencies(fileparts(nfilename('fullpath'))); | ||
//============================================================================= | ||
%============================================================================= | ||
fprintf(_('Building ''%s'' sources.\n'), MODULE_NAME); | ||
run([fileparts(nfilename('fullpath')), '/src/builder.nls']); | ||
//============================================================================= | ||
%============================================================================= | ||
fprintf(_('Building ''%s'' builtin.\n'), MODULE_NAME); | ||
run([fileparts(nfilename('fullpath')), '/builtin/builder.nls']); | ||
//============================================================================= | ||
%============================================================================= | ||
fprintf(_('Building ''%s'' loader.\n'), MODULE_NAME); | ||
nmm_build_loader(MODULE_NAME, fileparts(nfilename('fullpath'))); | ||
//============================================================================= | ||
%============================================================================= | ||
nmm_build_help(MODULE_NAME, fileparts(nfilename('fullpath'))); | ||
//============================================================================= | ||
%============================================================================= | ||
clear('MODULE_NAME'); | ||
//============================================================================= | ||
%============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
//============================================================================= | ||
// Copyright (c) 2018-present Allan CORNET (Nelson) | ||
// | ||
// This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
//============================================================================= | ||
// remove C/C++ gateway | ||
%============================================================================= | ||
% Copyright (c) 2018-present Allan CORNET (Nelson) | ||
% | ||
% This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
%============================================================================= | ||
% remove C/C++ gateway | ||
MODULE_NAME = 'module_skeleton'; | ||
removegateway([fileparts(nfilename('fullpath')), '/../builtin/', [MODULE_NAME, '_builtin'], getdynlibext()]); | ||
//============================================================================= | ||
// remove C/C++ code associated to the previous gateway | ||
%============================================================================= | ||
% remove C/C++ code associated to the previous gateway | ||
run([fileparts(nfilename('fullpath')), '/../src/unloader.nls']); | ||
//============================================================================= | ||
// remove macros | ||
%============================================================================= | ||
% remove macros | ||
rmpath([fileparts(nfilename('fullpath')), '/../functions']); | ||
//============================================================================= | ||
%============================================================================= | ||
clear('MODULE_NAME'); | ||
//============================================================================= | ||
%============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
//============================================================================= | ||
// Copyright (c) 2018-present Allan CORNET (Nelson) | ||
// | ||
// This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
//============================================================================= | ||
// load C/C++ business code used by the gateway | ||
%============================================================================= | ||
% Copyright (c) 2018-present Allan CORNET (Nelson) | ||
% | ||
% This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
%============================================================================= | ||
% load C/C++ business code used by the gateway | ||
run([fileparts(nfilename('fullpath')), '/../src/loader.nls']); | ||
//============================================================================= | ||
// load C/C++ gateway | ||
%============================================================================= | ||
% load C/C++ gateway | ||
MODULE_NAME = 'module_skeleton'; | ||
addgateway([fileparts(nfilename('fullpath')), '/../builtin/', [MODULE_NAME, '_builtin'], getdynlibext()]); | ||
//============================================================================= | ||
// load macros | ||
%============================================================================= | ||
% load macros | ||
addpath([fileparts(nfilename('fullpath')), '/../functions']); | ||
//============================================================================= | ||
%============================================================================= | ||
clear('MODULE_NAME'); | ||
//============================================================================= | ||
%============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
//============================================================================= | ||
// Copyright (c) 2018-present Allan CORNET (Nelson) | ||
// | ||
// This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
//============================================================================= | ||
function C = nelson_sum(A, B) | ||
%============================================================================= | ||
% Copyright (c) 2018-present Allan CORNET (Nelson) | ||
% | ||
% This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
%============================================================================= | ||
function varargout = macro_sum(varargin) | ||
narginchk(1, 2) | ||
if (nargout > 1) | ||
error(_('Wrong number of output arguments.')); | ||
end | ||
A = varargin{1}; | ||
B = varargin{2}; | ||
mustBeScalarOrEmpty(A, 1); | ||
mustBeReal(A, 1); | ||
mustBeScalarOrEmpty(B, 2); | ||
mustBeReal(B, 2); | ||
C = A + B; | ||
varargout{1} = C; | ||
endfunction | ||
//============================================================================= | ||
%============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
//============================================================================= | ||
// Copyright (c) 2018-present Allan CORNET (Nelson) | ||
// | ||
// This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
//============================================================================= | ||
%============================================================================= | ||
% Copyright (c) 2018-present Allan CORNET (Nelson) | ||
% | ||
% This file is released under the 3-clause BSD license. See COPYING-BSD. | ||
%============================================================================= | ||
if ~ismodule('module_skeleton') | ||
run([fileparts(nfilename('fullpathext')), '/../loader.nls']); | ||
end | ||
//============================================================================= | ||
%============================================================================= | ||
assert_isequal(nargin('cpp_sum'), 2); | ||
assert_isequal(nargout('cpp_sum'), 1); | ||
//============================================================================= | ||
%============================================================================= | ||
assert_isequal(cpp_sum(3, 2), 5); | ||
//============================================================================= | ||
%============================================================================= | ||
assert_checkerror('cpp_sum(3, 2, 4)', _('Wrong number of input arguments.')); | ||
assert_checkerror('cpp_sum([3, 4], 2)', _('Expected a real value scalar.')); | ||
//============================================================================= | ||
msg = [sprintf(_('Invalid input argument at position %d.'), 1), char(10), _('Value must be scalar or empty.')]; | ||
assert_checkerror('cpp_sum([3, 4], 2)', msg); | ||
%============================================================================= |