Skip to content

Commit

Permalink
Merge 2f9fa60 into 2616792
Browse files Browse the repository at this point in the history
  • Loading branch information
goulart-paul committed Sep 6, 2019
2 parents 2616792 + 2f9fa60 commit 34f4a18
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions include/glob_opts.h
Expand Up @@ -120,33 +120,13 @@ typedef float c_float; /* for numerical values */

# endif // end EMBEDDED


# ifdef PRINTING
# include <stdio.h>
# include <string.h>

/* informational print function */
# ifdef MATLAB
# define c_print mexPrintf

// The following trick slows down the performance a lot. Since many solvers
// actually
// call mexPrintf and immediately force print buffer flush
// otherwise messages don't appear until solver termination
// ugly because matlab does not provide a vprintf mex interface
// #include <stdarg.h>
// static int c_print(char *msg, ...)
// {
// va_list argList;
// va_start(argList, msg);
// //message buffer
// int bufferSize = 256;
// char buffer[bufferSize];
// vsnprintf(buffer,bufferSize-1, msg, argList);
// va_end(argList);
// int out = mexPrintf(buffer); //print to matlab display
// mexEvalString("drawnow;"); // flush matlab print buffer
// return out;
// }
# elif defined PYTHON
# include <Python.h>
# define c_print PySys_WriteStdout
Expand All @@ -155,11 +135,17 @@ typedef float c_float; /* for numerical values */
# define c_print Rprintf
# else /* ifdef MATLAB */
# define c_print printf
# endif /* ifdef MATLAB */

/* Print error macro */
# define c_eprint(...) c_print("ERROR in %s: ", __FUNCTION__); c_print(\
__VA_ARGS__); c_print("\n");
# endif /* c_print configuration */

/* error printing function */
# ifdef R_LANG
/* Some CRAN builds complain about __VA_ARGS__, so just print */
/* out the error messages on R without the __FUNCTION__ trace */
# define c_eprint Rprintf
# else
# define c_eprint(...) c_print("ERROR in %s: ", __FUNCTION__); \
c_print(__VA_ARGS__); c_print("\n");
# endif /* c_eprint configuration */

# endif /* PRINTING */

Expand Down

0 comments on commit 34f4a18

Please sign in to comment.