Commit 3aa88765 authored by sebastien's avatar sebastien

Beautified preprocessor code (uncrustify + emacs + manual adjustments, in...

Beautified preprocessor code (uncrustify + emacs + manual adjustments, in particular with templates in MacroValue)

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3249 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 160ec5d7
......@@ -29,11 +29,11 @@
# include "linbcg.hh"
#endif
#ifdef BYTE_CODE
#ifndef DEBUG_EX
#include "mex.h"
#else
#include "mex_interface.hh"
#endif
# ifndef DEBUG_EX
# include "mex.h"
# else
# include "mex_interface.hh"
# endif
#endif
#ifdef _MSC_VER
......@@ -52,9 +52,9 @@ typedef unsigned __int64 uint64_t;
using namespace std;
/**
* \enum Tags
* \brief The differents flags of the bytecode
*/
* \enum Tags
* \brief The differents flags of the bytecode
*/
enum Tags
{
FLDZ, //!< Stores zero in the stack - 0
......@@ -95,8 +95,7 @@ enum Tags
FOK //!< Used for debugging purpose - 1B
};
};
enum BlockType
{
......@@ -114,8 +113,6 @@ enum EquationType
E_SOLVE //!< No simple evaluation of the equation, it has to be solved
};
enum BlockSimulationType
{
UNKNOWN, //!< Unknown simulation type
......@@ -188,10 +185,10 @@ enum TrinaryOpcode
oNormcdf
};
struct Block_contain_type
{
int Equation, Variable, Own_Derivative;
};
struct Block_contain_type
{
int Equation, Variable, Own_Derivative;
};
#pragma pack(push, 1)
class TagWithoutArgument
......@@ -199,8 +196,14 @@ class TagWithoutArgument
protected:
uint8_t op_code;
public:
inline TagWithoutArgument(uint8_t op_code_arg) : op_code(op_code_arg) {};
inline void write(ostream &CompileCode) {CompileCode.write(reinterpret_cast<char *>(this), sizeof(*this)); };
inline TagWithoutArgument(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
inline void
write(ostream &CompileCode)
{
CompileCode.write(reinterpret_cast<char *>(this), sizeof(*this));
};
};
template < class T1 >
......@@ -210,9 +213,17 @@ protected:
uint8_t op_code;
T1 arg1;
public:
inline TagWithOneArgument(uint8_t op_code_arg) : op_code(op_code_arg) {};
inline TagWithOneArgument(uint8_t op_code_arg, T1 arg_arg1) : op_code(op_code_arg), arg1(arg_arg1) {};
inline void write(ostream &CompileCode) {CompileCode.write(reinterpret_cast<char *>(this), sizeof(TagWithOneArgument)); };
inline TagWithOneArgument(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
inline TagWithOneArgument(uint8_t op_code_arg, T1 arg_arg1) : op_code(op_code_arg), arg1(arg_arg1)
{
};
inline void
write(ostream &CompileCode)
{
CompileCode.write(reinterpret_cast<char *>(this), sizeof(TagWithOneArgument));
};
};
template < class T1, class T2 >
......@@ -223,9 +234,17 @@ protected:
T1 arg1;
T2 arg2;
public:
inline TagWithTwoArguments(uint8_t op_code_arg) : op_code(op_code_arg) {};
inline TagWithTwoArguments(uint8_t op_code_arg, T1 arg_arg1, T2 arg_arg2) : op_code(op_code_arg), arg1(arg_arg1), arg2(arg_arg2) {};
inline void write(ostream &CompileCode) {CompileCode.write(reinterpret_cast<char *>(this), sizeof(*this)); };
inline TagWithTwoArguments(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
inline TagWithTwoArguments(uint8_t op_code_arg, T1 arg_arg1, T2 arg_arg2) : op_code(op_code_arg), arg1(arg_arg1), arg2(arg_arg2)
{
};
inline void
write(ostream &CompileCode)
{
CompileCode.write(reinterpret_cast<char *>(this), sizeof(*this));
};
};
template < class T1, class T2, class T3 >
......@@ -237,238 +256,458 @@ protected:
T2 arg2;
T3 arg3;
public:
inline TagWithThreeArguments(uint8_t op_code_arg) : op_code(op_code_arg) {};
inline TagWithThreeArguments(uint8_t op_code_arg, T1 arg_arg1, T2 arg_arg2, T3 arg_arg3) : op_code(op_code_arg), arg1(arg_arg1), arg2(arg_arg2), arg3(arg_arg3) {};
inline void write(ostream &CompileCode) {CompileCode.write(reinterpret_cast<char *>(this), sizeof(*this)); };
inline TagWithThreeArguments(uint8_t op_code_arg) : op_code(op_code_arg)
{
};
inline TagWithThreeArguments(uint8_t op_code_arg, T1 arg_arg1, T2 arg_arg2, T3 arg_arg3) : op_code(op_code_arg), arg1(arg_arg1), arg2(arg_arg2), arg3(arg_arg3)
{
};
inline void
write(ostream &CompileCode)
{
CompileCode.write(reinterpret_cast<char *>(this), sizeof(*this));
};
};
class FLDZ_ : public TagWithoutArgument
{
public:
inline FLDZ_() : TagWithoutArgument(FLDZ) {};
inline FLDZ_() : TagWithoutArgument(FLDZ)
{
};
};
class FEND_ : public TagWithoutArgument
{
public:
inline FEND_() : TagWithoutArgument(FEND) {};
inline FEND_() : TagWithoutArgument(FEND)
{
};
};
class FENDBLOCK_ : public TagWithoutArgument
{
public:
inline FENDBLOCK_() : TagWithoutArgument(FENDBLOCK) {};
inline FENDBLOCK_() : TagWithoutArgument(FENDBLOCK)
{
};
};
class FENDEQU_ : public TagWithoutArgument
{
public:
inline FENDEQU_() : TagWithoutArgument(FENDEQU) {};
inline FENDEQU_() : TagWithoutArgument(FENDEQU)
{
};
};
class FCUML_ : public TagWithoutArgument
{
public:
inline FCUML_() : TagWithoutArgument(FCUML) {};
inline FCUML_() : TagWithoutArgument(FCUML)
{
};
};
class FDIMT_ : public TagWithOneArgument<unsigned int>
{
public:
inline FDIMT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMT) {};
inline FDIMT_(unsigned int size_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMT,size_arg) {};
inline unsigned int get_size() {return arg1;};
inline FDIMT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMT)
{
};
inline FDIMT_(unsigned int size_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMT, size_arg)
{
};
inline unsigned int
get_size()
{
return arg1;
};
};
class FDIMST_ : public TagWithOneArgument<unsigned int>
{
public:
inline FDIMST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMST) {};
inline FDIMST_(const unsigned int size_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMST,size_arg) {};
inline unsigned int get_size() {return arg1;};
inline FDIMST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMST)
{
};
inline FDIMST_(const unsigned int size_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FDIMST, size_arg)
{
};
inline unsigned int
get_size()
{
return arg1;
};
};
class FLDC_ : public TagWithOneArgument<double>
{
public:
inline FLDC_() : TagWithOneArgument<double>::TagWithOneArgument(FLDC) {};
inline FLDC_(const double value_arg) : TagWithOneArgument<double>::TagWithOneArgument(FLDC,value_arg) {};
inline double get_value() {return arg1;};
inline FLDC_() : TagWithOneArgument<double>::TagWithOneArgument(FLDC)
{
};
inline FLDC_(const double value_arg) : TagWithOneArgument<double>::TagWithOneArgument(FLDC, value_arg)
{
};
inline double
get_value()
{
return arg1;
};
};
class FLDU_ : public TagWithOneArgument<unsigned int>
{
public:
inline FLDU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDU) {};
inline FLDU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDU,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FLDU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDU)
{
};
inline FLDU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDU, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FLDSU_ : public TagWithOneArgument<unsigned int>
{
public:
inline FLDSU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDSU) {};
inline FLDSU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDSU,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FLDSU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDSU)
{
};
inline FLDSU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDSU, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FLDR_ : public TagWithOneArgument<unsigned int>
{
public:
inline FLDR_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDR) {};
inline FLDR_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDR,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FLDR_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDR)
{
};
inline FLDR_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDR, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FLDT_ : public TagWithOneArgument<unsigned int>
{
public:
inline FLDT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDT) {};
inline FLDT_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDT,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FLDT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDT)
{
};
inline FLDT_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDT, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FLDST_ : public TagWithOneArgument<unsigned int>
{
public:
inline FLDST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDST) {};
inline FLDST_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDST,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FLDST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDST)
{
};
inline FLDST_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FLDST, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FSTPT_ : public TagWithOneArgument<unsigned int>
{
public:
inline FSTPT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPT) {};
inline FSTPT_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPT,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FSTPT_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPT)
{
};
inline FSTPT_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPT, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FSTPST_ : public TagWithOneArgument<unsigned int>
{
public:
inline FSTPST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPST) {};
inline FSTPST_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPST,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FSTPST_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPST)
{
};
inline FSTPST_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPST, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FSTPR_ : public TagWithOneArgument<unsigned int>
{
public:
inline FSTPR_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPR) {};
inline FSTPR_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPR,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FSTPR_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPR)
{
};
inline FSTPR_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPR, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FSTPU_ : public TagWithOneArgument<unsigned int>
{
public:
inline FSTPU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPU) {};
inline FSTPU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPU,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FSTPU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPU)
{
};
inline FSTPU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPU, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FSTPSU_ : public TagWithOneArgument<unsigned int>
{
public:
inline FSTPSU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPSU) {};
inline FSTPSU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPSU,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FSTPSU_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPSU)
{
};
inline FSTPSU_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPSU, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FSTPG_ : public TagWithOneArgument<unsigned int>
{
public:
inline FSTPG_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPG,0) {};
inline FSTPG_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPG,pos_arg) {};
inline unsigned int get_pos() {return arg1;};
inline FSTPG_() : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPG, 0)
{
};
inline FSTPG_(const unsigned int pos_arg) : TagWithOneArgument<unsigned int>::TagWithOneArgument(FSTPG, pos_arg)
{
};
inline unsigned int
get_pos()
{
return arg1;
};
};
class FUNARY_ : public TagWithOneArgument<uint8_t>
{
public:
inline FUNARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FUNARY) {};
inline FUNARY_(uint8_t op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FUNARY,op_type_arg) {};
inline uint8_t get_op_type() {return arg1;};
inline FUNARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FUNARY)
{
};
inline FUNARY_(uint8_t op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FUNARY, op_type_arg)
{
};
inline uint8_t
get_op_type()
{
return arg1;
};
};
class FBINARY_ : public TagWithOneArgument<uint8_t>
{
public:
inline FBINARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FBINARY) {};
inline FBINARY_(const int op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FBINARY,op_type_arg) {};
inline uint8_t get_op_type() {return arg1;};
inline FBINARY_() : TagWithOneArgument<uint8_t>::TagWithOneArgument(FBINARY)
{
};
inline FBINARY_(const int op_type_arg) : TagWithOneArgument<uint8_t>::TagWithOneArgument(FBINARY, op_type_arg)
{
};
inline uint8_t
get_op_type()
{
return arg1;
};
};
class FOK_ : public TagWithOneArgument<int>
{
public:
inline FOK_() : TagWithOneArgument<int>::TagWithOneArgument(FOK) {};
inline FOK_(const int arg_arg) : TagWithOneArgument<int>::TagWithOneArgument(FOK,arg_arg) {};
inline int get_arg() {return arg1;};
inline FOK_() : TagWithOneArgument<int>::TagWithOneArgument(FOK)
{
};
inline FOK_(const int arg_arg) : TagWithOneArgument<int>::TagWithOneArgument(FOK, arg_arg)
{
};
inline int
get_arg()
{
return arg1;
};
};
class FLDVS_ : public TagWithTwoArguments<uint8_t, unsigned int>
{
public:
inline FLDVS_() : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDVS) {};
inline FLDVS_(uint8_t type_arg, const unsigned int pos_arg) : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDVS, type_arg, pos_arg) {};
inline uint8_t get_type() {return arg1;};
inline unsigned int get_pos() {return arg2;};
inline FLDVS_() : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDVS)
{
};
inline FLDVS_(uint8_t type_arg, const unsigned int pos_arg) : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDVS, type_arg, pos_arg)
{
};
inline uint8_t
get_type()
{
return arg1;
};
inline unsigned int
get_pos()
{
return arg2;
};
};
class FLDSV_ : public TagWithTwoArguments<uint8_t, unsigned int>
{
public:
inline FLDSV_() : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDSV) {};
inline FLDSV_() : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDSV)
{
};
inline FLDSV_(const uint8_t type_arg, const unsigned int pos_arg) :
TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDSV, type_arg, pos_arg) {};
inline uint8_t get_type() {return arg1;};
inline unsigned int get_pos() {return arg2;};
TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FLDSV, type_arg, pos_arg)
{
};
inline uint8_t
get_type()
{
return arg1;
};
inline unsigned int
get_pos()
{
return arg2;
};
};
class FSTPSV_ : public TagWithTwoArguments<uint8_t, unsigned int>
{
public:
inline FSTPSV_() : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FSTPSV) {};
inline FSTPSV_() : TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FSTPSV)
{
};
inline FSTPSV_(const uint8_t type_arg, const unsigned int pos_arg) :
TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FSTPSV, type_arg, pos_arg) {};
inline uint8_t get_type() {return arg1;};
inline unsigned int get_pos() {return arg2;};
TagWithTwoArguments<uint8_t, unsigned int>::TagWithTwoArguments(FSTPSV, type_arg, pos_arg)
{
};
inline uint8_t
get_type()
{
return arg1;
};
inline unsigned int
get_pos()
{
return arg2;
};
};
class FLDV_ : public TagWithThreeArguments<uint8_t, unsigned int, int>
{
public:
inline FLDV_() : TagWithThreeArguments<uint8_t, unsigned int, int>::TagWithThreeArguments(FLDV) {};
inline FLDV_() : TagWithThreeArguments<uint8_t, unsigned int, int>::TagWithThreeArguments(FLDV)
{
};
inline FLDV_(const int type_arg, const unsigned int pos_arg) :
TagWithThreeArguments<uint8_t, unsigned int, int>::TagWithThreeArguments(FLDV, type_arg, pos_arg, 0) {};
TagWithThreeArguments<uint8_t, unsigned int, int>::TagWithThreeArguments(FLDV, type_arg, pos_arg, 0)
{
};
inline FLDV_(const int type_arg, const unsigned int pos_arg, const int lead_lag_arg) :
TagWithThreeArguments<uint8_t, unsigned int, int>::TagWithThreeArguments(FLDV, type_arg, pos_arg, lead_lag_arg) {};
inline uint8_t get_type() {return arg1;};
inline unsigned int get_pos() {return arg2;};
inline int get_lead_lag() {return arg3;};
TagWithThreeArguments<uint8_t, unsigned int, int>::TagWithThreeArguments(FLDV, type_arg, pos_arg, lead_lag_arg)