CXXR (C++ R) API
Rinterface.h
1 /*CXXR $Id: Rinterface.h 1348 2013-02-25 17:49:03Z arr $
2  *CXXR
3  *CXXR This file is part of CXXR, a project to refactor the R interpreter
4  *CXXR into C++. It may consist in whole or in part of program code and
5  *CXXR documentation taken from the R project itself, incorporated into
6  *CXXR CXXR (and possibly MODIFIED) under the terms of the GNU General Public
7  *CXXR Licence.
8  *CXXR
9  *CXXR CXXR is Copyright (C) 2008-13 Andrew R. Runnalls, subject to such other
10  *CXXR copyrights and copyright restrictions as may be stated below.
11  *CXXR
12  *CXXR CXXR is not part of the R project, and bugs and other issues should
13  *CXXR not be reported via r-bugs or other R project channels; instead refer
14  *CXXR to the CXXR website.
15  *CXXR */
16 
17 /*
18  * R : A Computer Language for Statistical Data Analysis
19  * Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
20  * Copyright (C) 1998--2006 The R Core Team.
21  *
22  * This program is free software; you can redistribute it and/or modify
23  * it under the terms of the GNU General Public License as published by
24  * the Free Software Foundation; either version 2 of the License, or
25  * (at your option) any later version.
26  *
27  * This program is distributed in the hope that it will be useful,
28  * but WITHOUT ANY WARRANTY; without even the implied warranty of
29  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30  * GNU General Public License for more details.
31  *
32  * You should have received a copy of the GNU General Public License
33  * along with this program; if not, a copy is available at
34  * http://www.r-project.org/Licenses/
35  */
36 
37 /* This header file is to provide hooks for external GUIs such as
38  GNOME and Cocoa. It is only used on Unix-alikes. All entries
39  here should be documented in doc/manual/R-exts.texi
40 */
41 
42 #ifndef RINTERFACE_H_
43 #define RINTERFACE_H_
44 
45 #ifdef __cplusplus
46 #include <cstdio>
47 extern "C" {
48 #else
49 #include <stdio.h>
50 #endif
51 
52 #include <R_ext/Boolean.h>
53 #include <R_ext/RStartup.h>
54 
55 /* from Defn.h */
56 /* this duplication will be removed in due course */
57 
58 extern Rboolean R_Interactive; /* TRUE during interactive use*/
59 extern Rboolean R_Slave; /* Run as a slave process */
60 
61 extern void R_RestoreGlobalEnv(void);
62 extern void R_RestoreGlobalEnvFromFile(const char *, Rboolean);
63 extern void R_SaveGlobalEnv(void);
64 extern void R_SaveGlobalEnvToFile(const char *);
65 extern void R_FlushConsole(void);
66 extern void R_ClearerrConsole(void);
67 extern void R_Suicide(const char *);
68 extern char *R_HomeDir(void);
69 extern int R_DirtyImage; /* Current image dirty */
70 extern const char *R_GUIType;
71 extern void R_setupHistory(void);
72 extern char *R_HistoryFile; /* Name of the history file */
73 extern int R_HistorySize; /* Size of the history file */
74 extern int R_RestoreHistory; /* restore the history file? */
75 extern char *R_Home; /* Root of the R tree */
76 
77 # define jump_to_toplevel Rf_jump_to_toplevel
78 # define mainloop Rf_mainloop
79 # define onintr Rf_onintr
80 void jump_to_toplevel(void);
81 void mainloop(void);
82 void onintr(void);
83 
84 void process_site_Renviron(void);
85 void process_system_Renviron(void);
86 void process_user_Renviron(void);
87 
88 extern FILE * R_Consolefile;
89 extern FILE * R_Outputfile;
90 
91 
92 /* in sys-unix.c */
93 void R_setStartTime(void);
94 void fpu_setup(Rboolean);
95 
96 #ifdef CSTACK_DEFNS
97 /* duplicating Defn.h */
98 #if !defined(HAVE_UINTPTR_T) && !defined(uintptr_t)
99  typedef unsigned long uintptr_t;
100 #endif
101 
102 extern uintptr_t R_CStackLimit; /* C stack limit */
103 extern uintptr_t R_CStackStart; /* Initial stack address */
104 #endif
105 
106 /* formerly in src/unix/devUI.h */
107 
108 #ifdef R_INTERFACE_PTRS
109 
110 /* In CXXR, Rinternals.h must not itself be wrapped in extern "C": */
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #include <Rinternals.h>
116 
117 #ifdef __cplusplus
118 extern "C" {
119 #endif
120 
121 #ifdef __SYSTEM__
122 # define extern
123 #endif
124 
125 extern void (*ptr_R_Suicide)(const char *);
126 extern void (*ptr_R_ShowMessage)(const char *);
127 extern int (*ptr_R_ReadConsole)(const char *, unsigned char *, int, int);
128 extern void (*ptr_R_WriteConsole)(const char *, int);
129 extern void (*ptr_R_WriteConsoleEx)(const char *, int, int);
130 extern void (*ptr_R_ResetConsole)(void);
131 extern void (*ptr_R_FlushConsole)(void);
132 extern void (*ptr_R_ClearerrConsole)(void);
133 extern void (*ptr_R_Busy)(int);
134 extern void (*ptr_R_CleanUp)(SA_TYPE, int, int);
135 extern int (*ptr_R_ShowFiles)(int, const char **, const char **,
136  const char *, Rboolean, const char *);
137 extern int (*ptr_R_ChooseFile)(int, char *, int);
138 extern int (*ptr_R_EditFile)(const char *);
139 extern void (*ptr_R_loadhistory)(SEXP, SEXP, SEXP, SEXP);
140 extern void (*ptr_R_savehistory)(SEXP, SEXP, SEXP, SEXP);
141 extern void (*ptr_R_addhistory)(SEXP, SEXP, SEXP, SEXP);
142 
143 #ifdef HAVE_AQUA
144 extern int (*ptr_R_EditFiles)(int, const char **, const char **, const char *);
145 #endif
146 
147 /* These two are not used by R itself, but are used by the GNOME front-end
148  and the tcltk package */
149 extern int (*R_timeout_handler)(void);
150 extern long R_timeout_val;
151 
152 #endif /* R_INTERFACE_PTRS */
153 
154 #ifdef __SYSTEM__
155 # undef extern
156 #endif
157 
158 extern int R_SignalHandlers;
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* RINTERFACE_H_ */