Thanks.

I was not aware that macros can not call each other. And I was not aware that 
code generally used inside macros like newIdentNode() can be used also in 
procs. I tried to use static and compileTime pragma myself, but I applied 
compileTime pragma to macro. Which does not work -- of course macro is 
compileTime already.

One problem may be still, that I have to access the const, which name we 
construct from a string, already inside the macro t. Indeed what I really need 
is a string constant which name I construct from strings and I have to process 
that string constant inside macro t. Will try that. (As I wrote yesterday in 
IRC, using a table in combination with static keyword works also for my 
purpose.)

The purpose of all that is to handle connecting to callbacks from GTK.

What currently works is
    
    
    let b = newButton()
    b.connect("clicked", callback, optArg)
    

That is used in the gintro tutorial.

But for a few signal names things are more complicated. For example using the 
"draw" signal user wants to type
    
    
    b.connect("draw", drawcallback, optArg)
    
    

For this signal name, callback proc has an additional parameter, which I have 
to handle in the connect macro. I can do that because my gtk.nim module 
contains constants like
    
    
    const SCI_draw_Widget* = "1|(cr: ptr cairo.Context00): 
gboolean|(cast[cairo.Context00](cr.impl))|"
    
    

Parsing that const gives me the information which I need in the macro. "draw" 
in not unique, I have to access the type of the first parameter of the connect 
call also, which may be button, which i a subtype of widget.

We may have about 30 of such advanced callbacks, I still hope that I have not 
to write all 30 macro variants manually.

Reply via email to