[Nix-dev] ATerm function generation magic

Eelco Dolstra eelco at cs.uu.nl
Thu Aug 16 21:42:52 CEST 2007


Wouter wrote:
> Hi,
> 
> Does anyone know how the ATmakeListX functions (for instance,
> ATmakeList5 is used in nix-env.cc) are defined? I would like to use
> ATmakeList7, but only ATmakeList1 - ATmakeList6 are now defined
> (somewhere). I've grepped in every possible way, but these functions are
> gone at the end of the compilation.

They're defined in aterm2.h in the ATerm library:

#define ATmakeList2(el0, el1)           ATinsert(ATmakeList1(el1), el0)
#define ATmakeList3(el0, el1, el2)      ATinsert(ATmakeList2(el1,el2), el0)
...

so it's basically just sugar for calls to ATinsert().  So making a list of 7
elements is just another ATinsert() call.

> ATmakeAppl seems to be generated just like ATmakeList, and I have no
> idea where too look.

Those are actually real functions in memory.c in the ATerm library.  If you want
arities >= 7, you have to use ATmakeApplList() or ATmakeApplArray().

-- 
Eelco Dolstra | http://www.cs.uu.nl/~eelco



More information about the nix-dev mailing list