How to use extype on at-view?

34 views
Skip to first unread message

Kiwamu Okabe

unread,
Nov 14, 2015, 7:06:37 AM11/14/15
to ats-lang-users, ats-lang-users
Hi all,

I'm trying to make a function exported from C language.
ATS language side is following:

```
typedef dns_found_callback_t = [l:addr] (ip_addr_t@l | string, ptr l,
ptr) -> void
extern fun dns_done: dns_found_callback_t = "mac#"
implement dns_done (pfat | name, ipaddr, arg) = {
val () = dns_done_c (pfat | name, ipaddr, arg) // <= Error occurs at here!
}
```

C language side is following:

```
void dns_done_c( const char *name, ip_addr_t *ipaddr, void *arg )
{
...
```

I believe the view will be removed after compile. However the code
can't be compiled.

```
$ make
ATS user/user_main.dats
/home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats:
1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): the
dynamic expression cannot be assigned the type
[S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1; addr=S2Ecst(uint32)),
S2Evar(l$3144(7279)))].
/home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats:
1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch
of sorts in unification:
The sort of variable is: S2RTbas(S2RTBASimp(1; t@ype))
The sort of solution is: S2RTbas(S2RTBASimp(7; view))
/home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats:
1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch
of static terms (tyleq):
The actual term is: S2EVar(1955)
The needed term is: S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1;
addr=S2Ecst(uint32)); S2Evar(l$3144(7279)))
```

How to use extype on at-view?

Thanks,
--
Kiwamu Okabe at METASEPI DESIGN

gmhwxi

unread,
Nov 14, 2015, 7:46:08 AM11/14/15
to ats-lang-users, ats-lan...@lists.sourceforge.net, kiw...@debian.or.jp

There seems a misuse of quantifier:

typedef dns_found_callback_t = {l:addr} (!ip_addr_t@l | string, ptr l, ptr) -> void

gmhwxi

unread,
Nov 14, 2015, 7:49:01 AM11/14/15
to ats-lang-users, ats-lan...@lists.sourceforge.net, kiw...@debian.or.jp

By the way, what is the type of dns_done_c?


On Saturday, November 14, 2015 at 7:06:37 AM UTC-5, Kiwamu Okabe wrote:

Kiwamu Okabe

unread,
Nov 14, 2015, 8:02:33 AM11/14/15
to ats-lang-users, ats-lang-users
On Sat, Nov 14, 2015 at 9:49 PM, gmhwxi <gmh...@gmail.com> wrote:
> By the way, what is the type of dns_done_c?

extern fun dns_done_c: dns_found_callback_t = "mac#"

Hongwei Xi

unread,
Nov 14, 2015, 8:08:31 AM11/14/15
to ats-lan...@googlegroups.com

What is the reason for having both: dns_done and dns_done_c?

Are these two functions different?

--
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 ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAEvX6dmo%3DixkOOitbhyQ7kEWZVaG26KmsenyLrTdTTjqqRxumg%40mail.gmail.com.

Kiwamu Okabe

unread,
Nov 14, 2015, 8:08:42 AM11/14/15
to ats-lang-users, ats-lang-users
On Sat, Nov 14, 2015 at 9:46 PM, gmhwxi <gmh...@gmail.com> wrote:
> There seems a misuse of quantifier:
>
> typedef dns_found_callback_t = {l:addr} (!ip_addr_t@l | string, ptr l, ptr)
> -> void

Fixed. Thanks.
BTW. How to understand following error message?

```
ATS user/user_main.dats
/home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats:
1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): the
dynamic expression cannot be assigned the type
[S2Eat(S2Etyrec(fltext(ip_addr_t); npf=-1; addr=S2Ecst(uint32)),
S2Evar(l$3144(7279)))].
/home/kiwamu/src/esp8266-ats/dweet_ats/user/user_main.dats:
1022(line=32, offs=24) -- 1026(line=32, offs=28): error(3): mismatch
of sorts in unification:
The sort of variable is: S2RTbas(S2RTBASimp(1; t@ype))
The sort of solution is: S2RTbas(S2RTBASimp(7; view))
```

Kiwamu Okabe

unread,
Nov 14, 2015, 8:10:52 AM11/14/15
to ats-lang-users
On Sat, Nov 14, 2015 at 10:08 PM, Hongwei Xi <gmh...@gmail.com> wrote:
> What is the reason for having both: dns_done and dns_done_c?
>
> Are these two functions different?

Now, I'm rewriting original C language function named dns_done_c()
into new ATS function named dns_done.

Kiwamu Okabe

unread,
Nov 14, 2015, 8:15:58 AM11/14/15
to ats-lang-users
On Sat, Nov 14, 2015 at 10:10 PM, Kiwamu Okabe <kiw...@debian.or.jp> wrote:
> On Sat, Nov 14, 2015 at 10:08 PM, Hongwei Xi <gmh...@gmail.com> wrote:
>> What is the reason for having both: dns_done and dns_done_c?
>>
>> Are these two functions different?
>
> Now, I'm rewriting original C language function named dns_done_c()
> into new ATS function named dns_done.

Published the code at following:

https://github.com/fpiot/esp8266-ats/blob/ats/dweet_ats/user/user_main.dats
Reply all
Reply to author
Forward
0 new messages