Fixed it.
The following two lines were missing in ccomp/runtime/temptory_typedefs.h:
#define atstyclo_top struct{ void *cfun; }
#define atstyclo_type(flab) flab##__closure_t0ype
--Hongwei
On Mon, Jun 24, 2019 at 2:51 PM aditya siram <[email protected]> wrote:
> Hi,
> Stack allocated closures don't seem to work the same way in Temptory, eg.
> compiling the following:
>
> #include "share/HATS/temptory_staload_bucs320.hats"
>
> fun apply(f: &(string) -<clo1> void, s:string):void = f(s)
>
> implement main0(argc,argv) =
> let
> var f = lam@(s:string):void => println! s
> in
> apply(f,"hello world")
> end
>
>
>
> results in:
>
> In file included from test2_dats.c:15:
> test2_dats.c: In function ‘mainats_0_argc_argv’:
> test2_dats.c:323:20: warning: implicit declaration of function ‘
> atstyclo_type’; did you mean ‘atstyvar_type’? [-Wimplicit-function-
> declaration]
> ATStmpdec(tmpref2, atstyclo_type(__patsfun_2)) ;
> ^~~~~~~~~~~~~
> /home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/
> temptory_instrset.h:209:29: note: in definition of macro ‘ATStmpdec’
> #define ATStmpdec(tmp, hit) hit tmp
> ^~~
> test2_dats.c:323:11: error: expected ‘;’ before ‘tmpref2’
> ATStmpdec(tmpref2, atstyclo_type(__patsfun_2)) ;
> ^~~~~~~
> /home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/
> temptory_instrset.h:209:33: note: in definition of macro ‘ATStmpdec’
> #define ATStmpdec(tmp, hit) hit tmp
> ^~~
> test2_dats.c:345:68: error: ‘tmpref2’ undeclared (first use in this
> function)
> ATSINSclosure_initize(__patsfun_2, ((__patsfun_2__closure_t0ype*)(&
> tmpref2))) ;
>
> ^~~~~~~
> /home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/
> temptory_instrset.h:369:66: note: in definition of macro ‘
> ATSINSclosure_initize’
> #define ATSINSclosure_initize(flab, tmpenv) (flab##__closureinit)tmpenv
> ^~~~~~
> test2_dats.c:345:68: note: each undeclared identifier is reported only
> once for each function it appears in
> ATSINSclosure_initize(__patsfun_2, ((__patsfun_2__closure_t0ype*)(&
> tmpref2))) ;
>
> ^~~~~~~
> /home/deech/ATS/ComposeTalk2019/ATS/ATS-Temptory/ccomp/runtime/
> temptory_instrset.h:369:66: note: in definition of macro ‘
> ATSINSclosure_initize’
> #define ATSINSclosure_initize(flab, tmpenv) (flab##__closureinit)tmpenv
>
>
>
> Thanks!
> -deech
>
> --
> You received this message because you are subscribed to the Google Groups
> "ats-lang-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/ats-lang-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ats-lang-users/7ee015c5-b3d1-4b26-a5d9-21a967d83144%40googlegroups.com
> <https://groups.google.com/d/msgid/ats-lang-users/7ee015c5-b3d1-4b26-a5d9-21a967d83144%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLr5OxGmD8NmY5OjHtU6CMnb8Bu%3D5n0nM9_kcYwj-VKH-w%40mail.gmail.com.