[Ecls-list] -shell and -load difference

David_Creelman at pa.com.au David_Creelman at pa.com.au
Tue Oct 16 23:34:32 UTC 2007


Hi Juan,
Forwarding to mailing list as well.
Regards
David

----- Forwarded by David Creelman/PROFESSIONAL ADVANTAGE/AU on 17/10/2007
09:34 AM -----
|---------+---------------------------->
|         |           David Creelman   |
|         |                            |
|         |           17/10/2007 09:10 |
|         |           AM               |
|         |                            |
|---------+---------------------------->
  >-----------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                             |
  |       To:      "Juan Jose Garcia-Ripoll" <jjgarcia at users.sourceforge.net>                                                   |
  |       cc:                                                                                                                   |
  |       Subject: Re: [Ecls-list] -shell and -load difference(Document link: David Creelman)                                   |
  >-----------------------------------------------------------------------------------------------------------------------------|






|---------+------------------------------------>
|         |           "Juan Jose Garcia-Ripoll"|
|         |           <jjgarcia at users.sourcefor|
|         |           ge.net>                  |
|         |           Sent by:                 |
|         |           juanjose.garciaripoll at goo|
|         |           glemail.com              |
|         |                                    |
|         |                                    |
|         |           16/10/2007 06:04 PM      |
|         |                                    |
|---------+------------------------------------>
  >------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                              |
  |       To:       "David_Creelman at pa.com.au" <David_Creelman at pa.com.au>                                                        |
  |       cc:       ecls-list at lists.sourceforge.net                                                                              |
  |       Subject:  Re: [Ecls-list] -shell and -load difference                                                                  |
  >------------------------------------------------------------------------------------------------------------------------------|




2007/10/16, David_Creelman at pa.com.au <David_Creelman at pa.com.au>:
> I'm trying to get standard input processed by a script called by doing
:- >    cat text | ecl -shell processtext
> But this doesn't seem to work.... If I use load, it does work, but it
gives
> me all of the ECL startup banner at the beginning which makes it less
than
> useful if I want to use it in a Unix shell pipe processing kind of a way.

-shell is exactly -load. The difference is minimal since they are
coded exactly the same way except for a single statement that
instructs ECL not to be verbose and not to quit (see
src/lsp/cmdline.lsp)

If it the script does not work (this is a very imprecise statement)
then one possible cause is that the program has a bug: it causes an
error that makes ECL jump to the toplevel. Can you provide me with an
example of the offending code?

Hi Juan,

Here it is reproduced....

Notice nothing on standard output for the -shell version.

Script started on Wed 17 Oct 2007 08:32:38 EST
sh-3.1$ cat somelisp.mail
Delivery-date: Mon, 08 Oct 2007 08:27:59 +1000
Status: RO
Content-Length: 5
Lines: 1

(load "reminder.lisp" :verbose nil)

(add-reminder "someguy at com.net" "remember that thing" 7 8 :year 1959)
sh-3.1$ cat runsomelisp.lisp
; Read each line of the file until 'Line:' is found in the header

; This is a somewhat poor substitute for  .. | sed -n /^string/p
(defun line-starts-with (line str)
  (if (>= (length line) (length str))
      (equal str (subseq line 0 (length str)))))

(do ((line (read-line *standard-input* nil 'eof)
         (read-line *standard-input* nil 'eof)))
    ((or (eql line 'eof) (line-starts-with line "Lines:")) 'done))
;    (format t "line is ~a~%" line))

;(format t "this is print out~%")
;(setq *lisp-initialized* t)

; Everything after this point is message body.
; Perhaps I could implement reading the number of lines in the Lines:
header..

; WooHoo !! it seems the default behaviour of CLs is to interpret the text
; coming in over standard input. So that means all I need to do for this
; utility is to make sure that the text in the email is parsable CL code.
sh-3.1$ cat somelisp.mail | ecl -norc -load runsomelisp.lisp
;;; Loading "/home/davidc/learn/lisp/reminder/runsomelisp.lisp"
ECL (Embeddable Common-Lisp) 0.9i (CVS 2007-10-14 10:57)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  Top level.
> "/home/davidc/learn/lisp/reminder/reminder.lisp"
> email someguy at com.net, reminder remember that thing, day 7, month 8, year
1959
T
>
sh-3.1$ cat somelisp.mail | ecl -norc -shell runsomelisp.lisp
sh-3.1$ eexit

Script done on Wed 17 Oct 2007 08:34:22 EST



Juanjo

$ cat foo.lsp
(print "Hello")
(terpri)
$ ecl -load foo.lsp
;;; Loading "/Users/jjgarcia/foo.lsp"

"Hello"
ECL (Embeddable Common-Lisp) 0.9i
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  Top level.
> (quit)
$ ecl -shell foo.lsp

"Hello"


--
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com










More information about the ecl-devel mailing list