Re: [Rd] Rf_errorcall - translate to Pascal

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu 16 Feb 2006 - 17:20:47 GMT

On Thu, 16 Feb 2006, Hans-Peter wrote:

> Hello!
>
> Thanks for your answers!
>
> ---
> 2006/2/16, Duncan Murdoch <murdoch@stats.uwo.ca>:
>> I think it would be helpful to know the scope of the problem. Could you
>> collect together a complete list of examples like this?
>
> yes, I will do that. Until now it's only the one function mentioned
> and the 2 macro groups.
> Btw: your Delphi notes were great to get me started !!!
>
> ---
> 2006/2/16, Rainer M Krug <rkrug@sun.ac.za>:
>> Hans-Peter wrote:
>>> I (try to) convert the external R header files to Pascal (Delphi). At
>> Sounds interesting - Could you keep me updated about your progress? I
>> would be interested in the header files to use them in the analysis of
>> simulations from Delphi.
>
> Sure, but I cannot promise anything. I did the same for Matlab but
> it's much more difficult with R.
>
> ---
> 2006/2/16, Prof Brian Ripley <ripley@stats.ox.ac.uk>:
>> Yes, and their names are case-sensitive too. So it is intentional that
>> errorcall is not in R_Ext/Error.h. Since it is needed for writing
>> front-ends and now mentioned in Writing R Extensions it should probably be
>> in Rinternals.h.
>
> that would be great!
>
>> But note that is basically the only way that a non-core
>> programmer is going to be writing code that gets passed 'call' objects.
>
> ok, thanks
>
>>> As a sidenote: in Defn.h are two macrogroups:
>> This is intentional. Both Defn.h and Rinternals.h have these in a section
>> protected by
>> #ifdef USE_RINTERNALS
>> #endif
>> and that section should not be regarded as public.
>
> I know that USE_RINTERNALS is ...internal and can change.

It is for use only inside R itself: see the comments in Defn.h.

> But I had to translate it nevertheless, because I need at least the type
> definition "SEXP".

Which is not inside #ifdef USE_RINTERNALS.

> And e.g. in chapter "4.8.2 Calling .External" there are code
> samples with the macros CADR, TYPEOF, CHAR, STRING_ELT, ... which

Those are not macros, but function calls.

> AFAIK can run in Pascal only if they are redefined as pascal
> functions. Regarding the possible changes I have to think about DUnit
> tests to catch them.
>
>> There _are_ (mis-titled) sections
>> /* Promise Access Macros */
>> /* Hashing Macros */
>> in Rinternals.h, and those are the function equivalents defined for
>> external use.
>
> Sorry, I don't understand. Eg. in Rinternals.h the first entry in /*
> Promise Access Macros */ is: SEXP (PRCODE)(SEXP x);

That's not a macro (macros in C start #define). It is a definition of a function call. And R.dll exports a function entry point PRCODE.

> Do you now mean, that the macro PRCODE is defined for external use?
> On the other hand, it's nowhere in the "writing R extensions
> documentation". But it's e.g. used in the library methods (in the
> function: methods-List_dispatch.c).

It is not part of the API, and the methods package imports the PRCODE function. It does not use the PRCODE macro. However, do note that the standard packages which ship with R are regarded as part of R and have privileges other packages do not have. (One is to use Defn.h.)

I realize you may be unfamiliar with C terminology, but you do definitely seem to be misreadling Rinternals.h.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Fri Feb 17 04:37:37 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:41 GMT