Running the S Evaluator from C

This discussion supplements that of Appendix A, with a few more details and a couple of useful macros that may not be defined in your current S/S-Plus. You should read this if you plan to use the S evaluator from another application or to develop your own front-end, say from a GUI. For background, look at section 4.9 of the book to understand how the S evaluator works, in addition to getting the basic ideas of C programming from Appendix A.

There are two different situations we have in mind here:

  1. from an S session, we have gone into another environment, perhaps a C subroutine, perhaps another language entirely, and during this computation, we want to call back to S;
  2. we are taking over full control of the evaluation, as from a GUI or from a verson of S embedded in some other process (we'll discuss embedding S separately).
The basic technique, fortunately, is the same in either case: to construct an S expression object in C that represents the computation to be done, and then to invoke the EVAL macro in C to do the evaluation and return the result.

John Chambers<>
Last modified: Mon Apr 26 17:21:39 Local time zone must be set--see zic manual page 1999