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

2020-01-20 Thread megane


Andrew Mack  writes:

> 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.

Hi, Andrew!
>
> 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)
  ^^
append-map is being called during syntax expansion time here. So,
instead of (import srfi-1) you need (import-for-syntax srfi-1).

> (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.

You're correct in that you need to use er-macro-transformer from
(chicken syntax).

Alternatively you can use ir-macro-transformer:

(define-syntax --sdl-flags
  (ir-macro-transformer
   (lambda (e i c)
 `(begin
,@(append-map (lambda (str)
(let* ((sym (string->symbol str))
   (psym (i (string->symbol (string-append "-" 
str)
  `((define-foreign-variable ,psym unsigned-integer 
,str)
(define ,sym ,psym
  (cdr e))
>
> Thanks in advance, 
>
> Andrew Mack




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

2020-01-20 Thread Andrew Mack

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

Re: Multi-platform app development options for chicken?

2020-01-20 Thread Jörg F. Wittenberger
Hi Matt,

this is what I currently do to this end:

Since a while I'm using lambdanative.  It makes it easy for me to build
APKs.  Supports iOS too, though I never tried.  I make a Chicken build
for it (not avail upstream but I'll make it avail if anyone would like
it). Chicken running in a pthread talking to the Gambit pthread from
lambdanative via abstract socket.  To make it easier to control native
Android GUI elements, I ported the original JScheme (and very
slightly extended it, e.g., to enable contructors to dispatch on
argument types)[1].

The only thing I'm currently really, really missing is a way to have
select(2)able fd's for pthread-to-pthread communication under Windows.

My verdict: great it all you need is to quickly glue some GUI
together.  However: IUp is much more capable, but also harder
to use.

Complex user interfaces I rather do as Web applications.  The server in
Chicken on the loopback interface the GUI part (on Android) is the
webkit widget from Android, controled via LNjScheme.  (On Linux/Windows
it starts a Webbrowser.  iOS I did not tryso far.)

Best

/Jörg

[1]:
https://github.com/part-cw/lambdanative/tree/master/apps/DemoAndroidLNjScheme


On Sun, 19 Jan 2020 11:57:26 -0700
Matt Welland  wrote:

> Currently I've got windows and Linux covered  and I'm very happy with
> the Chicken+IUP combo (although getting that to work on old platforms
> with Chicken 5 is a challenge). However I need to try again for
> Android. The SDL build worked and has great potential for games but
> not so much for regular apps.
> 
> My thought is to learn Javascript and ramp up on something like
> Native ( https://www.nativescript.org) which begs the question, is it
> feasible to use Chicken as part of a Native app such that the core of
> the app is Chicken and the interface is Javascript/Native?
> 
> I'm looking for opinions and comments from Chicken users as to how you
> would approach this problem.
> 
> Thanks.
> --
> Complexity is your enemy. Any fool can make something complicated.
> It is hard to keep things simple. - Richard Branson.