uint8_t packetIn[127];const uint8_t *packetInCount = packetIn;const uint8_t *packetInHeader = packetIn + 1;DATS/frames_dats.c: In function ‘process_smbus_frame_command_138’:DATS/frames_dats.c:9714:1: warning: passing argument 1 of ‘ATSLIB_056_prelude__arrayref_get_at_gint__20__5’ discards ‘const’ qualifier from pointer target type [enabled by default] ATSINSmove(tmp356, ATSLIB_056_prelude__arrayref_get_at_gint__20__5(ATSPMVextval(packetInContents), ATSPMVi0nt(0))) ; ^DATS/frames_dats.c:861:1: note: expected ‘atstype_ptrk’ but argument is of type ‘const uint8_t *’ ATSLIB_056_prelude__arrayref_get_at_gint__20__5(atstkind_type(atstype_ptrk), atstkind_t0ype(atstype_int)) ; ^patsopt -o DATS/main_dats.c.tmp -d DATS/main.datsmv DATS/main_dats.c.tmp DATS/main_dats.cavr-gcc -g -Wall -O2 -mmcu=atmega328p -DF_CPU=16000000UL -std=c99 -D_XOPEN_SOURCE -D_ATSTYPE_VAR_SIZE_=0X000F -D_ATS_CCOMP_EXCEPTION_NONE_ -D_ATS_CCOMP_RUNTIME_NONE_ -D_ATS_CCOMP_PRELUDE_NONE_ -D_ATS_CCOMP_PRELUDE_USER_=\"/home/mike/linti/libs/arduino-ats/avr_prelude/kernel_prelude.cats\" -Wno-unused-variable -Wno-unused-label -Wno-unused-but-set-variable -I. -I/opt/ATS/ATS2-Postiats-0.2.4 -I/opt/ATS/ATS2-Postiats-0.2.4/ccomp/runtime -I/home/mike/linti/libs/arduino-ats/_arduino -I/home/mike/linti/libs/arduino-ats/_dummy -I/home/mike/linti/libs/arduino-ats -c -o DATS/main_dats.o DATS/main_dats.cDATS/main_dats.c:333:1: warning: ‘output_high_1’ defined but not used [-Wunused-function] output_high_1(atstkind_t0ype(atstype_int) arg0) ^DATS/main_dats.c:363:1: warning: ‘input_2’ defined but not used [-Wunused-function] input_2(atstkind_t0ype(atstype_int) arg0)
And if you use templates everywhere, it global optimizes, but the image is bigger due to inlining. Correct?
--
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/400a6d0b-7c22-4baf-8c15-d7de7de21f36%40googlegroups.com.
(* ****** ****** *)
//
extern
fun{} foo(int): void
//
extern
fun foo_ : $d2ctype(foo<>)
implement foo_(x) = foo(x)
//
#ifdef
FOO_TEMPLATE_NONE
#define foo foo_
#endif
//
val () = foo(0)
val () = foo(1)
//
(* ****** ****** *)
--
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/a49d73cf-e3d8-46c9-81c7-f26563754032%40googlegroups.com.
data SMBus = SMBus { sendByte :: Address -> Command -> IO (Either SMBusStatus ()), writeByte :: Address -> Command -> Word8 -> IO (Either SMBusStatus ()), readByte :: Address -> Command -> IO (Either SMBusStatus Word8), writeWord :: Address -> Command -> Word16 -> IO (Either SMBusStatus ()), readWord :: Address -> Command -> IO (Either SMBusStatus Word16), readBlock :: Address -> Command -> Size -> IO (Either SMBusStatus [Char]), readString :: Address -> Command -> Size -> IO (Either SMBusStatus String), probe :: () -> IO (Maybe [Address]), close :: () -> IO (),}smbusAardvark = do devices <- devices -- From USB API handle <- A.openDevice (head devices) -- Don't get hung up on how dangerous this is to assume the first device, yes it is return $ SMBus { sendByte = \address command -> do (status, numWritten) <- i2cWriteExt (fromIntegral handle) (fromIntegral address) I2cNoFlags [(fromIntegral command)] 1 ss <- toStatus status if ss == SMBusOk then return $ Right () else return $ Left ss,smbus <- smbusAardvark
runI2cTest :: SMBus -> IO ()runI2cTest smbus@SMBus{..} = do
s <- writeByte 0x30 0x00 0x00
--
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/2e8f4c84-4615-45ce-a851-4b89c8061543%40googlegroups.com.
I think that ultimately, a closure is required to capture a moniker used by an implementation of an interface, to do what the Haskell example does.
--
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/b22afdfb-6dea-483d-9ab7-99ead6243fa0%40googlegroups.com.
wrt HaskellI
The template approach will allow more or lesser number of functions rather than requiring a fixed interface, with possible throwing of exceptions for the unimplemented. This does have merit, so I will give this a go.The Haskell approach was in reaction to several attempts that failed in one way or another and this was the best of multiple alternatives. I'm not stuck on it if there is a better approach.
--
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/22ec2ecc-a734-41d5-a4c2-532da0ea861a%40googlegroups.com.