Subject: [clisp-list] clisp problem with ignore-errors compiled?

From: [email-masked] (Don Cohen)
Date: Wed, 22 Mar 2000 11:15:23 -0500

This is the top level function from the webserver I posted:
(defun start-server (&key (port 8000))
  ;; start the web server running on the given port.
  ;; Note that on unix, ports below 1024 can only be obtained by
  ;; programs running as root.
  ;; The default port number for web browsers is 80, to use any other
  ;; port number in a url you have to put that port number after the
  ;; machine name as in    http://www.foo.com:8000/the/url/I/want
  ;;
  (let ((websocket ;; *** generalize from ACL
	 #+clisp (lisp:socket-server port)
	 #+allegro (socket:make-socket :connect :passive :local-port port)))
    (unwind-protect
	(loop
	 ;; It turns out that all the stream operations can and in
	 ;; practice do generate errors.
	 ;; The practical solution is to put an ignore-errors
	 ;; at a pretty high level.
	  (multiple-value-bind (ignore err) ;; ***
            (ignore-errors	       
              (let ((connection ;; *** generalize from ACL
		     #+clisp (lisp:socket-accept websocket)
		     #+allegro (socket:accept-connection websocket)))
		(unwind-protect
		    (do-command connection
				#'(lambda () (return-from start-server)))
		  (close connection))))
	    (declare (ignore ignore))
	    (when err (log- "~%error : ~A" err))))
      ;; *** generalize from ACL
      #+clisp (lisp:socket-server-close websocket)
      #+allegro (close websocket))))

Note the do-command inside the ignore-errors.  When I run this
compiled I get breaks, and when I type "where" I see that I'm 
in do-command.  If I interpret this code things work.  Do you
have any immediate suspects or do you want further data? 
If so, what should I send you?

---

From: Bruno Haible <[email-masked]>
Date: Wed, 22 Mar 2000 20:25:01 +0100 (MET)

> This is the top level function from the webserver I posted:
 [...]
> in do-command.  If I interpret this code things work.

Looks fishy. Can you send a complete backtrace [i.e. (setq *print-circle* t)
then backtrace-1]? Also, what's the value of sys::*use-clcs* inside the break
loop?

Bruno

---

From: Sam Steingold <[email-masked]>
Date: 22 Mar 2000 16:46:45 -0500

>>>> In message <[email-masked]>
>>>> On the subject of "[clisp-list] clisp problem with ignore-errors compiled?"
>>>> Sent on Wed Mar 22 14:14:28 EST 2000
>>>> Honorable Don Cohen <[email-masked]> writes:
...
 >> 	 #+allegro (socket:make-socket :connect :passive :local-port port)))
...
 >> 		     #+allegro (socket:accept-connection websocket)))
...
 >>       #+allegro (close websocket))))

you might want to use clocc/src/port/net.lsp

-- 
Sam Steingold (http://www.podval.org/~sds)
Micros**t is not the answer.  Micros**t is a question, and the answer is Linux,
(http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation.
(let ((a "(let ((a %c%s%c)) (format a 34 a 34))")) (format a 34 a 34))

---

From: David Kaasen <[email-masked]>
Date: Thu, 23 Mar 2000 13:45:50 +0100 (CET)

Hello!

I am writing a text editor in lisp. I try to do it as
platform and implementation independent as possible.
But I need some functionality that I can't find in any
description of the lisp standard. Can you help me?

1. I need to receive unbuffered keystrokes from the user,
i.e. without having to pressing Enter. I know CLISP has
*keyboard-input*, but how can this be done more
implementation independently?

2. Is there some way to get the number of text rows and
columns currently displayed on the screen? I don't want
to rely on packages such as Curses, if it exists for LISP.

3. Is it any method for catching 'out of memory' errors,
so that the program can flush the line buffer to disk,
and continue to function?

Many thanks in advance, David Kaasen.

---

From: Sam Steingold <[email-masked]>
Date: 23 Mar 2000 11:07:06 -0500

>>>> In message <[email-masked]>
>>>> On the subject of "[clisp-list] Some problems"
>>>> Sent on Thu Mar 23 07:44:46 EST 2000
>>>> Honorable David Kaasen <[email-masked]> writes:
 >> 

you would be much better off not using the terminal.

you might want to look at CL-based web browser closure, available at
<http://www.uni-karlsruhe.de/~unk6/>. 

-- 
Sam Steingold (http://www.podval.org/~sds)
Micros**t is not the answer.  Micros**t is a question, and the answer is Linux,
(http://www.linux.org) the choice of the GNU (http://www.gnu.org) generation.
Never let your schooling interfere with your education.

---

From: Bruno Haible <[email-masked]>
Date: Thu, 23 Mar 2000 17:56:58 +0100 (MET)

> implementation independently?

There is no portable common model for keyboard handling; it's
too different in Unix and DOS/Windows. Portable GUI toolkits use
keyboard events, not simple streams, but then you are programming
GUI.

> columns currently displayed on the screen?

In clisp, the number of columns on the screen is (1+ sys::*prin-linelength*).

> I don't want to rely on packages such as Curses, if it exists for LISP.

But ncurses is portable across Unixes.

> and continue to function?

No.

Bruno