Skip to content

Commit 45c9af2

Browse files
committed
removed python compatibility
1 parent 36bd74a commit 45c9af2

File tree

4 files changed

+18
-36
lines changed

4 files changed

+18
-36
lines changed

src/fread.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static inline int iminInt( int a, int b) { return a < b ? a : b; }
200200
/** Return value of `x` clamped to the range [upper, lower] */
201201
static inline int64_t clamp_i64t(int64_t x, int64_t lower, int64_t upper)
202202
{
203-
return x < lower ? lower : x > upper? upper : x;
203+
return x < lower ? lower : x > upper ? upper : x;
204204
}
205205

206206

@@ -2363,10 +2363,8 @@ int freadMain(freadMainArgs _args)
23632363
.threadn = me,
23642364
.quoteRule = quoteRule,
23652365
.stopTeam = &stopTeam,
2366-
#ifndef DTPY
23672366
.nStringCols = nStringCols,
23682367
.nNonStringCols = nNonStringCols
2369-
#endif
23702368
};
23712369
if ((rowSize8 && !ctx.buff8) || (rowSize4 && !ctx.buff4) || (rowSize1 && !ctx.buff1)) {
23722370
stopTeam = true;

src/fread.h

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,11 @@
55
#include <stdlib.h> // size_t
66
#include <stdbool.h> // bool
77
#include "myomp.h"
8-
#ifdef DTPY
9-
#include "py_fread.h"
10-
#define ENC2NATIVE(s) (s)
11-
#else
12-
#include "freadR.h"
13-
extern cetype_t ienc;
14-
// R's message functions only take C's char pointer not SEXP, where encoding info can't be stored
15-
// so must convert the error message char to native encoding first in order to correctly display in R
16-
#define ENC2NATIVE(s) translateChar(mkCharCE(s, ienc))
17-
#endif
8+
#include "freadR.h"
9+
extern cetype_t ienc;
10+
// R's message functions only take C's char pointer not SEXP, where encoding info can't be stored
11+
// so must convert the error message char to native encoding first in order to correctly display in R
12+
#define ENC2NATIVE(s) translateChar(mkCharCE(s, ienc))
1813

1914
// Ordered hierarchy of types
2015
// Each of these corresponds to a parser; they must be ordered "preferentially", i.e., if the same
@@ -173,7 +168,7 @@ typedef struct freadMainArgs
173168
char _padding[1];
174169

175170
// Any additional implementation-specific parameters.
176-
FREAD_MAIN_ARGS_EXTRA_FIELDS
171+
bool oldNoDateTime;
177172

178173
} freadMainArgs;
179174

@@ -219,8 +214,8 @@ typedef struct ThreadLocalFreadParsingContext
219214

220215
int quoteRule;
221216

222-
// Any additional implementation-specific parameters.
223-
FREAD_PUSH_BUFFERS_EXTRA_FIELDS
217+
int nStringCols;
218+
int nNonStringCols;
224219

225220
} ThreadLocalFreadParsingContext;
226221

src/freadR.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@
77
#include <Rinternals.h>
88
#include "po.h"
99

10-
#define FREAD_MAIN_ARGS_EXTRA_FIELDS \
11-
bool oldNoDateTime;
12-
13-
#define FREAD_PUSH_BUFFERS_EXTRA_FIELDS \
14-
int nStringCols; \
15-
int nNonStringCols;
16-
1710
// Before error() [or warning() with options(warn=2)] call freadCleanup() to close mmp and fix :
1811
// http://stackoverflow.com/questions/18597123/fread-data-table-locks-files
1912
// However, msg has to be manually constructed first (rather than simply leaving construction to snprintf inside warning()

src/fwrite.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
#ifdef DTPY
2-
#include "py_fread.h"
3-
#else
4-
#ifndef STRICT_R_HEADERS
5-
#define STRICT_R_HEADERS
6-
#endif
7-
#include <R.h>
8-
#include <Rinternals.h> // for SEXP in writeList() prototype
9-
#include "po.h"
10-
#define STOP error
11-
#define DTPRINT Rprintf
12-
static char internal_error_buff[256] __attribute__((unused)); // todo: fix imports such that compiler warns correctly #6468
13-
#define INTERNAL_STOP(...) do {snprintf(internal_error_buff, sizeof(internal_error_buff), __VA_ARGS__); error("%s %s: %s. %s", _("Internal error in"), __func__, internal_error_buff, _("Please report to the data.table issues tracker"));} while (0)
1+
#ifndef STRICT_R_HEADERS
2+
#define STRICT_R_HEADERS
143
#endif
4+
#include <R.h>
5+
#include <Rinternals.h> // for SEXP in writeList() prototype
6+
#include "po.h"
7+
#define STOP error
8+
#define DTPRINT Rprintf
9+
static char internal_error_buff[256] __attribute__((unused)); // todo: fix imports such that compiler warns correctly #6468
10+
#define INTERNAL_STOP(...) do {snprintf(internal_error_buff, sizeof(internal_error_buff), __VA_ARGS__); error("%s %s: %s. %s", _("Internal error in"), __func__, internal_error_buff, _("Please report to the data.table issues tracker"));} while (0)
1511

1612
typedef void writer_fun_t(const void *, int64_t, char **);
1713

0 commit comments

Comments
 (0)