Re: -Wincompatible-pointer-type for functions taking a pointer

2021-06-07 Thread David Smith
ts/blob/master/doc/EXAMPLE/MISC/mysendmailist.dats > > On Sat, Jun 5, 2021 at 3:42 PM David Smith wrote: > >> >> Hey, >> I'm trying to use a C library (libwayland) from ATS (still), and now I >> finally got everything working, but I'm getting a few warnings rela

-Wincompatible-pointer-type for functions taking a pointer

2021-06-05 Thread David Smith
Hey, I'm trying to use a C library (libwayland) from ATS (still), and now I finally got everything working, but I'm getting a few warnings related to function pointers. I got the following code typedef wl_registry_listener = $extype_struct "struct wl_registry_listener" of { global= (ptr,

Re: Passing null as a string

2021-06-03 Thread David Smith
better > understanding of what you are trying to do? > > On Thu, Jun 3, 2021, 6:00 PM David Smith wrote: > >> I'm trying to wrap a library that has a function that takes a `char *`, >> and optionally NULL. >> >> I tried strptr, string, and other random t

Re: "Number is smaller than 0x8000, trust me"

2021-06-03 Thread David Smith
u need to use an >> external solver like Z3. >> But it would require a lot of effort. >> >> I would suggest using a run-time check for now. And you could always come >> back to fix it later >> if really needed. >> >> On Sun, May 23, 2021 at 6:28

Memory Mapped IO

2021-06-03 Thread David Smith
When dealing with memory mapped IO, is there a neat way to axiomatically say "there is something at address 0x12345678? At the moment I'm using a C macro that just returns the address, and then have an at-view in the ATS type signature, though I'd prefer to somehow treat that as global, if onl

Passing null as a string

2021-06-03 Thread David Smith
I'm trying to wrap a library that has a function that takes a `char *`, and optionally NULL. I tried strptr, string, and other random types I found in the prelude. Now I'm trying to pass NULL (using `the_null_ptr`; great name btw), and I'm getting type errors. Which string should I use here, a

Re: "Number is smaller than 0x8000, trust me"

2021-05-23 Thread David Smith
the same, and on modern processors performance is the same. > > On Sun, 23 May 2021, David Smith wrote: > > > > > Hey, I have a small convenience function that takes 3 5 bit bit numbers > to produce a 15 bit color, that's guaranteed to be <0x8000. > > > >

"Number is smaller than 0x8000, trust me"

2021-05-23 Thread David Smith
Hey, I have a small convenience function that takes 3 5 bit bit numbers to produce a 15 bit color, that's guaranteed to be <0x8000. Now, apparently the typechecker doesn't know much about `lor`. Is there any way I could say "hey trust me, if these three numbers are < 0x20 then the result is <

Re: agez vs addr > null

2021-05-23 Thread David Smith
Ah, my brain somehow went > and ≥ is the same. Thanks to both of you! On Sun, May 23, 2021, 01:06 Elijah Stone wrote: > On Sat, 22 May 2021, Elijah Stone wrote: > > > If you think about addresses as signed > > Err, sorry, this should read 'if you think about addresses as _un_signed'. > > -- > Y

agez vs addr > null

2021-05-22 Thread David Smith
I find a lot of code like this: absvtype json_object_vtype (l:addr) = ptr vtypedef json_object (l:addr) = json_object_vtype (l) vtypedef json_object0 = [l:agez] json_object (l) vtypedef json_object1 = [l:addr | l > null] json_object (l) I have multiple questions about this: 1. What is t

Re: PMVtmpltcstmat not declared

2021-05-21 Thread David Smith
Yeah, I figured it was something like that. I'll try to play around with HX's makefile, thanks for the link! Here is the original error: In file included from DATS/hello_dats.c:36: /usr/lib/ats2-postiats-0.4.2/prelude/CATS/char.cats: In function 'atspre_isascii_int': /usr/lib/ats2-postiats-0.4.

Re: PMVtmpltcstmat not declared

2021-05-21 Thread David Smith
When I do that I get a couple of warnings and then an error at link time, due to me not using the prelude (-D_ATS_CCOMP_PRELUDE_NONE_). Here's the output: In file included from DATS/hello_dats.c:15: DATS/hello_dats.c: In function 'mainats_0_void': DATS/hello_dats.c:254:19: warning: implicit dec

PMVtmpltcstmat not declared

2021-05-20 Thread David Smith
Hey, I'm trying to write some code for a GBA game using ATS, meaning I plan on not using the prelude. In my code (at the end), I'm trying to just loop over every pixel on the screen and set it to white, however it fails to compile due to PMVtmpltcstmat not being defined, leading to a whole cha

Re: Termetric not well-founded

2021-05-20 Thread David Smith
Oh, it works with n:nat. Epic! David Smith schrieb am Donnerstag, 20. Mai 2021 um 21:16:28 UTC: > I'm having a bit of trouble to get anything with termination checking to > run. > > I produced a rather simple example: > > implement > main0() = > let > fun

Termetric not well-founded

2021-05-20 Thread David Smith
I'm having a bit of trouble to get anything with termination checking to run. I produced a rather simple example: implement main0() = let fun fact{n:int} .. (n: int(n)) : int = if n > 0 then n * fact(n-1) else 1 in println!("fact(5) = ", fact(5)) end Ho