Dear list, some updates about my problem.

I eventually decided to do the things The Good Way.
Adding a shortcut to EmuLisp was a fun hack, almost a joke, but not a
good idea as:
1) It was not EmuLisp anymore.
2) I may need this export functionality with other platforms (read
PicoLisp implementations).
3) Above all, I need this functionality with numbers too.

Now what I do is preprocess the source code with this:

(de protect_literals (src)
   (cond
      ((num? src) (list 'Literal src))
      ((str? src) (list 'Literal src))
      ((sym? src) src)
      (T          (mapcar 'protect_literals src))
    )
)

Then handle numbers and transients like this:

(de Literal (content)
  (cond
    ((num? content) (pack "<block type=\"nombre\"><field name=\"TEXT\">"
                          content
                          "</field></block>"))
    ((str? content) (pack "<block type=\"texte\"><field name=\"TEXT\">"
                          content
                          "</field></block>"))
    (T "Is this really a literal?")
  ))

Works for me.
I also wanted to post this to have a free review by better PicoLispers than me;)


chri
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to