@include @define aqsortdom(){ @local aqsortns, pras; aqsortns = @names clp64le { @0x004111e5 int cmpx(void *va, void *vb); @0x00418574 int ncmp; }; pras = mkpras("192.168.184.129:30000"); return mkdom(aqsortns, pras); } @define testaqsort(){ @local val, gas, nsolid, candidate, tmp, pr; tmp = mkdom(@names clp64le { @0x0 int val[64]; }, mkzas(1024)); pr = aqsortdom(); pr.launch(0,["test\\Debug\\aqsort.exe"]); gas = 63; nsolid = 0; candidate = 0; val = tmp`val; for(i = 0; i < 64; i++) val[i] = gas; pr.xtrap(&pr`cmpx, @lambda(addr){ @local x, y, ra, id; x = {tmp}**(int**)(pr.getrsp()+4); y = {tmp}**(int**)(pr.getrsp()+8); pr`ncmp++; if(val[x] == gas && val[y] == gas) if(x == candidate) val[x] = nsolid++; else val[y] = nsolid++; if(val[x] == gas) candidate = x; else if(val[y] == gas) candidate = y; ra = *(long*)pr.getrsp(); id = pr.xtrap(ra, @lambda(addr){ pr.setrax(val[x]-val[y]); pr.bpdel(id); }); }); pr.xcontwait(); for(i = 0; i < 64; i++) printf("%d ", val[i]); printf("\n"); } testaqsort();