source definition for R_NilValue/return from TYPEOF(R_NilValue)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

source definition for R_NilValue/return from TYPEOF(R_NilValue)

Dan Kortschak
Hello,

for reasons I want to know the return value of TYPEOF(R_NilValue), I
expect it to be NILSXP, but I can't find this documented anywhere.
Ideally, I'd like to see the source definition of R_NilValue, but after
fair bit of searching I cannot find an obviously location for this.

Would someone please point me in the right direction?

thanks
--
CRICOS provider code 00123M

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: source definition for R_NilValue/return from TYPEOF(R_NilValue)

Gábor Csárdi
It is in the source:
https://github.com/wch/r-source/blob/ea8c13aef93058c71d647619583b561567856584/src/include/Rinternals.h#L110
https://github.com/wch/r-source/blob/ea8c13aef93058c71d647619583b561567856584/src/include/Rinternals.h#L1798

It could probably be in
https://cran.r-project.org/doc/manuals/r-devel/R-lang.html#NULL-object

Gabor

On Mon, Dec 16, 2019 at 9:59 AM Dan Kortschak
<[hidden email]> wrote:

>
> Hello,
>
> for reasons I want to know the return value of TYPEOF(R_NilValue), I
> expect it to be NILSXP, but I can't find this documented anywhere.
> Ideally, I'd like to see the source definition of R_NilValue, but after
> fair bit of searching I cannot find an obviously location for this.
>
> Would someone please point me in the right direction?
>
> thanks
> --
> CRICOS provider code 00123M
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: source definition for R_NilValue/return from TYPEOF(R_NilValue)

Ivan Krylov
In reply to this post by Dan Kortschak
On Sun, 15 Dec 2019 10:47:11 +0000
Dan Kortschak <[hidden email]> wrote:

> I'd like to see the source definition of R_NilValue, but after
> fair bit of searching I cannot find an obviously location for this.
>
> Would someone please point me in the right direction?

As far as I understand, the assignment to R_NilValue happens in
src/main/memory.c:

https://github.com/wch/r-source/blob/776929704cb4f9398f52805f48f2c93582ec3d38/src/main/memory.c#L2186

(see the definition of GET_FREE_NODE(s) in the same file)

Besides declaring R_NulValue as "extern" and assignments in void
InitMemory(), there doesn't seem to be anything else.

--
Best regards,
Ivan

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: source definition for R_NilValue/return from TYPEOF(R_NilValue)

Dan Kortschak
In reply to this post by Gábor Csárdi
Thank you, but those source lines do not address the issue here.

Dan

On Mon, 2019-12-16 at 10:02 +0000, Gábor Csárdi wrote:
> It is in the source:
>
https://github.com/wch/r-source/blob/ea8c13aef93058c71d647619583b561567856584/src/include/Rinternals.h#L110
>
https://github.com/wch/r-source/blob/ea8c13aef93058c71d647619583b561567856584/src/include/Rinternals.h#L1798
>
> It could probably be in
>
https://cran.r-project.org/doc/manuals/r-devel/R-lang.html#NULL-object

>
> Gabor
>
> On Mon, Dec 16, 2019 at 9:59 AM Dan Kortschak
> <[hidden email]> wrote:
> >
> > Hello,
> >
> > for reasons I want to know the return value of TYPEOF(R_NilValue),
> > I
> > expect it to be NILSXP, but I can't find this documented anywhere.
> > Ideally, I'd like to see the source definition of R_NilValue, but
> > after
> > fair bit of searching I cannot find an obviously location for this.
> >
> > Would someone please point me in the right direction?
> >
> > thanks
> > --
> > CRICOS provider code 00123M
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
--
CRICOS provider code 00123M

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: source definition for R_NilValue/return from TYPEOF(R_NilValue)

Dan Kortschak
In reply to this post by Ivan Krylov
Thanks, Ivan. That answers the question perfectly.

Dan

On Mon, 2019-12-16 at 13:33 +0300, Ivan Krylov wrote:

> On Sun, 15 Dec 2019 10:47:11 +0000
> Dan Kortschak <[hidden email]> wrote:
>
> > I'd like to see the source definition of R_NilValue, but after
> > fair bit of searching I cannot find an obviously location for this.
> >
> > Would someone please point me in the right direction?
>
> As far as I understand, the assignment to R_NilValue happens in
> src/main/memory.c:
>
>
https://github.com/wch/r-source/blob/776929704cb4f9398f52805f48f2c93582ec3d38/src/main/memory.c#L2186
>
> (see the definition of GET_FREE_NODE(s) in the same file)
>
> Besides declaring R_NulValue as "extern" and assignments in void
> InitMemory(), there doesn't seem to be anything else.
>
--
CRICOS provider code 00123M

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel