The R Project SVN R

Rev

Rev 71956 | Rev 78411 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
31538 ripley 1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
71956 ripley 4
 *  Copyright (C) 1998--2017  The R Core Team.
31538 ripley 5
 *
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 2 of the License, or
9
 *  (at your option) any later version.
10
 *
11
 *  This program is distributed in the hope that it will be useful,
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 *  GNU General Public License for more details.
15
 *
16
 *  You should have received a copy of the GNU General Public License
42308 ripley 17
 *  along with this program; if not, a copy is available at
68949 ripley 18
 *  https://www.R-project.org/Licenses/
31538 ripley 19
 */
20
 
60253 ripley 21
/* This header file is to provide hooks for alternative front-ends,
22
   e.g. GUIs such as GNOME and Cocoa.  It is only used on Unix-alikes.
23
   All entries here should be documented in doc/manual/R-exts.texi.
24
 
25
   It should not be included by package sources unless they are
26
   providing such a front-end.
71864 ripley 27
 
71879 ripley 28
   If CSTACK_DEFNS is defined, also define HAVE_UINTPTR_T (if true)
29
   before including this, perhaps by including Rconfig.h from C code
30
   (for C++ you need to test the C++ compiler in use).
37831 ripley 31
*/
31538 ripley 32
 
33
#ifndef RINTERFACE_H_
34
#define RINTERFACE_H_
35
 
71379 ripley 36
#include <R_ext/Boolean.h>
37
 
31542 ripley 38
#ifdef __cplusplus
71864 ripley 39
/* we do not support DO_NOT_USE_CXX_HEADERS in this file */
71371 ripley 40
# include <cstdio>
31542 ripley 41
extern "C" {
51836 ripley 42
#else
71371 ripley 43
# include <stdio.h>
31542 ripley 44
#endif
45
 
67181 luke 46
#if defined(__GNUC__) && __GNUC__ >= 3
70041 ripley 47
# define NORET __attribute__((noreturn))
67181 luke 48
#else
70041 ripley 49
# define NORET
67181 luke 50
#endif
51
 
31538 ripley 52
/* from Defn.h */
53
/* this duplication will be removed in due course */
54
 
55
extern Rboolean R_Interactive;	/* TRUE during interactive use*/
77228 maechler 56
extern Rboolean	R_NoEcho;	/* do not echo R code */
31538 ripley 57
 
58
extern void R_RestoreGlobalEnv(void);
59
extern void R_RestoreGlobalEnvFromFile(const char *, Rboolean);
60
extern void R_SaveGlobalEnv(void);
61
extern void R_SaveGlobalEnvToFile(const char *);
62
extern void R_FlushConsole(void);
63
extern void R_ClearerrConsole(void);
43767 ripley 64
extern void R_Suicide(const char *);
41862 ripley 65
extern char *R_HomeDir(void);
31538 ripley 66
extern int R_DirtyImage;	/* Current image dirty */
41862 ripley 67
extern char *R_GUIType;
44195 ripley 68
extern void R_setupHistory(void);
41862 ripley 69
extern char *R_HistoryFile;	/* Name of the history file */
31538 ripley 70
extern int R_HistorySize;	/* Size of the history file */
71
extern int R_RestoreHistory;	/* restore the history file? */
41862 ripley 72
extern char *R_Home;		    /* Root of the R tree */
31538 ripley 73
 
74
# define jump_to_toplevel	Rf_jump_to_toplevel
75
# define mainloop		Rf_mainloop
76
# define onintr			Rf_onintr
70852 luke 77
# define onintrNoResume		Rf_onintrNoResume
67181 luke 78
void NORET jump_to_toplevel(void);
31538 ripley 79
void mainloop(void);
44195 ripley 80
void onintr(void);
70852 luke 81
void onintrNoResume(void);
31538 ripley 82
#ifndef DEFN_H_
83
extern void* R_GlobalContext;    /* Need opaque pointer type for export */
84
#endif
85
 
44195 ripley 86
void process_site_Renviron(void);
87
void process_system_Renviron(void);
88
void process_user_Renviron(void);
31538 ripley 89
 
71373 ripley 90
#ifdef __cplusplus
91
extern std::FILE * R_Consolefile;
92
extern std::FILE * R_Outputfile;
93
#else
31540 ripley 94
extern FILE * R_Consolefile;
95
extern FILE * R_Outputfile;
71373 ripley 96
#endif
31538 ripley 97
 
68232 maechler 98
/* in ../unix/sys-unix.c */
31538 ripley 99
void R_setStartTime(void);
100
void fpu_setup(Rboolean);
101
 
68232 maechler 102
/* in ../unix/system.c */
103
extern int R_running_as_main_program;
66120 ripley 104
 
37873 ripley 105
#ifdef CSTACK_DEFNS
71879 ripley 106
/* duplicating older Defn.h.
107
   Note: this is never used when including Rinterface.h from R itself
108
*/
37831 ripley 109
#if !defined(HAVE_UINTPTR_T) && !defined(uintptr_t)
110
 typedef unsigned long uintptr_t;
71852 urbaneks 111
#else
71870 ripley 112
# ifndef __cplusplus
113
#  include <stdint.h>
114
# elif __cplusplus >= 201103L
71864 ripley 115
#  include <cstdint>
116
# endif
37831 ripley 117
#endif
118
 
119
extern uintptr_t R_CStackLimit;	/* C stack limit */
120
extern uintptr_t R_CStackStart;	/* Initial stack address */
37873 ripley 121
#endif
37831 ripley 122
 
31538 ripley 123
/* formerly in src/unix/devUI.h */
124
 
125
#ifdef R_INTERFACE_PTRS
71873 ripley 126
#include <Rinternals.h> // for SEXP
127
#include <R_ext/RStartup.h> // for SA_TYPE
31538 ripley 128
 
129
#ifdef __SYSTEM__
130
# define extern
131
#endif
132
 
43767 ripley 133
extern void (*ptr_R_Suicide)(const char *);
134
extern void (*ptr_R_ShowMessage)(const char *);
135
extern int  (*ptr_R_ReadConsole)(const char *, unsigned char *, int, int);
136
extern void (*ptr_R_WriteConsole)(const char *, int);
137
extern void (*ptr_R_WriteConsoleEx)(const char *, int, int);
44195 ripley 138
extern void (*ptr_R_ResetConsole)(void);
139
extern void (*ptr_R_FlushConsole)(void);
140
extern void (*ptr_R_ClearerrConsole)(void);
31538 ripley 141
extern void (*ptr_R_Busy)(int);
142
extern void (*ptr_R_CleanUp)(SA_TYPE, int, int);
43767 ripley 143
extern int  (*ptr_R_ShowFiles)(int, const char **, const char **,
144
			       const char *, Rboolean, const char *);
31538 ripley 145
extern int  (*ptr_R_ChooseFile)(int, char *, int);
43767 ripley 146
extern int  (*ptr_R_EditFile)(const char *);
31538 ripley 147
extern void (*ptr_R_loadhistory)(SEXP, SEXP, SEXP, SEXP);
148
extern void (*ptr_R_savehistory)(SEXP, SEXP, SEXP, SEXP);
37572 murdoch 149
extern void (*ptr_R_addhistory)(SEXP, SEXP, SEXP, SEXP);
35328 ripley 150
 
61285 ripley 151
// added in 3.0.0
41807 rgentlem 152
extern int  (*ptr_R_EditFiles)(int, const char **, const char **, const char *);
60685 ripley 153
// naming follows earlier versions in R.app
154
extern SEXP (*ptr_do_selectlist)(SEXP, SEXP, SEXP, SEXP);
155
extern SEXP (*ptr_do_dataentry)(SEXP, SEXP, SEXP, SEXP);
156
extern SEXP (*ptr_do_dataviewer)(SEXP, SEXP, SEXP, SEXP);
61469 ripley 157
extern void (*ptr_R_ProcessEvents)();
37831 ripley 158
 
60685 ripley 159
 
61760 ripley 160
/* These two are not used by R itself, but are used by the tcltk package */
44195 ripley 161
extern int  (*R_timeout_handler)(void);
31538 ripley 162
extern long R_timeout_val;
163
 
38854 ripley 164
#endif /* R_INTERFACE_PTRS */
31538 ripley 165
 
166
#ifdef __SYSTEM__
167
# undef extern
168
#endif
169
 
37951 ripley 170
extern int R_SignalHandlers;
171
 
31542 ripley 172
#ifdef __cplusplus
173
}
174
#endif
175
 
31538 ripley 176
#endif /* RINTERFACE_H_ */