1 /*
2  *  gretl -- Gnu Regression, Econometrics and Time-series Library
3  *  Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti
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 3 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
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  */
19 
20 #ifndef GRETL_FOREIGN_H
21 #define GRETL_FOREIGN_H
22 
23 typedef enum {
24     LANG_R = 1,
25     LANG_OX,
26     LANG_OCTAVE,
27     LANG_STATA,
28     LANG_PYTHON,
29     LANG_JULIA,
30     LANG_MPI
31 } ForeignLang;
32 
33 int foreign_start (int ci, const char *param, gretlopt opt, PRN *prn);
34 
35 int foreign_append (const char *line, int context);
36 
37 int foreign_execute (const DATASET *dset, gretlopt opt, PRN *prn);
38 
39 void foreign_destroy (void);
40 
41 int execute_R_buffer (const char *buf,
42 		      const DATASET *dset,
43 		      gretlopt opt,
44 		      PRN *prn);
45 
46 int write_gretl_R_files (const char *buf,
47 			 const DATASET *dset,
48 			 gretlopt opt);
49 
50 void delete_gretl_R_files (void);
51 
52 int write_gretl_foreign_script (const char *buf, int lang,
53 				gretlopt opt, const DATASET *dset,
54 				const char **pfname);
55 
56 int gretl_max_mpi_processes (void);
57 
58 #ifdef HAVE_MPI
59 
60 void set_mpi_variant (const char *pref);
61 
62 int check_for_mpiexec (void);
63 
64 #endif /* HAVE_MPI */
65 
66 #ifdef USE_RLIB
67 
68 int get_R_function_by_name (const char *name);
69 
70 int gretl_R_get_call (const char *name, int argc);
71 
72 int gretl_R_function_add_arg (void *ptr, GretlType type);
73 
74 int gretl_R_function_add_series (double *x, const DATASET *dset, int v);
75 
76 int gretl_R_function_exec (const char *name, int *rtype, void **ret);
77 
78 void gretl_R_reset_error (void);
79 
80 void gretl_R_cleanup (void);
81 
82 #endif /* USE_RLIB */
83 
84 #endif /* GRETL_FOREIGN_H */
85