Mac#% meaning?

Hello all,

I know declaring a function = “mac#foo” makes it treated like a macro in
C, but what does mac#% mean? e.g. in libc/SATS/alloca.sats:

fun alloca
{dummy:addr}{n:int}
(
pf: void@dummy | n: size_t (n)
) : [l:addr]
(
bytes(n) @ l, bytes(n) @ l → void@dummy | ptr(l)
) = “mac#%” // end of [alloca]

~Shea

ATS_PACKNAME is for names generated by the compiler, and
ATS_EXTERN_PREFIX is for external names chosen by a programmer.On Saturday, August 30, 2014 8:01:17 AM UTC-4, Artyom Shalkhakov wrote:

On Saturday, August 30, 2014 10:26:23 AM UTC+6, gmhwxi wrote:

There is also a special flag named ATS_EXTERN_PREFIX.

Say we have

#define ATS_EXTERN_PREFIX “ABCDE_”

If we do

extern fun foo(…): … = “mac#%”

then the external name of foo is ${ATS_EXTERN_PREFIX}foo. Basically, the
‘%’ here
is replaced with the string value stored in ATS_EXTERN_PREFIX.

Does this interact with ATS_PACKNAME or not? What’s the difference?

On Sat, Aug 30, 2014 at 12:20 AM, Shea Levy sh...@shealevy.com wrote:

Hello all,

I know declaring a function = “mac#foo” makes it treated like a macro in
C, but what does mac#% mean? e.g. in libc/SATS/alloca.sats:

fun alloca
{dummy:addr}{n:int}
(
pf: void@dummy | n: size_t (n)
) : [l:addr]
(
bytes(n) @ l, bytes(n) @ l → void@dummy | ptr(l)
) = “mac#%” // end of [alloca]

~Shea


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...@googlegroups.com.
To post to this group, send email to ats-l...@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/20140830042043.GB9476%40nixos.hsd1.nh.comcast.net
.

045 looks a bit too mysterious (it is translated from ‘%’).
I have now changed it to ‘ATS_EXTERN_PREFIX’. So, basically,
if ATS_EXTERN_PREFIX is undefined, its value is assumed to be
ATS_EXTERN_PREFIX.On Saturday, May 9, 2015 at 7:01:46 PM UTC-4, Yannick Duchêne wrote:

Le samedi 30 août 2014 06:26:23 UTC+2, gmhwxi a écrit :

There is also a special flag named ATS_EXTERN_PREFIX.

Say we have

#define ATS_EXTERN_PREFIX “ABCDE_”

If we do

extern fun foo(…): … = “mac#%”

then the external name of foo is ${ATS_EXTERN_PREFIX}foo. Basically, the
‘%’ here
is replaced with the string value stored in ATS_EXTERN_PREFIX.

I don’t know if it’s on purpose, I noticed when there is no definition for
ATS_EXTERN_PREFIX, the name is just substituted _045_ , literally and
with no warning, while there is a warning when ATS_EXTERN_PREFIX is defined
with anything which is not a string.

There is also a special flag named ATS_EXTERN_PREFIX.

Say we have

#define ATS_EXTERN_PREFIX “ABCDE_”

If we do

extern fun foo(…): … = “mac#%”

then the external name of foo is ${ATS_EXTERN_PREFIX}foo. Basically, the
‘%’ here
is replaced with the string value stored in ATS_EXTERN_PREFIX.

Does this interact with ATS_PACKNAME or not? What’s the difference?

There is also a special flag named ATS_EXTERN_PREFIX.

Say we have

#define ATS_EXTERN_PREFIX “ABCDE_”

If we do

extern fun foo(…): … = “mac#%”

then the external name of foo is ${ATS_EXTERN_PREFIX}foo. Basically, the
‘%’ here
is replaced with the string value stored in ATS_EXTERN_PREFIX.On Sat, Aug 30, 2014 at 12:20 AM, Shea Levy sh...@shealevy.com wrote:

Hello all,

I know declaring a function = “mac#foo” makes it treated like a macro in
C, but what does mac#% mean? e.g. in libc/SATS/alloca.sats:

fun alloca
{dummy:addr}{n:int}
(
pf: void@dummy | n: size_t (n)
) : [l:addr]
(
bytes(n) @ l, bytes(n) @ l → void@dummy | ptr(l)
) = “mac#%” // end of [alloca]

~Shea


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/20140830042043.GB9476%40nixos.hsd1.nh.comcast.net
.

045 looks a bit too mysterious (it is translated from ‘%’).

Yes, it do the same with other character codes.

Ah ha. That answers the next question I had about the implementation of
alloca, now I see it in alloca.hats.

~SheaOn Sat, Aug 30, 2014 at 12:26:22AM -0400, Hongwei Xi wrote:

There is also a special flag named ATS_EXTERN_PREFIX.

Say we have

#define ATS_EXTERN_PREFIX “ABCDE_”

If we do

extern fun foo(…): … = “mac#%”

then the external name of foo is ${ATS_EXTERN_PREFIX}foo. Basically, the
‘%’ here
is replaced with the string value stored in ATS_EXTERN_PREFIX.

On Sat, Aug 30, 2014 at 12:20 AM, Shea Levy sh...@shealevy.com wrote:

Hello all,

I know declaring a function = “mac#foo” makes it treated like a macro in
C, but what does mac#% mean? e.g. in libc/SATS/alloca.sats:

fun alloca
{dummy:addr}{n:int}
(
pf: void@dummy | n: size_t (n)
) : [l:addr]
(
bytes(n) @ l, bytes(n) @ l → void@dummy | ptr(l)
) = “mac#%” // end of [alloca]

~Shea


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/20140830042043.GB9476%40nixos.hsd1.nh.comcast.net
.


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/CAPPSPLpnNZPHwYiejB9Fx8xrknFpq2it5fLy1ifpMXG1PBjSNQ%40mail.gmail.com.

There is also a special flag named ATS_EXTERN_PREFIX.

Say we have

#define ATS_EXTERN_PREFIX “ABCDE_”

If we do

extern fun foo(…): … = “mac#%”

then the external name of foo is ${ATS_EXTERN_PREFIX}foo. Basically, the
‘%’ here
is replaced with the string value stored in ATS_EXTERN_PREFIX.

I don’t know if it’s on purpose, I noticed when there is no definition for
ATS_EXTERN_PREFIX, the name is just substituted _045_ , literally and
with no warning, while there is a warning when ATS_EXTERN_PREFIX is defined
with anything which is not a string.