On Mon, Jun 13, 2016 at 12:36 PM, Kiwamu Okabe <[email protected]> wrote:
>> if chEvtBroachcastI does not change the type of pss, you may just do
>>
>> prval pss2 = pss
>> val () = if true then chEvtBroadcastI (pss2 | inserted_event_p)
>> ...
>> prval () = (pss := pss2)
>
> Your code is type-checked.
> However, why is renaming pss needed? I think simple renaming is not
> hint for ATS2 compiler...
More complex code is also type-checked... It's mysterious for me...
```
extern fun tmrfunc (!chss(chss_isr) | ptr): void = "mac#"
implement tmrfunc (pss | p) = {
val bbdp = $UN.cast{cPtr0(BaseBlockDevice)}(p)
val () = chSysLockFromISR (pss | )
val cnt = $extval(int, "cnt")
prval pss2 = pss
val () = if cnt > 0 then
if blkIsInserted (bbdp) then {
extvar "cnt" = cnt - 1
val cnt = $extval(int, "cnt")
val () = if cnt = 0 then chEvtBroadcastI (pss2 |
inserted_event_p)
} else {
extvar "cnt" = POLLING_INTERVAL
}
else if ~blkIsInserted(bbdp) then {
extvar "cnt" = POLLING_INTERVAL
val () = chEvtBroadcastI (pss2 | removed_event_p)
}
prval () = pss := pss2
val () = chVTSetI (tmr_p, MS2ST (POLLING_DELAY),
$UN.cast{vtfunc_t}(tmrfunc), bbdp)
val () = chSysUnlockFromISR (pss | )
}
```
Best regards,
--
Kiwamu Okabe at METASEPI DESIGN
--
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/CAEvX6d%3DQKwnQHqA9LKVyBmwDXJgt%2B%3DWjrA%3DQu%2BncsqA2Xbc0Xw%40mail.gmail.com.