#  A simple test of a few standard C functions
#  for Unix platforms that implement loadfunc().

$ifdef _DYNAMIC_LOADING

   link cfunc

   procedure main()
      local i

      every i := 500 to 513 do
         gen(bitcount, i)
      gen(vword, 314159)
      gen(lgconv, 10^30)
      gen(unpack, "abcd")
      gen(pack, 1684234849)
   end

   procedure gen(p, a)
      write(image(p), "(", image(a), ") = ", p(a) | "[failed]")
      return
   end

$else 

   # fake the "passing" output when LoadFunc is not available,
   # so that "make Tests" does not fail.

   procedure main()
      every write(!open("cfuncs.std"))
   end

$endif
