Changeset: 957fda19fb4e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=957fda19fb4e
Modified Files:
        clients/R/MonetDB.R/src/mapisplit.c
Branch: default
Log Message:

R Connector: separated out MAPI code


diffs (66 lines):

diff --git a/clients/R/MonetDB.R/src/mapisplit.c 
b/clients/R/MonetDB.R/src/mapisplit.c
--- a/clients/R/MonetDB.R/src/mapisplit.c
+++ b/clients/R/MonetDB.R/src/mapisplit.c
@@ -2,9 +2,6 @@
 #include <string.h>
 #include <errno.h>
 
-#include <R.h>
-#include <Rdefines.h>
-
 typedef enum {
        INQUOTES, ESCAPED, INTOKEN, INCRAP
 } mapi_line_chrstate;
@@ -79,52 +76,3 @@ void mapi_line_split(char* line, char** 
                }
        }
 }
-
-char nullstr[] = "NULL";
-
-SEXP mapi_split(SEXP mapiLinesVector, SEXP numCols) {
-       assert(TYPEOF(mapiLinesVector) == CHARSXP);
-
-       int cols = INTEGER_POINTER(AS_INTEGER(numCols))[0];
-       int rows = LENGTH(mapiLinesVector);
-
-       assert(rows > 0);
-       assert(cols > 0);
-
-       SEXP colVec;
-       PROTECT(colVec = NEW_LIST(cols));
-
-       int col;
-       for (col = 0; col < cols; col++) {
-               SEXP colV = PROTECT(NEW_STRING(rows));
-               assert(TYPEOF(colV) == STRSXP);
-               SET_ELEMENT(colVec, col, colV);
-               UNPROTECT(1);
-       }
-
-       int cRow;
-       int cCol;
-       char* elems[cols];
-
-       for (cRow = 0; cRow < rows; cRow++) {
-               const char *rval = CHAR(STRING_ELT(mapiLinesVector, cRow));
-               char *val = strdup(rval);
-               cCol = 0;
-               mapi_line_split(val, elems, cols);
-
-               for (cCol = 0; cCol < cols; cCol++) {
-                       SEXP colV = VECTOR_ELT(colVec, cCol);
-                       size_t tokenLen = strlen(elems[cCol]);
-                       if (tokenLen < 1 || strcmp(elems[cCol], nullstr) == 0) {
-                               SET_STRING_ELT(colV, cRow, NA_STRING);
-                       }
-                       else {
-                               SET_STRING_ELT(colV, cRow, 
mkCharLen(elems[cCol], tokenLen));
-                       }
-               }
-               free(val);
-       }
-
-       UNPROTECT(1);
-       return colVec;
-}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to