chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help porting someone else's macro from 4 to 5.


From: Andrew Mack
Subject: Help porting someone else's macro from 4 to 5.
Date: Mon, 20 Jan 2020 22:02:56 -0500

Hello all, I'm attempting to port the sdl-mixer egg (originally by Christian Kellermann) from 4 to 5. I think I've made most of the necessary changes, but  I'm running into a bit of an issue and would greatly appreciate some help troubleshooting.

I'm a bit new to Chicken and lisp in general, and while I feel I have a decent understanding of regular macros the er- and ir-macro-transformer procedures are still eluding me somewhat. In sdl-mixer's chicken 4 source, we have the macro


(module sdl-mixer-lolevel

(import ... srfi-1 ...)

...

(define-syntax --sdl-flags
  (lambda (e r c)
   `(,(r 'begin)
      ,@(append-map (lambda (str)
         (let* ((sym (string->symbol str))
                 (psym (string->symbol (string-append "-" str))))
           `((,(r 'define-foreign-variable) ,psym unsigned-integer ,str)
             (,(r 'define) ,sym ,psym))))
         (cdr e)))))

...

) ; end module

Looking through various chicken documentation, my first assumption was to wrap the lambda argument to define-syntax in an er-macro-transformer call. However this does not recognize append-map (of course defined in srfi-1) as bound. I thought that it might also need to be renamed with (r 'append-map) but this also did not work.

Since I am new to Chicken, I assume its a misunderstanding on my part of what is necessary, but I cannot figure out where to go from here. So first of all, is my assumption that I need an er-macro-transformer correct, or am I barking up the wrong tree? Second, after resolving the first question what is the next step I need to take? Any help would be greatly appreciated.

Thanks in advance,

Andrew Mack


reply via email to

[Prev in Thread] Current Thread [Next in Thread]