Skip to content

Commit 8898e12

Browse files
author
ripley
committed
Rboolean -> bool
git-svn-id: https://svn.r-project.org/R/trunk@87863 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent e7d009e commit 8898e12

File tree

12 files changed

+145
-146
lines changed

12 files changed

+145
-146
lines changed

src/main/Rdynload.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static SEXP Rf_MakeDLLInfo(DllInfo *info);
132132

133133
static SEXP createRSymbolObject(SEXP sname, DL_FUNC f,
134134
R_RegisteredNativeSymbol *symbol,
135-
Rboolean withRegistrationInfo);
135+
bool withRegistrationInfo);
136136

137137
static DllInfo *R_RegisterDLL(HINSTANCE handle, const char *path);
138138

@@ -672,7 +672,7 @@ Rf_freeDllInfo(DllInfo *info)
672672
typedef void (*DllInfoUnloadCall)(DllInfo *);
673673
typedef DllInfoUnloadCall DllInfoInitCall;
674674

675-
static Rboolean
675+
static bool
676676
R_callDLLUnload(DllInfo *dllInfo)
677677
{
678678
char buf[1024];
@@ -1470,7 +1470,7 @@ R_getSymbolInfo(SEXP sname, SEXP spackage, SEXP withRegistrationInfo)
14701470

14711471
if(f)
14721472
sym = createRSymbolObject(sname, f, &symbol,
1473-
asRbool(withRegistrationInfo, R_NilValue));
1473+
asBool2(withRegistrationInfo, R_NilValue));
14741474

14751475
vmaxset(vmax);
14761476
return sym;
@@ -1511,7 +1511,7 @@ R_getDllTable(void)
15111511

15121512
static SEXP
15131513
createRSymbolObject(SEXP sname, DL_FUNC f, R_RegisteredNativeSymbol *symbol,
1514-
Rboolean withRegistrationInfo)
1514+
bool withRegistrationInfo)
15151515
{
15161516
SEXP tmp, klass, sym, names;
15171517
int n = (symbol->type != R_ANY_SYM) ? 4 : 3;

src/main/apply.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ attribute_hidden SEXP do_lapply(SEXP call, SEXP op, SEXP args, SEXP rho)
4848
XX = PROTECT(eval(CAR(args), rho));
4949
R_xlen_t n = xlength(XX); // a vector, so will be valid.
5050
FUN = checkArgIsSymbol(CADR(args));
51-
Rboolean realIndx = n > INT_MAX;
51+
bool realIndx = n > INT_MAX;
5252

5353
SEXP ans = PROTECT(allocVector(VECSXP, n));
5454
SEXP names = getAttrib(XX, R_NamesSymbol);
@@ -99,7 +99,7 @@ attribute_hidden SEXP do_vapply(SEXP call, SEXP op, SEXP args, SEXP rho)
9999
R_xlen_t i, n;
100100
int commonLen;
101101
int useNames, rnk_v = -1; // = array_rank(value) := length(dim(value))
102-
Rboolean array_value;
102+
bool array_value;
103103
SEXPTYPE commonType;
104104
PROTECT_INDEX index = 0; /* initialize to avoid a warning */
105105

@@ -116,7 +116,7 @@ attribute_hidden SEXP do_vapply(SEXP call, SEXP op, SEXP args, SEXP rho)
116116

117117
n = xlength(XX);
118118
if (n == NA_INTEGER) error(_("invalid length"));
119-
Rboolean realIndx = n > INT_MAX;
119+
bool realIndx = n > INT_MAX;
120120

121121
commonLen = length(value);
122122
if (commonLen > 1 && n > INT_MAX)
@@ -179,7 +179,7 @@ attribute_hidden SEXP do_vapply(SEXP call, SEXP op, SEXP args, SEXP rho)
179179
commonLen, (long long)i+1, length(val));
180180
valType = TYPEOF(val);
181181
if (valType != commonType) {
182-
Rboolean okay = FALSE;
182+
bool okay = false;
183183
switch (commonType) {
184184
case CPLXSXP: okay = (valType == REALSXP) || (valType == INTSXP)
185185
|| (valType == LGLSXP); break;
@@ -284,10 +284,10 @@ attribute_hidden SEXP do_vapply(SEXP call, SEXP op, SEXP args, SEXP rho)
284284

285285
// Apply FUN() to X recursively; workhorse of rapply()
286286
static SEXP do_one(SEXP X, SEXP FUN, SEXP classes, SEXP deflt,
287-
Rboolean replace, SEXP rho)
287+
bool replace, SEXP rho)
288288
{
289289
SEXP ans, names, klass;
290-
Rboolean matched = FALSE;
290+
bool matched = false;
291291

292292
/* if X is a list, recurse. Otherwise if it matches classes call f */
293293
if(X == R_NilValue || isVectorList(X)) {
@@ -306,13 +306,13 @@ static SEXP do_one(SEXP X, SEXP FUN, SEXP classes, SEXP deflt,
306306
return ans;
307307
}
308308
if(strcmp(CHAR(STRING_ELT(classes, 0)), "ANY") == 0) /* ASCII */
309-
matched = TRUE;
309+
matched = true;
310310
else {
311-
PROTECT(klass = R_data_class(X, FALSE));
311+
PROTECT(klass = R_data_class(X, false));
312312
for(int i = 0; i < LENGTH(klass); i++)
313313
for(int j = 0; j < length(classes); j++)
314314
if(Seql(STRING_ELT(klass, i), STRING_ELT(classes, j)))
315-
matched = TRUE;
315+
matched = true;
316316
UNPROTECT(1);
317317
}
318318
if(matched) {
@@ -349,7 +349,7 @@ attribute_hidden SEXP do_rapply(SEXP call, SEXP op, SEXP args, SEXP rho)
349349
deflt = CAR(args); args = CDR(args);
350350
how = CAR(args);
351351
if(!isString(how)) error(_("invalid '%s' argument"), "how");
352-
Rboolean replace = strcmp(CHAR(STRING_ELT(how, 0)), "replace") == 0; /* ASCII */
352+
bool replace = strcmp(CHAR(STRING_ELT(how, 0)), "replace") == 0; /* ASCII */
353353
R_xlen_t n = xlength(X);
354354
if (replace) {
355355
PROTECT(ans = shallow_duplicate(X));
@@ -380,9 +380,9 @@ static int islistfactor(SEXP X)
380380
for(int i = 0; i < n; i++) {
381381
int isLF = islistfactor(VECTOR_ELT(X, i));
382382
if(!isLF)
383-
return FALSE;
384-
else if(isLF == TRUE)
385-
ans = TRUE;
383+
return false;
384+
else if(isLF == true)
385+
ans = true;
386386
// else isLF is NA
387387
}
388388
return ans;
@@ -399,19 +399,19 @@ attribute_hidden SEXP do_islistfactor(SEXP call, SEXP op, SEXP args, SEXP rho)
399399
{
400400
checkArity(op, args);
401401
SEXP X = CAR(args);
402-
Rboolean recursive = asRbool(CADR(args), call);
402+
bool recursive = asBool2(CADR(args), call);
403403
int n = length(X);
404404
if(n == 0 || !isVectorList(X))
405-
return ScalarLogical(FALSE);
405+
return ScalarLogical(false);
406406

407407
if(!recursive) {
408408
for(int i = 0; i < n; i++)
409409
if(!isFactor(VECTOR_ELT(X, i)))
410-
return ScalarLogical(FALSE);
410+
return ScalarLogical(false);
411411

412-
return ScalarLogical(TRUE);
412+
return ScalarLogical(true);
413413
}
414414
else { // recursive: isVectorList(X) <==> X is VECSXP or EXPRSXP
415-
return ScalarLogical((islistfactor(X) == TRUE) ? TRUE : FALSE);
415+
return ScalarLogical((islistfactor(X) == true) ? true : false);
416416
}
417417
}

src/main/attrib.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ static SEXP row_names_gets(SEXP vec, SEXP val)
5656
return ans;
5757
}
5858
if(isInteger(val)) {
59-
Rboolean OK_compact = TRUE;
59+
bool OK_compact = TRUE;
6060
int i, n = LENGTH(val);
6161
if(n == 2 && INTEGER(val)[0] == NA_INTEGER) {
6262
n = INTEGER(val)[1];
6363
} else if (n > 2) {
6464
for(i = 0; i < n; i++)
6565
if(INTEGER(val)[i] != i+1) {
66-
OK_compact = FALSE;
66+
OK_compact = false;
6767
break;
6868
}
69-
} else OK_compact = FALSE;
69+
} else OK_compact = false;
7070
if(OK_compact) {
7171
/* we hide the length in an impossible integer vector */
7272
PROTECT(vec);
@@ -96,14 +96,14 @@ static SEXP stripAttrib(SEXP tag, SEXP lst)
9696
return lst;
9797
}
9898

99-
static Rboolean isOneDimensionalArray(SEXP vec)
99+
static bool isOneDimensionalArray(SEXP vec)
100100
{
101101
if(isVector(vec) || isList(vec) || isLanguage(vec)) {
102102
SEXP s = getAttrib(vec, R_DimSymbol);
103103
if(TYPEOF(s) == INTSXP && LENGTH(s) == 1)
104104
return TRUE;
105105
}
106-
return FALSE;
106+
return false;
107107
}
108108

109109
/* NOTE: For environments serialize.c calls this function to find if
@@ -127,7 +127,7 @@ attribute_hidden SEXP getAttrib0(SEXP vec, SEXP name)
127127
int len = length(vec);
128128
PROTECT(s = allocVector(STRSXP, len));
129129
int i = 0;
130-
Rboolean any = FALSE;
130+
bool any = false;
131131
for ( ; vec != R_NilValue; vec = CDR(vec), i++) {
132132
if (TAG(vec) == R_NilValue)
133133
{
@@ -320,7 +320,7 @@ void copyMostAttribNoTs(SEXP inp, SEXP ans)
320320
} else if (TAG(s) == R_ClassSymbol) {
321321
SEXP cl = CAR(s);
322322
int i;
323-
Rboolean ists = FALSE;
323+
bool ists = false;
324324
for (i = 0; i < LENGTH(cl); i++)
325325
if (strcmp(CHAR(STRING_ELT(cl, i)), "ts") == 0) { /* ASCII */
326326
ists = TRUE;
@@ -529,7 +529,7 @@ SEXP classgets(SEXP vec, SEXP klass)
529529

530530
/* HOWEVER, it is the way that the object bit gets set/unset */
531531

532-
Rboolean isfactor = FALSE;
532+
bool isfactor = false;
533533

534534
if (vec == R_NilValue)
535535
error(_("attempt to set an attribute on NULL"));
@@ -712,7 +712,7 @@ static SEXP cache_class(const char *class, SEXP klass)
712712
return klass;
713713
}
714714

715-
static SEXP S4_extends(SEXP klass, Rboolean use_tab) {
715+
static SEXP S4_extends(SEXP klass, bool use_tab) {
716716
static SEXP s_extends = 0, s_extendsForS3;
717717
SEXP e, val; const char *class;
718718
const void *vmax;
@@ -746,7 +746,7 @@ static SEXP S4_extends(SEXP klass, Rboolean use_tab) {
746746

747747
attribute_hidden SEXP R_S4_extends(SEXP klass, SEXP useTable)
748748
{
749-
return S4_extends(klass, asRbool(useTable, R_NilValue));
749+
return S4_extends(klass, asBool2(useTable, R_NilValue));
750750
}
751751

752752

0 commit comments

Comments
 (0)