I've been using hyperterminal (rather than c code) to send/receive info from
the device, so I don't have any working code.
Someone developed a way to do this in Lisp, and makes available a fasl file.
The problem is that it seems to only work with Allegro CL (maybe it uses
built-in Allegro support for serial communications, etc.).
The problem with just using Allegro is that the free version prohibits its
use for university research (that's my goal), so I turned to CLisp since
it's much less expensive than Allegro.
I do have access to a linux box (Red Hat 9.0, I believe). Would a linux
CLisp environment be better for serial communications?
Thanks,
Joe
----- Original Message -----
From: "Sam Steingold" <sds@...>
To: <clisp-list@...>; "Joseph Driscoll"
<driscoll85@...>
Sent: Sunday, February 22, 2004 1:42 PM
Subject: [clisp-list] Re: Serial port access with CLisp and Windows
> > * Joseph Driscoll <qevfpbyy85@...> [2004-02-22 13:07:04 -0600]:
> >
> > #<IO UNBUFFERED FILE-STREAM CHARACTER #P"COM1" @1>
>
> somehow I missed this.
> CLISP thinks that this is an ordinary text file while this is a special
> device which should be accessed with specialized functions.
> I don't know how to make this work.
> Do you have sample C code?
>
> --
> Sam Steingold (http://www.podval.org/~sds) running w2k
> <http://www.camera.org&gt; <http://www.iris.org.il&gt; <http://www.memri.org/&gt;
> <http://www.mideasttruth.com/&gt; <http://www.honestreporting.com&gt;
> Old Age Comes at a Bad Time.
>
>
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
> _______________________________________________
> clisp-list mailing list
> clisp-list@...
> https://lists.sourceforge.net/lists/listinfo/clisp-list
>

Hello,
Has anyone successfully been able to use the serial (COM) ports of a Windows
machine under CLisp (or some other free Lisp)? I'd need both input and
output modes. Is there sample code available?
Here's a transcript of what I was trying before. I open and close the
stream, just to see if that works. Then I open it again, print a character
to it, then try to read from it. But this hangs, and I have to ctrl-c out of
it. I'm not certain if the character I sent out is even being sent. I'm
pretty sure that the port is really opened, since a separate terminal
program (hyperterminal) can't access the port until the "close" instruction
is used in CLisp. Note that everything (input and output) works fine if I
just use Hyperterminal, so I'm fairly sure that the hardware is working.
[9]> (setf sers (open "COM1" :direction :io))
#<IO UNBUFFERED FILE-STREAM CHARACTER #P"COM1" @1>
[10]> (close sers)
T
[11]> (setf sers (open "COM1" :direction :io))
#<IO UNBUFFERED FILE-STREAM CHARACTER #P"COM1" @1>
[12]> (print 'e sers)
E
[13]> (read sers)
*** - READ: Ctrl-C: User break
Break 1 [14]>
I posted this question to comp.lang.lisp, and I have received several
suggestions. Unfortunately, none of these worked: they always result
hanging. I have tried:
(let ((v (make-array 10 :fill-pointer 0 :adjustable t :element-type
'character))) (loop :while (listen serial) :do (vector-push-extend
(read-char serial) v)) v)
(with-output-to-string (s) (loop :while (listen serial) :do (write-char
(read-char serial) s)))
(with-output-to-string (s) (loop :for c = (read-char-no-hang serial) :while
c :do (write-char c s)))
Thanks to Sam Steingold, who has sent several replies on this topic, and
suggested that I post here.
Thanks,
Joe

> * Bruno Haible <oehab@...> [2004-02-22 14:34:03 +0100]:
>
> Sam Steingold wrote:
>> In ANSI CL, DELETE-FILE is specified to return T on success.
>> CLISP returns the truename of the deleted file.
>
> Looking at CLHS (I don't have a copy of ANSI CL):
> Where do you read that returning the truename is not allowed?
>
> - The overview of the function is
>
> "delete-file filespec => t"
>
> where "t" refers to the page leaving the choice between the symbol T
> and the class T. The latter allows any return value.
Actually, everywhere else this overview entry has the _type_ of the
value, not the value (or its description).
So, you appears to be correct!
--
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org&gt; <http://www.iris.org.il&gt; <http://www.memri.org/&gt;
<http://www.mideasttruth.com/&gt; <http://www.honestreporting.com&gt;
The only substitute for good manners is fast reflexes.

Paul F. Dietz writes:
> Bruno Haible wrote:
>
> > - The overview of the function is
> >
> > "delete-file filespec => t"
> >
> > where "t" refers to the page leaving the choice between the symbol T
> > and the class T. The latter allows any return value.
>
> No, the 't' there refers to a value being returned, not its type.
> There are plenty of places where the return value is => nil, and the
> type NIL has no elements.
>
> See section 1.4.4.20.4: "An evaluation arrow ``=> '' precedes a list
> of values to be returned."
>
> The types of entities specified in the Syntax section are defined
> in the 'Arguments and Values' section of a dictionary entry.
Let's hope the next version of the standard will be more formal, and
at least includes signatures for all functions:
(declaim (ftype (function (pathname) (member t)) delete-file))
vs.
(declaim (ftype (function (pathname) t) delete-file))
--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/

Bruno Haible wrote:
> - The overview of the function is
>
> "delete-file filespec => t"
>
> where "t" refers to the page leaving the choice between the symbol T
> and the class T. The latter allows any return value.
No, the 't' there refers to a value being returned, not its type.
There are plenty of places where the return value is => nil, and the
type NIL has no elements.
See section 1.4.4.20.4: "An evaluation arrow ``=> '' precedes a list
of values to be returned."
The types of entities specified in the Syntax section are defined
in the 'Arguments and Values' section of a dictionary entry.
Paul

Sam Steingold wrote:
> In ANSI CL, DELETE-FILE is specified to return T on success.
> CLISP returns the truename of the deleted file.
Looking at CLHS (I don't have a copy of ANSI CL):
Where do you read that returning the truename is not allowed?
- The overview of the function is
"delete-file filespec => t"
where "t" refers to the page leaving the choice between the symbol T
and the class T. The latter allows any return value.
- The description of the function says
"delete-file returns true if it succeeds"
and "true" means any non-NIL object.
- The examples of the function are not relevant, according to CLHS
section 1.4.3.
Bruno

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details