Skip to content

Commit e7d009e

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

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/library/methods/src/methods_list_dispatch.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static SEXP s_dot_Methods, s_skeleton, s_expression, s_function,
5454
s_missing, s_generic_dot_skeleton, s_subset_gets, s_element_gets,
5555
s_argument, s_allMethods, s_base;
5656
static SEXP R_FALSE, R_TRUE;
57-
static Rboolean table_dispatch_on = 1;
57+
static bool table_dispatch_on = 1;
5858

5959
/* precomputed skeletons for special primitive calls */
6060
static SEXP R_short_skeletons, R_empty_skeletons;
@@ -68,8 +68,8 @@ static SEXP R_target, R_defined, R_nextMethod, R_dot_nextMethod,
6868

6969
static SEXP Methods_Namespace = NULL;
7070

71-
static const char *check_single_string(SEXP, Rboolean, const char *);
72-
static const char *check_symbol_or_string(SEXP obj, Rboolean nonEmpty,
71+
static const char *check_single_string(SEXP, bool, const char *);
72+
static const char *check_symbol_or_string(SEXP obj, bool nonEmpty,
7373
const char *what);
7474
static const char *class_string(SEXP obj);
7575

@@ -405,7 +405,7 @@ static SEXP R_S_MethodsListSelectCleanup(SEXP err, void *data)
405405
{
406406
SEXP fname = (SEXP) data;
407407
error(_("S language method selection did not return normally when called from internal dispatch for function '%s'"),
408-
check_symbol_or_string(fname, TRUE,
408+
check_symbol_or_string(fname, true,
409409
_("Function name for method selection called internally")));
410410
return R_NilValue;
411411
}
@@ -444,7 +444,9 @@ static SEXP R_S_MethodsListSelect(SEXP fname, SEXP ev, SEXP mlist, SEXP f_env)
444444

445445
static SEXP get_generic(SEXP symbol, SEXP rho, SEXP package)
446446
{
447-
SEXP vl, generic = R_UnboundValue, gpackage; const char *pkg; Rboolean ok;
447+
SEXP vl, generic = R_UnboundValue, gpackage;
448+
const char *pkg;
449+
bool ok;
448450
if(!isSymbol(symbol))
449451
symbol = installTrChar(asChar(symbol));
450452
pkg = CHAR(STRING_ELT(package, 0)); /* package is guaranteed single string */
@@ -457,15 +459,15 @@ static SEXP get_generic(SEXP symbol, SEXP rho, SEXP package)
457459
vl = eval(vl, rho);
458460
UNPROTECT(1);
459461
}
460-
ok = FALSE;
462+
ok = false;
461463
if(IS_GENERIC(vl)) {
462464
if(strlen(pkg)) {
463465
gpackage = PACKAGE_SLOT(vl);
464466
check_single_string(gpackage, FALSE, "The \"package\" slot in generic function object");
465467
ok = !strcmp(pkg, CHAR(STRING_ELT(gpackage, 0)));
466468
}
467469
else
468-
ok = TRUE;
470+
ok = true;
469471
}
470472
if(ok) {
471473
generic = vl;
@@ -494,7 +496,7 @@ SEXP R_getGeneric(SEXP name, SEXP mustFind, SEXP env, SEXP package)
494496
{
495497
SEXP value;
496498
if(isSymbol(name)) {}
497-
else check_single_string(name, TRUE, "The argument \"f\" to getGeneric");
499+
else check_single_string(name, true, "The argument \"f\" to getGeneric");
498500
check_single_string(package, FALSE, "The argument \"package\" to getGeneric");
499501
value = get_generic(name, env, package);
500502
if(value == R_UnboundValue) {
@@ -522,7 +524,7 @@ SEXP R_standardGeneric(SEXP fname, SEXP ev, SEXP fdef)
522524
/* TODO: the code for do_standardGeneric does a test of fsym,
523525
* with a less informative error message. Should combine them.*/
524526
if(!isSymbol(fsym)) {
525-
const char *fname = check_single_string(fsym, TRUE, "The function name in the call to standardGeneric");
527+
const char *fname = check_single_string(fsym, true, "The function name in the call to standardGeneric");
526528
fsym = install(fname);
527529
}
528530
switch(TYPEOF(fdef)) {
@@ -594,7 +596,7 @@ SEXP R_standardGeneric(SEXP fname, SEXP ev, SEXP fdef)
594596
computations in the body of the function may have assigned to the
595597
argument name.
596598
*/
597-
static Rboolean is_missing_arg(SEXP symbol, SEXP ev)
599+
static bool is_missing_arg(SEXP symbol, SEXP ev)
598600
{
599601
R_varloc_t loc;
600602

@@ -646,6 +648,7 @@ static SEXP argEvalCleanup(SEXP err, void *data_)
646648
return R_NilValue;
647649
}
648650

651+
// FIXME: use bool eventually
649652
static SEXP do_dispatch(SEXP fname, SEXP ev, SEXP mlist, int firstTry,
650653
int evalArgs)
651654
{
@@ -751,7 +754,7 @@ SEXP R_nextMethodCall(SEXP matched_call, SEXP ev)
751754
{
752755
SEXP e, val, args, this_sym, op;
753756
int i, nargs = length(matched_call)-1;
754-
Rboolean prim_case;
757+
bool prim_case;
755758
/* for primitive .nextMethod's, suppress further dispatch to avoid
756759
* going into an infinite loop of method calls
757760
*/
@@ -885,7 +888,7 @@ static SEXP R_selectByPackage(SEXP table, SEXP classes, int nargs) {
885888
}
886889

887890
static const char *
888-
check_single_string(SEXP obj, Rboolean nonEmpty, const char *what)
891+
check_single_string(SEXP obj, bool nonEmpty, const char *what)
889892
{
890893
const char *string = "<unset>"; /* -Wall */
891894
if(isString(obj)) {
@@ -904,7 +907,7 @@ check_single_string(SEXP obj, Rboolean nonEmpty, const char *what)
904907
return string;
905908
}
906909

907-
static const char *check_symbol_or_string(SEXP obj, Rboolean nonEmpty,
910+
static const char *check_symbol_or_string(SEXP obj, bool nonEmpty,
908911
const char *what)
909912
{
910913
if(isSymbol(obj))
@@ -933,9 +936,9 @@ SEXP R_methodsPackageMetaName(SEXP prefix, SEXP name, SEXP pkg)
933936

934937
prefixString = check_single_string(prefix, TRUE,
935938
"The internal prefix (e.g., \"C\") for a meta-data object");
936-
nameString = check_single_string(name, FALSE,
939+
nameString = check_single_string(name, false,
937940
"The name of the object (e.g,. a class or generic function) to find in the meta-data");
938-
pkgString = check_single_string(pkg, FALSE,
941+
pkgString = check_single_string(pkg, false,
939942
"The name of the package for a meta-data object");
940943
size_t len;
941944
/* fits pkgString version format + '\0' */
@@ -1169,7 +1172,7 @@ SEXP R_dispatchGeneric(SEXP fname, SEXP ev, SEXP fdef)
11691172

11701173
SEXP R_set_method_dispatch(SEXP onOff)
11711174
{
1172-
Rboolean prev = table_dispatch_on, value = asRboolean(onOff);
1175+
bool prev = table_dispatch_on, value = asBool(onOff);
11731176
if(value == NA_LOGICAL) /* just return previous*/
11741177
value = prev;
11751178
table_dispatch_on = value;

0 commit comments

Comments
 (0)