Here's some test code for Judy1 and JudySL..
//////////////////

// Judy1 array test: first, just put integers in:

open Judy;
var je: JError_t;
var j = J1Array();
var i: int;
var res: int;
forall i in 0 upto 100 do 
   Judy1Set(j, (i*2).word, &je, &res);
done

forall i in 0 upto 200 do
  Judy1Test(j, i.word, &je, &res);
  print res;
done
println ""; println "Done";
collect();
println "Collected";

//////////////////////

var js = JSLArray();
var buffer = C_hack::cast[&char]$ C_hack::malloc(100);
*buffer = char 0;
var pres : &word;

forall i in 0 upto 20 do 
   strcpy(buffer,cstr (str i));
   JudySLIns(js, buffer, &je, &pres);
   *pres = word i;
done

*buffer = char 0;
JudySLFirst(js, buffer, &je, &pres);
whilst not (isNULL pres) do
  println$ str buffer + " -> " + str (int (*pres));
  JudySLNext(js, buffer, &je, &pres);
done
println ""; println "Done";
collect();
println "Collected";
/////////////////////////////

Look at the ugly cast to create something as "simple" as a char buffer.

--
john skaller
skal...@users.sourceforge.net





------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to