From kynnjo at gmail.com  Wed Jun  3 00:44:25 2009
From: kynnjo at gmail.com (Kynn Jones)
Date: Tue, 2 Jun 2009 18:44:25 -0400
Subject: [Rd] How to generate R objects in C?
Message-ID: <c2350ba40906021544r51bfefb9k6b64e4734e66c90b@mail.gmail.com>

I'm in the process of coding a parser (in C) to generate R entities
(vectors, lists, etc.) from a text description (different from R).
The basic parser works, and now I need to tell it how to create R
entities.  I need to be able to create character vectors (for unicode
strings), integers, floats, unnamed lists, named lists, boolean
values, and NA.  With the exception of the two types of lists and the
character vectors, all the other objects I need to generate are
"scalars", so I suppose they will correspond to 1-element vectors in
R.  I also need to be able to add R entities to both kinds of lists.

I've been staring at various official documents (ch 5 of Writing R
Extensions, R Internals, Rinternals.h) for this kind of work for some
time, but I can't find the constructors for such objects (here I'm
using the term "constructor" loosely).  I'm even further from finding
the C equivalent of "my.list[[ length(my.list) + 1 ]] <- new.thing".

Can someone point me in the right direction?

Thanks!

Kynn



[Rd] How to generate R objects in C?
Kynn Jones