From cd5ea952f97fe60467ba069aceb6e36be6216e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Fri, 28 Feb 2014 18:25:02 +0100 Subject: [PATCH] Forbid MOD file names that are too long. And rename filenames in the testsuite that are too long. Closes #626 (cherry picked from commit 9e332ef3059a7e83ced90a493d57ea21b6caff5e) --- matlab/dynare.m | 6 ++++++ tests/Makefile.am | 12 ++++++------ ...ded.mod => first_and_2nd_deriv_fcns_provided.mod} | 0 ...mod => first_and_2nd_deriv_fcns_provided_dll.mod} | 0 ...ion_provided.mod => first_deriv_fcn_provided.mod} | 0 ...ided_dll.mod => first_deriv_fcn_provided_dll.mod} | 0 ...tions_provided.mod => no_deriv_fcns_provided.mod} | 0 ...ovided_dll.mod => no_deriv_fcns_provided_dll.mod} | 0 8 files changed, 12 insertions(+), 6 deletions(-) rename tests/external_function/{example1_1st_and_2nd_deriv_functions_provided.mod => first_and_2nd_deriv_fcns_provided.mod} (100%) rename tests/external_function/{example1_1st_and_2nd_deriv_functions_provided_dll.mod => first_and_2nd_deriv_fcns_provided_dll.mod} (100%) rename tests/external_function/{example1_1st_deriv_function_provided.mod => first_deriv_fcn_provided.mod} (100%) rename tests/external_function/{example1_1st_deriv_function_provided_dll.mod => first_deriv_fcn_provided_dll.mod} (100%) rename tests/external_function/{example1_no_deriv_functions_provided.mod => no_deriv_fcns_provided.mod} (100%) rename tests/external_function/{example1_no_deriv_functions_provided_dll.mod => no_deriv_fcns_provided_dll.mod} (100%) diff --git a/matlab/dynare.m b/matlab/dynare.m index 034ec0674..84b7efca4 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -82,6 +82,7 @@ end % Testing if file have extension % If no extension default .mod is added if isempty(strfind(fname,'.')) + fnamelength = length(fname); fname1 = [fname '.dyn']; d = dir(fname1); if length(d) == 0 @@ -94,8 +95,13 @@ else && ~strcmp(upper(fname(size(fname,2)-3:size(fname,2))),'.DYN') error('DYNARE: argument must be a filename with .mod or .dyn extension') end; + fnamelength = length(fname) - 4; end; +if fnamelength + length('_set_auxiliary_variables') > namelengthmax() + error('The name of your MOD file is too long, please shorten it') +end + % Workaround for a strange bug with Octave: if there is any call to exist(fname) % before the call to the preprocessor, then Octave will use the old copy of % the .m instead of the newly generated one. Deleting the .m beforehand diff --git a/tests/Makefile.am b/tests/Makefile.am index 8b3baccfd..b19c4651c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -100,12 +100,12 @@ MODFILES = \ dsge-var/simul_hybrid.mod \ dsge-var/dsgevar_forward_calibrated_lambda.mod \ dsge-var/dsgevar_forward_estimated_lambda.mod \ - external_function/example1_1st_and_2nd_deriv_functions_provided.mod \ - external_function/example1_1st_and_2nd_deriv_functions_provided_dll.mod \ - external_function/example1_1st_deriv_function_provided.mod \ - external_function/example1_1st_deriv_function_provided_dll.mod \ - external_function/example1_no_deriv_functions_provided.mod \ - external_function/example1_no_deriv_functions_provided_dll.mod \ + external_function/first_and_2nd_deriv_fcns_provided.mod \ + external_function/first_and_2nd_deriv_fcns_provided_dll.mod \ + external_function/first_deriv_fcn_provided.mod \ + external_function/first_deriv_fcn_provided_dll.mod \ + external_function/no_deriv_fcns_provided.mod \ + external_function/no_deriv_fcns_provided_dll.mod \ seeds.mod \ identification/kim/kim2.mod \ identification/as2007/as2007.mod \ diff --git a/tests/external_function/example1_1st_and_2nd_deriv_functions_provided.mod b/tests/external_function/first_and_2nd_deriv_fcns_provided.mod similarity index 100% rename from tests/external_function/example1_1st_and_2nd_deriv_functions_provided.mod rename to tests/external_function/first_and_2nd_deriv_fcns_provided.mod diff --git a/tests/external_function/example1_1st_and_2nd_deriv_functions_provided_dll.mod b/tests/external_function/first_and_2nd_deriv_fcns_provided_dll.mod similarity index 100% rename from tests/external_function/example1_1st_and_2nd_deriv_functions_provided_dll.mod rename to tests/external_function/first_and_2nd_deriv_fcns_provided_dll.mod diff --git a/tests/external_function/example1_1st_deriv_function_provided.mod b/tests/external_function/first_deriv_fcn_provided.mod similarity index 100% rename from tests/external_function/example1_1st_deriv_function_provided.mod rename to tests/external_function/first_deriv_fcn_provided.mod diff --git a/tests/external_function/example1_1st_deriv_function_provided_dll.mod b/tests/external_function/first_deriv_fcn_provided_dll.mod similarity index 100% rename from tests/external_function/example1_1st_deriv_function_provided_dll.mod rename to tests/external_function/first_deriv_fcn_provided_dll.mod diff --git a/tests/external_function/example1_no_deriv_functions_provided.mod b/tests/external_function/no_deriv_fcns_provided.mod similarity index 100% rename from tests/external_function/example1_no_deriv_functions_provided.mod rename to tests/external_function/no_deriv_fcns_provided.mod diff --git a/tests/external_function/example1_no_deriv_functions_provided_dll.mod b/tests/external_function/no_deriv_fcns_provided_dll.mod similarity index 100% rename from tests/external_function/example1_no_deriv_functions_provided_dll.mod rename to tests/external_function/no_deriv_fcns_provided_dll.mod -- GitLab