Commit 120d4121 authored by sebastien's avatar sebastien
Browse files

v4: dropped Scilab support


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1878 ac1d8469-bf42-47a9-8791-bf33cf982152
parent dfc1f3c9
No preview for this file type
......@@ -23,7 +23,6 @@
using namespace std;
#include "ComputingTasks.hh"
#include "Interface.hh"
#include "Statement.hh"
SteadyStatement::SteadyStatement(const OptionsList &options_list_arg) :
......@@ -570,8 +569,9 @@ void
CalibVarStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << "\n" << interfaces::comment() << "CALIB_VAR \n"
<< interfaces::comment() << "\n";
output << "%" << endl
<< "% CALIB_VAR" << endl
<< "%" << endl;
for(int i = 1; i < 4 ; i++)
{
......@@ -728,9 +728,11 @@ OptimWeightsStatement::OptimWeightsStatement(const var_weights_type &var_weights
void
OptimWeightsStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << "OPTIM_WEIGHTS\n\n";
output << "optim_weights_ = sparse(M_.endo_nbr,M_.endo_nbr);\n";
output << "obj_var_ = [];\n\n";
output << "%" << endl
<< "% OPTIM_WEIGHTS" << endl
<< "%" << endl
<< "optim_weights_ = sparse(M_.endo_nbr,M_.endo_nbr);" << endl
<< "obj_var_ = [];" << endl << endl;
for(var_weights_type::const_iterator it = var_weights.begin();
it != var_weights.end(); it++)
......
/*
* Copyright (C) 2006-2008 Dynare Team
*
* This file is part of Dynare.
*
* Dynare 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.
*
* Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
#include "Interface.hh"
namespace interfaces
{
string comment()
{
return "% ";
}
string delete_file(string s)
{
return "delete " + s;
}
string file_exist(string s)
{
return "exist('" + s + "')";
}
string compile(string s)
{
return "mex -O " + s + "\n";
}
string function_close()
{
return "";
}
string function_file_extension()
{
return ".m";
}
string strvcat(string s1, string s2)
{
return "strvcat(" + s1 + "," + s2 + ")";
}
string load_model_function_files(string filename)
{
return "";
}
}
/*
* Copyright (C) 2006-2008 Dynare Team
*
* This file is part of Dynare.
*
* Dynare 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.
*
* Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
#include <string>
#include "Interface.hh"
namespace interfaces
{
string comment()
{
return "// ";
}
string delete_file(string s)
{
return "mdelete " + s;
}
string file_exist(string s)
{
return "file_exist(" + s + ")";
}
string compile(string s)
{
return "";
}
string function_close()
{
return "endfunction\n";
}
string function_file_extension()
{
return ".sci";
}
string strvcat(string s1, string s2)
{
return "[" + s1 + ";" + s2 + "]";
}
string load_model_function_files(string filename)
{
return "getf('" + filename + "_static.sci');\ngetf('" + filename + "_dynamic.sci');\n";
}
}
......@@ -2,18 +2,15 @@ include Makefile.include
ifeq ($(shell uname -o), Cygwin)
DYNARE_M = dynare_m.exe
DYNARE_S = dynare_s.exe
else
DYNARE_M = dynare_m
DYNARE_S = dynare_s
endif
ifeq ($(CROSS_WIN32), yes)
DYNARE_M = dynare_m.exe
DYNARE_S = dynare_s.exe
endif
COMMON_OBJ = \
OBJS = \
DynareFlex.o \
DynareBison.o \
ComputingTasks.o \
......@@ -38,30 +35,22 @@ COMMON_OBJ = \
DynareMain.o \
DynareMain2.o
MATLAB_OBJ = InterfaceMatlab.o
SCILAB_OBJ = InterfaceScilab.o
# Build rules
all: all-recursive $(DYNARE_M) $(DYNARE_S)
all: all-recursive $(DYNARE_M)
all-recursive:
make -C macro
$(DYNARE_M): $(COMMON_OBJ) $(MATLAB_OBJ) macro/libmacro.a
$(CPP) $(CPPFLAGS) -o $(DYNARE_M) $(COMMON_OBJ) $(MATLAB_OBJ) -Lmacro -lmacro
$(DYNARE_M): $(OBJS) macro/libmacro.a
$(CPP) $(CPPFLAGS) -o $(DYNARE_M) $(OBJS) -Lmacro -lmacro
cp $(DYNARE_M) ../matlab/
$(DYNARE_S): $(COMMON_OBJ) $(SCILAB_OBJ) macro/libmacro.a
$(CPP) $(CPPFLAGS) -o $(DYNARE_S) $(COMMON_OBJ) $(SCILAB_OBJ) -Lmacro -lmacro
cp $(DYNARE_S) ../scilab/
# Dependencies
-include $(COMMON_OBJ:.o=.P) $(MATLAB_OBJ:.o=.P) $(SCILAB_OBJ:.o=.P)
-include $(OBJS:.o=.P)
DynareFlex.cc: DynareFlex.ll include/DynareBison.hh include/ParsingDriver.hh
flex -oDynareFlex.cc DynareFlex.ll
......@@ -83,8 +72,7 @@ clean: clean-recursive
include/stack.hh \
include/location.hh \
include/DynareBison.hh \
$(DYNARE_M) \
$(DYNARE_S)
$(DYNARE_M)
clean-recursive:
make -C macro clean
......
......@@ -21,7 +21,6 @@
#include <fstream>
#include "ModFile.hh"
#include "Interface.hh"
ModFile::ModFile() : expressions_tree(symbol_table, num_constants),
model_tree(symbol_table, num_constants),
......@@ -110,7 +109,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
if (basename.size())
{
string fname(basename);
fname += interfaces::function_file_extension();
fname += ".m";
mOutputFile.open(fname.c_str(), ios::out | ios::binary);
if (!mOutputFile.is_open())
{
......@@ -125,11 +124,11 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
exit(-1);
}
mOutputFile << interfaces::comment() << endl;
mOutputFile << interfaces::comment() << "Status : main Dynare file " << endl;
mOutputFile << interfaces::comment() << endl;
mOutputFile << interfaces::comment() << "Warning : this file is generated automatically by Dynare" << endl;
mOutputFile << interfaces::comment() << " from model file (.mod)" << endl << endl;
mOutputFile << "%" << endl
<< "% Status : main Dynare file " << endl
<< "%" << endl
<< "% Warning : this file is generated automatically by Dynare" << endl
<< "% from model file (.mod)" << endl << endl;
if (clear_all)
mOutputFile << "clear all" << endl;
......@@ -139,12 +138,12 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
mOutputFile << "global ys0_ recurs0_ ex0_ ct_" << endl;
mOutputFile << "options_ = [];" << endl;
mOutputFile << "M_.fname = '" << basename << "';" << endl;
mOutputFile << interfaces::comment() << endl;
mOutputFile << interfaces::comment() << "Some global variables initialisation" << endl;
mOutputFile << interfaces::comment() << endl;
mOutputFile << "%" << endl;
mOutputFile << "% Some global variables initialization" << endl;
mOutputFile << "%" << endl;
mOutputFile << "global_initialization;" << endl;
mOutputFile << "diary off;" << endl << "warning off;" << endl << endl;
mOutputFile << interfaces::delete_file(basename + ".log") << ";" << endl;
mOutputFile << "delete " << basename << ".log;" << endl;
mOutputFile << "warning on;" << endl << "warning backtrace;" << endl;
mOutputFile << "logname_ = '" << basename << ".log';" << endl;
mOutputFile << "diary '" << basename << ".log';" << endl;
......@@ -154,22 +153,19 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
{
if (model_tree.mode == eDLLMode)
{
mOutputFile << "if ";
mOutputFile << interfaces::file_exist(basename + "_static.c") << endl;
mOutputFile << "if exist('" << basename << "_static.c')" << endl;
mOutputFile << " clear " << basename << "_static" << endl;
mOutputFile << " " << interfaces::compile(basename +"_static.c") << endl;
mOutputFile << " mex -O " << basename << "_static.c" << endl;
mOutputFile << "end" << endl;
mOutputFile << "if ";
mOutputFile << interfaces::file_exist(basename + "_dynamic.c") << endl;
mOutputFile << "if exist('" << basename << "_dynamic.c')" << endl;
mOutputFile << " clear " << basename << "_dynamic" << endl;
mOutputFile << " " + interfaces::compile(basename+"_dynamic.c") << endl;
mOutputFile << " mex -O " << basename << "_dynamic.c" << endl;
mOutputFile << "end" << endl;
}
else
{
mOutputFile << "erase_compiled_function('" + basename +"_static');" << endl;
mOutputFile << "erase_compiled_function('" + basename +"_dynamic');" << endl;
mOutputFile << interfaces::load_model_function_files(basename);
}
}
......
This diff is collapsed.
......@@ -18,7 +18,6 @@
*/
#include "NumericalInitialization.hh"
#include "Interface.hh"
InitParamStatement::InitParamStatement(const string &param_name_arg,
const NodeID param_value_arg,
......@@ -80,10 +79,12 @@ InitValStatement::InitValStatement(const init_values_type &init_values_arg,
void
InitValStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << "\n" << interfaces::comment() << "INITVAL instructions \n"
<< interfaces::comment() << "\n";
output << "%" << endl
<< "% INITVAL instructions" << endl
<< "%" << endl;
// Writing initval block to set initial values for variables
output << "options_.initval_file = 0;\nendval_=0;\n";
output << "options_.initval_file = 0;" << endl
<< "endval_=0;" << endl;
if (symbol_table.recur_nbr > 0)
output << "recurs_ = zeros(" << symbol_table.recur_nbr << ", 1);\n";
......@@ -110,10 +111,14 @@ EndValStatement::EndValStatement(const init_values_type &init_values_arg,
void
EndValStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << "\n" << interfaces::comment() << "ENDVAL instructions\n"
<< interfaces::comment() << "\n";
output << "%" << endl
<< "% ENDVAL instructions" << endl
<< "%" << endl;
// Writing endval block to set terminal values for variables
output << "ys0_= oo_.steady_state;\nex0_ = oo_.exo_steady_state;\nrecurs0_ = recurs_;\nendval_ = 1;\n";
output << "ys0_= oo_.steady_state;" << endl
<< "ex0_ = oo_.exo_steady_state;" << endl
<< "recurs0_ = recurs_;" << endl
<< "endval_ = 1;" << endl;
writeInitValues(output);
}
......@@ -128,8 +133,9 @@ HistValStatement::HistValStatement(const hist_values_type &hist_values_arg,
void
HistValStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << "\n" << interfaces::comment() << "HISTVAL instructions\n"
<< interfaces::comment() << "\n";
output << "%" << endl
<< "% HISTVAL instructions" << endl
<< "%" << endl;
for(hist_values_type::const_iterator it = hist_values.begin();
it != hist_values.end(); it++)
......@@ -161,12 +167,11 @@ InitvalFileStatement::InitvalFileStatement(const string &filename_arg) :
void
InitvalFileStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << endl
<< interfaces::comment() << "INITVAL_FILE statement" << endl
<< interfaces::comment() << endl
<< "options_.initval_file = 1;" << endl;
output << "initvalf('" << filename << "');" << endl;
output << "%" << endl
<< "% INITVAL_FILE statement" << endl
<< "%" << endl
<< "options_.initval_file = 1;" << endl
<< "initvalf('" << filename << "');" << endl;
}
HomotopyStatement::HomotopyStatement(const homotopy_values_type &homotopy_values_arg,
......@@ -179,9 +184,9 @@ HomotopyStatement::HomotopyStatement(const homotopy_values_type &homotopy_values
void
HomotopyStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << endl
<< interfaces::comment() << "HOMOTOPY_SETUP instructions" << endl
<< interfaces::comment() << endl
output << "%" << endl
<< "% HOMOTOPY_SETUP instructions" << endl
<< "%" << endl
<< "options_.homotopy_values = [];" << endl;
for(homotopy_values_type::const_iterator it = homotopy_values.begin();
......
......@@ -22,7 +22,6 @@ using namespace std;
#include <iostream>
#include "Shocks.hh"
#include "Interface.hh"
AbstractShocksStatement::AbstractShocksStatement(bool mshocks_arg,
const det_shocks_type &det_shocks_arg,
......@@ -149,12 +148,12 @@ ShocksStatement::ShocksStatement(const det_shocks_type &det_shocks_arg,
void
ShocksStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << endl << interfaces::comment();
output << "SHOCKS instructions \n";
output << interfaces::comment() << "\n";
output << "%" << endl
<< "% SHOCKS instructions" << endl
<< "%" << endl;
// Write instruction that initializes a shock
output << "make_ex_;\n";
output << "make_ex_;" << endl;
writeDetShocks(output);
writeVarAndStdShocks(output);
......@@ -175,12 +174,12 @@ MShocksStatement::MShocksStatement(const det_shocks_type &det_shocks_arg,
void
MShocksStatement::writeOutput(ostream &output, const string &basename) const
{
output << interfaces::comment() << endl << interfaces::comment();
output << "SHOCKS instructions \n";
output << interfaces::comment() << "\n";
output << "%" << endl
<< "% SHOCKS instructions" << endl
<< "%" << endl;
// Write instruction that initializes a shock
output << "make_ex_;\n";
output << "make_ex_;" << endl;
writeDetShocks(output);
writeVarAndStdShocks(output);
......
......@@ -18,7 +18,6 @@
*/
#include "SymbolList.hh"
#include "Interface.hh"
void
SymbolList::addSymbol(const string &symbol)
......@@ -32,10 +31,7 @@ SymbolList::writeOutput(const string &varname, ostream &output) const
output << varname << "=[];" << endl;
for (vector<string>::const_iterator it = symbols.begin();
it != symbols.end(); it++)
{
output << varname << " = "
<< interfaces::strvcat(varname, "'" + *it + "'") << ";" << endl;
}
output << varname << " = strvcat(" << varname << ", '" << *it << "');" << endl;
}
void
......
......@@ -21,7 +21,6 @@
#include <sstream>
#include "SymbolTable.hh"
#include "Interface.hh"
SymbolTable::SymbolTable() : endo_nbr(0), exo_nbr(0), exo_det_nbr(0), recur_nbr(0),
parameter_nbr(0), model_local_variable_nbr(0),
......@@ -83,8 +82,8 @@ SymbolTable::writeOutput(ostream &output) const
output << "M_.exo_names_tex = '" << getTeXNameByID(eExogenous, 0) << "';" << endl;
for (int id = 1; id < exo_nbr; id++)
{
output << "M_.exo_names = " << interfaces::strvcat("M_.exo_names","'"+getNameByID(eExogenous, id)+"'") << ";" << endl;
output << "M_.exo_names_tex = " << interfaces::strvcat("M_.exo_names_tex","'"+getTeXNameByID(eExogenous, id)+"'") << ";" << endl;
output << "M_.exo_names = strvcat(M_.exo_names, '" << getNameByID(eExogenous, id) << "');" << endl
<< "M_.exo_names_tex = strvcat(M_.exo_names_tex, '" << getTeXNameByID(eExogenous, id) << "');" << endl;
}
}
if (exo_det_nbr > 0)
......@@ -93,8 +92,8 @@ SymbolTable::writeOutput(ostream &output) const
output << "lgxdet_tex_ = '" << getTeXNameByID(eExogenousDet, 0) << "';" << endl;
for (int id = 1; id < exo_det_nbr; id++)
{
output << "lgxdet_ = " << interfaces::strvcat("lgxdet_","'"+getNameByID(eExogenousDet, id)+"'") << ";" << endl;
output << "lgxdet_tex_ = " << interfaces::strvcat("lgxdet_tex_","'"+getTeXNameByID(eExogenousDet, id)+"'") << ";" << endl;
output << "lgxdet_ = srtvcat(lgxdet_, '" << getNameByID(eExogenousDet, id) << "');" << endl
<< "lgxdet_tex_ = strvcat(lgxdet_tex_, '" << getTeXNameByID(eExogenousDet, id) << "');" << endl;
}
}
if (endo_nbr > 0)
......@@ -103,8 +102,8 @@ SymbolTable::writeOutput(ostream &output) const
output << "M_.endo_names_tex = '" << getTeXNameByID(eEndogenous, 0) << "';" << endl;
for (int id = 1; id < endo_nbr; id++)
{
output << "M_.endo_names = " << interfaces::strvcat("M_.endo_names","'"+getNameByID(eEndogenous, id)+"'") << ";" << endl;
output << "M_.endo_names_tex = " << interfaces::strvcat("M_.endo_names_tex","'"+getTeXNameByID(eEndogenous, id)+"'") << ";" << endl;
output << "M_.endo_names = strvcat(M_.endo_names, '" << getNameByID(eEndogenous, id) << "');" << endl
<< "M_.endo_names_tex = strvcat(M_.endo_names_tex, '" << getTeXNameByID(eEndogenous, id) << "');" << endl;
}
}
if (recur_nbr > 0)
......@@ -113,8 +112,8 @@ SymbolTable::writeOutput(ostream &output) const
output << "M_.recur_names_tex = '" << getTeXNameByID(eRecursiveVariable, 0) << "';" << endl;
for (int id = 1; id < recur_nbr; id++)
{
output << "M_.recur_names = " << interfaces::strvcat("M_.recur_names","'"+getNameByID(eRecursiveVariable, id)+"'") << ";" << endl;
output << "M_.recur_names_tex = " << interfaces::strvcat("M_.recur_names_tex","'"+getTeXNameByID(eRecursiveVariable, id)+"'") << ";" << endl;
output << "M_.recur_names = strvcat(M_.recur_names, '" << getNameByID(eRecursiveVariable, id) << "');" << endl
<< "M_.recur_names_tex = strvcat(M_.recur_names_tex, '" << getTeXNameByID(eRecursiveVariable, id) << "');" << endl;
}
}
if (parameter_nbr > 0)
......@@ -123,8 +122,8 @@ SymbolTable::writeOutput(ostream &output) const
output << "M_.param_names_tex = '" << getTeXNameByID(eParameter, 0) << "';" << endl;
for (int id = 1; id < parameter_nbr; id++)
{
output << "M_.param_names = " << interfaces::strvcat("M_.param_names","'"+getNameByID(eParameter, id)+"'") << ";" << endl;
output << "M_.param_names_tex = " << interfaces::strvcat("M_.param_names_tex","'"+getTeXNameByID(eParameter, id)+"'") << ";" << endl;
output << "M_.param_names = strvcat(M_.param_names, '" << getNameByID(eParameter, id) << "');" << endl
<< "M_.param_names_tex = strvcat(M_.param_names_tex, '" << getTeXNameByID(eParameter, id) << "');" << endl;
}
}
......
/*
* Copyright (C) 2006-2008 Dynare Team
*
* This file is part of Dynare.
*
* Dynare 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.
*
* Dynare 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 Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _INTERFACE_HH
#define _INTERFACE_HH
using namespace std;
namespace interfaces
{
string comment();
string delete_file(string s);
string file_exist(string s);
string compile(string s);
string function_close();
string function_file_extension();
string strvcat(string s1, string s2);
string load_model_function_files(string filename);
}
#endif
function y=%s_2_s(a,b)
y = real(a) > real(b)
copy a:*.bin c:\dynare\scilab
copy a:*.sci c:\dynare\scilab
copy a:*.exe c:\dynare\scilab
copy a:names c:\dynare\scilab
copy a:lib c:\dynare\scilab
attrib -r c:\deamq\*
\ No newline at end of file
Copyright (C) 2001 Michel Juillard
function [d1]=bksupk(ny,fid,jcf,icc1)
d1=[];
// Copyright (C) 2001 Michel Juillard
//
global('ykmax_','iter_','c','ncc');
icf = 1:jcf-1;
ir = (iter_-1)*ny+1:ny*iter_;
irf = icc1+(iter_-1)*ny;
d1 = zeros(iter_*ny,1);
ofs = ((iter_-1)*ny+1-1)*ncc*8;
junk = mseek(ofs,fid,'set');
c = mtlb_fread(fid,[ncc,ny],'float64');
c = c';
%v = c(:,jcf)
d1(ir,1) = %v(:);
ir = ir-ny;
i = 2;
while i<=ykmax_|i<=iter_ then
irf1 = selif(irf,irf<iter_*ny);
ofs = ((iter_-i)*ny+1-1)*ncc*8;
junk = mseek(ofs,fid,'set');
c = mtlb_fread(fid,[ncc,ny],'float64');
c = c';
%v1 = c(:,jcf)-c(:,1:size(irf1,1))*d1(irf1)
d1(ir,1) = %v1(:);
ir = ir-ny;