Commit d1fc072a authored by sebastien's avatar sebastien

trunk korderpert: beautified code using uncrustify

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2702 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 2c3aa0c7
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__6D080F4C_4FEB_4290_90B5_6943DFBBE92A__INCLUDED_)
#define AFX_STDAFX_H__6D080F4C_4FEB_4290_90B5_6943DFBBE92A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#endif // _MSC_VER > 1000
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
//#endif // !defined(AFX_STDAFX_H__6D080F4C_4FEB_4290_90B5_6943DFBBE92A__INCLUDED_)
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__6D080F4C_4FEB_4290_90B5_6943DFBBE92A__INCLUDED_)
#define AFX_STDAFX_H__6D080F4C_4FEB_4290_90B5_6943DFBBE92A__INCLUDED_
#if _MSC_VER > 1000
# pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#endif // _MSC_VER > 1000
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
//#endif // !defined(AFX_STDAFX_H__6D080F4C_4FEB_4290_90B5_6943DFBBE92A__INCLUDED_)
This diff is collapsed.
This diff is collapsed.
......@@ -17,24 +17,24 @@
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
*/
// The following ifdef block is the standard way of creating macros which make exporting
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the K_ORDER_PERTURBATION_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// that uses this DLL. This way any other project whose source files include this file see
// K_ORDER_PERTURBATION_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef WINDOWS
#ifdef K_ORDER_PERTURBATION_EXPORTS
#define K_ORDER_PERTURBATION_API __declspec(dllexport)
#else
#define K_ORDER_PERTURBATION_API __declspec(dllimport)
#endif
#ifdef WINDOWS
# ifdef K_ORDER_PERTURBATION_EXPORTS
# define K_ORDER_PERTURBATION_API __declspec(dllexport)
# else
# define K_ORDER_PERTURBATION_API __declspec(dllimport)
# endif
#include "stdafx.h"
# include "stdafx.h"
#else
#include <dlfcn.h> // unix/linux DLL (.so) handling routines
# include <dlfcn.h> // unix/linux DLL (.so) handling routines
#endif
#include <string>
......@@ -46,26 +46,26 @@ typedef void *(DynamicFn)
#else // linux
typedef void (*DynamicFn)
#endif
(double *y, double *x, int nb_row_x, double *params,
(double *y, double *x, int nb_row_x, double *params,
int it_, double *residual, double *g1, double *g2);
//DynamicFn Dynamic;
typedef void *(mexFunctionPtr)(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]);
const int MAX_MODEL_NAME=100;
const int MAX_MODEL_NAME = 100;
/**
* creates pointer to Dynamic function inside <model>_dynamic.dll
* and handles calls to it.
**/
* creates pointer to Dynamic function inside <model>_dynamic.dll
* and handles calls to it.
**/
class DynamicModelDLL
{
private:
#ifdef WINDOWS
DynamicFn *Dynamic;// pointer to the Dynamic function in DLL
DynamicFn *Dynamic; // pointer to the Dynamic function in DLL
#else
DynamicFn Dynamic;// pointer to the Dynamic function in DLL
DynamicFn Dynamic; // pointer to the Dynamic function in DLL
#endif
const int length; // tot num vars = Num of Jacobian rows
const int jcols; // tot num var t-1, t and t+1 instances + exogs = Num of Jacobian columns
......@@ -74,35 +74,39 @@ private:
// const char * sExt; // dynamic file extension: dll, mexw32, ...
#ifdef WINDOWS
HINSTANCE dynamicHinstance; // DLL instance pointer in Windows
# else // linux
void * dynamicHinstance ; // and in Linux
#else // linux
void *dynamicHinstance; // and in Linux
#endif
public:
// construct and load Dynamic model DLL
DynamicModelDLL(const char* fname, const int length,const int jcols,
const int nMax_lag, const int nExog, const char * sExt);
virtual ~DynamicModelDLL(){close();};
// construct and load Dynamic model DLL
DynamicModelDLL(const char *fname, const int length, const int jcols,
const int nMax_lag, const int nExog, const char *sExt);
virtual ~DynamicModelDLL()
{
close();
};
// evaluate Dynamic model DLL
void eval(double *y, double *x, int nb_row_x, double *params,
int it_, double *residual, double *g1, double *g2){
void
eval(double *y, double *x, int nb_row_x, double *params,
int it_, double *residual, double *g1, double *g2)
{
Dynamic(y, x, nb_row_x, params, it_, residual, g1, g2);
};
void eval(const Vector&y, const Vector&x, const Vector* params,
Vector&residual, TwoDMatrix*g1, TwoDMatrix*g2);
void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
int it_, Vector&residual, TwoDMatrix*g1, TwoDMatrix*g2);
void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
Vector& residual, TwoDMatrix *g1, TwoDMatrix *g2);
// void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
void eval(const Vector &y, const Vector &x, const Vector *params,
Vector &residual, TwoDMatrix *g1, TwoDMatrix *g2);
void eval(const Vector &y, const TwoDMatrix &x, const Vector *params,
int it_, Vector &residual, TwoDMatrix *g1, TwoDMatrix *g2);
void eval(const Vector &y, const TwoDMatrix &x, const Vector *params,
Vector &residual, TwoDMatrix *g1, TwoDMatrix *g2);
// void eval(const Vector&y, const TwoDMatrix&x, const Vector* params,
// Vector& residual, double *g1, double *g2);
// close DLL: If the referenced object was successfully closed,
// close DLL: If the referenced object was successfully closed,
// close() returns 0, non 0 otherwise
int close();
};
// convert Matlab endo and exo names array to C type array of strings
const char ** DynareMxArrayToString(const mxArray * mxFldp, const int len, const int width );
const char ** DynareMxArrayToString(const char * cArray, const int len, const int width );
const char **DynareMxArrayToString(const mxArray *mxFldp, const int len, const int width);
const char **DynareMxArrayToString(const char *cArray, const int len, const int width);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment