- Files needed to debug simulate.dll
git-svn-id: https://www.dynare.org/svn/dynare/trunk@2837 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
45c28cadc2
commit
08c97bbef7
|
@ -0,0 +1,83 @@
|
|||
#include "mex_interface.hh"
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int
|
||||
mexPrintf(string str, ...)
|
||||
{
|
||||
va_list vl;
|
||||
size_t found, found_p=0;
|
||||
found=str.find_first_of("%");
|
||||
va_start(vl,str);
|
||||
while (found!=string::npos)
|
||||
{
|
||||
ostringstream tmp_out("");
|
||||
//tmp_out.clear();
|
||||
tmp_out << "%";
|
||||
char c = str[found+1];
|
||||
while((c>='0' and c<='9') or c=='.')
|
||||
{
|
||||
tmp_out << c;
|
||||
found++;
|
||||
c = str[found+1];
|
||||
}
|
||||
tmp_out << c;
|
||||
switch(c)
|
||||
{
|
||||
case 'd':
|
||||
printf(str.substr(found_p, found-found_p).c_str());
|
||||
printf(tmp_out.str().c_str(),va_arg(vl,int));
|
||||
break;
|
||||
case 'e':
|
||||
case 'f':
|
||||
case 'g':
|
||||
printf(str.substr(found_p, found-found_p).c_str());
|
||||
printf(tmp_out.str().c_str(),va_arg(vl,double));
|
||||
break;
|
||||
case 's':
|
||||
printf(str.substr(found_p, found-found_p).c_str());
|
||||
printf(tmp_out.str().c_str(),va_arg(vl,char*));
|
||||
break;
|
||||
case 'x':
|
||||
printf(str.substr(found_p, found-found_p).c_str());
|
||||
printf(tmp_out.str().c_str(),va_arg(vl,int));
|
||||
break;
|
||||
}
|
||||
found_p = found+2;
|
||||
found=str.find_first_of("%",found_p);
|
||||
}
|
||||
printf(str.substr(found_p, str.size()-found_p+1).c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
mexErrMsgTxt(const string str)
|
||||
{
|
||||
perror(str.c_str());
|
||||
}
|
||||
|
||||
void
|
||||
mxFree(void* to_release)
|
||||
{
|
||||
free(to_release);
|
||||
}
|
||||
|
||||
void*
|
||||
mxMalloc(int amount)
|
||||
{
|
||||
return malloc(amount);
|
||||
}
|
||||
|
||||
void*
|
||||
mxRealloc(void* to_extend, int amount)
|
||||
{
|
||||
return realloc(to_extend, amount);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mexEvalString(const string str)
|
||||
{
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
function simulate_debug()
|
||||
global M_ oo_ options_;
|
||||
fid = fopen([M_.fname '_options.txt'],'wt');
|
||||
fprintf(fid,'%d\n',options_.periods);
|
||||
fprintf(fid,'%d\n',options_.maxit_);
|
||||
fprintf(fid,'%f\n',options_.slowc);
|
||||
fprintf(fid,'%f\n',options_.markowitz);
|
||||
fprintf(fid,'%f\n',options_.dynatol);
|
||||
fclose(fid);
|
||||
|
||||
fid = fopen([M_.fname '_M.txt'],'wt');
|
||||
fprintf(fid,'%d\n',M_.maximum_lag);
|
||||
fprintf(fid,'%d\n',M_.maximum_lead);
|
||||
fprintf(fid,'%d\n',M_.maximum_endo_lag);
|
||||
fprintf(fid,'%d\n',M_.param_nbr);
|
||||
fprintf(fid,'%d\n',size(oo_.exo_simul, 1));
|
||||
fprintf(fid,'%d\n',size(oo_.exo_simul, 2));
|
||||
fprintf(fid,'%d\n',M_.endo_nbr);
|
||||
fprintf(fid,'%d\n',size(oo_.endo_simul, 2));
|
||||
fprintf(fid,'%d\n',M_.exo_det_nbr);
|
||||
fprintf(fid,'%f\n',M_.params);
|
||||
|
||||
fclose(fid);
|
||||
fid = fopen([M_.fname '_oo.txt'],'wt');
|
||||
fprintf(fid,'%f\n',oo_.endo_simul);
|
||||
fprintf(fid,'%f\n',oo_.exo_simul);
|
||||
fclose(fid);
|
||||
|
Loading…
Reference in New Issue