SWZ: centralize mex changes, remove unused functions
parent
a1ade98209
commit
f2e2f68223
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2010 Dynare Team
|
* Copyright (C) 2010-2011 Dynare Team
|
||||||
*
|
*
|
||||||
* This file is part of Dynare.
|
* This file is part of Dynare.
|
||||||
*
|
*
|
||||||
|
@ -17,51 +17,23 @@
|
||||||
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
* along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
|
||||||
#include <dynmex.h>
|
#include <dynmex.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
int constant_seed;
|
int constant_seed;
|
||||||
|
|
||||||
void
|
|
||||||
ms_fprintf_err(char *str, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, str);
|
|
||||||
|
|
||||||
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
|
||||||
mexPrintf(str, ap);
|
|
||||||
#else
|
|
||||||
vfprintf(stderr, str, ap);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
msExit(int status)
|
msExit(int status)
|
||||||
{
|
{
|
||||||
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
|
||||||
throw "Error in MS-SBVAR MEX file.\n";
|
throw "Error in MS-SBVAR MEX file.\n";
|
||||||
#else
|
|
||||||
exit(status);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
|
@ -20,42 +20,26 @@
|
||||||
#ifndef _MEXMOD
|
#ifndef _MEXMOD
|
||||||
#define _MEXMOD
|
#define _MEXMOD
|
||||||
|
|
||||||
void ms_exit(int status);
|
|
||||||
void ms_fprintf_err(const char * str, ...);
|
|
||||||
extern int constant_seed;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
|
||||||
|
|
||||||
#include <dynmex.h>
|
#include <dynmex.h>
|
||||||
#include <dynblas.h>
|
#include <dynblas.h>
|
||||||
#include <dynlapack.h>
|
#include <dynlapack.h>
|
||||||
#include <mat.h>
|
|
||||||
|
|
||||||
#define msMalloc mxMalloc
|
#define dw_malloc(n) mxMalloc(n)
|
||||||
#define msCalloc mxCalloc
|
#define dw_calloc(n) mxCalloc(n)
|
||||||
#define msRealloc mxRealloc
|
#define dw_realloc(buffer,n) mxRealloc(buffer,n)
|
||||||
#define msFree mxFree
|
#define dw_free(buffer) mxFree(buffer)
|
||||||
|
#define dw_exit(n) msExit(n)
|
||||||
|
|
||||||
|
void msExit(int status);
|
||||||
|
extern int constant_seed;
|
||||||
|
|
||||||
|
/* Write Matlab Output */
|
||||||
mxArray *globalMatlabStruct;
|
mxArray *globalMatlabStruct;
|
||||||
|
|
||||||
#ifndef _MEXWRITE
|
|
||||||
#define _MEXWRITE
|
|
||||||
|
|
||||||
void mex_write_to_matlab_matfile(double *, int, int, const char *, const char *);
|
void mex_write_to_matlab_matfile(double *, int, int, const char *, const char *);
|
||||||
void mex_write_to_matlab_global_struct(double *, int, int, const char *);
|
void mex_write_to_matlab_global_struct(double *, int, int, const char *);
|
||||||
mxArray *getMxArray(double *, int, int);
|
mxArray *getMxArray(double *, int, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define ms_fprintf_stdout printf
|
|
||||||
#define msMalloc malloc
|
|
||||||
#define msCalloc calloc
|
|
||||||
#define msRealloc realloc
|
|
||||||
#define msFree free
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue