Juan Jose Garcia-Ripoll | 1 Nov 09:14 2006
Picon
Picon

Re: ecl_stream_to_handle bug? (Was: Latest changes)

2006/10/30, Dave Roberts <dave@...>:
> Juan Jose Garcia-Ripoll wrote:
> >  - New C functions: ecl_stream_to_handle(), ecl_base_char_code(),
> >    ecl_type_error().
>
> I'm all for ecl_stream_to_handle() (very handy). But I'm having a
> problem under SLIME [...]
> Calling this in SLIME for *standard-input* and *standard-output* result
> in -1, however:

Well, the thing is that this routine does not know how to deal with
sockets and sllime does communicate via sockets with ECL.

Juanjo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Dave Roberts | 1 Nov 18:58 2006

Re: ecl_stream_to_handle bug? (Was: Latest changes)

Juan Jose Garcia-Ripoll wrote:
> Well, the thing is that this routine does not know how to deal with
> sockets and sllime does communicate via sockets with ECL.

I'm not sure exactly how Slime does its thing, but sockets still have 
file handles, no? That is, at least under Unix-like systems, I would not 
expect this routine to return -1 unless the particular stream was closed.

I could see ecl_stream_to_handle returning -1 if Slime is doing some 
fancy intercept of output and *standard-output* (for instance) is a 
custom stream (Gray or simple or something) that doesn't use a file 
handle at all in the stream itself. Clearly, there is a file handle 
buried deep down in Slime somewhere, associate with the socket that 
connects to Emacs, but perhaps it's nowhere near the objects bound to 
*standard-input/output*.

Anyway, my use case is that I'm doing some direct terminal IO (termios 
stuff). I want to grab the file handles associated with standard 
input/output and pass them to isatty and if I'm working with a terminal 
enable certain raw IO. I wouldn't expect the raw IO to work with Slime, 
obviously, but I was not expecting a -1 from ecl_stream_to_handle.

-- Dave

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
(Continue reading)

Juan Jose Garcia-Ripoll | 1 Nov 19:06 2006
Picon
Picon

Re: ecl_stream_to_handle bug? (Was: Latest changes)

2006/11/1, Dave Roberts <dave@...>:
> Juan Jose Garcia-Ripoll wrote:
> > Well, the thing is that this routine does not know how to deal with
> > sockets and sllime does communicate via sockets with ECL.
>
> I'm not sure exactly how Slime does its thing, but sockets still have
> file handles, no? That is, at least under Unix-like systems, I would not
> expect this routine to return -1 unless the particular stream was closed.

SB-SOCKETS in ECL are implemented as CLOS objects. The routine you try
to use does not know about these objects. Indeed, this routine was not
at all expected to be exported. It is so level it was thought for
internal use in the core library. I made it public because I was asked
to do so. Now it does not fit your work, well, extend it! :-)

In your case you probably do not even need do it. Your function must
check first whether the input/output stream is a CLOS object and
return NIL in that case because isatty() does not make a sense on Gray
streams.

Juanjo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Juan Jose Garcia-Ripoll | 1 Nov 19:10 2006
Picon
Picon

More changes

Hi,

I have committed another 9 patches regarding error handling in ECL.
They mostly include a new function ecl_fixnum_in_range() which ensures
that the input is a fixnum between two specific values. This is being
used in many other functions. Apart from that, two fixes:

 - Reader for #( did not always read the last parenthesis, what lead
to a warning:
        > #3(1 2 3)
        #(1 2 3)
        > ;;; Warning: Ignoring an unmatched right parenthesis.

 - DIGIT-CHAR-P and DIGIT-CHAR will signal an error if the radix is not an
   integer value between 2 and 36, both included.

Regards,

Juanjo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Dave Roberts | 1 Nov 19:38 2006

Re: ecl_stream_to_handle bug? (Was: Latest changes)

Juan Jose Garcia-Ripoll wrote:
> 2006/11/1, Dave Roberts <dave@...>:
>> Juan Jose Garcia-Ripoll wrote:
>> > Well, the thing is that this routine does not know how to deal with
>> > sockets and sllime does communicate via sockets with ECL.
>>
>> I'm not sure exactly how Slime does its thing, but sockets still have
>> file handles, no? That is, at least under Unix-like systems, I would not
>> expect this routine to return -1 unless the particular stream was closed.
> 
> SB-SOCKETS in ECL are implemented as CLOS objects. The routine you try
> to use does not know about these objects. Indeed, this routine was not
> at all expected to be exported. It is so level it was thought for
> internal use in the core library. I made it public because I was asked
> to do so. Now it does not fit your work, well, extend it! :-)

Okay, okay, I'll quit whining and get coding... ;-)

> In your case you probably do not even need do it. Your function must
> check first whether the input/output stream is a CLOS object and
> return NIL in that case because isatty() does not make a sense on Gray
> streams.

Actually, I'd pass the file handle to isatty. Something like:

(if (isatty (ecl_stream_to_handle *standard-input*))
     ...set terminal for raw IO...
     ...else just use readline...)

-- Dave
(Continue reading)

Juan Jose Garcia-Ripoll | 1 Nov 19:59 2006
Picon
Picon

Re: ecl_stream_to_handle bug? (Was: Latest changes)

2006/11/1, Dave Roberts <dave@...>:
> (if (isatty (ecl_stream_to_handle *standard-input*))
>      ...set terminal for raw IO...
>      ...else just use readline...)

Is a -1 a valid input to isatty? Don't you need to check the output of
ecl_stream_to_handle? I also presume you want to do

(if (isatty (ecl_stream_to_handle *standard-input*))
     ...else just use readline...
     ...set terminal for raw IO...)

Juanjo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Dustin Long | 4 Nov 18:11 2006

windows build fail

The newest cvs fails building on windows using VC++. It gives a linking 
error against "va_copy", which is called in eval.d, and seems to be 
relatively recent. It seems as though this function is gcc specific, and 
I don't know of a similar replacement for windows. Anyone know a fix?

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Juan Jose Garcia-Ripoll | 4 Nov 18:49 2006
Picon
Picon

windows build fail

2006/11/4, Dustin Long <dlong@...>:
> The newest cvs fails building on windows using VC++. It gives a linking
> error against "va_copy", which is called in eval.d, and seems to be
> relatively recent. It seems as though this function is gcc specific, and
> I don't know of a similar replacement for windows. Anyone know a fix?

va_copy is ISO C. It is probably not supported by VC. I will issue a
replacement when I finish installing my new windows machine.
Please be patient.

Juanjo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
Dustin Long | 5 Nov 01:37 2006

Re: windows build fail

Juan Jose Garcia-Ripoll wrote:
> 2006/11/4, Dustin Long <dlong@...>:
>   
>> The newest cvs fails building on windows using VC++. It gives a linking
>> error against "va_copy", which is called in eval.d, and seems to be
>> relatively recent. It seems as though this function is gcc specific, and
>> I don't know of a similar replacement for windows. Anyone know a fix?
>>     
>
> va_copy is ISO C. It is probably not supported by VC. I will issue a
> replacement when I finish installing my new windows machine.
> Please be patient.
>
> Juanjo
>   
I see. Seems it was a GNU extension but got standardized.
Would this do? According to vc6's stdarg.h va_list is just a struct 
containing the stack pointer and an offset. ECL seems to build fine and 
work if I include it.

ecl.h:

#if defined(_MSC_VER) || !defined(va_copy)
#define va_copy(dst, src) \
    ((void) memcpy(&(dst), &(src), sizeof(va_list)))
#endif

Dustin

-------------------------------------------------------------------------
(Continue reading)

Juan Jose Garcia-Ripoll | 5 Nov 10:12 2006
Picon
Picon

Re: windows build fail

2006/11/5, Dustin Long <dlong@...>:
> Juan Jose Garcia-Ripoll wrote:
> > va_copy is ISO C. It is probably not supported by VC. I will issue a
> > replacement when I finish installing my new windows machine.
>
> I see. Seems it was a GNU extension but got standardized.
> Would this do? According to vc6's stdarg.h va_list is just a struct
> containing the stack pointer and an offset. ECL seems to build fine and
> work if I include it.

Ok, I will include your fix. Thanks,

Juanjo

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Gmane