The R Project SVN R

Rev

Rev 61527 | Rev 70014 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61527 Rev 62016
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 2000-2012   The R Core Team.
3
 *  Copyright (C) 2000-2013   The R Core Team.
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
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
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
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 15... Line 15...
15
 *  You should have received a copy of the GNU General Public License
15
 *  You should have received a copy of the GNU General Public License
16
 *  along with this program; if not, a copy is available at
16
 *  along with this program; if not, a copy is available at
17
 *  http://www.r-project.org/Licenses/
17
 *  http://www.r-project.org/Licenses/
18
 */
18
 */
19
 
19
 
20
#ifndef R_CONNECTIONS_H_
20
#ifndef R_EXT_CONNECTIONS_H_
21
#define R_CONNECTIONS_H_
21
#define R_EXT_CONNECTIONS_H_
22
#include <R_ext/Boolean.h>
-
 
23
 
22
 
24
/* NB: this is a private header, and not installed.  The internals of
-
 
25
   connections are private and subject to change without notice. */
23
#include <R_ext/Boolean.h>
26
 
24
 
-
 
25
#ifndef NO_C_HEADERS
27
#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO) && defined(HAVE_SYS_TYPES_H)
26
# include <stddef.h> /* for size_t */
28
#include <sys/types.h>
27
# include <stdarg.h> /* for va_list */
29
#endif
28
#endif
30
 
29
 
-
 
30
/* IMPORTANT: we do not expect future connection APIs to be
-
 
31
   backward-compatible so if you use this, you *must* check the version
-
 
32
   and proceed only if it matches what you expect
-
 
33
 
-
 
34
   We explicitly reserve the right to change the connection
-
 
35
   implementation without a compatibility layer.
-
 
36
 */
-
 
37
#define R_CONNECTIONS_VERSION 1
-
 
38
 
31
/* this allows the opaque pointer definition to be made available 
39
/* this allows the opaque pointer definition to be made available 
32
   in Rinternals.h */
40
   in Rinternals.h */
33
#ifndef HAVE_RCONNECTION_TYPEDEF
41
#ifndef HAVE_RCONNECTION_TYPEDEF
34
typedef struct Rconn  *Rconnection;
42
typedef struct Rconn  *Rconnection;
35
#endif
43
#endif
Line 66... Line 74...
66
    void *ex_ptr;
74
    void *ex_ptr;
67
    void *private;
75
    void *private;
68
    int status; /* for pipes etc */
76
    int status; /* for pipes etc */
69
};
77
};
70
 
78
 
-
 
79
#ifdef  __cplusplus
-
 
80
extern "C" {
-
 
81
#endif
71
 
82
 
72
typedef enum {HTTPsh, FTPsh, HTTPSsh} UrlScheme;
-
 
73
 
-
 
74
/* used in internet module */
-
 
75
typedef struct urlconn {
-
 
76
    void *ctxt;
-
 
77
    UrlScheme type;
-
 
78
} *Rurlconn;
-
 
79
 
-
 
80
/* used in internet module */
-
 
81
typedef struct sockconn {
-
 
82
    int port;
-
 
83
    int server;
-
 
84
    int fd;
-
 
85
    int timeout;
-
 
86
    char *host;
-
 
87
    char inbuf[4096], *pstart, *pend;
-
 
88
} *Rsockconn;
-
 
89
 
-
 
90
/* used in X11 module */
-
 
91
typedef struct clpconn {
-
 
92
    char *buff;
-
 
93
    int pos, len, last, sizeKB;
-
 
94
    Rboolean warned;
-
 
95
} *Rclpconn;
-
 
96
 
-
 
97
#define init_con	Rf_init_con
-
 
98
#define con_pushback	Rf_con_pushback
-
 
99
 
-
 
100
int Rconn_fgetc(Rconnection con);
-
 
101
int Rconn_ungetc(int c, Rconnection con);
-
 
102
int Rconn_getline(Rconnection con, char *buf, int bufsize);
-
 
103
int Rconn_printf(Rconnection con, const char *format, ...);
-
 
104
Rconnection getConnection(int n);
-
 
105
Rconnection getConnection_no_err(int n);
-
 
106
Rboolean switch_stdout(int icon, int closeOnExit);
-
 
107
void init_con(Rconnection new, const char *description, int enc,
-
 
108
	      const char * const mode);
-
 
109
Rconnection R_newurl(const char *description, const char * const mode);
-
 
110
Rconnection R_newsock(const char *host, int port, int server, const char * const mode, int timeout);
-
 
111
Rconnection in_R_newsock(const char *host, int port, int server, const char *const mode, int timeout);
83
SEXP   R_new_custom_connection(const char *description, const char *mode, const char *class_name, Rconnection *ptr);
112
Rconnection R_newunz(const char *description, const char * const mode);
-
 
113
int dummy_fgetc(Rconnection con);
-
 
114
int dummy_vfprintf(Rconnection con, const char *format, va_list ap);
84
size_t R_ReadConnection(Rconnection con, void *buf, size_t n);
115
int getActiveSink(int n);
-
 
116
void con_pushback(Rconnection con, Rboolean newLine, char *line);
85
size_t R_WriteConnection(Rconnection con, void *buf, size_t n);
117
 
-
 
118
int Rsockselect(int nsock, int *insockfd, int *ready, int *write, double timeout);
-
 
119
 
86
 
120
#define set_iconv Rf_set_iconv
87
#ifdef  __cplusplus
121
void set_iconv(Rconnection con);
-
 
-
 
88
}
122
#endif
89
#endif
123
 
90
 
-
 
91
#endif