- versioning in macos

- fixes to input/output to improve interaction with eclipse console.
-
This commit is contained in:
Vítor Santos Costa
2014-02-20 10:38:18 +00:00
parent 42ec115e75
commit f264859483
9 changed files with 50 additions and 22 deletions

View File

@@ -1448,7 +1448,11 @@ PRED_IMPL("with_output_to", 2, with_output_to, PL_FA_TRANSPARENT)
void
PL_write_prompt(int dowrite)
{ GET_LD
#if __YAP_PROLOG__
IOSTREAM *s = getStream(Suser_error);
#else
IOSTREAM *s = getStream(Suser_output);
#endif
if ( s )
{ if ( dowrite )
@@ -1457,7 +1461,6 @@ PL_write_prompt(int dowrite)
if ( a )
writeAtomToStream(s, a);
}
Sflush(s);
releaseStream(s);
}
@@ -2937,7 +2940,6 @@ PRED_IMPL("prompt", 2, prompt, 0)
void
prompt1(atom_t prompt)
{ GET_LD
if ( LD->prompt.first != prompt )
{ if ( LD->prompt.first )
PL_unregister_atom(LD->prompt.first);

View File

@@ -415,7 +415,6 @@ Sread_readline(void *handle, char *buf, size_t size)
int fd = (int) h;
int ttymode = PL_ttymode(Suser_input); /* Not so nice */
int rval;
PL_write_prompt(ttymode == PL_NOTTY);
switch( ttymode )
@@ -474,6 +473,9 @@ Sread_readline(void *handle, char *buf, size_t size)
reset_readline();
}
#if __YAP_PROLOG__
rl_outstream = stderr;
#endif
if ( in_readline++ )
{ int state = rl_readline_state;

View File

@@ -2662,7 +2662,6 @@ Swrite_file(void *handle, char *buf, size_t size)
#else
bytes = write((int)h, buf, size);
#endif
if ( bytes == -1 && errno == EINTR )
{ if ( PL_handle_signals() < 0 )
{ errno = EPLEXCEPTION;
@@ -3541,8 +3540,15 @@ SinitStreams(void)
if ( !isatty(i) && s->functions == &Sttyfunctions )
{ s->flags &= ~SIO_ISATTY;
s->functions = &Sfilefunctions; /* Check for pipe? */
s->functions = &Sfilefunctions; /* Check for pipe? */
#if HAVE_SETLINEBUF
/* make sure wwe buffer on new line for ttys, eg eclipse console */
} else if (i == 1) {
setlinebuf( stdout );
#endif
}
if ( s > 0)
s->newline = SIO_NL_DOS;
if ( s->encoding == ENC_ISO_LATIN_1 )
s->encoding = enc;
#ifdef O_PLMT

View File

@@ -249,7 +249,7 @@ writeTopTerm(term_t t, int prec, write_options *options)
int
writeAtomToStream(IOSTREAM *s, atom_t atom)
{ Yap_plwrite(MkAtomTerm(YAP_AtomFromSWIAtom(atom)), s, 0, 0, 1200);
{ Yap_WriteAtom( s, YAP_AtomFromSWIAtom(atom));
return 1;
}