In the current version where I try to combine clo and !refhttps://gist.github.com/bbarker/d068e38107e4b801b7c5/c3fd0f9d2a34557a2335e5e62d18a2332a88c027,
I get a gcc error, which indicates I’m probably not doing things in the
usual or correct way:
$ atscc linset_ats1libtest.dats
/home/brand_000/ats-lang-anairiats-0.2.11/bin/atsopt --output
linset_ats1libtest_dats.c --dynamic linset_ats1libtest.dats
gcc -I/home/brand_000/ats-lang-anairiats-0.2.11/
-I/home/brand_000/ats-lang-anairiats-0.2.11/ccomp/runtime/
-L/home/brand_000/ats-lang-anairiats-0.2.11/ccomp/lib/
/home/brand_000/ats-lang-anairiats-0.2.11/ccomp/runtime/ats_prelude.c
linset_ats1libtest_dats.c -lats
linset_ats1libtest_dats.c: In function ‘loop_8’:
linset_ats1libtest_dats.c:541:15: error: cannot convert to a pointer type
/* tmp36 = / ((ats_void_type()(ats_clo_ptr_type, ats_ptr_type,
ats_ptr_type, ats_ref_type))(ats_closure_fun(env1))) (env1, tmp35, arg1,
tmp30) ;
^
linset_ats1libtest_dats.c:541:15: error: incompatible type for argument 1
of ‘(ats_void_type (*)(struct ats_clo_type *, void *, void , void
))0u->closure_fun’
linset_ats1libtest_dats.c:541:15: note: expected ‘ats_clo_ptr_type’ but
argument is of type ‘ats_clo_type’
linset_ats1libtest_dats.c:547:15: error: cannot convert to a pointer type
/ tmp39 = / ((ats_void_type()(ats_clo_ptr_type, ats_ptr_type,
ats_ptr_type, ats_ref_type))(ats_closure_fun(env1))) (env1, arg0, tmp38,
tmp32) ;
^
linset_ats1libtest_dats.c:547:15: error: incompatible type for argument 1
of ‘(ats_void_type ()(struct ats_clo_type *, void *, void , void
))0u->closure_fun’
linset_ats1libtest_dats.c:547:15: note: expected ‘ats_clo_ptr_type’ but
argument is of type ‘ats_clo_type’
linset_ats1libtest_dats.c:553:15: error: cannot convert to a pointer type
/ tmp42 = / ((ats_void_type()(ats_clo_ptr_type, ats_ptr_type,
ats_ptr_type, ats_ref_type))(ats_closure_fun(env1))) (env1, tmp40, tmp41,
tmp30) ;
^
linset_ats1libtest_dats.c:553:15: error: incompatible type for argument 1
of ‘(ats_void_type ()(struct ats_clo_type *, void *, void *, void
))0u->closure_fun’
linset_ats1libtest_dats.c:553:15: note: expected ‘ats_clo_ptr_type’ but
argument is of type ‘ats_clo_type’
linset_ats1libtest_dats.c: In function ‘my_linset_union_02003_ats_int_type’:
linset_ats1libtest_dats.c:611:15: warning: passing argument 1 of
‘(ats_void_type ()(struct ats_clo_type *, void *, void *, void *))((struct
ats_clo_type )ptrof_error(loop_8_closure_error()))->closure_fun’ makes
pointer from integer without a cast [enabled by default]
/ tmp44 = / ((ats_void_type()(ats_clo_ptr_type, ats_ptr_type,
ats_ptr_type,
ats_ref_type))(ats_closure_fun(ptrof_error(loop_8_closure_error ()))))
(ptrof_error(loop_8_closure_error ()), arg0, arg1, (&tmp43)) ;
^
linset_ats1libtest_dats.c:611:15: note: expected ‘ats_clo_ptr_type’ but
argument is of type ‘int’
Exit: [gcc] failed.On Tuesday, January 14, 2014 8:25:41 PM UTC-5, Brandon Barker wrote:
There are a lot of nice library functions and succinct algorithms in
ATS1’s ATSLIB, while at the same time, many of these seem to be implemented
in ATS2 using templates where possible.
It can be helpful to check one’s understanding of the ATS1 code by
inspection and modification before attempting to port to ATS2.
One alternative is to use version control, but others may prefer to copy
and paste code into a single file with included tests. This may involve
copy from several files though.
I’ve put an example https://gist.github.com/bbarker/d068e38107e4b801b7c5of this up as a git gist for linset_union (copied to my_linset_union); feel
free to improve it or suggest changes.
Currently, there is a problem with the termination metric though (I don’t
know why yet).