Hi

@1 refers to the first parameter of the mx macro call, @2 to the second and so on.

For example if

@=macro_mx
printf("@1 @2 @3\n");


and you call macro_mx like that:

@:macro_mx(one, two, three):@

it will print

one two three

On Fri, Dec 30, 2011 at 3:26 AM, David Pennell <dpennell@good-cloud.com> wrote:
Where can I learn more about mx files?  

In particular, in the following code, it looks like @2 is derived from the type expands this into a multitude of type specific functions.  I can't figure out what @3 is.  Is there a list of these?

SORTfndlast_@2(BAT *b, ptr v)
{
BUN diff, end = BUNlast(b), cur = end;
BUN lo = BUNfirst(b), hi = end;
int cmp = 1;
BATiter bi = bat_iterator(b);

        if (lo >= hi || @3_CMP(BUNt@1(bi, cur - 1), v, @4)<=0) {
/* shortcut: if BAT is empty or last (and hence all) tail
* value is <= v, we're done. */
return cur;
}
while (lo < hi) {
BUN mid = (lo + hi) >> 1;
cur = mid;
cmp = @3_CMP(BUNt@1(bi, cur), v, @4);
if (cmp < 0) {
lo = ++mid;
cur++;
} else if (cmp > 0) {
hi = mid;
} else {
break;
}
}
if (cmp == 0 && b->tkey == 0) {  /* shift over multiple equals */
                for(diff = (end-cur)>>1; diff; diff >>= 1) {
   while ((cur+diff) < end && @3_EQ(BUNt@1(bi, cur+diff), v, @4)) cur += diff;
}
}
if (cmp == 0) cur++;
return cur;
}

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual
desktops for less than the cost of PCs and save 60% on VDI infrastructure
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Monetdb-developers mailing list
Monetdb-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/monetdb-developers