CXXR (C++ R)
Macros | Functions | Variables
main.cpp File Reference

($Id: main.cpp 1351 2013-03-08 15:12:28Z arr $)

#include <iostream>
#include <config.h>
#include <math.h>
#include <float.h>
#include <ctype.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include "Defn.h"
#include "Rinterface.h"
#include "IOStuff.h"
#include "Fileio.h"
#include "Parse.h"
#include "Rembedded.h"
#include "Startup.h"
#include "basedecl.h"
#include <locale.h>
#include "CXXR/Browser.hpp"
#include "CXXR/ClosureContext.hpp"
#include "CXXR/CommandTerminated.hpp"
#include "CXXR/ProvenanceTracker.h"
#include "CXXR/ReturnException.hpp"
#include <R_ext/Callbacks.h>
#include <R_ext/RS.h>
Include dependency graph for main.cpp:

Functions

void Rf_callToplevelHandlers (SEXP expr, SEXP value, Rboolean succeeded, Rboolean visible)
void InitDynload (void)
char * R_PromptString (int browselevel, int type)
int Rf_ReplIteration (SEXP rho, CXXRUNSIGNED int savestack, R_ReplState *state)
void R_ReplDLLinit (void)
int R_ReplDLLdo1 (void)
unsigned int TimeToSeed (void)
const char * get_workspace_name ()
void setup_Rmainloop (void)
void end_Rmainloop (void)
void run_Rmainloop (void)
void mainloop (void)
SEXP attribute_hidden do_browser (SEXP call, SEXP op, SEXP args, SEXP rho)
void R_dot_Last (void)
SEXP attribute_hidden do_quit (SEXP call, SEXP op, SEXP args, SEXP rho)
R_ToplevelCallbackEl * Rf_addTaskCallback (R_ToplevelCallback cb, void *data, void(*finalizer)(void *), const char *name, int *pos)
Rboolean Rf_removeTaskCallbackByName (const char *name)
Rboolean Rf_removeTaskCallbackByIndex (int id)
SEXP R_removeTaskCallback (SEXP which)
SEXP R_getTaskCallbackNames (void)
Rboolean R_taskCallbackRoutine (SEXP expr, SEXP value, Rboolean succeeded, Rboolean visible, void *userData)
SEXP R_addTaskCallback (SEXP f, SEXP data, SEXP useData, SEXP name)
void F77_SYMBOL() intpr (const char *, int *, int *, int *)
void attribute_hidden dummy12345 (void)

Variables

LibExport double R_NaN
LibExport double R_PosInf
LibExport double R_NegInf
LibExport double R_NaReal
LibExport int R_NaInt
LibExport SEXP R_NamespaceRegistry
LibExport char * R_Home
LibExport int R_Is_Running
LibExport Rboolean R_Interactive = TRUE
LibExport char * R_TempDir = NULL
LibExport char * R_HistoryFile
LibExport int R_HistorySize
LibExport int R_RestoreHistory
LibExport Rboolean utf8locale = FALSE
LibExport Rboolean mbcslocale = FALSE
LibExport unsigned int localeCP = 1252
LibExport int R_num_math_threads = 1
LibExport int R_max_num_math_threads = 1
LibExport SEXP R_MethodsNamespace
LibExport AccuracyInfo R_AccuracyInfo
int gc_inhibit_torture = 1
uintptr_t R_CStackLimit = uintptr_t(-1)
uintptr_t R_CStackStart = uintptr_t(-1)
Rboolean R_Slave = FALSE
FILE * R_Consolefile = NULL
FILE * R_Outputfile = NULL
int R_DirtyImage = 0
const char * R_GUIType = "unknown"
Rboolean R_isForkedChild = FALSE
double cpuLimit = -1.0
double cpuLimit2 = -1.0
double cpuLimitValue = -1.0
double elapsedLimit = -1.0
double elapsedLimit2 = -1.0
double elapsedLimitValue = -1.0
attribute_hidden R_size_t R_VSize = R_VSIZE
attribute_hidden SEXP R_NHeap
attribute_hidden SEXP R_FreeSEXP
attribute_hidden int R_BrowseLines = 0
attribute_hidden Rboolean R_KeepSource = FALSE
attribute_hidden int R_WarnLength = 1000
attribute_hidden int R_nwarnings = 50
attribute_hidden int R_CStackDir = 1
attribute_hidden Rboolean R_WarnEscapes = TRUE
attribute_hidden Rboolean R_Quiet = FALSE
attribute_hidden Rboolean R_Verbose = FALSE
attribute_hidden int R_ErrorCon = 2
attribute_hidden char * Sys_TempDir = NULL
attribute_hidden char R_StdinEnc [31] = ""
attribute_hidden int R_ParseError = 0
attribute_hidden int R_ParseErrorCol
attribute_hidden SEXP R_ParseErrorFile
attribute_hidden char R_ParseErrorMsg [PARSE_ERROR_SIZE] = ""
attribute_hidden char R_ParseContext [PARSE_CONTEXT_SIZE] = ""
attribute_hidden int R_ParseContextLast = 0
attribute_hidden int R_ParseContextLine
attribute_hidden int R_CollectWarnings = 0
GCRoot R_Warnings
attribute_hidden int R_ShowErrorMessages = 1
attribute_hidden Rboolean R_warn_partial_match_dollar = FALSE
attribute_hidden Rboolean R_warn_partial_match_attr = FALSE
attribute_hidden Rboolean R_ShowWarnCalls = FALSE
attribute_hidden Rboolean R_ShowErrorCalls = FALSE
attribute_hidden int R_NShowCalls = 50
attribute_hidden Rboolean latin1locale = FALSE
attribute_hidden char OutDec = '.'
attribute_hidden Rboolean R_DisableNLinBrowser = FALSE
attribute_hidden int R_dec_min_exponent = -308
attribute_hidden unsigned int max_contour_segments = 25000
attribute_hidden Rboolean known_to_be_latin1 = FALSE
attribute_hidden Rboolean known_to_be_utf8 = FALSE
int R_ignore_SIGPIPE = 0
int R_SignalHandlers = 0
SA_TYPE SaveAction

Detailed Description

The main program.


Function Documentation

SEXP R_removeTaskCallback ( SEXP  which)

R-level entry point to remove an entry from the list of top-level callbacks. 'which' should be an integer and give us the 0-based index of the element to be removed from the list.

See also:
Rf_RemoveToplevelCallbackByIndex(int)
R_ToplevelCallbackEl* Rf_addTaskCallback ( R_ToplevelCallback  cb,
void *  data,
void(*)(void *)  finalizer,
const char *  name,
int *  pos 
)

This is the C-level entry point for registering a handler that is to be called when each top-level task completes.

Perhaps we need names to make removing them handlers easier since they could be more identified by an invariant (rather than position).

Rboolean Rf_removeTaskCallbackByIndex ( int  id)

Remove the top-level task handler/callback identified by its position in the list of callbacks.

int Rf_ReplIteration ( SEXP  rho,
CXXRUNSIGNED int  savestack,
R_ReplState *  state 
)

This is the body of the REPL. It attempts to parse the first line or expression of its input, and optionally request input from the user if none is available. If the input can be parsed correctly, i) the resulting expression is evaluated, ii) the result assigned to .Last.Value, iii) top-level task handlers are invoked.

If the input cannot be parsed, i.e. there is a syntax error, it is incomplete, or we encounter an end-of-file, then we change the prompt accordingly.

The "cursor" for the input buffer is moved to the next starting point, i.e. the end of the first line or after the first ;.