1 #ifndef dt_FREAD_R_H
2 #define dt_FREAD_R_H
3 #define STRICT_R_HEADERS   // https://cran.r-project.org/doc/manuals/r-devel/R-exts.html#Error-handling
4 #include <R.h>
5 #include <Rinternals.h>
6 #include "po.h"
7 
8 #define FREAD_MAIN_ARGS_EXTRA_FIELDS \
9   bool oldNoDateTime;
10 
11 #define FREAD_PUSH_BUFFERS_EXTRA_FIELDS \
12   int nStringCols; \
13   int nNonStringCols;
14 
15 // Before error() [or warning() with options(warn=2)] call freadCleanup() to close mmp and fix :
16 //   http://stackoverflow.com/questions/18597123/fread-data-table-locks-files
17 // However, msg has to be manually constructed first (rather than simply leaving construction to snprintf inside warning()
18 // or error()) because the msg usually points to substrings from the mmp (which is invalid after close).
19 // Where no halt is happening, we can just use raw Rprintf() or warning()
20 void __halt(bool warn, const char *format, ...);   // see freadR.c
21 #define STOP(...)   __halt(0, __VA_ARGS__)
22 #define DTPRINT     Rprintf
23 #define DTWARN(...) warningsAreErrors ? __halt(1, __VA_ARGS__) : warning(__VA_ARGS__)
24 
25 #endif
26 
27