| 654 |
rgentlem |
1 |
/*
|
| 2429 |
maechler |
2 |
* R : A Computer Language for Statistical Data Analysis
|
| 654 |
rgentlem |
3 |
* Copyright (C) 1997 Robert Gentleman and Ross Ihaka
|
| 59039 |
ripley |
4 |
* Copyright (C) 2005 R Core Team
|
| 654 |
rgentlem |
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/
|
| 654 |
rgentlem |
19 |
*/
|
|
|
20 |
|
| 70046 |
ripley |
21 |
/* Internal header, not installed */
|
|
|
22 |
|
| 34748 |
ripley |
23 |
#ifndef R_IOSTUFF_H
|
|
|
24 |
#define R_IOSTUFF_H
|
|
|
25 |
|
| 654 |
rgentlem |
26 |
/*
|
|
|
27 |
* I/O Support for Consoles and Character Vectors
|
|
|
28 |
*
|
|
|
29 |
* This code provides analogues for the stdio routines "fgetc" and
|
| 32774 |
ripley |
30 |
* (formerly) "ungetc" for "consoles" and character vectors. These routines
|
| 654 |
rgentlem |
31 |
* are used for parsing input from the console window and character
|
|
|
32 |
* vectors.
|
|
|
33 |
*/
|
|
|
34 |
|
| 36498 |
ripley |
35 |
#include <Defn.h>
|
| 654 |
rgentlem |
36 |
#include <stdio.h>
|
|
|
37 |
|
|
|
38 |
#define IOBSIZE 4096
|
|
|
39 |
|
|
|
40 |
typedef struct BufferListItem {
|
| 3921 |
pd |
41 |
unsigned char buf[IOBSIZE];
|
| 654 |
rgentlem |
42 |
struct BufferListItem *next;
|
|
|
43 |
} BufferListItem;
|
|
|
44 |
|
|
|
45 |
typedef struct IoBuffer {
|
|
|
46 |
BufferListItem *start_buf; /* First buffer item */
|
|
|
47 |
BufferListItem *write_buf; /* Write pointer location */
|
| 3921 |
pd |
48 |
unsigned char *write_ptr; /* Write pointer location */
|
| 654 |
rgentlem |
49 |
int write_offset; /* Write pointer location */
|
|
|
50 |
BufferListItem *read_buf; /* Read pointer location */
|
| 3921 |
pd |
51 |
unsigned char *read_ptr; /* Read pointer location */
|
| 654 |
rgentlem |
52 |
int read_offset; /* Read pointer location */
|
|
|
53 |
} IoBuffer;
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
typedef struct TextBuffer {
|
| 41901 |
ripley |
57 |
void *vmax; /* Memory stack top */
|
| 4622 |
maechler |
58 |
unsigned char *buf; /* Line buffer */
|
|
|
59 |
unsigned char *bufp; /* Line buffer location */
|
| 654 |
rgentlem |
60 |
SEXP text; /* String Vector */
|
|
|
61 |
int ntext; /* Vector length */
|
|
|
62 |
int offset; /* Offset within vector */
|
|
|
63 |
} TextBuffer;
|
|
|
64 |
|
| 4622 |
maechler |
65 |
#ifndef __MAIN__
|
|
|
66 |
extern
|
| 37001 |
ripley |
67 |
#else
|
|
|
68 |
attribute_hidden
|
| 4622 |
maechler |
69 |
#endif
|
|
|
70 |
IoBuffer R_ConsoleIob; /* Console IO Buffer */
|
|
|
71 |
|
| 1016 |
maechler |
72 |
/*- some of these really could be void */
|
| 654 |
rgentlem |
73 |
int R_IoBufferInit(IoBuffer*);
|
|
|
74 |
int R_IoBufferFree(IoBuffer*);
|
|
|
75 |
int R_IoBufferReadReset(IoBuffer*);
|
|
|
76 |
int R_IoBufferWriteReset(IoBuffer*);
|
|
|
77 |
int R_IoBufferGetc(IoBuffer*);
|
|
|
78 |
int R_IoBufferPutc(int, IoBuffer*);
|
|
|
79 |
int R_IoBufferPuts(char*, IoBuffer*);
|
| 58084 |
murdoch |
80 |
int R_IoBufferReadOffset(IoBuffer*);
|
| 654 |
rgentlem |
81 |
|
|
|
82 |
int R_TextBufferInit(TextBuffer*, SEXP);
|
|
|
83 |
int R_TextBufferFree(TextBuffer*);
|
|
|
84 |
int R_TextBufferGetc(TextBuffer*);
|
| 34748 |
ripley |
85 |
|
|
|
86 |
#endif /* not R_IOSTUFF_H */
|