newLISP Fan Club

Forum => Anything else we might add? => Topic started by: Jeff on August 06, 2008, 10:29:10 AM

Title: Problem in xml-type-tags
Post by: Jeff on August 06, 2008, 10:29:10 AM
I'm working on an application where I need to frequently alter the xml-type-tags and want to return to a default, so I wrote a macro, with-xml-type-tags:


(define-macro (with-xml-type-tags)
  (letex ((old-tags (xml-type-tags))
          (new-tags (args 0))
          (body (cons 'begin (rest (args)))))
    (apply 'xml-type-tags 'new-tags)
    (let ((res body))
      (apply 'xml-type-tags 'old-tags)
      res)))


I'm getting some odd results using it:


(println "1: " (xml-type-tags))
(println "2: "
  (with-xml-type-tags (nil nil nil nil)
    (xml-type-tags)))
(println "3: " (xml-type-tags))


...prints out:


1: ("TEXT" "CDATA" "COMMENT" "ELEMENT") ; before macro
2: (nil nil nil nil) ; in macro body
3: ("00005{" "COMME" "ELEMENT" "00005{000000") ; after macro


That looks like some sort of weird alignment problem... any ideas?
Title:
Post by: Lutz on August 06, 2008, 01:09:35 PM
The problem is with the xml-type-tags, which only accepts constants safely.



Until this is fixed the only safe way is, to use xml-type-tags with constants as parameters.



I will release a fix soon as a development release.