fix IO for simplesim

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@320 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2002-01-23 02:28:31 +00:00
parent fe63bae633
commit d108f4123c
2 changed files with 20 additions and 6 deletions

View File

@ -373,6 +373,14 @@ unix_upd_stream_info (StreamDesc * s)
}
#else
#if HAVE_ISATTY
#if __simplescalar__
/* isatty does not seem to work with simplescar. I'll assume the first
three streams will probably be ttys (pipes are not thatg different) */
if (s-Stream < 3) {
s->u.file.name = LookupAtom("tty");
s->status |= Tty_Stream_f|Reset_Eof_Stream_f|Promptable_Stream_f;
}
#else
{
int filedes; /* visualc */
filedes = YP_fileno (s->u.file.file);
@ -386,6 +394,7 @@ unix_upd_stream_info (StreamDesc * s)
return;
}
}
#endif
#endif /* HAVE_ISATTY */
#endif /* _MSC_VER */
s->status |= Seekable_Stream_f;

View File

@ -107,6 +107,10 @@ STATIC_PROTO (int chdir, (char *));
/* #define signal skel_signal */
#endif /* MACYAP */
#if __simplescalar__
char yap_pwd[YAP_FILENAME_MAX];
#endif
STD_PROTO (void exit, (int));
#ifdef _WIN32
@ -1505,7 +1509,6 @@ int TrueFileName (char *source, char *result, int in_lib)
#if __simplescalar__
/* does not implement getcwd */
char *yap_pwd = getenv("PWD");
strncpy(ares1,yap_pwd,YAP_FILENAME_MAX);
#elif HAVE_GETCWD
if (getcwd (ares1, YAP_FILENAME_MAX) == NULL)
@ -1595,7 +1598,6 @@ p_getcwd(void)
#if __simplescalar__
/* does not implement getcwd */
char *yap_pwd = getenv("PWD");
strncpy(FileNameBuf,yap_pwd,YAP_FILENAME_MAX);
#elif HAVE_GETCWD
if (getcwd (FileNameBuf, YAP_FILENAME_MAX) == NULL)
@ -1787,10 +1789,7 @@ p_cd (void)
}
TrueFileName (FileNameBuf, FileNameBuf2, FALSE);
#if __simplescalar__
strncpy(FileNameBuf,"PWD=",YAP_FILENAME_MAX);
strncat(FileNameBuf,FileNameBuf2,YAP_FILENAME_MAX);
fprintf(stderr,"adding %s\n", FileNameBuf);
putenv(FileNameBuf);
strncpy(yap_pwd,FileNameBuf2,YAP_FILENAME_MAX);
#endif
return (!chdir (FileNameBuf2));
#else
@ -2057,6 +2056,12 @@ set_fpu_exceptions(int flag)
void
InitSysbits (void)
{
#if __simplescalar__
{
char *pwd = getenv("PWD");
strncpy(yap_pwd,pwd,YAP_FILENAME_MAX);
}
#endif
InitPageSize();
InitTime ();
InitWTime ();