Skip to content

Commit 82429f7

Browse files
author
ripley
committed
revert r87936/7: non-API header is being used in packages
git-svn-id: https://svn.r-project.org/R/trunk@87945 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 5d92c1b commit 82429f7

File tree

3 files changed

+46
-50
lines changed

3 files changed

+46
-50
lines changed

doc/NEWS.Rd

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,10 +418,6 @@
418418
\item Header \file{R_exts/Error.h} now ensures that
419419
\code{Rf_error} and similar are given a \code{noreturn}
420420
attribute when used from C++ under all compilers.
421-
422-
\item The functions in header \file{R_ext/Callbacks.h} (which is
423-
\strong{not} part of the API) have been converted to use the
424-
\code{bool} type.
425421
}
426422
}
427423

src/include/R_ext/Callbacks.h

Lines changed: 8 additions & 8 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-2025 The R Core Team.
3+
* Copyright (C) 2001-2020 The R Core Team.
44
*
55
* This header file is free software; you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -43,7 +43,7 @@
4343
visible - a logical value indicating whether the result was printed to the R ``console''/stdout.
4444
data - user-level data passed to the registration routine.
4545
*/
46-
typedef bool (*R_ToplevelCallback)(SEXP expr, SEXP value, bool succeeded, bool visible, void *);
46+
typedef Rboolean (*R_ToplevelCallback)(SEXP expr, SEXP value, Rboolean succeeded, Rboolean visible, void *);
4747

4848
typedef struct _ToplevelCallback R_ToplevelCallbackEl;
4949
/**
@@ -63,8 +63,8 @@ struct _ToplevelCallback {
6363
extern "C" {
6464
#endif
6565

66-
bool Rf_removeTaskCallbackByIndex(int id);
67-
bool Rf_removeTaskCallbackByName(const char *name);
66+
Rboolean Rf_removeTaskCallbackByIndex(int id);
67+
Rboolean Rf_removeTaskCallbackByName(const char *name);
6868
SEXP R_removeTaskCallback(SEXP which);
6969
R_ToplevelCallbackEl* Rf_addTaskCallback(R_ToplevelCallback cb, void *data, void (*finalizer)(void *), const char *name, int *pos);
7070

@@ -83,20 +83,20 @@ typedef struct _R_ObjectTable R_ObjectTable;
8383

8484
/* Do we actually need the exists() since it is never called but R
8585
uses get to see if the symbol is bound to anything? */
86-
typedef bool (*Rdb_exists)(const char * const name, bool *canCache, R_ObjectTable *);
87-
typedef SEXP (*Rdb_get)(const char * const name, bool *canCache, R_ObjectTable *);
86+
typedef Rboolean (*Rdb_exists)(const char * const name, Rboolean *canCache, R_ObjectTable *);
87+
typedef SEXP (*Rdb_get)(const char * const name, Rboolean *canCache, R_ObjectTable *);
8888
typedef int (*Rdb_remove)(const char * const name, R_ObjectTable *);
8989
typedef SEXP (*Rdb_assign)(const char * const name, SEXP value, R_ObjectTable *);
9090
typedef SEXP (*Rdb_objects)(R_ObjectTable *);
91-
typedef bool (*Rdb_canCache)(const char * const name, R_ObjectTable *);
91+
typedef Rboolean (*Rdb_canCache)(const char * const name, R_ObjectTable *);
9292

9393
typedef void (*Rdb_onDetach)(R_ObjectTable *);
9494
typedef void (*Rdb_onAttach)(R_ObjectTable *);
9595

9696
struct _R_ObjectTable{
9797
int type;
9898
char **cachedNames;
99-
bool active;
99+
Rboolean active;
100100

101101
Rdb_exists exists;
102102
Rdb_get get;

src/main/main.c

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ attribute_hidden void nl_Rdummy(void)
6868
*/
6969

7070
attribute_hidden
71-
void Rf_callToplevelHandlers(SEXP expr, SEXP value, bool succeeded,
72-
bool visible);
71+
void Rf_callToplevelHandlers(SEXP expr, SEXP value, Rboolean succeeded,
72+
Rboolean visible);
7373

7474
static int ParseBrowser(SEXP, SEXP);
7575

@@ -200,7 +200,7 @@ Rf_ReplIteration(SEXP rho, int savestack, int browselevel, R_ReplState *state)
200200
{
201201
int c, browsevalue;
202202
SEXP value, thisExpr;
203-
bool wasDisplayed = false;
203+
bool wasDisplayed = FALSE;
204204

205205
/* clear warnings that might have accumulated during a jump to top level */
206206
if (R_CollectWarnings)
@@ -271,7 +271,7 @@ Rf_ReplIteration(SEXP rho, int savestack, int browselevel, R_ReplState *state)
271271
PrintValueEnv(value, rho);
272272
if (R_CollectWarnings)
273273
PrintWarnings();
274-
Rf_callToplevelHandlers(thisExpr, value, true, wasDisplayed);
274+
Rf_callToplevelHandlers(thisExpr, value, TRUE, wasDisplayed);
275275
R_CurrentExpr = value; /* Necessary? Doubt it. */
276276
UNPROTECT(2); /* thisExpr, value */
277277
if (R_BrowserLastCommand == 'S') R_BrowserLastCommand = 's';
@@ -333,7 +333,7 @@ static void check_session_exit(void)
333333
error is signaled from one of the functions called. The
334334
'exiting' variable identifies this and results in
335335
R_Suicide. */
336-
static bool exiting = false;
336+
static bool exiting = FALSE;
337337
if (exiting)
338338
R_Suicide(_("error during cleanup\n"));
339339
else {
@@ -368,7 +368,7 @@ int R_ReplDLLdo1(void)
368368
int c;
369369
ParseStatus status;
370370
SEXP rho = R_GlobalEnv, lastExpr;
371-
bool wasDisplayed = false;
371+
bool wasDisplayed = FALSE;
372372

373373
if(!*DLLbufp) {
374374
R_Busy(0);
@@ -405,7 +405,7 @@ int R_ReplDLLdo1(void)
405405
PrintValueEnv(R_CurrentExpr, rho);
406406
if (R_CollectWarnings)
407407
PrintWarnings();
408-
Rf_callToplevelHandlers(lastExpr, R_CurrentExpr, true, wasDisplayed);
408+
Rf_callToplevelHandlers(lastExpr, R_CurrentExpr, TRUE, wasDisplayed);
409409
UNPROTECT(1);
410410
R_IoBufferWriteReset(&R_ConsoleIob);
411411
R_Busy(0);
@@ -1615,14 +1615,14 @@ static R_ToplevelCallbackEl *Rf_CurrentToplevelHandler = NULL;
16151615

16161616
/* A running handler attempted to remove itself from Rf_ToplevelTaskHandlers,
16171617
do it after it finishes. */
1618-
static bool Rf_DoRemoveCurrentToplevelHandler = false;
1618+
static Rboolean Rf_DoRemoveCurrentToplevelHandler = FALSE;
16191619

16201620
/* A handler has been removed from the Rf_ToplevelTaskHandlers. */
1621-
static bool Rf_RemovedToplevelHandlers = false;
1621+
static Rboolean Rf_RemovedToplevelHandlers = FALSE;
16221622

16231623
/* Flag to ensure that the top-level handlers aren't called recursively.
16241624
Simple state to indicate that they are currently being run. */
1625-
static bool Rf_RunningToplevelHandlers = false;
1625+
static Rboolean Rf_RunningToplevelHandlers = FALSE;
16261626

16271627
/**
16281628
This is the C-level entry point for registering a handler
@@ -1677,24 +1677,24 @@ Rf_addTaskCallback(R_ToplevelCallback cb, void *data,
16771677
static void removeToplevelHandler(R_ToplevelCallbackEl *e)
16781678
{
16791679
if (Rf_CurrentToplevelHandler == e)
1680-
Rf_DoRemoveCurrentToplevelHandler = true; /* postpone */
1680+
Rf_DoRemoveCurrentToplevelHandler = TRUE; /* postpone */
16811681
else {
1682-
Rf_RemovedToplevelHandlers = true;
1682+
Rf_RemovedToplevelHandlers = TRUE;
16831683
if(e->finalizer)
16841684
e->finalizer(e->data);
16851685
free(e->name);
16861686
free(e);
16871687
}
16881688
}
16891689

1690-
attribute_hidden bool
1690+
attribute_hidden Rboolean
16911691
Rf_removeTaskCallbackByName(const char *name)
16921692
{
16931693
R_ToplevelCallbackEl *el = Rf_ToplevelTaskHandlers, *prev = NULL;
1694-
bool status = true;
1694+
Rboolean status = TRUE;
16951695

16961696
if(!Rf_ToplevelTaskHandlers) {
1697-
return(false); /* error("there are no task callbacks registered"); */
1697+
return(FALSE); /* error("there are no task callbacks registered"); */
16981698
}
16991699

17001700
while(el) {
@@ -1712,7 +1712,7 @@ Rf_removeTaskCallbackByName(const char *name)
17121712
if(el)
17131713
removeToplevelHandler(el);
17141714
else
1715-
status = false;
1715+
status = FALSE;
17161716

17171717
return(status);
17181718
}
@@ -1721,11 +1721,11 @@ Rf_removeTaskCallbackByName(const char *name)
17211721
Remove the top-level task handler/callback identified by
17221722
its position in the list of callbacks.
17231723
*/
1724-
attribute_hidden bool
1724+
attribute_hidden Rboolean
17251725
Rf_removeTaskCallbackByIndex(int id)
17261726
{
17271727
R_ToplevelCallbackEl *el = Rf_ToplevelTaskHandlers, *tmp = NULL;
1728-
bool status = true;
1728+
Rboolean status = TRUE;
17291729

17301730
if(id < 0)
17311731
error(_("negative index passed to R_removeTaskCallbackByIndex"));
@@ -1750,7 +1750,7 @@ Rf_removeTaskCallbackByIndex(int id)
17501750
if(tmp)
17511751
removeToplevelHandler(tmp);
17521752
else
1753-
status = false;
1753+
status = FALSE;
17541754

17551755
return(status);
17561756
}
@@ -1768,17 +1768,17 @@ attribute_hidden SEXP
17681768
R_removeTaskCallback(SEXP which)
17691769
{
17701770
int id;
1771-
bool val;
1771+
Rboolean val;
17721772

17731773
if(TYPEOF(which) == STRSXP) {
17741774
if (LENGTH(which) == 0)
1775-
val = false;
1775+
val = FALSE;
17761776
else
17771777
val = Rf_removeTaskCallbackByName(CHAR(STRING_ELT(which, 0)));
17781778
} else {
17791779
id = asInteger(which);
17801780
if (id != NA_INTEGER) val = Rf_removeTaskCallbackByIndex(id - 1);
1781-
else val = false;
1781+
else val = FALSE;
17821782
}
17831783
return ScalarLogical(val);
17841784
}
@@ -1819,28 +1819,28 @@ R_getTaskCallbackNames(void)
18191819

18201820
/* This is not used in R and in no header */
18211821
void
1822-
Rf_callToplevelHandlers(SEXP expr, SEXP value, bool succeeded,
1823-
bool visible)
1822+
Rf_callToplevelHandlers(SEXP expr, SEXP value, Rboolean succeeded,
1823+
Rboolean visible)
18241824
{
18251825
R_ToplevelCallbackEl *h, *prev = NULL;
1826-
bool again;
1826+
Rboolean again;
18271827

1828-
if(Rf_RunningToplevelHandlers == true)
1828+
if(Rf_RunningToplevelHandlers == TRUE)
18291829
return;
18301830

18311831
h = Rf_ToplevelTaskHandlers;
1832-
Rf_RunningToplevelHandlers = true;
1832+
Rf_RunningToplevelHandlers = TRUE;
18331833
while(h) {
1834-
Rf_RemovedToplevelHandlers = false;
1835-
Rf_DoRemoveCurrentToplevelHandler = false;
1834+
Rf_RemovedToplevelHandlers = FALSE;
1835+
Rf_DoRemoveCurrentToplevelHandler = FALSE;
18361836
Rf_CurrentToplevelHandler = h;
18371837
again = (h->cb)(expr, value, succeeded, visible, h->data);
18381838
Rf_CurrentToplevelHandler = NULL;
18391839

18401840
if (Rf_DoRemoveCurrentToplevelHandler) {
18411841
/* the handler attempted to remove itself, PR#18508 */
1842-
Rf_DoRemoveCurrentToplevelHandler = false;
1843-
again = false;
1842+
Rf_DoRemoveCurrentToplevelHandler = FALSE;
1843+
again = FALSE;
18441844
}
18451845
if (Rf_RemovedToplevelHandlers) {
18461846
/* some handlers were removed, but not "h" -> recompute "prev" */
@@ -1876,7 +1876,7 @@ Rf_callToplevelHandlers(SEXP expr, SEXP value, bool succeeded,
18761876
}
18771877
}
18781878

1879-
Rf_RunningToplevelHandlers = false;
1879+
Rf_RunningToplevelHandlers = FALSE;
18801880
}
18811881

18821882

@@ -1886,9 +1886,9 @@ static void defineVarInc(SEXP sym, SEXP val, SEXP rho)
18861886
INCREMENT_NAMED(val); /* in case this is used in a NAMED build */
18871887
}
18881888

1889-
attribute_hidden bool
1890-
R_taskCallbackRoutine(SEXP expr, SEXP value, bool succeeded,
1891-
bool visible, void *userData)
1889+
attribute_hidden Rboolean
1890+
R_taskCallbackRoutine(SEXP expr, SEXP value, Rboolean succeeded,
1891+
Rboolean visible, void *userData)
18921892
{
18931893
/* install some symbols */
18941894
static SEXP R_cbSym = NULL;
@@ -1909,7 +1909,7 @@ R_taskCallbackRoutine(SEXP expr, SEXP value, bool succeeded,
19091909
SEXP f = (SEXP) userData;
19101910
SEXP e, val, cur, rho;
19111911
int errorOccurred;
1912-
bool again, useData = (bool)LOGICAL(VECTOR_ELT(f, 2))[0];
1912+
Rboolean again, useData = (Rboolean)LOGICAL(VECTOR_ELT(f, 2))[0];
19131913

19141914
/* create an environment with bindings for the function and arguments */
19151915
PROTECT(rho = NewEnvironment(R_NilValue, R_NilValue, R_GlobalEnv));
@@ -1948,10 +1948,10 @@ R_taskCallbackRoutine(SEXP expr, SEXP value, bool succeeded,
19481948
/* It would be nice to identify the function. */
19491949
warning(_("top-level task callback did not return a logical value"));
19501950
}
1951-
again = (bool) asLogical(val);
1951+
again = (Rboolean) asLogical(val);
19521952
} else {
19531953
/* warning("error occurred in top-level task callback\n"); */
1954-
again = false;
1954+
again = FALSE;
19551955
}
19561956

19571957
UNPROTECT(3); /* rho, e, val */

0 commit comments

Comments
 (0)