[ET Trac] [Einstein Toolkit] #1502: provide equivalent of CCTK_PASS_CTOC and CCTK_PASS_FTOF between languages

Einstein Toolkit trac-noreply at einsteintoolkit.org
Mon Dec 9 18:32:36 CST 2013

#1502: provide equivalent of CCTK_PASS_CTOC and CCTK_PASS_FTOF between languages
 Reporter:  rhaas        |       Owner:                     
     Type:  enhancement  |      Status:  new                
 Priority:  minor        |   Milestone:                     
Component:  Cactus       |     Version:  development version
 Keywords:               |  
 It is occasionally (such as when interfacing with legacy code) code useful
 to use the equivalent of {{{CCTK_PASS_CTOF}}} and {{{CCTK_PASS_FTOC}}}.

 This seems to be impossible to directly. Workarounds are declare the C
 function to take {{{cGH ** p_cctkGH}}} as an argument then set up a local
 {{{cGH *cctkGH = *p_cctkGH}}} before {{{DECLARE_CCTK_ARGUMENTS}}} for
 {{{CCTK_PASS_FTOC}}} while for {{{CCTK_PASS_CTOF}}} one seems to have to
 resort to {{{CCTK_FortranWrapper}}} and call the returned wrapper with
 cctkGH and the (Fortran) function pointer.

 Note: this of course suffers from combinatorial explosion of options when
 Cactus starts to support Lua/Python/Tcl/Java/Forth.
 It might be useful to instead provide a set of functions that allow this
 to be done "officially". Something like:
   call CCTK_PASSFTOC(Cfunc)
 where the later is essentially
 #define CCTK_PASSCTOF(fun) (CCTK_FortranWrapper(CCTK_THORNSTRING))(fun,
 and the former
 #define CCTK_PASSFTOC(fun) CCTK_PassFtoC(fun, cctkGH)
 void CCTK_FNAME(CCTK_PassFtoC)(void (*f)(cGH *cctkGH), cGH **p_cctkGH)

Ticket URL: <https://trac.einsteintoolkit.org/ticket/1502>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit

More information about the Trac mailing list