Skip to content

Commit 49a5107

Browse files
author
ripley
committed
remove incorrect C declaration for F77_SUB(interv)
git-svn-id: https://svn.r-project.org/R/trunk@87947 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent c6e470e commit 49a5107

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

doc/NEWS.Rd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,11 @@
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 Header \file{R_exts/Utils.h} no longer contains a
423+
declaration for \code{77_SUB(interv)}. This is intended to be
424+
called from Fortran and was wrongly declared: \code{LOGICAL} in
425+
Fortran corresponds to \code{int *} not \code{Rboolean *}.
421426
}
422427
}
423428

src/appl/interv.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@
2727
#include <R_ext/Boolean.h>
2828
#include <R_ext/Utils.h>
2929

30-
/* In API headers R_ext/Applic.h and R_ext/Utils.h
30+
/* Was in API header R_ext/Utils.h
3131
32-
This is called from stats/src/bvalue.f, 3 x stats/src/s*.f for smooth.spline()
33-
and packages gam and mda */
32+
This is called from Fortran in stats/src/bvalue.f,
33+
3x stats/src/s*.f for smooth.spline()
34+
and packages gam and mda.
35+
36+
Was Rboolean *. but that is not possible from Fortran. Since it is
37+
inteneded to be called from C it should not be in a C header.
38+
*/
3439
int F77_SUB(interv)(double *xt, int *n, double *x,
35-
Rboolean *rightmost_closed, Rboolean *all_inside,
40+
int *rightmost_closed, int *all_inside,
3641
int *ilo, int *mflag)
3742
{
3843
return findInterval(xt, *n, *x, *rightmost_closed, *all_inside, *ilo, mflag);

src/include/R_ext/Utils.h

Lines changed: 7 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-2024 The R Core Team
3+
* Copyright (C) 1998-2025 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
@@ -107,7 +107,7 @@ void R_CheckStack(void);
107107
void R_CheckStack2(R_SIZE_T);
108108

109109

110-
/* ../../appl/interv.c: first also in Applic.h
110+
/* ../../appl/interv.c: first and also in Applic.h
111111
Both are API
112112
*/
113113
int findInterval(double *xt, int n, double x,
@@ -116,11 +116,15 @@ int findInterval(double *xt, int n, double x,
116116
int findInterval2(double *xt, int n, double x,
117117
Rboolean rightmost_closed, Rboolean all_inside, Rboolean left_open,
118118
int ilo, int *mflag);
119+
/* Removed in 4.5.0
119120
#ifdef R_RS_H
121+
// Was Rboolean*, but that is not possible in Fortran.
120122
int F77_SUB(interv)(double *xt, int *n, double *x,
121-
Rboolean *rightmost_closed, Rboolean *all_inside,
123+
int *rightmost_closed, int *all_inside,
122124
int *ilo, int *mflag);
123125
#endif
126+
*/
127+
124128
/* not API, no longer in R
125129
void find_interv_vec(double *xt, int *n, double *x, int *nx,
126130
int *rightmost_closed, int *all_inside, int *indx);

0 commit comments

Comments
 (0)