Hello,

When I compile and load the file m_sup_1.lisp (see attachement) with
GCL-2.7.0 (CLtL1) and call the function |checkSplitPunctuation| with
"'s" as parameter the returned value is ("" "'s") but it has to be
("'s").

This is strange : if I paste the content of this file in a freshly
started interpeter and test this function (always with the same
parameter) the result is correct. If I compile this function later this
is correct too.

But now if I compile the file, load the binary file produced and call
this function : bad result. Now (after compilation of this file and
loading of the binary file produced) if I repaste the code of the
function in the interpreter and compile this function the result is
incorrect. I hope you understand me and you can reproduce what I'm
saying. It seems that GCL does not like nested 'cond'. And moreover the
compilation of a file modify the state of GCL.

I'm somewhat lost.

Greg
;; Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;;
;;     - Redistributions of source code must retain the above copyright
;;       notice, this list of conditions and the following disclaimer.
;;
;;     - Redistributions in binary form must reproduce the above copyright
;;       notice, this list of conditions and the following disclaimer in
;;       the documentation and/or other materials provided with the
;;       distribution.
;;
;;     - Neither the name of The Numerical ALgorithms Group Ltd. nor the
;;       names of its contributors may be used to endorse or promote products
;;       derived from this software without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS and CONTRIBUTorS "AS
;; IS" and ANY EXPRESS or IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
;; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY and FITNESS For A
;; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
;; or CONTRIBUTorS BE LIABLE For ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
;; EXEMPLARY, or consEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
;; PROCUREMENT OF SUBSTITUTE GOODS or SERVICES; LOSS OF USE, DATA, or
;; PROFITS; or BUSINESS INTERRUPTION) HOWEVER CAUSED and ON ANY THEorY OF
;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, or TorT (INCLUDING
;; NEGLIGENCE or OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


(defun substring (cvec start length)
  (setq cvec (string cvec))
  (if length (subseq cvec start (+ start length)) (subseq cvec start)))

(defun maxindex (str) (1- (length str)))
(setq |$charPeriod| #\.)
(setq |$charBack| #\\)
(setq |$charQuote| #\')
(setq |$charSemiColon| #\;)
(setq |$charComma| #\,)
(setq |$charDash| #\-)

(defun |checkSplitPunctuation| (|x|)
  (prog (|m| |lastchar|)
    (return
      (progn (setq |m| (MAXINDEX |x|))
             (cond ((> 1 |m|) (cons |x| nil))
                   (t (setq |lastchar| (elt |x| |m|))
                       (cond 
                         ((and (equal |lastchar| |$charPeriod|) (equal (elt |x| 
(- |m| 1)) |$charPeriod|))
                          (cons |x| nil))

                         ((or (equal |lastchar| |$charPeriod|)
                              (equal |lastchar| |$charSemiColon|)
                              (equal |lastchar| |$charComma|))
                          (cons (SUBSTRING |x| 0 |m|) (cons |lastchar| nil)))
                         
                         ((and (> |m| 1) (equal (elt |x| (- |m| 1)) 
|$charQuote|))
                          (format t "char quote detected but m is: ~D" |m|)
                          (cons (SUBSTRING |x| 0 (- |m| 1)) (cons (SUBSTRING 
|x| (- |m| 1) nil) nil)))
                         
                         (t (cons |x| nil)))))))))
 
_______________________________________________
Gcl-devel mailing list
Gcl-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/gcl-devel

Reply via email to