dynare.m: simplify code
parent
3a223e9c08
commit
dec7d4fdb4
|
@ -206,8 +206,9 @@ end
|
||||||
|
|
||||||
command = ['"' dynareroot 'preprocessor' arch_ext filesep 'dynare_m" ' fname] ;
|
command = ['"' dynareroot 'preprocessor' arch_ext filesep 'dynare_m" ' fname] ;
|
||||||
command = [ command ' mexext=' mexext ' "matlabroot=' matlabroot '"'];
|
command = [ command ' mexext=' mexext ' "matlabroot=' matlabroot '"'];
|
||||||
for i=1:length(varargin)
|
if ~isempty(varargin)
|
||||||
command = [command ' ' varargin{i}];
|
dynare_varargin = strjoin(varargin);
|
||||||
|
command = [command ' ' dynare_varargin];
|
||||||
end
|
end
|
||||||
|
|
||||||
if preprocessoroutput
|
if preprocessoroutput
|
||||||
|
@ -216,7 +217,7 @@ if preprocessoroutput
|
||||||
if isempty(varargin)
|
if isempty(varargin)
|
||||||
disp('none')
|
disp('none')
|
||||||
else
|
else
|
||||||
disp(strjoin(varargin));
|
disp(dynare_varargin);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -252,17 +253,11 @@ if exist(fname(1:end-4),'dir') && exist([fname(1:end-4) filesep 'hooks'],'dir')
|
||||||
end
|
end
|
||||||
|
|
||||||
% Save preprocessor result in logfile (if `no_log' option not present)
|
% Save preprocessor result in logfile (if `no_log' option not present)
|
||||||
no_log = 0;
|
|
||||||
for i=1:length(varargin)
|
|
||||||
no_log = no_log || strcmp(varargin{i}, 'nolog');
|
|
||||||
end
|
|
||||||
fid = fopen(fname, 'r');
|
fid = fopen(fname, 'r');
|
||||||
firstline = fgetl(fid);
|
firstline = fgetl(fid);
|
||||||
fclose(fid);
|
fclose(fid);
|
||||||
if ~isempty(regexp(firstline, '//\s*--\+\s*options:(|.*\s|.*,)nolog(|\s.*|,.*)\+--'))
|
if ~ismember('nolog', varargin) ...
|
||||||
no_log = 1;
|
&& isempty(regexp(firstline, '//\s*--\+\s*options:(|.*\s|.*,)nolog(|\s.*|,.*)\+--'))
|
||||||
end
|
|
||||||
if ~no_log
|
|
||||||
logname = [fname(1:end-4) '.log'];
|
logname = [fname(1:end-4) '.log'];
|
||||||
fid = fopen(logname, 'w');
|
fid = fopen(logname, 'w');
|
||||||
fprintf(fid, '%s', result);
|
fprintf(fid, '%s', result);
|
||||||
|
|
Loading…
Reference in New Issue