start working on configure support for vc
WIN should always disable buffering on stderr fix some warnings in ypsocks do some cleanups in save.c git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@722 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
parent
52f4eb1895
commit
696fdc338b
20
C/iopreds.c
20
C/iopreds.c
@ -222,20 +222,13 @@ unix_upd_stream_info (StreamDesc * s)
|
||||
#endif /* USE_SOCKET */
|
||||
#if _MSC_VER || defined(__MINGW32__)
|
||||
{
|
||||
struct _stat buf;
|
||||
char *emacs_env = getenv("EMACS");
|
||||
|
||||
if (_fstat(YP_fileno(s->u.file.file), &buf) == -1) {
|
||||
return;
|
||||
}
|
||||
if (buf.st_mode & S_IFCHR) {
|
||||
if (_isatty(_fileno(s->u.file.file))) {
|
||||
s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f;
|
||||
/* make all console descriptors unbuffered */
|
||||
setvbuf(s->u.file.file, NULL, _IONBF, 0);
|
||||
} else if (emacs_env != NULL && strcmp(emacs_env,"t") == 0) {
|
||||
/* emacs communicates with sub-processes via a pipe */
|
||||
s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f;
|
||||
/* make all console descriptors unbuffered */
|
||||
}
|
||||
/* standard error stream should never be buffered */
|
||||
if (StdErrStream == s-Stream) {
|
||||
setvbuf(s->u.file.file, NULL, _IONBF, 0);
|
||||
}
|
||||
return;
|
||||
@ -773,11 +766,12 @@ static int
|
||||
ConsolePutc (int sno, int ch)
|
||||
{
|
||||
StreamDesc *s = &Stream[sno];
|
||||
#if MAC || _MSC_VER
|
||||
#if MAC || _MSC_VER || defined(__MINGW32__)
|
||||
if (ch == 10)
|
||||
{
|
||||
ch = '\n';
|
||||
putc ('\n', s->u.file.file);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
putc (ch, s->u.file.file);
|
||||
console_count_output_char(ch,s);
|
||||
|
16
C/save.c
16
C/save.c
@ -1343,9 +1343,11 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
|
||||
if (inpf == NULL)
|
||||
inpf = StartUpFile;
|
||||
if (inpf != NULL && (splfild = open_file(inpf, O_RDONLY)) > 0) {
|
||||
if ((mode = commit_to_saved_state(inpf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE)
|
||||
if ((mode = commit_to_saved_state(inpf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE) {
|
||||
Yap_ErrorMessage = NULL;
|
||||
return(mode);
|
||||
}
|
||||
}
|
||||
if (!Yap_dir_separator(inpf[0]) && !Yap_volume_header(inpf)) {
|
||||
/*
|
||||
we have a relative path for the file, try to do somewhat better
|
||||
@ -1354,30 +1356,36 @@ OpenRestore(char *inpf, char *YapLibDir, CELL *Astate, CELL *ATrail, CELL *AStac
|
||||
if (YapLibDir != NULL) {
|
||||
cat_file_name(Yap_FileNameBuf, Yap_LibDir, inpf, YAP_FILENAME_MAX);
|
||||
if ((splfild = open_file(Yap_FileNameBuf, O_RDONLY)) > 0) {
|
||||
if ((mode = commit_to_saved_state(Yap_FileNameBuf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE)
|
||||
if ((mode = commit_to_saved_state(Yap_FileNameBuf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE) {
|
||||
Yap_ErrorMessage = NULL;
|
||||
return(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if HAVE_GETENV
|
||||
{
|
||||
char *yap_env = getenv("YAPLIBDIR");
|
||||
if (yap_env != NULL) {
|
||||
cat_file_name(Yap_FileNameBuf, yap_env, inpf, YAP_FILENAME_MAX);
|
||||
if ((splfild = open_file(Yap_FileNameBuf, O_RDONLY)) > 0) {
|
||||
if ((mode = commit_to_saved_state(Yap_FileNameBuf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE)
|
||||
if ((mode = commit_to_saved_state(Yap_FileNameBuf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE) {
|
||||
Yap_ErrorMessage = NULL;
|
||||
return(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (LIB_DIR != NULL) {
|
||||
cat_file_name(Yap_FileNameBuf, LIB_DIR, inpf, YAP_FILENAME_MAX);
|
||||
if ((splfild = open_file(Yap_FileNameBuf, O_RDONLY)) > 0) {
|
||||
if ((mode = commit_to_saved_state(Yap_FileNameBuf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE)
|
||||
if ((mode = commit_to_saved_state(Yap_FileNameBuf,Astate,ATrail,AStack,AHeap)) != FAIL_RESTORE) {
|
||||
Yap_ErrorMessage = NULL;
|
||||
return(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Yap_Error(SYSTEM_ERROR, TermNil, Yap_ErrorMessage);
|
||||
Yap_ErrorMessage = NULL;
|
||||
return(FAIL_RESTORE);
|
||||
|
12
C/ypsocks.c
12
C/ypsocks.c
@ -225,7 +225,7 @@ Yap_init_socks(char *host, long interface_port)
|
||||
|
||||
ling.l_onoff = 1;
|
||||
ling.l_linger = 0;
|
||||
setsockopt(s, SOL_SOCKET, SO_LINGER, (char *) &ling,
|
||||
setsockopt(s, SOL_SOCKET, SO_LINGER, (void *) &ling,
|
||||
sizeof(ling));
|
||||
|
||||
r = connect ( s, (struct sockaddr *) &soadr, sizeof(soadr));
|
||||
@ -772,7 +772,7 @@ p_socket_connect(void)
|
||||
saddr.sin_family = AF_INET;
|
||||
ling.l_onoff = 1;
|
||||
ling.l_linger = 0;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *) &ling,
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_LINGER, (void *) &ling,
|
||||
sizeof(ling)) < 0) {
|
||||
#if HAVE_STRERROR
|
||||
Yap_Error(SYSTEM_ERROR, TermNil,
|
||||
@ -957,9 +957,9 @@ p_socket_buffering(void)
|
||||
}
|
||||
fd = Yap_GetStreamFd(sno);
|
||||
if (writing) {
|
||||
getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsize, &len);
|
||||
getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *)&bufsize, &len);
|
||||
} else {
|
||||
getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, &len);
|
||||
getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *)&bufsize, &len);
|
||||
}
|
||||
if (!Yap_unify(ARG3,MkIntegerTerm(bufsize)))
|
||||
return(FALSE);
|
||||
@ -979,9 +979,9 @@ p_socket_buffering(void)
|
||||
bufsize = siz;
|
||||
}
|
||||
if (writing) {
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize));
|
||||
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void *)&bufsize, sizeof(bufsize));
|
||||
} else {
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize));
|
||||
setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void *)&bufsize, sizeof(bufsize));
|
||||
}
|
||||
return(TRUE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user