Skip to content

Commit da39a84

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

File tree

16 files changed

+152
-152
lines changed

16 files changed

+152
-152
lines changed

src/library/stats/src/Srunmed.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ SEXP runmed(SEXP sx, SEXP stype, SEXP sk, SEXP end, SEXP naAct, SEXP printLev)
229229
Rprintf("firstNA = %lld%s.\n", (long long)firstNA,
230230
(firstNA == 0) ? " <=> *no* NA/NaN" : "");
231231
if(firstNA) { // anyNA(x)
232-
Rboolean NA_pos = TRUE;
232+
bool NA_pos = true;
233233
switch(na_action) {
234234
case NA_BIG_alternate_M:
235-
NA_pos = FALSE; // <<-- "M"inus: *not* positive
235+
NA_pos = false; // <<-- "M"inus: *not* positive
236236
// no break; --> continue
237237
case NA_BIG_alternate_P: {
238238
xx = (double *) R_alloc(n, sizeof(double));

src/library/stats/src/arima.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ KalmanSmooth(SEXP sy, SEXP mod, SEXP sUP)
196196
double *y = REAL(sy), *Z = REAL(sZ), *a, *P,
197197
*T = REAL(sT), *V = REAL(sV), h = asReal(sh), *Pnew;
198198
double *at, *rt, *Pt, *gains, *resids, *Mt, *L, gn, *Nt;
199-
Rboolean var = TRUE;
199+
bool var = true;
200200

201201
PROTECT(ssa = duplicate(sa)); a = REAL(ssa);
202202
PROTECT(ssP = duplicate(sP)); P = REAL(ssP);
@@ -614,7 +614,7 @@ ARIMA_Like(SEXP sy, SEXP mod, SEXP sUP, SEXP giveResid)
614614
double *phi = REAL(sPhi), *theta = REAL(sTheta), *delta = REAL(sDelta);
615615
double sumlog = 0.0, ssq = 0, *anew, *mm = NULL, *M;
616616
int nu = 0;
617-
Rboolean useResid = asRboolean(giveResid);
617+
bool useResid = asBool(giveResid);
618618
double *rsResid = NULL /* -Wall */;
619619

620620
anew = (double *) R_alloc(rd, sizeof(double));
@@ -759,7 +759,7 @@ ARIMA_CSS(SEXP sy, SEXP sarma, SEXP sPhi, SEXP sTheta,
759759
int n = LENGTH(sy), *arma = INTEGER(sarma), p = LENGTH(sPhi),
760760
q = LENGTH(sTheta), ncond = asInteger(sncond);
761761
int ns, nu = 0;
762-
Rboolean useResid = asRboolean(giveResid);
762+
bool useResid = asBool(giveResid);
763763

764764
w = (double *) R_alloc(n, sizeof(double));
765765
for (int l = 0; l < n; l++) w[l] = y[l];

src/library/stats/src/cov.c

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@
3434
#include "statsR.h"
3535
#include "statsErr.h"
3636

37-
static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP kendall, Rboolean cor);
37+
static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP kendall, bool cor);
3838

3939

4040
SEXP cor(SEXP x, SEXP y, SEXP na_method, SEXP kendall)
4141
{
42-
return corcov(x, y, na_method, kendall, TRUE);
42+
return corcov(x, y, na_method, kendall, true);
4343
}
4444
SEXP cov(SEXP x, SEXP y, SEXP na_method, SEXP kendall)
4545
{
46-
return corcov(x, y, na_method, kendall, FALSE);
46+
return corcov(x, y, na_method, kendall, false);
4747
}
4848

4949

@@ -112,7 +112,7 @@ SEXP cov(SEXP x, SEXP y, SEXP na_method, SEXP kendall)
112112
} \
113113
if (cor) { \
114114
if(xsd == 0. || ysd == 0.) { \
115-
*sd_0 = TRUE; \
115+
*sd_0 = true; \
116116
sum = NA_REAL; \
117117
} \
118118
else { \
@@ -135,8 +135,8 @@ SEXP cov(SEXP x, SEXP y, SEXP na_method, SEXP kendall)
135135

136136

137137
static void cov_pairwise1(int n, int ncx, double *x,
138-
double *ans, Rboolean *sd_0, Rboolean cor,
139-
Rboolean kendall)
138+
double *ans, bool *sd_0, bool cor,
139+
bool kendall)
140140
{
141141
for (int i = 0 ; i < ncx ; i++) {
142142
double *xx = &x[i * n];
@@ -151,8 +151,8 @@ static void cov_pairwise1(int n, int ncx, double *x,
151151
}
152152

153153
static void cov_pairwise2(int n, int ncx, int ncy, double *x, double *y,
154-
double *ans, Rboolean *sd_0, Rboolean cor,
155-
Rboolean kendall)
154+
double *ans, bool *sd_0, bool cor,
155+
bool kendall)
156156
{
157157
for (int i = 0 ; i < ncx ; i++) {
158158
double *xx = &x[i * n];
@@ -242,8 +242,8 @@ static void cov_pairwise2(int n, int ncx, int ncy, double *x, double *y,
242242

243243
static void
244244
cov_complete1(int n, int ncx, double *x, double *xm,
245-
int *ind, double *ans, Rboolean *sd_0, Rboolean cor,
246-
Rboolean kendall)
245+
int *ind, double *ans, bool *sd_0, bool cor,
246+
bool kendall)
247247
{
248248
COV_init(ncx);
249249

@@ -287,7 +287,7 @@ cov_complete1(int n, int ncx, double *x, double *xm,
287287
for (i = 0 ; i < ncx ; i++) {
288288
for (j = 0 ; j < i ; j++) {
289289
if (xm[i] == 0 || xm[j] == 0) {
290-
*sd_0 = TRUE;
290+
*sd_0 = true;
291291
ANS(j,i) = ANS(i,j) = NA_REAL;
292292
}
293293
else {
@@ -302,8 +302,8 @@ cov_complete1(int n, int ncx, double *x, double *xm,
302302

303303
static void
304304
cov_na_1(int n, int ncx, double *x, double *xm,
305-
int *has_na, double *ans, Rboolean *sd_0, Rboolean cor,
306-
Rboolean kendall)
305+
int *has_na, double *ans, bool *sd_0, bool cor,
306+
bool kendall)
307307
{
308308

309309
COV_ini_na(ncx);
@@ -356,7 +356,7 @@ cov_na_1(int n, int ncx, double *x, double *xm,
356356
for (i = 0 ; i < ncx ; i++) {
357357
if(!has_na[i]) for (j = 0 ; j < i ; j++) {
358358
if (xm[i] == 0 || xm[j] == 0) {
359-
*sd_0 = TRUE;
359+
*sd_0 = true;
360360
ANS(j,i) = ANS(i,j) = NA_REAL;
361361
}
362362
else {
@@ -372,7 +372,7 @@ cov_na_1(int n, int ncx, double *x, double *xm,
372372
static void
373373
cov_complete2(int n, int ncx, int ncy, double *x, double *y,
374374
double *xm, double *ym, int *ind,
375-
double *ans, Rboolean *sd_0, Rboolean cor, Rboolean kendall)
375+
double *ans, bool *sd_0, bool cor, bool kendall)
376376
{
377377
COV_init(ncy);
378378

@@ -439,7 +439,7 @@ cov_complete2(int n, int ncx, int ncy, double *x, double *y,
439439
for (i = 0 ; i < ncx ; i++)
440440
for (j = 0 ; j < ncy ; j++)
441441
if (xm[i] == 0. || ym[j] == 0.) {
442-
*sd_0 = TRUE;
442+
*sd_0 = true;
443443
ANS(i,j) = NA_REAL;
444444
}
445445
else {
@@ -454,7 +454,7 @@ cov_complete2(int n, int ncx, int ncy, double *x, double *y,
454454
static void
455455
cov_na_2(int n, int ncx, int ncy, double *x, double *y,
456456
double *xm, double *ym, int *has_na_x, int *has_na_y,
457-
double *ans, Rboolean *sd_0, Rboolean cor, Rboolean kendall)
457+
double *ans, bool *sd_0, bool cor, bool kendall)
458458
{
459459
COV_ini_na(ncy);
460460

@@ -530,7 +530,7 @@ cov_na_2(int n, int ncx, int ncy, double *x, double *y,
530530
for (j = 0 ; j < ncy ; j++)
531531
if(!has_na_y[j]) {
532532
if (xm[i] == 0. || ym[j] == 0.) {
533-
*sd_0 = TRUE;
533+
*sd_0 = true;
534534
ANS(i,j) = NA_REAL;
535535
}
536536
else {
@@ -574,13 +574,13 @@ cov_na_2(int n, int ncx, int ncy, double *x, double *y,
574574
NA_LOOP \
575575
}
576576

577-
static void complete1(int n, int ncx, double *x, int *ind, Rboolean na_fail)
577+
static void complete1(int n, int ncx, double *x, int *ind, bool na_fail)
578578
{
579579
COMPLETE_1
580580
}
581581

582582
static void
583-
complete2(int n, int ncx, int ncy, double *x, double *y, int *ind, Rboolean na_fail)
583+
complete2(int n, int ncx, int ncy, double *x, double *y, int *ind, bool na_fail)
584584
{
585585
COMPLETE_1
586586

@@ -626,10 +626,10 @@ find_na_2(int n, int ncx, int ncy, double *x, double *y, int *has_na_x, int *has
626626
"all.obs", "complete.obs", "pairwise.complete", "everything", "na.or.complete"
627627
kendall = TRUE/FALSE)
628628
*/
629-
static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, Rboolean cor)
629+
static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, bool cor)
630630
{
631631
SEXP ans, xm, ym, ind;
632-
Rboolean ansmat, kendall, pair, na_fail, everything, sd_0, empty_err;
632+
bool ansmat, kendall, pair, na_fail, everything, sd_0, empty_err;
633633
int i, method, n, ncx, ncy, nprotect = 2;
634634

635635
#define DEFUNCT_VAR_FACTOR
@@ -675,7 +675,7 @@ static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, Rboolean cor)
675675
if (nrows(y) != n)
676676
error(_("incompatible dimensions"));
677677
ncy = ncols(y);
678-
ansmat = TRUE;
678+
ansmat = true;
679679
}
680680
else {
681681
if (length(y) != n)
@@ -687,28 +687,28 @@ static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, Rboolean cor)
687687
method = asInteger(na_method);
688688

689689
/* Arg.4: kendall */
690-
kendall = asRboolean(skendall);
690+
kendall = asBool(skendall);
691691

692692
/* "default: complete" (easier for -Wall) */
693-
na_fail = FALSE; everything = FALSE; empty_err = TRUE;
694-
pair = FALSE;
693+
na_fail = false; everything = FALSE; empty_err = true;
694+
pair = false;
695695
switch(method) {
696696
case 1: /* use all : no NAs */
697-
na_fail = TRUE;
697+
na_fail = true;
698698
break;
699699
case 2: /* complete */
700700
/* did na.omit in R */
701701
if (!LENGTH(x)) error(_("no complete element pairs"));
702702
break;
703703
case 3: /* pairwise.complete */
704-
pair = TRUE;
704+
pair = true;
705705
break;
706706
case 4: /* "everything": NAs are propagated */
707-
everything = TRUE;
708-
empty_err = FALSE;
707+
everything = true;
708+
empty_err = false;
709709
break;
710710
case 5: /* "na.or.complete": NAs are propagated */
711-
empty_err = FALSE;
711+
empty_err = false;
712712
break;
713713
default:
714714
error(_("invalid 'use' (computational method)"));
@@ -718,7 +718,7 @@ static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, Rboolean cor)
718718

719719
if (ansmat) PROTECT(ans = allocMatrix(REALSXP, ncx, ncy));
720720
else PROTECT(ans = allocVector(REALSXP, ncx * ncy));
721-
sd_0 = FALSE;
721+
sd_0 = false;
722722
if (isNull(y)) {
723723
if (everything) { /* NA's are propagated */
724724
PROTECT(xm = allocVector(REALSXP, ncx));
@@ -735,9 +735,9 @@ static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, Rboolean cor)
735735
cov_complete1(n, ncx, REAL(x), REAL(xm),
736736
INTEGER(ind), REAL(ans), &sd_0, cor, kendall);
737737
if(empty_err) {
738-
Rboolean indany = FALSE;
738+
bool indany = false;
739739
for(i = 0; i < n; i++) {
740-
if(INTEGER(ind)[i] == 1) { indany = TRUE; break; }
740+
if(INTEGER(ind)[i] == 1) { indany = true; break; }
741741
}
742742
if(!indany) error(_("no complete element pairs"));
743743
}
@@ -768,9 +768,9 @@ static SEXP corcov(SEXP x, SEXP y, SEXP na_method, SEXP skendall, Rboolean cor)
768768
cov_complete2(n, ncx, ncy, REAL(x), REAL(y), REAL(xm), REAL(ym),
769769
INTEGER(ind), REAL(ans), &sd_0, cor, kendall);
770770
if(empty_err) {
771-
Rboolean indany = FALSE;
771+
bool indany = false;
772772
for(i = 0; i < n; i++) {
773-
if(INTEGER(ind)[i] == 1) { indany = TRUE; break; }
773+
if(INTEGER(ind)[i] == 1) { indany = true; break; }
774774
}
775775
if(!indany) error(_("no complete element pairs"));
776776
}

src/library/stats/src/deriv.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
3-
* Copyright (C) 1998-2023 The R Core Team.
3+
* Copyright (C) 1998-2025 The R Core Team.
44
* Copyright (C) 2004-2017 The R Foundation
55
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
66
*
@@ -71,7 +71,7 @@ static SEXP Log1MExpSymbol;
7171
static SEXP Log1PMxSymbol;
7272
*/
7373

74-
static Rboolean Initialized = FALSE;
74+
static bool Initialized = false;
7575

7676

7777
static void InitDerivSymbols(void)
@@ -120,7 +120,7 @@ static void InitDerivSymbols(void)
120120
Log1PMxSymbol = install("log1pmx"); # log1p(x)-x
121121
*/
122122

123-
Initialized = TRUE;
123+
Initialized = true;
124124
}
125125

126126
static SEXP Constant(double x)

0 commit comments

Comments
 (0)