@@ -59,7 +59,7 @@ static bool notFirst=false;
5959static char msg [1001 ];
6060// use STOP in this file (not error()) to ensure cleanup() is called first
6161// snprintf to msg first in case nrow (just as an example) is provided in the message because cleanup() sets nrow to 0
62- #define STOP (...) do {snprintf(msg, 1000, __VA_ARGS__); cleanup(); error("%s", msg);} while(0) // http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon
62+ #define STOP (...) do {snprintf(msg, 1000, __VA_ARGS__); cleanup(); error("%s", msg);} while(0) // # notranslate. http://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html#Swallowing-the-Semicolon
6363
6464#undef warning
6565#define warning (...) Do not use warning in this file // since it can be turned to error via warn=2
@@ -511,7 +511,7 @@ SEXP forder(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP sortGroupsA
511511 STOP (_ ("retStats must be TRUE or FALSE" )); // # nocov # covered in reuseSorting forder
512512 retstats = LOGICAL (retStatsArg )[0 ]== TRUE;
513513 if (!retstats && retgrp )
514- error ("retStats must be TRUE whenever retGrp is TRUE" ); // # nocov # covered in reuseSorting forder
514+ error (_ ( "retStats must be TRUE whenever retGrp is TRUE" ) ); // # nocov # covered in reuseSorting forder
515515 if (!IS_TRUE_OR_FALSE (sortGroupsArg ))
516516 STOP (_ ("sort must be TRUE or FALSE" )); // # nocov # covered in reuseSorting forder
517517 sortType = LOGICAL (sortGroupsArg )[0 ]== TRUE; // if sortType is 1, it is later flipped between +1/-1 according to ascArg. Otherwise ascArg is ignored when sortType==0
@@ -1619,7 +1619,7 @@ void putIndex(SEXP x, SEXP cols, SEXP o) {
16191619bool GetUseIndex (void ) {
16201620 SEXP opt = GetOption (install ("datatable.use.index" ), R_NilValue );
16211621 if (!IS_TRUE_OR_FALSE (opt ))
1622- error ("'datatable.use.index' option must be TRUE or FALSE" ); // # nocov
1622+ error (_ ( "'datatable.use.index' option must be TRUE or FALSE" ) ); // # nocov
16231623 return LOGICAL (opt )[0 ];
16241624}
16251625
@@ -1632,7 +1632,7 @@ bool GetAutoIndex(void) {
16321632 if (isNull (opt ))
16331633 return false;
16341634 if (!IS_TRUE_OR_FALSE (opt ))
1635- error ("'datatable.forder.auto.index' option must be TRUE or FALSE" ); // # nocov
1635+ error (_ ( "'datatable.forder.auto.index' option must be TRUE or FALSE" ) ); // # nocov
16361636 return LOGICAL (opt )[0 ];
16371637}
16381638
@@ -1649,25 +1649,25 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
16491649 if (verbose )
16501650 tic = omp_get_wtime ();
16511651 if (isNull (DT ))
1652- error ("DT is NULL" );
1652+ error (_ ( "DT is NULL" ) );
16531653 if (!IS_TRUE_OR_FALSE (retGrpArg ))
1654- error ("retGrp must be TRUE or FALSE" );
1654+ error (_ ( "retGrp must be TRUE or FALSE" ) );
16551655 bool retGrp = (bool )LOGICAL (retGrpArg )[0 ];
16561656 if (!IS_TRUE_OR_FALSE (retStatsArg ))
1657- error ("retStats must be TRUE or FALSE" );
1657+ error (_ ( "retStats must be TRUE or FALSE" ) );
16581658 bool retStats = (bool )LOGICAL (retStatsArg )[0 ];
16591659 if (!retStats && retGrp )
1660- error ("retStats must be TRUE whenever retGrp is TRUE" ); // retStats doesnt cost anything and it will be much easier to optimize use of index
1660+ error (_ ( "retStats must be TRUE whenever retGrp is TRUE" ) ); // retStats doesnt cost anything and it will be much easier to optimize use of index
16611661 if (!IS_TRUE_OR_FALSE (sortGroupsArg ))
1662- error ("sort must be TRUE or FALSE" );
1662+ error (_ ( "sort must be TRUE or FALSE" ) );
16631663 bool sortGroups = (bool )LOGICAL (sortGroupsArg )[0 ];
16641664 if (!isLogical (naArg ) || LENGTH (naArg ) != 1 )
1665- error ("na.last must be logical TRUE, FALSE or NA of length 1" );
1665+ error (_ ( "na.last must be logical TRUE, FALSE or NA of length 1" ) );
16661666 bool na = (bool )LOGICAL (naArg )[0 ];
16671667 if (!isInteger (ascArg ))
1668- error ("order must be integer" ); // # nocov # coerced to int in R
1668+ error (_ ( "order must be integer" ) ); // # nocov # coerced to int in R
16691669 if (!isLogical (reuseSortingArg ) || LENGTH (reuseSortingArg ) != 1 )
1670- error ("reuseSorting must be logical TRUE, FALSE or NA of length 1" );
1670+ error (_ ( "reuseSorting must be logical TRUE, FALSE or NA of length 1" ) );
16711671 int reuseSorting = LOGICAL (reuseSortingArg )[0 ];
16721672 if (!length (DT ))
16731673 return allocVector (INTSXP , 0 );
@@ -1679,7 +1679,7 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
16791679 opt = -1 ;
16801680 } else {
16811681 if (verbose )
1682- Rprintf ("forderReuseSorting: opt not possible: is.data.table(DT)=%d, sortGroups=%d, all1(ascArg)=%d\n" , INHERITS (DT ,char_datatable ), sortGroups , all1 (ascArg ));
1682+ Rprintf (_ ( "forderReuseSorting: opt not possible: is.data.table(DT)=%d, sortGroups=%d, all1(ascArg)=%d\n" ) , INHERITS (DT ,char_datatable ), sortGroups , all1 (ascArg ));
16831683 opt = 0 ;
16841684 }
16851685 } else if (reuseSorting ) {
@@ -1698,7 +1698,7 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
16981698 opt = 1 ; // keyOpt
16991699 ans = PROTECT (allocVector (INTSXP , 0 )); protecti ++ ;
17001700 if (verbose )
1701- Rprintf ("forderReuseSorting: using key: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1701+ Rprintf (_ ( "forderReuseSorting: using key: %s\n" ) , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17021702 }
17031703 if (opt == -1 && GetUseIndex ()) {
17041704 SEXP idx = getIndex (DT , by );
@@ -1733,31 +1733,31 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
17331733 opt = 2 ; // idxOpt but need to drop groups or stats
17341734 } else if (!hasGrp && retGrp && !hasStats && retStats ) {
17351735 if (verbose )
1736- Rprintf ("forderReuseSorting: index found but not for retGrp and retStats: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1736+ Rprintf (_ ( "forderReuseSorting: index found but not for retGrp and retStats: %s\n" )); , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17371737 } else if (!hasGrp && retGrp ) {
17381738 if (verbose )
1739- Rprintf ("forderReuseSorting: index found but not for retGrp: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1739+ Rprintf (_ ( "forderReuseSorting: index found but not for retGrp: %s\n" )); , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17401740 } else if (!hasStats && retStats ) {
17411741 if (verbose )
1742- Rprintf ("forderReuseSorting: index found but not for retStats: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1742+ Rprintf (_ ( "forderReuseSorting: index found but not for retStats: %s\n" )); , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17431743 } else {
17441744 internal_error_with_cleanup (__func__ , "reuseSorting forder index optimization unhandled branch of retGrp-retStats" ); // # nocov
17451745 }
17461746 } else {
17471747 if (!hasStats ) {
17481748 if (verbose )
1749- Rprintf ("forderReuseSorting: index found but na.last=TRUE and no stats available: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1749+ Rprintf (_ ( "forderReuseSorting: index found but na.last=TRUE and no stats available: %s\n" )); , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17501750 } else if (idxAnyNF (idx )) {
17511751 if (verbose )
1752- Rprintf ("forderReuseSorting: index found but na.last=TRUE and NAs present: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1752+ Rprintf (_ ( "forderReuseSorting: index found but na.last=TRUE and NAs present: %s\n" )); , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17531753 } else {
17541754 internal_error_with_cleanup (__func__ , "reuseSorting forder index optimization unhandled branch of last.na=T" ); // # nocov
17551755 }
17561756 }
17571757 if (opt == 2 ) {
17581758 ans = idx ;
17591759 if (verbose )
1760- Rprintf ("forderReuseSorting: using existing index: %s\n" , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1760+ Rprintf (_ ( "forderReuseSorting: using existing index: %s\n" )); , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17611761 }
17621762 }
17631763 }
@@ -1769,11 +1769,11 @@ SEXP forderReuseSorting(SEXP DT, SEXP by, SEXP retGrpArg, SEXP retStatsArg, SEXP
17691769 GetAutoIndex ()) { // disabled by default, use datatable.forder.auto.index=T to enable, do not export/document, use for debugging only
17701770 putIndex (DT , by , ans );
17711771 if (verbose )
1772- Rprintf ("forderReuseSorting: setting index (retGrp=%d, retStats=%d) on DT: %s\n" , retGrp , retStats , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
1772+ Rprintf (_ ( "forderReuseSorting: setting index (retGrp=%d, retStats=%d) on DT: %s\n" )); , retGrp , retStats , CHAR (STRING_ELT (idxName (DT , by ), 0 )));
17731773 }
17741774 }
17751775 if (verbose )
1776- Rprintf ("forderReuseSorting: opt=%d, took %.3fs\n" , opt , omp_get_wtime ()- tic );
1776+ Rprintf (_ ( "forderReuseSorting: opt=%d, took %.3fs\n" )); , opt , omp_get_wtime ()- tic );
17771777 UNPROTECT (protecti );
17781778 return ans ;
17791779}
0 commit comments