| 5306 |
ripley |
1 |
/*
|
|
|
2 |
* R : A Computer Language for Statistical Data Analysis
|
| 89798 |
luke |
3 |
* Copyright (C) 1999-2026 The R Core Team
|
| 5306 |
ripley |
4 |
*
|
|
|
5 |
* This program is free software; you can redistribute it and/or modify
|
|
|
6 |
* it under the terms of the GNU General Public License as published by
|
|
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
|
8 |
* (at your option) any later version.
|
|
|
9 |
*
|
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
13 |
* GNU General Public License for more details.
|
|
|
14 |
*
|
|
|
15 |
* You should have received a copy of the GNU General Public License
|
| 42308 |
ripley |
16 |
* along with this program; if not, a copy is available at
|
| 68949 |
ripley |
17 |
* https://www.R-project.org/Licenses/
|
| 5306 |
ripley |
18 |
*/
|
|
|
19 |
|
| 60253 |
ripley |
20 |
/*
|
|
|
21 |
C functions to be called from alternative front-ends.
|
|
|
22 |
|
|
|
23 |
Part of the API for such front-ends but not for packages.
|
|
|
24 |
*/
|
|
|
25 |
|
| 34748 |
ripley |
26 |
#ifndef R_EXT_RSTARTUP_H_
|
|
|
27 |
#define R_EXT_RSTARTUP_H_
|
| 11139 |
maechler |
28 |
|
| 71379 |
ripley |
29 |
#if defined(__cplusplus) && !defined(DO_NOT_USE_CXX_HEADERS)
|
|
|
30 |
# include <cstddef>
|
|
|
31 |
# define R_SIZE_T std::size_t
|
|
|
32 |
#else
|
|
|
33 |
# include <stddef.h> /* for size_t */
|
|
|
34 |
# define R_SIZE_T size_t
|
|
|
35 |
#endif
|
|
|
36 |
|
| 87861 |
ripley |
37 |
//#include <R_ext/Boolean.h> /* TRUE/FALSE and formerly for Rboolean */
|
| 42411 |
ripley |
38 |
|
| 31542 |
ripley |
39 |
#ifdef __cplusplus
|
|
|
40 |
extern "C" {
|
|
|
41 |
#endif
|
|
|
42 |
|
| 5306 |
ripley |
43 |
#ifdef Win32
|
|
|
44 |
typedef enum {RGui, RTerm, LinkDLL} UImode;
|
|
|
45 |
#endif
|
|
|
46 |
|
| 81952 |
kalibera |
47 |
#define RSTART_VERSION 1 /* version 1 introduced in R 4.2.0 */
|
|
|
48 |
|
| 11139 |
maechler |
49 |
/* Startup Actions */
|
|
|
50 |
typedef enum {
|
|
|
51 |
SA_NORESTORE,/* = 0 */
|
|
|
52 |
SA_RESTORE,
|
| 11661 |
maechler |
53 |
SA_DEFAULT,/* was === SA_RESTORE */
|
| 11139 |
maechler |
54 |
SA_NOSAVE,
|
|
|
55 |
SA_SAVE,
|
|
|
56 |
SA_SAVEASK,
|
|
|
57 |
SA_SUICIDE
|
|
|
58 |
} SA_TYPE;
|
|
|
59 |
|
| 87861 |
ripley |
60 |
/* This is a public struct which is used by alternative front-ends
|
|
|
61 |
* which wish to to bw able to link to different versions of R. So
|
|
|
62 |
* only change the layout if essential.
|
|
|
63 |
*/
|
| 5306 |
ripley |
64 |
typedef struct
|
|
|
65 |
{
|
| 87861 |
ripley |
66 |
/* Some of thse were Rboolean, but if we change the size of
|
|
|
67 |
* that it would affect alignment and padding here.
|
|
|
68 |
* So changed to int in R 4.5.0.
|
|
|
69 |
*/
|
|
|
70 |
int R_Quiet;
|
|
|
71 |
int R_NoEcho;
|
|
|
72 |
int R_Interactive;
|
|
|
73 |
int R_Verbose;
|
|
|
74 |
int LoadSiteFile;
|
|
|
75 |
int LoadInitFile;
|
|
|
76 |
int DebugInitFile; // unused
|
| 12976 |
pd |
77 |
SA_TYPE RestoreAction;
|
|
|
78 |
SA_TYPE SaveAction;
|
| 71379 |
ripley |
79 |
R_SIZE_T vsize;
|
|
|
80 |
R_SIZE_T nsize;
|
|
|
81 |
R_SIZE_T max_vsize;
|
|
|
82 |
R_SIZE_T max_nsize;
|
|
|
83 |
R_SIZE_T ppsize;
|
| 87861 |
ripley |
84 |
int NoRenviron : 16; /* was Rboolean, so assumed that had an
|
|
|
85 |
underlying type of at leat 16 bits.
|
|
|
86 |
Only used for TRUE/FALSE so only one bit used.
|
|
|
87 |
*/
|
| 81952 |
kalibera |
88 |
/* RstartVersion has been added in R 4.2.0. Earlier, NoRenviron was an
|
|
|
89 |
int (normally 32-bit like Rboolean), so on most machines the
|
|
|
90 |
version would become 0 when setting NoRenviron to FALSE in
|
|
|
91 |
R_DefParams by R older than 4.2.0. To be safe, embedding
|
|
|
92 |
applications should be compiled using the same version of R they
|
|
|
93 |
embed, as shown in rtest.c and WRE, and definitely recompiled with
|
|
|
94 |
R 4.2.0.
|
|
|
95 |
*/
|
|
|
96 |
int RstartVersion : 16;
|
| 84466 |
ripley |
97 |
int nconnections;
|
| 81952 |
kalibera |
98 |
|
| 5306 |
ripley |
99 |
#ifdef Win32
|
|
|
100 |
char *rhome; /* R_HOME */
|
|
|
101 |
char *home; /* HOME */
|
| 81626 |
kalibera |
102 |
|
|
|
103 |
int (*ReadConsole) (const char *, unsigned char *, int, int);
|
|
|
104 |
void (*WriteConsole) (const char *, int);
|
| 81952 |
kalibera |
105 |
void (*CallBack) (void); /* ProcessEvents under Unix */
|
| 81626 |
kalibera |
106 |
void (*ShowMessage) (const char *);
|
|
|
107 |
int (*YesNoCancel) (const char *);
|
|
|
108 |
/* Return value here is expected to be 1 for Yes, -1 for No and
|
|
|
109 |
|
|
|
110 |
*/
|
|
|
111 |
void (*Busy) (int);
|
| 5306 |
ripley |
112 |
UImode CharacterMode;
|
| 81952 |
kalibera |
113 |
/* The following field has been added in R 2.5.0 */
|
| 81626 |
kalibera |
114 |
void (*WriteConsoleEx) (const char *, int, int);
|
|
|
115 |
/* used only if WriteConsole is NULL */
|
| 81952 |
kalibera |
116 |
|
|
|
117 |
/* The following field has been added in R 4.0.0. */
|
| 87861 |
ripley |
118 |
int EmitEmbeddedUTF8;
|
| 77769 |
kalibera |
119 |
/* R may embed UTF-8 sections into strings otherwise in current native
|
|
|
120 |
encoding, escaped by UTF8in and UTF8out (rgui_UTF8.h). The setting
|
| 81952 |
kalibera |
121 |
has no effect in Rgui (escaping happens iff the system codepage is
|
|
|
122 |
not UTF-8) neither in Rterm (never enabled). For UTF-8 to be the
|
| 84150 |
maechler |
123 |
system codepage, the embedding application must set UTF-8 as the
|
| 81952 |
kalibera |
124 |
active code page (system encoding) via its fusion manifest. When
|
|
|
125 |
using version 0 of the structure, this field must be initialized
|
|
|
126 |
by the embedding application/front-end.
|
| 77769 |
kalibera |
127 |
*/
|
| 81952 |
kalibera |
128 |
|
|
|
129 |
/* The following fields have been added in R 4.2.0 and are only
|
|
|
130 |
available with RstarVersion 1.
|
|
|
131 |
*/
|
|
|
132 |
void (*CleanUp)(SA_TYPE, int, int);
|
|
|
133 |
void (*ClearerrConsole)(void);
|
|
|
134 |
void (*FlushConsole)(void);
|
|
|
135 |
void (*ResetConsole) (void);
|
|
|
136 |
void (*Suicide) (const char *s);
|
| 5306 |
ripley |
137 |
#endif
|
|
|
138 |
} structRstart;
|
|
|
139 |
|
|
|
140 |
typedef structRstart *Rstart;
|
|
|
141 |
|
| 81952 |
kalibera |
142 |
void R_DefParams(Rstart); /* only for RstartVersion 0 */
|
|
|
143 |
int R_DefParamsEx(Rstart, int);
|
|
|
144 |
/* New code should always use R_DefParamsEx(Rstart, RSTART_VERSION) to
|
|
|
145 |
inform R about the version of the structure used. R_DefParams(Rstart)
|
|
|
146 |
only supports version 0 of the structure.
|
|
|
147 |
*/
|
| 5306 |
ripley |
148 |
void R_SetParams(Rstart);
|
| 89069 |
luke |
149 |
#ifdef Win32
|
| 81952 |
kalibera |
150 |
void R_DefCallbacks(Rstart, int);
|
| 89069 |
luke |
151 |
#endif
|
| 5306 |
ripley |
152 |
void R_SetWin32(Rstart);
|
|
|
153 |
void R_SizeFromEnv(Rstart);
|
|
|
154 |
void R_common_command_line(int *, char **, Rstart);
|
|
|
155 |
|
| 29748 |
ripley |
156 |
void R_set_command_line_arguments(int argc, char **argv);
|
| 10688 |
maechler |
157 |
|
| 60253 |
ripley |
158 |
void setup_Rmainloop(void); // also in Rembedded.h
|
| 89789 |
luke |
159 |
void run_Rmainloop(void); // also in Rembedded.h
|
| 11139 |
maechler |
160 |
|
| 89798 |
luke |
161 |
SA_TYPE R_GetSaveAction(void);
|
| 89808 |
luke |
162 |
SA_TYPE R_SetSaveAction(SA_TYPE newval);
|
| 89789 |
luke |
163 |
|
| 31542 |
ripley |
164 |
#ifdef __cplusplus
|
|
|
165 |
}
|
| 11139 |
maechler |
166 |
#endif
|
| 31542 |
ripley |
167 |
|
|
|
168 |
#endif
|