How to turn off warnings in Lisp?

Discussion of Common Lisp

How to turn off warnings in Lisp?

Postby luckytobehere » Wed Nov 23, 2011 5:16 pm

Hello all,

I got this HTML-extract code (open source) from http://weitz.de/html-extract/

I don't know anything about Lisp, I have a deadline and I don't have time to learn it now...

The problem is that when running the executable it displays warnings... "WARNING EOF after '&'" for example.
I want to turn off the warnings.. one possibility is to just remove the lines that print warnings... but as I don't know Lisp I don't want to break the code. Another possibility.. hoping to find some help... is there any command/function in Lisp that will turn off all the warnings without having to manually remove the lines of code?

The code looks something like this:

Code: Select all
(peek-cond (peek-char)
      ((char= peek-char #\&)
       (read-char)
       (peek-cond (peek-char (warn "EOF after '&'")
                             (write-char #\&))
         ((char= peek-char #\#)
          ;; probably a character reference
          (read-char)
          (peek-cond (peek-char (warn "EOF after '&#'")
                                (write-string "&#"))


You can see the warnings... this is just a snippet...

Thank you in advance,
Oana.
luckytobehere
 
Posts: 2
Joined: Wed Nov 23, 2011 5:08 pm

Re: How to turn off warnings in Lisp?

Postby Ramarren » Thu Nov 24, 2011 12:47 am

The warnings indicate that the HTML input is malformed and so the program may not work reliably. If you really want to suppress warning then change the final line of html-extract.lisp (and then rebuild) from:

Code: Select all
#+:build (html-extract)


to either:

Code: Select all
#+:build (handler-bind ((warning #'muffle-warning)) (html-extract))


which will suppress warning only, or

Code: Select all
#+:build (let ((*error-output* (make-broadcast-stream))) (html-extract))


which will suppress all error output.
Ramarren
 
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland

Re: How to turn off warnings in Lisp?

Postby luckytobehere » Thu Nov 24, 2011 3:20 am

Hi Ramarren,

Great!
Yes, I know about the purpose of warnings... I do not really care if the HTML is parsed correctly.
But I'll still leave the errors on...

Thanks alot,
Oana
luckytobehere
 
Posts: 2
Joined: Wed Nov 23, 2011 5:08 pm


Return to Common Lisp

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest