RAPI
Rinterface.h
Go to the documentation of this file.
00001 /*
00002  *  R : A Computer Language for Statistical Data Analysis
00003  *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
00004  *  Copyright (C) 1998--2016  The R Core Team.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, a copy is available at
00018  *  https://www.R-project.org/Licenses/
00019  */
00020 
00021 /* This header file is to provide hooks for alternative front-ends,
00022    e.g. GUIs such as GNOME and Cocoa.  It is only used on Unix-alikes.
00023    All entries here should be documented in doc/manual/R-exts.texi.
00024 
00025    It should not be included by package sources unless they are
00026    providing such a front-end.
00027 */
00028 
00029 #ifndef RINTERFACE_H_
00030 #define RINTERFACE_H_
00031 
00032 // Support for NO_C_HEADERS added in R 3.3.0
00033 #ifdef __cplusplus
00034 # ifndef NO_C_HEADERS
00035 #  include <cstdio>
00036 #  ifdef __SUNPRO_CC
00037 using std::FILE;
00038 #  endif
00039 # endif
00040 extern "C" {
00041 #else
00042 # ifndef NO_C_HEADERS
00043 #  include <stdio.h>
00044 #endif
00045 #endif
00046 
00047 #if defined(__GNUC__) && __GNUC__ >= 3
00048 # define NORET __attribute__((noreturn))
00049 #else
00050 # define NORET
00051 #endif
00052 
00053 #include <R_ext/Boolean.h>
00054 #include <R_ext/RStartup.h>
00055 
00056 /* from Defn.h */
00057 /* this duplication will be removed in due course */
00058 
00059 extern Rboolean R_Interactive;  /* TRUE during interactive use*/
00060 extern Rboolean R_Slave;    /* Run as a slave process */
00061 
00062 extern void R_RestoreGlobalEnv(void);
00063 extern void R_RestoreGlobalEnvFromFile(const char * name, Rboolean quiet);
00064 extern void R_SaveGlobalEnv(void);
00065 extern void R_SaveGlobalEnvToFile(const char * name);
00066 extern void R_FlushConsole(void);
00067 extern void R_ClearerrConsole(void);
00068 extern void R_Suicide(const char *);
00069 extern char *R_HomeDir(void);
00070 extern int R_DirtyImage;    /* Current image dirty */
00071 extern char *R_GUIType;
00072 extern void R_setupHistory(void);
00073 extern char *R_HistoryFile; /* Name of the history file */
00074 extern int R_HistorySize;   /* Size of the history file */
00075 extern int R_RestoreHistory;    /* restore the history file? */
00076 extern char *R_Home;            /* Root of the R tree */
00077 
00078 # define jump_to_toplevel   Rf_jump_to_toplevel
00079 # define mainloop       Rf_mainloop
00080 # define onintr         Rf_onintr
00081 # define onintrNoResume     Rf_onintrNoResume
00082 void NORET jump_to_toplevel(void);
00083 void mainloop(void);
00084 void onintr(void);
00085 void onintrNoResume(void);
00086 #ifndef DEFN_H_
00087 extern void* R_GlobalContext;    /* Need opaque pointer type for export */
00088 #endif
00089 
00090 void process_site_Renviron(void);
00091 void process_system_Renviron(void);
00092 void process_user_Renviron(void);
00093 
00094 extern FILE * R_Consolefile;
00095 extern FILE * R_Outputfile;
00096 
00097 
00098 /* in ../unix/sys-unix.c */
00099 void R_setStartTime(void);
00100 void fpu_setup(Rboolean);
00101 
00102 /* in ../unix/system.c */
00103 extern int R_running_as_main_program;
00104 
00105 #ifdef CSTACK_DEFNS
00106 /* duplicating Defn.h */
00107 #if !defined(HAVE_UINTPTR_T) && !defined(uintptr_t)
00108  typedef unsigned long uintptr_t;
00109 #endif
00110 
00111 extern uintptr_t R_CStackLimit; /* C stack limit */
00112 extern uintptr_t R_CStackStart; /* Initial stack address */
00113 #endif
00114 
00115 /* formerly in src/unix/devUI.h */
00116 
00117 #ifdef R_INTERFACE_PTRS
00118 #include <Rinternals.h>
00119 
00120 #ifdef __SYSTEM__
00121 # define extern
00122 #endif
00123 
00124 extern void (*ptr_R_Suicide)(const char *);
00125 extern void (*ptr_R_ShowMessage)(const char *);
00126 extern int  (*ptr_R_ReadConsole)(const char *, unsigned char *, int, int);
00127 extern void (*ptr_R_WriteConsole)(const char *, int);
00128 extern void (*ptr_R_WriteConsoleEx)(const char *, int, int);
00129 extern void (*ptr_R_ResetConsole)(void);
00130 extern void (*ptr_R_FlushConsole)(void);
00131 extern void (*ptr_R_ClearerrConsole)(void);
00132 extern void (*ptr_R_Busy)(int);
00133 extern void (*ptr_R_CleanUp)(SA_TYPE, int, int);
00134 extern int  (*ptr_R_ShowFiles)(int, const char **, const char **,
00135                    const char *, Rboolean, const char *);
00136 extern int  (*ptr_R_ChooseFile)(int, char *, int);
00137 extern int  (*ptr_R_EditFile)(const char *);
00138 extern void (*ptr_R_loadhistory)(SEXP, SEXP, SEXP, SEXP);
00139 extern void (*ptr_R_savehistory)(SEXP, SEXP, SEXP, SEXP);
00140 extern void (*ptr_R_addhistory)(SEXP, SEXP, SEXP, SEXP);
00141 
00142 // added in 3.0.0
00143 extern int  (*ptr_R_EditFiles)(int, const char **, const char **, const char *);
00144 // naming follows earlier versions in R.app
00145 extern SEXP (*ptr_do_selectlist)(SEXP, SEXP, SEXP, SEXP);
00146 extern SEXP (*ptr_do_dataentry)(SEXP, SEXP, SEXP, SEXP);
00147 extern SEXP (*ptr_do_dataviewer)(SEXP, SEXP, SEXP, SEXP);
00148 extern void (*ptr_R_ProcessEvents)();
00149 
00150 
00151 /* These two are not used by R itself, but are used by the tcltk package */
00152 extern int  (*R_timeout_handler)(void);
00153 extern long R_timeout_val;
00154 
00155 #endif /* R_INTERFACE_PTRS */
00156 
00157 #ifdef __SYSTEM__
00158 # undef extern
00159 #endif
00160 
00161 extern int R_SignalHandlers;
00162 
00163 #ifdef __cplusplus
00164 }
00165 #endif
00166 
00167 #endif /* RINTERFACE_H_ */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines