Skip to content

Commit b44d420

Browse files
author
ripley
committed
tweaks for Rboolean in packages
git-svn-id: https://svn.r-project.org/R/trunk@87832 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent b684883 commit b44d420

File tree

20 files changed

+81
-77
lines changed

20 files changed

+81
-77
lines changed

src/library/grDevices/src/axis_scales.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) 2004-2021 The R Core Team.
3+
* Copyright (C) 2004-2025 The R Core Team.
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@
3030
SEXP R_CreateAtVector(SEXP axp, SEXP usr, SEXP nint, SEXP is_log)
3131
{
3232
int nint_v = asInteger(nint);
33-
Rboolean logflag = asLogical(is_log);
33+
Rboolean logflag = asRboolean(is_log);
3434

3535
PROTECT(axp = coerceVector(axp, REALSXP));
3636
PROTECT(usr = coerceVector(usr, REALSXP));
@@ -51,7 +51,7 @@ SEXP R_GAxisPars(SEXP usr, SEXP is_log, SEXP nintLog)
5151
double
5252
min = REAL(usr)[0],
5353
max = REAL(usr)[1];
54-
Rboolean logflag = asLogical(is_log);
54+
Rboolean logflag = asRboolean(is_log);
5555
int n = asInteger(nintLog);// will be changed on output ..
5656

5757
GAxisPars(&min, &max, &n, logflag, 0);// axis = 0 :<==> do not warn

src/library/grDevices/src/cairo/cairoBM.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
33
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
4-
* Copyright (C) 1997--2023 The R Core Team
4+
* Copyright (C) 1997--2025 The R Core Team
55
*
66
* This program is free software; you can redistribute it and/or modify
77
* it under the terms of the GNU General Public License as published by
@@ -646,7 +646,7 @@ SEXP in_Cairo(SEXP args)
646646
error(_("invalid '%s' argument"), "symbolfamily");
647647
symbolfamily = translateChar(STRING_ELT(CAR(args), 0));
648648
/* scsymbol forced to have "usePUA" attribute in R code */
649-
usePUA = LOGICAL(getAttrib(CAR(args), install("usePUA")))[0];
649+
usePUA = asRboolean(getAttrib(CAR(args), install("usePUA")));
650650

651651
R_GE_checkVersionOrDie(R_GE_version);
652652
R_CheckDeviceAvailable();

src/library/grDevices/src/devPS.c

Lines changed: 24 additions & 21 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--2024 The R Core Team
3+
* Copyright (C) 1998--2025 The R Core Team
44
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
55
*
66
* This program is free software; you can redistribute it and/or modify
@@ -1563,7 +1563,7 @@ SEXP Type1FontInUse(SEXP name, SEXP isPDF)
15631563
if (!isString(name) || LENGTH(name) > 1)
15641564
error(_("invalid font name or more than one font name"));
15651565
return ScalarLogical(
1566-
findLoadedFont(CHAR(STRING_ELT(name, 0)), NULL, asLogical(isPDF))
1566+
findLoadedFont(CHAR(STRING_ELT(name, 0)), NULL, asRboolean(isPDF))
15671567
!= NULL);
15681568
}
15691569

@@ -1596,7 +1596,7 @@ SEXP CIDFontInUse(SEXP name, SEXP isPDF)
15961596
if (!isString(name) || LENGTH(name) > 1)
15971597
error(_("invalid font name or more than one font name"));
15981598
return ScalarLogical(
1599-
findLoadedCIDFont(CHAR(STRING_ELT(name, 0)), asLogical(isPDF))
1599+
findLoadedCIDFont(CHAR(STRING_ELT(name, 0)), asRboolean(isPDF))
16001600
!= NULL);
16011601
}
16021602

@@ -7764,7 +7764,7 @@ PDFDeviceDriver(pDevDesc dd, const char *file, const char *paper,
77647764
const char *family, const char **afmpaths,
77657765
const char *encoding,
77667766
const char *bg, const char *fg, double width, double height,
7767-
double ps, int onefile, int pagecentre,
7767+
double ps, Rboolean onefile, Rboolean pagecentre,
77687768
const char *title, SEXP fonts,
77697769
int versionMajor, int versionMinor,
77707770
const char *colormodel, int dingbats, int useKern,
@@ -10841,7 +10841,8 @@ SEXP PostScript(SEXP args)
1084110841
const char *file, *paper, *family=NULL, *bg, *fg, *cmd;
1084210842
const char *afms[5];
1084310843
const char *encoding, *title, call[] = "postscript", *colormodel;
10844-
int i, horizontal, onefile, pagecentre, printit, useKern;
10844+
int i, horizontal, useKern;
10845+
Rboolean onefile, pagecentre, printit;
1084510846
double height, width, ps;
1084610847
SEXP fam, fonts;
1084710848
Rboolean fillOddEven;
@@ -10874,9 +10875,9 @@ SEXP PostScript(SEXP args)
1087410875
if(horizontal == NA_LOGICAL)
1087510876
horizontal = 1;
1087610877
ps = asReal(CAR(args)); args = CDR(args);
10877-
onefile = asLogical(CAR(args)); args = CDR(args);
10878-
pagecentre = asLogical(CAR(args));args = CDR(args);
10879-
printit = asLogical(CAR(args)); args = CDR(args);
10878+
onefile = asRboolean(CAR(args)); args = CDR(args);
10879+
pagecentre = asRboolean(CAR(args));args = CDR(args);
10880+
printit = asRboolean(CAR(args)); args = CDR(args);
1088010881
cmd = CHAR(asChar(CAR(args))); args = CDR(args);
1088110882
title = translateChar(asChar(CAR(args))); args = CDR(args);
1088210883
fonts = CAR(args); args = CDR(args);
@@ -10885,7 +10886,7 @@ SEXP PostScript(SEXP args)
1088510886
colormodel = CHAR(asChar(CAR(args))); args = CDR(args);
1088610887
useKern = asLogical(CAR(args)); args = CDR(args);
1088710888
if (useKern == NA_LOGICAL) useKern = 1;
10888-
fillOddEven = asLogical(CAR(args));
10889+
fillOddEven = asRboolean(CAR(args));
1088910890
if (fillOddEven == NA_LOGICAL)
1089010891
error(_("invalid value of '%s'"), "fillOddEven");
1089110892

@@ -10935,7 +10936,8 @@ SEXP XFig(SEXP args)
1093510936
pGEDevDesc gdd;
1093610937
const void *vmax;
1093710938
const char *file, *paper, *family, *bg, *fg, *encoding;
10938-
int horizontal, onefile, pagecentre, defaultfont, textspecial;
10939+
int horizontal;
10940+
Rboolean onefile, pagecentre, defaultfont, textspecial;
1093910941
double height, width, ps;
1094010942

1094110943
vmax = vmaxget();
@@ -10954,10 +10956,10 @@ SEXP XFig(SEXP args)
1095410956
if(horizontal == NA_LOGICAL)
1095510957
horizontal = 1;
1095610958
ps = asReal(CAR(args)); args = CDR(args);
10957-
onefile = asLogical(CAR(args)); args = CDR(args);
10958-
pagecentre = asLogical(CAR(args));args = CDR(args);
10959-
defaultfont = asLogical(CAR(args)); args = CDR(args);
10960-
textspecial = asLogical(CAR(args)); args = CDR(args);
10959+
onefile = asRboolean(CAR(args)); args = CDR(args);
10960+
pagecentre = asRboolean(CAR(args));args = CDR(args);
10961+
defaultfont = asRboolean(CAR(args)); args = CDR(args);
10962+
textspecial = asRboolean(CAR(args)); args = CDR(args);
1096110963
encoding = CHAR(asChar(CAR(args)));
1096210964

1096310965
R_GE_checkVersionOrDie(R_GE_version);
@@ -11013,10 +11015,10 @@ SEXP PDF(SEXP args)
1101311015
*bg, *fg, *title, call[] = "PDF", *colormodel, *author;
1101411016
const char *afms[5];
1101511017
double height, width, ps;
11016-
int i, onefile, pagecentre, major, minor, dingbats, useKern, useCompression,
11017-
timestamp, producer;
11018+
int i, major, minor, dingbats, useKern, useCompression,
11019+
timestamp, producer, fillOddEven;
11020+
Rboolean onefile, pagecentre;
1101811021
SEXP fam, fonts;
11019-
Rboolean fillOddEven;
1102011022

1102111023
vmax = vmaxget();
1102211024
args = CDR(args); /* skip entry point name */
@@ -11041,8 +11043,8 @@ SEXP PDF(SEXP args)
1104111043
width = asReal(CAR(args)); args = CDR(args);
1104211044
height = asReal(CAR(args)); args = CDR(args);
1104311045
ps = asReal(CAR(args)); args = CDR(args);
11044-
onefile = asLogical(CAR(args)); args = CDR(args);
11045-
pagecentre = asLogical(CAR(args));args = CDR(args);
11046+
onefile = asRboolean(CAR(args)); args = CDR(args);
11047+
pagecentre = asRboolean(CAR(args));args = CDR(args);
1104611048
title = translateChar(asChar(CAR(args))); args = CDR(args);
1104711049
fonts = CAR(args); args = CDR(args);
1104811050
if (!isNull(fonts) && !isString(fonts))
@@ -11077,8 +11079,9 @@ SEXP PDF(SEXP args)
1107711079
if(!PDFDeviceDriver(dev, file, paper, family, afms, encoding, bg, fg,
1107811080
width, height, ps, onefile, pagecentre,
1107911081
title, fonts, major, minor, colormodel,
11080-
dingbats, useKern, fillOddEven,
11081-
useCompression, timestamp, producer, author)) {
11082+
dingbats, useKern, (Rboolean) fillOddEven,
11083+
(Rboolean) useCompression, (Rboolean) timestamp,
11084+
(Rboolean) producer, author)) {
1108211085
/* we no longer get here: error is thrown in PDFDeviceDriver */
1108311086
error(_("unable to start %s() device"), "pdf");
1108411087
}

src/library/grDevices/src/devPicTeX.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* A PicTeX device, (C) 1996 Valerio Aimale, for
33
* R : A Computer Language for Statistical Data Analysis
4-
* Copyright (C) 2001--2020 The R Core Team
4+
* Copyright (C) 2001--2025 The R Core Team
55
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
66
*
77
* This program is free software; you can redistribute it and/or modify
@@ -766,7 +766,7 @@ SEXP PicTeX(SEXP args)
766766
fg = CHAR(asChar(CAR(args))); args = CDR(args);
767767
width = asReal(CAR(args)); args = CDR(args);
768768
height = asReal(CAR(args)); args = CDR(args);
769-
debug = asLogical(CAR(args)); args = CDR(args);
769+
debug = asRboolean(CAR(args)); args = CDR(args);
770770
if(debug == NA_LOGICAL) debug = FALSE;
771771

772772
R_CheckDeviceAvailable();

src/library/grDevices/src/devices.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
33
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
4-
* Copyright (C) 1997--2013 The R Core Team
4+
* Copyright (C) 1997--2025 The R Core Team
55
* Copyright (C) 2002--2005 The R Foundation
66
*
77
* This program is free software; you can redistribute it and/or modify
@@ -239,14 +239,13 @@ SEXP devcap(SEXP args)
239239
SEXP devcapture(SEXP args)
240240
{
241241
int i, col, row, nrow, ncol, size;
242-
Rboolean native;
243242
pGEDevDesc gdd = GEcurrentDevice();
244243
int *rint;
245244
SEXP raster, image, idim;
246245

247246
args = CDR(args);
248247

249-
native = asLogical(CAR(args));
248+
int native = asLogical(CAR(args));
250249
if (native != TRUE) native = FALSE;
251250

252251
raster = GECap(gdd);

src/library/grDevices/src/grDevices.h

Lines changed: 2 additions & 2 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) 2004-2024 The R Core Team
3+
* Copyright (C) 2004-2025 The R Core Team
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -60,7 +60,7 @@ PSDeviceDriver(pDevDesc, const char*, const char*, const char*,
6060
Rboolean
6161
PDFDeviceDriver(pDevDesc, const char *, const char *, const char *,
6262
const char **, const char *, const char *, const char *,
63-
double, double, double, int, int, const char*, SEXP,
63+
double, double, double, Rboolean, Rboolean, const char*, SEXP,
6464
int, int, const char *, int, int, Rboolean, Rboolean,
6565
Rboolean, Rboolean, const char *);
6666

src/library/grDevices/src/stubs.c

Lines changed: 2 additions & 2 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) 2012-2014 the R Core Team
3+
* Copyright (C) 2012-2025 the R Core Team
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -102,7 +102,7 @@ SEXP devAskNewPage(SEXP call, SEXP op, SEXP args, SEXP env)
102102
if (!isNull(CAR(args))) {
103103
ask = asLogical(CAR(args));
104104
if (ask == NA_LOGICAL) error(_("invalid '%s' argument"), "ask");
105-
gdd->ask = ask;
105+
gdd->ask = (Rboolean) ask;
106106
R_Visible = FALSE;
107107
} else R_Visible = TRUE;
108108

src/library/graphics/src/graphics.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) 1997--2023 The R Core Team
3+
* Copyright (C) 1997--2025 The R Core Team
44
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
55
* Copyright (C) 2002--2011 The R Foundation
66
*
@@ -2069,7 +2069,7 @@ void GScale(double min, double max, int axis, pGEDevDesc dd)
20692069
*/
20702070

20712071
// Computation of [xy]axp[0:2] == (min,max,n) :
2072-
GAxisPars(&min, &max, &n, log, axis);
2072+
GAxisPars(&min, &max, &n, (Rboolean) log, axis);
20732073

20742074
#define G_Store_AXP(is_X) \
20752075
if(is_X) { \
@@ -2277,7 +2277,7 @@ void GRestore(pGEDevDesc dd)
22772277
/* graphics functions. */
22782278

22792279
static double adjsave; /* adj */
2280-
static int annsave; /* ann */
2280+
static Rboolean annsave; /* ann */
22812281
static char btysave; /* bty */
22822282
static double cexsave; /* cex */
22832283
static double lheightsave;

src/library/graphics/src/plot.c

Lines changed: 6 additions & 6 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) 1997--2021 The R Core Team
3+
* Copyright (C) 1997--2025 The R Core Team
44
* Copyright (C) 2002--2009 The R Foundation
55
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
66
*
@@ -1957,7 +1957,7 @@ SEXP C_raster(SEXP args)
19571957
GRaster(image, INTEGER(dim)[1], INTEGER(dim)[0],
19581958
x0, y0, x1 - x0, y1 - y0,
19591959
REAL(angle)[i % LENGTH(angle)],
1960-
LOGICAL(interpolate)[i % LENGTH(interpolate)], dd);
1960+
(Rboolean)(LOGICAL(interpolate)[i % LENGTH(interpolate)]), dd);
19611961
}
19621962
GMode(0, dd);
19631963

@@ -2560,7 +2560,7 @@ SEXP C_mtext(SEXP args)
25602560
gpptr(dd)->adj = ComputeAdjValue(adjval, sideval, gpptr(dd)->las);
25612561
padjval = ComputePAdjValue(padjval, sideval, gpptr(dd)->las);
25622562
atval = ComputeAtValue(atval, gpptr(dd)->adj, sideval, gpptr(dd)->las,
2563-
outerval, dd);
2563+
outerval > 0, dd);
25642564

25652565
if (isExpression(text))
25662566
GMMathText(VECTOR_ELT(text, i % ntext),
@@ -4030,9 +4030,9 @@ SEXP C_xspline(SEXP args)
40304030
sy = SETCAR(args, coerceVector(CAR(args), REALSXP)); args = CDR(args);
40314031
nx = LENGTH(sx);
40324032
ss = SETCAR(args, coerceVector(CAR(args), REALSXP)); args = CDR(args);
4033-
open = asLogical(CAR(args)); args = CDR(args);
4034-
repEnds = asLogical(CAR(args)); args = CDR(args);
4035-
draw = asLogical(CAR(args)); args = CDR(args);
4033+
open = asRboolean(CAR(args)); args = CDR(args);
4034+
repEnds = asRboolean(CAR(args)); args = CDR(args);
4035+
draw = asRboolean(CAR(args)); args = CDR(args);
40364036

40374037
PROTECT(col = FixupCol(CAR(args), R_TRANWHITE)); args = CDR(args);
40384038
ncol = LENGTH(col);

src/library/methods/src/methods_list_dispatch.c

Lines changed: 2 additions & 2 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) 2001-2023 The R Core Team.
3+
* Copyright (C) 2001-2025 The R Core Team.
44
*
55
* This program is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -1169,7 +1169,7 @@ SEXP R_dispatchGeneric(SEXP fname, SEXP ev, SEXP fdef)
11691169

11701170
SEXP R_set_method_dispatch(SEXP onOff)
11711171
{
1172-
Rboolean prev = table_dispatch_on, value = asLogical(onOff);
1172+
Rboolean prev = table_dispatch_on, value = asRboolean(onOff);
11731173
if(value == NA_LOGICAL) /* just return previous*/
11741174
value = prev;
11751175
table_dispatch_on = value;

0 commit comments

Comments
 (0)