Revert "Added what I call virtual io to tinycc this way we can make a monolitic executable or library that contains all needed to compile programs, truly tinycc portable."

This reverts commit 59e18aee0e.
tcc is being stabilized now in order to do a new release soon.
Therefore, such a change is not appropriate now.
This commit is contained in:
Thomas Preud'homme
2013-01-14 17:34:07 +01:00
parent 60a3ff5f2c
commit 8c56b0cf90
12 changed files with 62 additions and 903 deletions

16
tccpp.c
View File

@ -360,13 +360,13 @@ static int tcc_peekc_slow(BufferedFile *bf)
int len;
/* only tries to read if really end of buffer */
if (bf->buf_ptr >= bf->buf_end) {
if (bf->fd.fd != -1) {
if (bf->fd != -1) {
#if defined(PARSE_DEBUG)
len = 8;
#else
len = IO_BUF_SIZE;
#endif
len = vio_read(bf->fd, bf->buffer, len);
len = read(bf->fd, bf->buffer, len);
if (len < 0)
len = 0;
} else {
@ -1438,8 +1438,6 @@ ST_FUNC void preprocess(int is_bof)
CachedInclude *e;
BufferedFile **f;
const char *path;
int size;
vio_fd fd;
if (i == -2) {
/* check absolute include path */
@ -1452,9 +1450,8 @@ ST_FUNC void preprocess(int is_bof)
/* search in current dir if "header.h" */
if (c != '\"')
continue;
size = tcc_basename(file->filename) - file->filename;
memcpy(buf1, file->filename, size);
buf1[size] = '\0';
path = file->filename;
pstrncpy(buf1, path, tcc_basename(path) - path);
} else {
/* search in all the include paths */
@ -1484,13 +1481,10 @@ ST_FUNC void preprocess(int is_bof)
#ifdef INC_DEBUG
printf("%s: skipping cached %s\n", file->filename, buf1);
#endif
vio_initialize(&fd);
fd.fd = 0;
goto include_done;
}
fd = tcc_open(s1, buf1);
if (fd.fd < 0)
if (tcc_open(s1, buf1) < 0)
include_trynext:
continue;