[atspre_malloc_gc] on Arduino

2017-04-27 Thread August Alm
Hi!
I am fiddling around with using ATS for Arduino, based on the ATS-contrib 
folder.
Lots of fun! The following error, though, leaves me clueless as to how to 
fix: 

 In function ‘void* 
ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
 ... error: ‘atspre_malloc_gc’ was not declared in this scope

At least one of the examples in the contrib folder (the Queens puzzle 2, I 
think),
contains:

 %{^
 #define ATS_MFREE free
 #define ATS_MALLOC malloc
 %}

That does not help with the [atspre_malloc_gc], but is it something similar 
that must
be added to my file to make it compile?

Best wishes,
August

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-27 Thread gmhwxi






Plz try it. It may solve ur problem.
Sent from my T-Mobile 4G LTE device



-- Original message--From: August AlmDate: Thu, Apr 27, 2017 5:53 PMTo: 
ats-lang-users;Subject:[atspre_malloc_gc] on Arduino
Hi!
I am fiddling around with using ATS for Arduino, based on the ATS-contrib 
folder.
Lots of fun! The following error, though, leaves me clueless as to how to fix: 

 In function ‘void* ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
 ... error: ‘atspre_malloc_gc’ was not declared in this scope

At least one of the examples in the contrib folder (the Queens puzzle 2, I 
think),
contains:

 %{^
 #define ATS_MFREE free
 #define ATS_MALLOC malloc
 %}

That does not help with the [atspre_malloc_gc], but is it something similar 
that must
be added to my file to make it compile?

Best wishes,
August
-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com.


-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/000f4246.4b26e88e3d0a7379%40gmail.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-27 Thread August Alm
No luck unfortunately. 
Adding 
#include "prelude/CATS/memory.cats"
doesn't help either (it was the trick that did it in an old thread on this 
list).

Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
> Plz try it. It may solve ur problem.
> 
> 
> Sent from my T-Mobile 4G LTE device
> 
> 
> 
> 
> 
> 
> 
> -- Original message--
> From: August Alm
> Date: Thu, Apr 27, 2017 5:53 PM
> To: ats-lang-users;
> Subject:[atspre_malloc_gc] on Arduino
> 
> 
> Hi!
> I am fiddling around with using ATS for Arduino, based on the ATS-contrib 
> folder.
> Lots of fun! The following error, though, leaves me clueless as to how to 
> fix: 
> 
>  In function ‘void* ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>  ... error: ‘atspre_malloc_gc’ was not declared in this scope
> 
> At least one of the examples in the contrib folder (the Queens puzzle 2, I 
> think),
> contains:
> 
>  %{^
>  #define ATS_MFREE free
>  #define ATS_MALLOC malloc
>  %}
> 
> That does not help with the [atspre_malloc_gc], but is it something similar 
> that must
> be added to my file to make it compile?
> 
> Best wishes,
> August
> 
> -- 
> 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 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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com.

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/46b49e80-6c25-4a1d-a3a7-39b2435391e2%40googlegroups.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-27 Thread Hongwei Xi
I guess that the reason for the failure is due to 'malloc' being not
available.

One should probably avoid using malloc/free when coding for Arduino. If
anything
needs to be allocated, trying to do it at compile-time.


On Thu, Apr 27, 2017 at 7:32 PM, August Alm  wrote:

> No luck unfortunately.
> Adding
> #include "prelude/CATS/memory.cats"
> doesn't help either (it was the trick that did it in an old thread on this
> list).
>
> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
> > Plz try it. It may solve ur problem.
> >
> >
> > Sent from my T-Mobile 4G LTE device
> >
> >
> >
> >
> >
> >
> >
> > -- Original message------
> > From: August Alm
> > Date: Thu, Apr 27, 2017 5:53 PM
> > To: ats-lang-users;
> > Subject:[atspre_malloc_gc] on Arduino
> >
> >
> > Hi!
> > I am fiddling around with using ATS for Arduino, based on the
> ATS-contrib folder.
> > Lots of fun! The following error, though, leaves me clueless as to how
> to fix:
> >
> >  In function ‘void* ATSLIB_056_prelude__array_ptr_
> alloc__46__1(atstype_size)’:
> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
> >
> > At least one of the examples in the contrib folder (the Queens puzzle 2,
> I think),
> > contains:
> >
> >  %{^
> >  #define ATS_MFREE free
> >  #define ATS_MALLOC malloc
> >  %}
> >
> > That does not help with the [atspre_malloc_gc], but is it something
> similar that must
> > be added to my file to make it compile?
> >
> > Best wishes,
> > August
> >
> > --
> > 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 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/b10f1899-9196-498b-9645-25270feda8d3%
> 40googlegroups.com.
>
> --
> 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-users+unsubscr...@googlegroups.com.
> To post to this group, send email to ats-lang-users@googlegroups.com.
> 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/46b49e80-6c25-4a1d-a3a7-39b2435391e2%
> 40googlegroups.com.
>

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/CAPPSPLruAFbLSbOrAJZ1p%2BNhiJP34MY0TpTSADikjN60jDRu7Q%40mail.gmail.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread gmhwxi
I just noticed that there is indeed support for malloc/free...

On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>
> I guess that the reason for the failure is due to 'malloc' being not 
> available.
>
> One should probably avoid using malloc/free when coding for Arduino. If 
> anything
> needs to be allocated, trying to do it at compile-time.
>
>
> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>
>> No luck unfortunately.
>> Adding
>> #include "prelude/CATS/memory.cats"
>> doesn't help either (it was the trick that did it in an old thread on 
>> this list).
>>
>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>> > Plz try it. It may solve ur problem.
>> >
>> >
>> > Sent from my T-Mobile 4G LTE device
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > -- Original message--
>> > From: August Alm
>> > Date: Thu, Apr 27, 2017 5:53 PM
>> > To: ats-lang-users;
>> > Subject:[atspre_malloc_gc] on Arduino
>> >
>> >
>> > Hi!
>> > I am fiddling around with using ATS for Arduino, based on the 
>> ATS-contrib folder.
>> > Lots of fun! The following error, though, leaves me clueless as to how 
>> to fix:
>> >
>> >  In function ‘void* 
>> ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>> >
>> > At least one of the examples in the contrib folder (the Queens puzzle 
>> 2, I think),
>> > contains:
>> >
>> >  %{^
>> >  #define ATS_MFREE free
>> >  #define ATS_MALLOC malloc
>> >  %}
>> >
>> > That does not help with the [atspre_malloc_gc], but is it something 
>> similar that must
>> > be added to my file to make it compile?
>> >
>> > Best wishes,
>> > August
>> >
>> > --
>> > 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 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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com
>> .
>>
>> --
>> 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-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to ats-lang-users@googlegroups.com.
>> 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/46b49e80-6c25-4a1d-a3a7-39b2435391e2%40googlegroups.com
>> .
>>
>
>

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/5aef9594-377c-44a7-ad37-3be56e2467fc%40googlegroups.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread August Alm
I'm still not sure what to do.
Is there even a way to define [arrayptr]-values without malloc?

Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>
> I just noticed that there is indeed support for malloc/free...
>
> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>
>> I guess that the reason for the failure is due to 'malloc' being not 
>> available.
>>
>> One should probably avoid using malloc/free when coding for Arduino. If 
>> anything
>> needs to be allocated, trying to do it at compile-time.
>>
>>
>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>
>>> No luck unfortunately.
>>> Adding
>>> #include "prelude/CATS/memory.cats"
>>> doesn't help either (it was the trick that did it in an old thread on 
>>> this list).
>>>
>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>> > Plz try it. It may solve ur problem.
>>> >
>>> >
>>> > Sent from my T-Mobile 4G LTE device
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > -- Original message--
>>> > From: August Alm
>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>> > To: ats-lang-users;
>>> > Subject:[atspre_malloc_gc] on Arduino
>>> >
>>> >
>>> > Hi!
>>> > I am fiddling around with using ATS for Arduino, based on the 
>>> ATS-contrib folder.
>>> > Lots of fun! The following error, though, leaves me clueless as to how 
>>> to fix:
>>> >
>>> >  In function ‘void* 
>>> ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>>> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>>> >
>>> > At least one of the examples in the contrib folder (the Queens puzzle 
>>> 2, I think),
>>> > contains:
>>> >
>>> >  %{^
>>> >  #define ATS_MFREE free
>>> >  #define ATS_MALLOC malloc
>>> >  %}
>>> >
>>> > That does not help with the [atspre_malloc_gc], but is it something 
>>> similar that must
>>> > be added to my file to make it compile?
>>> >
>>> > Best wishes,
>>> > August
>>> >
>>> > --
>>> > 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 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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com
>>> .
>>>
>>> --
>>> 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 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/46b49e80-6c25-4a1d-a3a7-39b2435391e2%40googlegroups.com
>>> .
>>>
>>
>>

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/8793d39c-f32b-44f3-8f91-7abaa37bd78d%40googlegroups.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread gmhwxi






Yes. Could u paste the involved code?
Sent from my T-Mobile 4G LTE device



-- Original message--From: August AlmDate: Fri, Apr 28, 2017 2:25 PMTo: 
ats-lang-users;Subject:Re: [atspre_malloc_gc] on Arduino
I'm still not sure what to do.
Is there even a way to define [arrayptr]-values without malloc?

Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:I just noticed that 
there is indeed support for malloc/free...

On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:I guess that the 
reason for the failure is due to 'malloc' being not available.

One should probably avoid using malloc/free when coding for Arduino. If anything
needs to be allocated, trying to do it at compile-time.


On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
No luck unfortunately.
Adding
#include "prelude/CATS/memory.cats"
doesn't help either (it was the trick that did it in an old thread on this 
list).

Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
> Plz try it. It may solve ur problem.
>
>
> Sent from my T-Mobile 4G LTE device
>
>
>
>
>
>
>
> -- Original message--
> From: August Alm
> Date: Thu, Apr 27, 2017 5:53 PM
> To: ats-lang-users;
> Subject:[atspre_malloc_gc] on Arduino
>
>
> Hi!
> I am fiddling around with using ATS for Arduino, based on the ATS-contrib 
> folder.
> Lots of fun! The following error, though, leaves me clueless as to how to fix:
>
>  In function ‘void* ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>
> At least one of the examples in the contrib folder (the Queens puzzle 2, I 
> think),
> contains:
>
>  %{^
>  #define ATS_MFREE free
>  #define ATS_MALLOC malloc
>  %}
>
> That does not help with the [atspre_malloc_gc], but is it something similar 
> that must
> be added to my file to make it compile?
>
> Best wishes,
> August
>
> --
> 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 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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com.

--
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 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/46b49e80-6c25-4a1d-a3a7-39b2435391e2%40googlegroups.com.

-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/8793d39c-f32b-44f3-8f91-7abaa37bd78d%40googlegroups.com.


-- 
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-users+unsubscr...@googlegroups.com.
To post to this group, send email to ats-lang-users@googlegroups.com.
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/000f4246.2526660826769e0f%40gmail.com.


Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread August Alm
Here is a smallish working example: https://glot.io/snippets/epdbihpgw1 
It is essentially the "Blink.dats" but with an [arrayptr] initialization 
thrown in
in the middle.

Compilation à la the Makefile in ATS-contrib/arduino yields the error

  Blink_dats.ino: In function ‘void* 
ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:  
  Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in this 
scope


Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>
> Yes. Could u paste the involved code?
>
>
> Sent from my T-Mobile 4G LTE device
>
>
> -- Original message--
>
> *From: *August Alm
>
> *Date: *Fri, Apr 28, 2017 2:25 PM
>
> *To: *ats-lang-users;
>
> *Subject:*Re: [atspre_malloc_gc] on Arduino
>
>
> I'm still not sure what to do.
> Is there even a way to define [arrayptr]-values without malloc?
>
> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>
>> I just noticed that there is indeed support for malloc/free...
>>
>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>
>>> I guess that the reason for the failure is due to 'malloc' being not 
>>> available.
>>>
>>> One should probably avoid using malloc/free when coding for Arduino. If 
>>> anything
>>> needs to be allocated, trying to do it at compile-time.
>>>
>>>
>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>
>>>> No luck unfortunately.
>>>> Adding
>>>> #include "prelude/CATS/memory.cats"
>>>> doesn't help either (it was the trick that did it in an old thread on 
>>>> this list).
>>>>
>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>> > Plz try it. It may solve ur problem.
>>>> >
>>>> >
>>>> > Sent from my T-Mobile 4G LTE device
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > -- Original message--
>>>> > From: August Alm
>>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>>> > To: ats-lang-users;
>>>> > Subject:[atspre_malloc_gc] on Arduino
>>>> >
>>>> >
>>>> > Hi!
>>>> > I am fiddling around with using ATS for Arduino, based on the 
>>>> ATS-contrib folder.
>>>> > Lots of fun! The following error, though, leaves me clueless as to 
>>>> how to fix:
>>>> >
>>>> >  In function ‘void* 
>>>> ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>>>> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>>>> >
>>>> > At least one of the examples in the contrib folder (the Queens puzzle 
>>>> 2, I think),
>>>> > contains:
>>>> >
>>>> >  %{^
>>>> >  #define ATS_MFREE free
>>>> >  #define ATS_MALLOC malloc
>>>> >  %}
>>>> >
>>>> > That does not help with the [atspre_malloc_gc], but is it something 
>>>> similar that must
>>>> > be added to my file to make it compile?
>>>> >
>>>> > Best wishes,
>>>> > August
>>>> >
>>>> > --
>>>> > 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 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/b10f1899-9196-498b-9645-25270feda8d3%40googlegroups.com
>>>> .
>>>>
>>>> --
>>>> 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 https://groups.google.com/group/ats-lang-users.
>>>> To view this discussion on the web vis

Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread gmhwxi



Without malloc, you need to allocate statically:

//
%{^
#define N 8
int theArray[N] =
{
  0,0,0,0,0,0,0,0
} ;
%} // end of [%{^]
#define N 8
macdef theArray =
  $extval(arrayref(int,N),"theArray")
//

In embedded programming, resources are often all allocated at the beginning.
A function like audiobuffer_initize should only do initialization (and do 
no allocation).

On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>
> Here is a smallish working example: https://glot.io/snippets/epdbihpgw1 
> It is essentially the "Blink.dats" but with an [arrayptr] initialization 
> thrown in
> in the middle.
>
> Compilation à la the Makefile in ATS-contrib/arduino yields the error
>
>   Blink_dats.ino: In function ‘void* 
> ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:  
>   Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in 
> this scope
>
>
> Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>>
>> Yes. Could u paste the involved code?
>>
>>
>> Sent from my T-Mobile 4G LTE device
>>
>>
>> -- Original message--
>>
>> *From: *August Alm
>>
>> *Date: *Fri, Apr 28, 2017 2:25 PM
>>
>> *To: *ats-lang-users;
>>
>> *Subject:*Re: [atspre_malloc_gc] on Arduino
>>
>>
>> I'm still not sure what to do.
>> Is there even a way to define [arrayptr]-values without malloc?
>>
>> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>>
>>> I just noticed that there is indeed support for malloc/free...
>>>
>>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>>
>>>> I guess that the reason for the failure is due to 'malloc' being not 
>>>> available.
>>>>
>>>> One should probably avoid using malloc/free when coding for Arduino. If 
>>>> anything
>>>> needs to be allocated, trying to do it at compile-time.
>>>>
>>>>
>>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>>
>>>>> No luck unfortunately.
>>>>> Adding
>>>>> #include "prelude/CATS/memory.cats"
>>>>> doesn't help either (it was the trick that did it in an old thread on 
>>>>> this list).
>>>>>
>>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>>> > Plz try it. It may solve ur problem.
>>>>> >
>>>>> >
>>>>> > Sent from my T-Mobile 4G LTE device
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > -- Original message--
>>>>> > From: August Alm
>>>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>>>> > To: ats-lang-users;
>>>>> > Subject:[atspre_malloc_gc] on Arduino
>>>>> >
>>>>> >
>>>>> > Hi!
>>>>> > I am fiddling around with using ATS for Arduino, based on the 
>>>>> ATS-contrib folder.
>>>>> > Lots of fun! The following error, though, leaves me clueless as to 
>>>>> how to fix:
>>>>> >
>>>>> >  In function ‘void* 
>>>>> ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>>>>> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>>>>> >
>>>>> > At least one of the examples in the contrib folder (the Queens 
>>>>> puzzle 2, I think),
>>>>> > contains:
>>>>> >
>>>>> >  %{^
>>>>> >  #define ATS_MFREE free
>>>>> >  #define ATS_MALLOC malloc
>>>>> >  %}
>>>>> >
>>>>> > That does not help with the [atspre_malloc_gc], but is it something 
>>>>> similar that must
>>>>> > be added to my file to make it compile?
>>>>> >
>>>>> > Best wishes,
>>>>> > August
>>>>> >
>>>>> > --
>>>>> > 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 

Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread August Alm
Arduino does allow malloc, as you noted, and having two or three done
at the very beginning of runtime should be legit also for embedded 
programming,
I think. But even without malloc my question remains, can I statically 
allocate
an [arrayptr]?

The only ways to get an [arrayptr] that I've figured out rely on
[arrayptr-encode(pfat, pfgc| p)], and then you need a term proof [pfgc] of 
"garbage
collectability", and those seem hard to come by without malloc.

Den lördag 29 april 2017 kl. 00:13:13 UTC+2 skrev gmhwxi:
>
>
>
>
> Without malloc, you need to allocate statically:
>
> //
> %{^
> #define N 8
> int theArray[N] =
> {
>   0,0,0,0,0,0,0,0
> } ;
> %} // end of [%{^]
> #define N 8
> macdef theArray =
>   $extval(arrayref(int,N),"theArray")
> //
>
> In embedded programming, resources are often all allocated at the 
> beginning.
> A function like audiobuffer_initize should only do initialization (and do 
> no allocation).
>
> On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>>
>> Here is a smallish working example: https://glot.io/snippets/epdbihpgw1 
>> It is essentially the "Blink.dats" but with an [arrayptr] initialization 
>> thrown in
>> in the middle.
>>
>> Compilation à la the Makefile in ATS-contrib/arduino yields the error
>>
>>   Blink_dats.ino: In function ‘void* 
>> ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:  
>>   Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in 
>> this scope
>>
>>
>> Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>>>
>>> Yes. Could u paste the involved code?
>>>
>>>
>>> Sent from my T-Mobile 4G LTE device
>>>
>>>
>>> -- Original message--
>>>
>>> *From: *August Alm
>>>
>>> *Date: *Fri, Apr 28, 2017 2:25 PM
>>>
>>> *To: *ats-lang-users;
>>>
>>> *Subject:*Re: [atspre_malloc_gc] on Arduino
>>>
>>>
>>> I'm still not sure what to do.
>>> Is there even a way to define [arrayptr]-values without malloc?
>>>
>>> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>>>
>>>> I just noticed that there is indeed support for malloc/free...
>>>>
>>>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>>>
>>>>> I guess that the reason for the failure is due to 'malloc' being not 
>>>>> available.
>>>>>
>>>>> One should probably avoid using malloc/free when coding for Arduino. 
>>>>> If anything
>>>>> needs to be allocated, trying to do it at compile-time.
>>>>>
>>>>>
>>>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>>>
>>>>>> No luck unfortunately.
>>>>>> Adding
>>>>>> #include "prelude/CATS/memory.cats"
>>>>>> doesn't help either (it was the trick that did it in an old thread on 
>>>>>> this list).
>>>>>>
>>>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>>>> > Plz try it. It may solve ur problem.
>>>>>> >
>>>>>> >
>>>>>> > Sent from my T-Mobile 4G LTE device
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > -- Original message--
>>>>>> > From: August Alm
>>>>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>>>>> > To: ats-lang-users;
>>>>>> > Subject:[atspre_malloc_gc] on Arduino
>>>>>> >
>>>>>> >
>>>>>> > Hi!
>>>>>> > I am fiddling around with using ATS for Arduino, based on the 
>>>>>> ATS-contrib folder.
>>>>>> > Lots of fun! The following error, though, leaves me clueless as to 
>>>>>> how to fix:
>>>>>> >
>>>>>> >  In function ‘void* 
>>>>>> ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>>>>>> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>>>>>> >
>>>>>> > At least one of the examples in the contrib folder (the Queens 
>>>>>> puzzle 2, I think)

Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread August Alm
I found this old thread which I guess answers my questions:
http://ats-lang-users.googlegroups.narkive.com/eBqXxMgr/static-array
Short answer, I take it, is that no, there is no way to statically allocate
an [arrayptr] in ATS, and one should rely using C for those parts of the 
code.
A bit of a dissapointment.


Den lördag 29 april 2017 kl. 00:13:13 UTC+2 skrev gmhwxi:
>
>
>
>
> Without malloc, you need to allocate statically:
>
> //
> %{^
> #define N 8
> int theArray[N] =
> {
>   0,0,0,0,0,0,0,0
> } ;
> %} // end of [%{^]
> #define N 8
> macdef theArray =
>   $extval(arrayref(int,N),"theArray")
> //
>
> In embedded programming, resources are often all allocated at the 
> beginning.
> A function like audiobuffer_initize should only do initialization (and do 
> no allocation).
>
> On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>>
>> Here is a smallish working example: https://glot.io/snippets/epdbihpgw1 
>> It is essentially the "Blink.dats" but with an [arrayptr] initialization 
>> thrown in
>> in the middle.
>>
>> Compilation à la the Makefile in ATS-contrib/arduino yields the error
>>
>>   Blink_dats.ino: In function ‘void* 
>> ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:  
>>   Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in 
>> this scope
>>
>>
>> Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>>>
>>> Yes. Could u paste the involved code?
>>>
>>>
>>> Sent from my T-Mobile 4G LTE device
>>>
>>>
>>> -- Original message--
>>>
>>> *From: *August Alm
>>>
>>> *Date: *Fri, Apr 28, 2017 2:25 PM
>>>
>>> *To: *ats-lang-users;
>>>
>>> *Subject:*Re: [atspre_malloc_gc] on Arduino
>>>
>>>
>>> I'm still not sure what to do.
>>> Is there even a way to define [arrayptr]-values without malloc?
>>>
>>> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>>>
>>>> I just noticed that there is indeed support for malloc/free...
>>>>
>>>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>>>
>>>>> I guess that the reason for the failure is due to 'malloc' being not 
>>>>> available.
>>>>>
>>>>> One should probably avoid using malloc/free when coding for Arduino. 
>>>>> If anything
>>>>> needs to be allocated, trying to do it at compile-time.
>>>>>
>>>>>
>>>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>>>
>>>>>> No luck unfortunately.
>>>>>> Adding
>>>>>> #include "prelude/CATS/memory.cats"
>>>>>> doesn't help either (it was the trick that did it in an old thread on 
>>>>>> this list).
>>>>>>
>>>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>>>> > Plz try it. It may solve ur problem.
>>>>>> >
>>>>>> >
>>>>>> > Sent from my T-Mobile 4G LTE device
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > -- Original message--
>>>>>> > From: August Alm
>>>>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>>>>> > To: ats-lang-users;
>>>>>> > Subject:[atspre_malloc_gc] on Arduino
>>>>>> >
>>>>>> >
>>>>>> > Hi!
>>>>>> > I am fiddling around with using ATS for Arduino, based on the 
>>>>>> ATS-contrib folder.
>>>>>> > Lots of fun! The following error, though, leaves me clueless as to 
>>>>>> how to fix:
>>>>>> >
>>>>>> >  In function ‘void* 
>>>>>> ATSLIB_056_prelude__array_ptr_alloc__46__1(atstype_size)’:
>>>>>> >  ... error: ‘atspre_malloc_gc’ was not declared in this scope
>>>>>> >
>>>>>> > At least one of the examples in the contrib folder (the Queens 
>>>>>> puzzle 2, I think),
>>>>>> > contains:
>>>>>> >
>>>>>> >  %{^
>>>>>> >  #d

Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread Hongwei Xi
The code seems to compile if you just add:

%{^
#define atspre_malloc_gc malloc
%}


On Fri, Apr 28, 2017 at 6:31 PM, August Alm  wrote:

> Arduino does allow malloc, as you noted, and having two or three done
> at the very beginning of runtime should be legit also for embedded
> programming,
> I think. But even without malloc my question remains, can I statically
> allocate
> an [arrayptr]?
>
> The only ways to get an [arrayptr] that I've figured out rely on
> [arrayptr-encode(pfat, pfgc| p)], and then you need a term proof [pfgc] of
> "garbage
> collectability", and those seem hard to come by without malloc.
>
>
> Den lördag 29 april 2017 kl. 00:13:13 UTC+2 skrev gmhwxi:
>>
>>
>>
>>
>> Without malloc, you need to allocate statically:
>>
>> //
>> %{^
>> #define N 8
>> int theArray[N] =
>> {
>>   0,0,0,0,0,0,0,0
>> } ;
>> %} // end of [%{^]
>> #define N 8
>> macdef theArray =
>>   $extval(arrayref(int,N),"theArray")
>> //
>>
>> In embedded programming, resources are often all allocated at the
>> beginning.
>> A function like audiobuffer_initize should only do initialization (and do
>> no allocation).
>>
>> On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>>>
>>> Here is a smallish working example: https://glot.io/snippets/epdbihpgw1
>>> It is essentially the "Blink.dats" but with an [arrayptr] initialization
>>> thrown in
>>> in the middle.
>>>
>>> Compilation à la the Makefile in ATS-contrib/arduino yields the error
>>>
>>>   Blink_dats.ino: In function ‘void* 
>>> ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:
>>>
>>>   Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in
>>> this scope
>>>
>>>
>>> Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>>>>
>>>> Yes. Could u paste the involved code?
>>>>
>>>>
>>>> Sent from my T-Mobile 4G LTE device
>>>>
>>>>
>>>> -- Original message--
>>>>
>>>> *From: *August Alm
>>>>
>>>> *Date: *Fri, Apr 28, 2017 2:25 PM
>>>>
>>>> *To: *ats-lang-users;
>>>>
>>>> *Subject:*Re: [atspre_malloc_gc] on Arduino
>>>>
>>>>
>>>> I'm still not sure what to do.
>>>> Is there even a way to define [arrayptr]-values without malloc?
>>>>
>>>> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>>>>
>>>>> I just noticed that there is indeed support for malloc/free...
>>>>>
>>>>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>>>>
>>>>>> I guess that the reason for the failure is due to 'malloc' being not
>>>>>> available.
>>>>>>
>>>>>> One should probably avoid using malloc/free when coding for Arduino.
>>>>>> If anything
>>>>>> needs to be allocated, trying to do it at compile-time.
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>>>>
>>>>>>> No luck unfortunately.
>>>>>>> Adding
>>>>>>> #include "prelude/CATS/memory.cats"
>>>>>>> doesn't help either (it was the trick that did it in an old thread
>>>>>>> on this list).
>>>>>>>
>>>>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>>>>> > Plz try it. It may solve ur problem.
>>>>>>> >
>>>>>>> >
>>>>>>> > Sent from my T-Mobile 4G LTE device
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > -- Original message--
>>>>>>> > From: August Alm
>>>>>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>>>>>> > To: ats-lang-users;
>>>>>>> > Subject:[atspre_malloc_gc] on Arduino
>>>>>>> >
>>>>>>> >
>>>>>>> > Hi!
>>>>>>> > I am fiddling around with using ATS for A

Re: [atspre_malloc_gc] on Arduino

2017-04-28 Thread Hongwei Xi
As long as malloc/free is provided, arrayptr can be created.
For embedded programming, one may allocate some memory statically
and then build a simple malloc/free pair. See the following article:

http://ats-lang.sourceforge.net/EXAMPLE/EFFECTIVATS/linear-streams/main.html

I have long argued that linear streams can be quite suitable for embedded
programming.
I have never had time to try the idea on Aduino programming. Maybe you
could try it and
tell us how it goes :)


On Fri, Apr 28, 2017 at 7:29 PM, August Alm  wrote:

> I found this old thread which I guess answers my questions:
> http://ats-lang-users.googlegroups.narkive.com/eBqXxMgr/static-array
> Short answer, I take it, is that no, there is no way to statically allocate
> an [arrayptr] in ATS, and one should rely using C for those parts of the
> code.
> A bit of a dissapointment.
>
>
> Den lördag 29 april 2017 kl. 00:13:13 UTC+2 skrev gmhwxi:
>
>>
>>
>>
>> Without malloc, you need to allocate statically:
>>
>> //
>> %{^
>> #define N 8
>> int theArray[N] =
>> {
>>   0,0,0,0,0,0,0,0
>> } ;
>> %} // end of [%{^]
>> #define N 8
>> macdef theArray =
>>   $extval(arrayref(int,N),"theArray")
>> //
>>
>> In embedded programming, resources are often all allocated at the
>> beginning.
>> A function like audiobuffer_initize should only do initialization (and do
>> no allocation).
>>
>> On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>>>
>>> Here is a smallish working example: https://glot.io/snippets/epdbihpgw1
>>> It is essentially the "Blink.dats" but with an [arrayptr] initialization
>>> thrown in
>>> in the middle.
>>>
>>> Compilation à la the Makefile in ATS-contrib/arduino yields the error
>>>
>>>   Blink_dats.ino: In function ‘void* 
>>> ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:
>>>
>>>   Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in
>>> this scope
>>>
>>>
>>> Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>>>>
>>>> Yes. Could u paste the involved code?
>>>>
>>>>
>>>> Sent from my T-Mobile 4G LTE device
>>>>
>>>>
>>>> -- Original message--
>>>>
>>>> *From: *August Alm
>>>>
>>>> *Date: *Fri, Apr 28, 2017 2:25 PM
>>>>
>>>> *To: *ats-lang-users;
>>>>
>>>> *Subject:*Re: [atspre_malloc_gc] on Arduino
>>>>
>>>>
>>>> I'm still not sure what to do.
>>>> Is there even a way to define [arrayptr]-values without malloc?
>>>>
>>>> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>>>>
>>>>> I just noticed that there is indeed support for malloc/free...
>>>>>
>>>>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>>>>
>>>>>> I guess that the reason for the failure is due to 'malloc' being not
>>>>>> available.
>>>>>>
>>>>>> One should probably avoid using malloc/free when coding for Arduino.
>>>>>> If anything
>>>>>> needs to be allocated, trying to do it at compile-time.
>>>>>>
>>>>>>
>>>>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>>>>
>>>>>>> No luck unfortunately.
>>>>>>> Adding
>>>>>>> #include "prelude/CATS/memory.cats"
>>>>>>> doesn't help either (it was the trick that did it in an old thread
>>>>>>> on this list).
>>>>>>>
>>>>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>>>>> > Plz try it. It may solve ur problem.
>>>>>>> >
>>>>>>> >
>>>>>>> > Sent from my T-Mobile 4G LTE device
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > -- Original message--
>>>>>>> > From: August Alm
>>>>>>> > Date: Thu, Apr 27, 2017 5:53 PM
>>>>>>> > To: ats-lang-users;
>>>>>>> > Subject:[at

Re: [atspre_malloc_gc] on Arduino

2017-04-30 Thread August Alm
That simple, huh! Thank you, and thank you for nudging me in other 
directions. :)

Den lördag 29 april 2017 kl. 02:20:01 UTC+2 skrev gmhwxi:
>
> The code seems to compile if you just add:
>
> %{^
> #define atspre_malloc_gc malloc
> %}
>
>
> On Fri, Apr 28, 2017 at 6:31 PM, August Alm  > wrote:
>
>> Arduino does allow malloc, as you noted, and having two or three done
>> at the very beginning of runtime should be legit also for embedded 
>> programming,
>> I think. But even without malloc my question remains, can I statically 
>> allocate
>> an [arrayptr]?
>>
>> The only ways to get an [arrayptr] that I've figured out rely on
>> [arrayptr-encode(pfat, pfgc| p)], and then you need a term proof [pfgc] 
>> of "garbage
>> collectability", and those seem hard to come by without malloc.
>>
>>
>> Den lördag 29 april 2017 kl. 00:13:13 UTC+2 skrev gmhwxi:
>>>
>>>
>>>
>>>
>>> Without malloc, you need to allocate statically:
>>>
>>> //
>>> %{^
>>> #define N 8
>>> int theArray[N] =
>>> {
>>>   0,0,0,0,0,0,0,0
>>> } ;
>>> %} // end of [%{^]
>>> #define N 8
>>> macdef theArray =
>>>   $extval(arrayref(int,N),"theArray")
>>> //
>>>
>>> In embedded programming, resources are often all allocated at the 
>>> beginning.
>>> A function like audiobuffer_initize should only do initialization (and 
>>> do no allocation).
>>>
>>> On Friday, April 28, 2017 at 4:25:30 PM UTC-4, August Alm wrote:
>>>>
>>>> Here is a smallish working example: https://glot.io/snippets/epdbihpgw1 
>>>> It is essentially the "Blink.dats" but with an [arrayptr] 
>>>> initialization thrown in
>>>> in the middle.
>>>>
>>>> Compilation à la the Makefile in ATS-contrib/arduino yields the error
>>>>
>>>>   Blink_dats.ino: In function ‘void* 
>>>> ATSLIB_056_prelude__array_ptr_alloc__7__1(atstype_size)’:  
>>>>   Blink_dats.ino:816:50: error: ‘atspre_malloc_gc’ was not declared in 
>>>> this scope
>>>>
>>>>
>>>> Den fredag 28 april 2017 kl. 20:28:09 UTC+2 skrev gmhwxi:
>>>>>
>>>>> Yes. Could u paste the involved code?
>>>>>
>>>>>
>>>>> Sent from my T-Mobile 4G LTE device
>>>>>
>>>>>
>>>>> -- Original message--
>>>>>
>>>>> *From: *August Alm
>>>>>
>>>>> *Date: *Fri, Apr 28, 2017 2:25 PM
>>>>>
>>>>> *To: *ats-lang-users;
>>>>>
>>>>> *Subject:*Re: [atspre_malloc_gc] on Arduino
>>>>>
>>>>>
>>>>> I'm still not sure what to do.
>>>>> Is there even a way to define [arrayptr]-values without malloc?
>>>>>
>>>>> Den fredag 28 april 2017 kl. 17:11:14 UTC+2 skrev gmhwxi:
>>>>>>
>>>>>> I just noticed that there is indeed support for malloc/free...
>>>>>>
>>>>>> On Thursday, April 27, 2017 at 9:02:06 PM UTC-4, gmhwxi wrote:
>>>>>>>
>>>>>>> I guess that the reason for the failure is due to 'malloc' being not 
>>>>>>> available.
>>>>>>>
>>>>>>> One should probably avoid using malloc/free when coding for Arduino. 
>>>>>>> If anything
>>>>>>> needs to be allocated, trying to do it at compile-time.
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Apr 27, 2017 at 7:32 PM, August Alm <...> wrote:
>>>>>>>
>>>>>>>> No luck unfortunately.
>>>>>>>> Adding
>>>>>>>> #include "prelude/CATS/memory.cats"
>>>>>>>> doesn't help either (it was the trick that did it in an old thread 
>>>>>>>> on this list).
>>>>>>>>
>>>>>>>> Den fredag 28 april 2017 kl. 00:57:35 UTC+2 skrev gmhwxi:
>>>>>>>> > Plz try it. It may solve ur problem.
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Sent from my T-Mobile 4G LTE device
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>&g