# Variables in load paths

**URL:** <https://discourse.ats-lang.org/t/variables-in-load-paths/814>\
**Category:** Google Group\
**Created:** [December 10, 2014, 5:19pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814 "2014-12-10T17:19:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [December 10, 2014, 5:19pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/1 "2014-12-10T17:19:00Z")

</div>

Sorry if it has been asked before, I will try to update the approrpiate  
docs as needed. If you have something like:

staload JNI = “{$JNI}/SATS/jni.sats”

How do you set $JNI? Environment variables seems to not be the answer.

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [January 19, 2015, 6:53pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/2 "2015-01-19T18:53:29Z")

</div>

Ah yes, this strange cygwin quoting issue again. I’ll make a note on the  
wiki which I’ll hopefully find in case I forget again.  
Thanks!On Mon, Jan 19, 2015 at 1:44 PM, Hongwei Xi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:

> Try:
> 
> patscc -DATS  
> UNSAFE\_targetloc=\"/home/brand\_000/ATS-Postiats/prelude/SATS\"  
> hello.dats
> 
> On Mon, Jan 19, 2015 at 1:10 PM, Brandon Barker [brandon...@gmail.com](mailto:brandon...@gmail.com) wrote:
> 
> > I seem to be having a bit of trouble with this mechanism still. The  
> > #define works (commented out now), but the command line option shown below  
> > must not be quite right:
> > 
> > brand\_000@bbsurfacepro3 ~  
> > $ patscc -DATS  
> > UNSAFE\_targetloc=“/home/brand\_000/ATS-Postiats/prelude/SATS” hello.dats  
> > patsopt: error(0): the command-line argument  
> > [UNSAFE\_targetloc=/home/brand\_000/ATS-Postiats/prelude/SATS] cannot be  
> > properly parsed.  
> > exit(ATS): uncaught exception:  
> > \_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorExn(1025)
> > 
> > brand\_000@bbsurfacepro3 ~  
> > $ patscc -DATS  
> > UNSAFE\_targetloc="/home/brand\_000/ATS-Postiats/prelude/SATS" hello.dats  
> > patsopt: error(0): the command-line argument  
> > [UNSAFE\_targetloc=/home/brand\_000/ATS-Postiats/prelude/SATS] cannot be  
> > properly parsed.  
> > exit(ATS): uncaught exception:  
> > \_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorExn(1025)
> > 
> > //#define UNSAFE\_targetloc “$PATSHOME/prelude/SATS”
> > 
> > staload UN = “{$UNSAFE}/unsafe.sats”
> > 
> > implement  
> > main0 () = {  
> > val x = $UN.cast2size(7)  
> > val () = println! (“{$UNSAFE}”)  
> > val () = println! (“Hello world!”) // English  
> > val () = println! x  
> > } (\* end of [main0] \*)
> > 
> > On Wed, Dec 10, 2014 at 12:56 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:
> > 
> > > You can also do it this way
> > > 
> > > patsopt -DATS JNI\_targetloc="${JNI}" …
> > > 
> > > if you set JNI is as an environment variable.
> > > 
> > > On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:
> > > 
> > > > You can set it as follows:
> > > > 
> > > > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> > > > 
> > > > On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker wrote:
> > > > 
> > > > Sorry if it has been asked before, I will try to update the approrpiate
> > > > 
> > > > > docs as needed. If you have something like:
> > > > > 
> > > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > > 
> > > > > How do you set $JNI? Environment variables seems to not be the answer.
> > > > > 
> > > > > –  
> > > > > 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](mailto:ats-lang-user...@googlegroups.com).  
> > > > > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > > > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > 
> > –  
> > Brandon Barker  
> > [brandon...@gmail.com](mailto:brandon...@gmail.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](mailto:ats-lang-user...@googlegroups.com).  
> > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > Visit this group at [http://groups.google.com/group/ats-lang-users](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/CAORbNRpYFTW3\_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com](https://groups.google.com/d/msgid/ats-lang-users/CAORbNRpYFTW3_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/ats-lang-users/CAORbNRpYFTW3\_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/CAORbNRpYFTW3_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .
> 
> –  
> 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](mailto:ats-lang-user...@googlegroups.com).  
> To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> Visit this group at [http://groups.google.com/group/ats-lang-users](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/CAPPSPLpa1rsSj1HTt6cKvevC19LhTMepJ2TUxVKmXbrc-tceUQ%40mail.gmail.com](https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpa1rsSj1HTt6cKvevC19LhTMepJ2TUxVKmXbrc-tceUQ%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpa1rsSj1HTt6cKvevC19LhTMepJ2TUxVKmXbrc-tceUQ%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/CAPPSPLpa1rsSj1HTt6cKvevC19LhTMepJ2TUxVKmXbrc-tceUQ%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .

Brandon Barker  
[brandon...@gmail.com](mailto:brandon...@gmail.com)

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 6:44pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/3 "2014-12-10T18:44:32Z")

</div>

I tried your source code and encountered no problems.

By the way, JNI\_targetloc is already defined in share/atspre\_define.hats:

> <https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre_define.hats>

There is no need to define it again unless your new definition is different.On Wednesday, December 10, 2014 1:29:51 PM UTC-5, gmhwxi wrote:

> If you can already generate \*\_dats.c, it means the following line worked:
> 
> staload JNI = “{$JNI}/SATS/jni.sats”
> 
> On Wed, Dec 10, 2014 at 1:24 PM, Brandon Barker wrote:
> 
> > I tried this one too, but it seems to be the same (I have attached the  
> > file):
> > 
> > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > Gradle $ echo $JNI  
> > /home/brandon/ATS-Postiats-contrib/contrib/JNI  
> > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > Gradle $ patsopt -DATS JNI\_targetloc="${JNI}" -d Calculator.dats |  
> > grep JNI  
> > /home/brandon/ATS-Postiats-contrib/contrib/JNI/SATS/jni.sats:  
> > 249(line=15, offs=1) – 284(line=17, offs=3)  
> > #include “JNI/CATS/jni.cats”  
> > ATSdyncst\_mac(atscntrb\_JNI\_GetStringUTFChars)  
> > ATSdyncst\_mac(atscntrb\_JNI\_ReleaseStringUTFChars)  
> > ATSdyncst\_mac(atscntrb\_JNI\_RaiseExceptionByClassName)  
> > ATSINSflab(\_\_patsflab\_JNI\_eval):  
> > ATSINSmove(tmp960, atscntrb\_JNI\_GetStringUTFChars(arg0, arg2)) ;  
> > ATSINSmove\_void(tmp962, atscntrb\_JNI\_ReleaseStringUTFChars(arg0, arg2,  
> > tmp960)) ;  
> > ATSINSmove\_void(tmp964, atscntrb\_JNI\_RaiseExceptionByClassName(arg0,  
> > ATSPMVstring(“java/lang/IllegalArgumentException”), ATSPMVstring("  
> > ParsingError"))) ;
> > 
> > On Wednesday, December 10, 2014 12:57:22 PM UTC-5, gmhwxi wrote:
> > 
> > > You can also do it this way:
> > > 
> > > patsopt -DATS JNI\_targetloc="${JNI}" …
> > > 
> > > if you set JNI as an environment variable.
> > > 
> > > On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:
> > > 
> > > > Sorry if it has been asked before, I will try to update the approrpiate  
> > > > docs as needed. If you have something like:
> > > > 
> > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > 
> > > > How do you set $JNI? Environment variables seems to not be the answer.

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 6:29pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/4 "2014-12-10T18:29:50Z")

</div>

If you can already generate \*\_dats.c, it means the following line worked:

staload JNI = "{$JNI}/SATS/jni.sats"On Wed, Dec 10, 2014 at 1:24 PM, Brandon Barker [brandon...@gmail.com](mailto:brandon...@gmail.com) wrote:

> I tried this one too, but it seems to be the same (I have attached the  
> file):
> 
> brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> Gradle $ echo $JNI  
> /home/brandon/ATS-Postiats-contrib/contrib/JNI  
> brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> Gradle $ patsopt -DATS JNI\_targetloc="${JNI}" -d Calculator.dats |  
> grep JNI  
> /home/brandon/ATS-Postiats-contrib/contrib/JNI/SATS/jni.sats: 249(line=15,  
> offs=1) – 284(line=17, offs=3)  
> #include “JNI/CATS/jni.cats”  
> ATSdyncst\_mac(atscntrb\_JNI\_GetStringUTFChars)  
> ATSdyncst\_mac(atscntrb\_JNI\_ReleaseStringUTFChars)  
> ATSdyncst\_mac(atscntrb\_JNI\_RaiseExceptionByClassName)  
> ATSINSflab(\_\_patsflab\_JNI\_eval):  
> ATSINSmove(tmp960, atscntrb\_JNI\_GetStringUTFChars(arg0, arg2)) ;  
> ATSINSmove\_void(tmp962, atscntrb\_JNI\_ReleaseStringUTFChars(arg0, arg2,  
> tmp960)) ;  
> ATSINSmove\_void(tmp964, atscntrb\_JNI\_RaiseExceptionByClassName(arg0,  
> ATSPMVstring(“java/lang/IllegalArgumentException”), ATSPMVstring("  
> ParsingError"))) ;
> 
> On Wednesday, December 10, 2014 12:57:22 PM UTC-5, gmhwxi wrote:
> 
> > You can also do it this way:
> > 
> > patsopt -DATS JNI\_targetloc="${JNI}" …
> > 
> > if you set JNI as an environment variable.
> > 
> > On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:
> > 
> > > Sorry if it has been asked before, I will try to update the approrpiate  
> > > docs as needed. If you have something like:
> > > 
> > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > 
> > > How do you set $JNI? Environment variables seems to not be the answer.
> > > 
> > > –  
> > > 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](mailto:ats-lang-user...@googlegroups.com).  
> > > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/a3e802b0-ee6d-4d00-9746-433624984b6d%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/a3e802b0-ee6d-4d00-9746-433624984b6d%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/ats-lang-users/a3e802b0-ee6d-4d00-9746-433624984b6d%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/a3e802b0-ee6d-4d00-9746-433624984b6d%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [January 19, 2015, 6:44pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/5 "2015-01-19T18:44:49Z")

</div>

Try:

patscc -DATS  
UNSAFE\_targetloc=\"/home/brand\_000/ATS-Postiats/prelude/SATS\"  
hello.datsOn Mon, Jan 19, 2015 at 1:10 PM, Brandon Barker [brandon...@gmail.com](mailto:brandon...@gmail.com) wrote:

> I seem to be having a bit of trouble with this mechanism still. The  
> #define works (commented out now), but the command line option shown below  
> must not be quite right:
> 
> brand\_000@bbsurfacepro3 ~  
> $ patscc -DATS  
> UNSAFE\_targetloc=“/home/brand\_000/ATS-Postiats/prelude/SATS” hello.dats  
> patsopt: error(0): the command-line argument  
> [UNSAFE\_targetloc=/home/brand\_000/ATS-Postiats/prelude/SATS] cannot be  
> properly parsed.  
> exit(ATS): uncaught exception:  
> \_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorExn(1025)
> 
> brand\_000@bbsurfacepro3 ~  
> $ patscc -DATS  
> UNSAFE\_targetloc="/home/brand\_000/ATS-Postiats/prelude/SATS" hello.dats  
> patsopt: error(0): the command-line argument  
> [UNSAFE\_targetloc=/home/brand\_000/ATS-Postiats/prelude/SATS] cannot be  
> properly parsed.  
> exit(ATS): uncaught exception:  
> \_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorExn(1025)
> 
> //#define UNSAFE\_targetloc “$PATSHOME/prelude/SATS”
> 
> staload UN = “{$UNSAFE}/unsafe.sats”
> 
> implement  
> main0 () = {  
> val x = $UN.cast2size(7)  
> val () = println! (“{$UNSAFE}”)  
> val () = println! (“Hello world!”) // English  
> val () = println! x  
> } (\* end of [main0] \*)
> 
> On Wed, Dec 10, 2014 at 12:56 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:
> 
> > You can also do it this way
> > 
> > patsopt -DATS JNI\_targetloc="${JNI}" …
> > 
> > if you set JNI is as an environment variable.
> > 
> > On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:
> > 
> > > You can set it as follows:
> > > 
> > > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> > > 
> > > On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker wrote:
> > > 
> > > Sorry if it has been asked before, I will try to update the approrpiate
> > > 
> > > > docs as needed. If you have something like:
> > > > 
> > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > 
> > > > How do you set $JNI? Environment variables seems to not be the answer.
> > > > 
> > > > –  
> > > > 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](mailto:ats-lang-user...@googlegroups.com).  
> > > > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> 
> –  
> Brandon Barker  
> [brandon...@gmail.com](mailto:brandon...@gmail.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](mailto:ats-lang-user...@googlegroups.com).  
> To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> Visit this group at [http://groups.google.com/group/ats-lang-users](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/CAORbNRpYFTW3\_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com](https://groups.google.com/d/msgid/ats-lang-users/CAORbNRpYFTW3_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/ats-lang-users/CAORbNRpYFTW3\_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/CAORbNRpYFTW3_JQapuWQr9zyQ6j%3D6rXH52iKeQ%3DhxJ2avB%3D60w%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .

---

<div class="post-metadata">

**Author:** ![Yannick\_Duchene](https://avatars.discourse-cdn.com/v4/letter/y/b77776/32.png) [@Yannick\_Duchene](https://discourse.ats-lang.org/u/Yannick_Duchene)\
**Post date:** [December 27, 2015, 10:57pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/6 "2015-12-27T22:57:07Z")

</div>

> You can set it as follows:
> 
> #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”

I have three related questions.

Are underscore formally allowed in path variable names? No path variable  
use any underscore in the distribution nor in contrib, so I wonder.

What explicitly if a variable is unknown? it is to be left as is or it is  
to be substituted an empty string?

Are substitutions to be recursive?

I know I could play with patscc to test, this is just that i prefer  
authoritative answers.

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 7:02pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/7 "2014-12-10T19:02:13Z")

</div>

You got it 🙂

Please change PATSHOME to PATSHOMERELOC.

In my setting, these two are the same.On Wednesday, December 10, 2014 1:53:46 PM UTC-5, Brandon Barker wrote:

> I think I may have spotted a problem but need to step out for a few  
> minutes:
> 
> “${INCLUDE} -IIATS ${PATSHOME}/contrib -I${JNIincl} -c Calculator.dats”  
> } // end of [Calculator\_dats\_o]
> 
> I think it should be reloc; do you have a symlink there to  
> ATS-contrib/contrib?
> 
> On Wed, Dec 10, 2014 at 1:44 PM, gmhwxi \<[gmh...@gmail.com](mailto:gmh...@gmail.com) \<javascript:\>\> wrote:
> 
> > I tried your source code and encountered no problems.
> > 
> > By the way, JNI\_targetloc is already defined in share/atspre\_define.hats:
> > 
> > [https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre\_define.hats](https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre_define.hats)
> > 
> > There is no need to define it again unless your new definition is  
> > different.
> > 
> > On Wednesday, December 10, 2014 1:29:51 PM UTC-5, gmhwxi wrote:
> > 
> > > If you can already generate \*\_dats.c, it means the following line worked:
> > > 
> > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > 
> > > On Wed, Dec 10, 2014 at 1:24 PM, Brandon Barker wrote:
> > > 
> > > > I tried this one too, but it seems to be the same (I have attached the  
> > > > file):
> > > > 
> > > > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > > > Gradle $ echo $JNI  
> > > > /home/brandon/ATS-Postiats-contrib/contrib/JNI  
> > > > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > > > Gradle $ patsopt -DATS JNI\_targetloc="${JNI}" -d Calculator.dats |  
> > > > grep JNI  
> > > > /home/brandon/ATS-Postiats-contrib/contrib/JNI/SATS/jni.sats:  
> > > > 249(line=15, offs=1) – 284(line=17, offs=3)  
> > > > #include “JNI/CATS/jni.cats”  
> > > > ATSdyncst\_mac(atscntrb\_JNI\_GetStringUTFChars)  
> > > > ATSdyncst\_mac(atscntrb\_JNI\_ReleaseStringUTFChars)  
> > > > ATSdyncst\_mac(atscntrb\_JNI\_RaiseExceptionByClassName)  
> > > > ATSINSflab(\_\_patsflab\_JNI\_eval):  
> > > > ATSINSmove(tmp960, atscntrb\_JNI\_GetStringUTFChars(arg0, arg2)) ;  
> > > > ATSINSmove\_void(tmp962, atscntrb\_JNI\_ReleaseStringUTFChars(arg0, arg2,  
> > > > tmp960)) ;  
> > > > ATSINSmove\_void(tmp964, atscntrb\_JNI\_RaiseExceptionByClassName(arg0,  
> > > > ATSPMVstring(“java/lang/IllegalArgumentException”), ATSPMVstring("  
> > > > ParsingError"))) ;
> > > > 
> > > > On Wednesday, December 10, 2014 12:57:22 PM UTC-5, gmhwxi wrote:
> > > > 
> > > > > You can also do it this way:
> > > > > 
> > > > > patsopt -DATS JNI\_targetloc="${JNI}" …
> > > > > 
> > > > > if you set JNI as an environment variable.
> > > > > 
> > > > > On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:
> > > > > 
> > > > > > Sorry if it has been asked before, I will try to update the  
> > > > > > approrpiate docs as needed. If you have something like:
> > > > > > 
> > > > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > > > 
> > > > > > How do you set $JNI? Environment variables seems to not be the answer.
> > > 
> > > –  
> > > 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](mailto:ats-lang...@googlegroups.com) \<javascript:\>.  
> > > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com)  
> > > \<javascript:\>.  
> > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> 
> –  
> Brandon Barker  
> [brand...@gmail.com](mailto:brand...@gmail.com) \<javascript:\>

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 28, 2015, 3:36am UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/8 "2015-12-28T03:36:56Z")

</div>

1. The character ‘\_’ can be used in path names
2. Say you use $FOO but FOO is not defined (or defined as a non-string),  
the $FOO changes to FOO.
3. Recursive substitution is not supported (it can be easily supported if  
needed).On Sunday, December 27, 2015 at 5:57:07 PM UTC-5, Yannick Duchêne wrote:

> Le mercredi 10 décembre 2014 18:33:37 UTC+1, gmhwxi a écrit :
> 
> > You can set it as follows:
> > 
> > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> 
> I have three related questions.
> 
> Are underscore formally allowed in path variable names? No path variable  
> use any underscore in the distribution nor in contrib, so I wonder.
> 
> What explicitly if a variable is unknown? it is to be left as is or it is  
> to be substituted an empty string?
> 
> Are substitutions to be recursive?
> 
> I know I could play with patscc to test, this is just that i prefer  
> authoritative answers.

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [January 19, 2015, 6:10pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/9 "2015-01-19T18:10:25Z")

</div>

I seem to be having a bit of trouble with this mechanism still. The #define  
works (commented out now), but the command line option shown below must not  
be quite right:

brand\_000@bbsurfacepro3 ~  
$ patscc -DATS UNSAFE\_targetloc=“/home/brand\_000/ATS-Postiats/prelude/SATS”  
hello.dats  
patsopt: error(0): the command-line argument  
[UNSAFE\_targetloc=/home/brand\_000/ATS-Postiats/prelude/SATS] cannot be  
properly parsed.  
exit(ATS): uncaught exception:  
\_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorExn(1025)

brand\_000@bbsurfacepro3 ~  
$ patscc -DATS  
UNSAFE\_targetloc="/home/brand\_000/ATS-Postiats/prelude/SATS" hello.dats  
patsopt: error(0): the command-line argument  
[UNSAFE\_targetloc=/home/brand\_000/ATS-Postiats/prelude/SATS] cannot be  
properly parsed.  
exit(ATS): uncaught exception:  
\_2home\_2brand\_000\_2ATS\_2dPostiats\_2src\_2pats\_error\_2esats\_\_FatalErrorExn(1025)

//#define UNSAFE\_targetloc “$PATSHOME/prelude/SATS”

staload UN = “{$UNSAFE}/unsafe.sats”

implement  
main0 () = {  
val x = $UN.cast2size(7)  
val () = println! (“{$UNSAFE}”)  
val () = println! (“Hello world!”) // English  
val () = println! x  
} (\* end of [main0] \*)On Wed, Dec 10, 2014 at 12:56 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:

> You can also do it this way
> 
> patsopt -DATS JNI\_targetloc="${JNI}" …
> 
> if you set JNI is as an environment variable.
> 
> On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:
> 
> > You can set it as follows:
> > 
> > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> > 
> > On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker wrote:
> > 
> > Sorry if it has been asked before, I will try to update the approrpiate
> > 
> > > docs as needed. If you have something like:
> > > 
> > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > 
> > > How do you set $JNI? Environment variables seems to not be the answer.
> > > 
> > > –  
> > > 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](mailto:ats-lang-user...@googlegroups.com).  
> > > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/7df46954-3f6f-48e4-999d-bf0c448f7f34%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .

Brandon Barker  
[brandon...@gmail.com](mailto:brandon...@gmail.com)

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 5:33pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/10 "2014-12-10T17:33:37Z")

</div>

You can set it as follows:

#define JNI\_targetloc "$PATSHOMERELOC/contrib/JNI"On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker [brandon...@gmail.com](mailto:brandon...@gmail.com) wrote:

> Sorry if it has been asked before, I will try to update the approrpiate  
> docs as needed. If you have something like:
> 
> staload JNI = “{$JNI}/SATS/jni.sats”
> 
> How do you set $JNI? Environment variables seems to not be the answer.
> 
> –  
> 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](mailto:ats-lang-user...@googlegroups.com).  
> To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> Visit this group at [http://groups.google.com/group/ats-lang-users](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/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com)  
> [https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [December 10, 2014, 6:24pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/11 "2014-12-10T18:24:30Z")

</div>

I tried this one too, but it seems to be the same (I have attached the  
file):

brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/Gradle  
$ echo $JNI  
/home/brandon/ATS-Postiats-contrib/contrib/JNI  
brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/Gradle  
$ patsopt -DATS JNI\_targetloc="${JNI}" -d Calculator.dats | grep JNI  
/home/brandon/ATS-Postiats-contrib/contrib/JNI/SATS/jni.sats: 249(line=15,  
offs=1) – 284(line=17, offs=3)  
#include “JNI/CATS/jni.cats”  
ATSdyncst\_mac(atscntrb\_JNI\_GetStringUTFChars)  
ATSdyncst\_mac(atscntrb\_JNI\_ReleaseStringUTFChars)  
ATSdyncst\_mac(atscntrb\_JNI\_RaiseExceptionByClassName)  
ATSINSflab(\_\_patsflab\_JNI\_eval):  
ATSINSmove(tmp960, atscntrb\_JNI\_GetStringUTFChars(arg0, arg2)) ;  
ATSINSmove\_void(tmp962, atscntrb\_JNI\_ReleaseStringUTFChars(arg0, arg2,  
tmp960)) ;  
ATSINSmove\_void(tmp964, atscntrb\_JNI\_RaiseExceptionByClassName(arg0,  
ATSPMVstring(“java/lang/IllegalArgumentException”), ATSPMVstring("  
ParsingError"))) ;On Wednesday, December 10, 2014 12:57:22 PM UTC-5, gmhwxi wrote:

> You can also do it this way:
> 
> patsopt -DATS JNI\_targetloc="${JNI}" …
> 
> if you set JNI as an environment variable.
> 
> On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:
> 
> > Sorry if it has been asked before, I will try to update the approrpiate  
> > docs as needed. If you have something like:
> > 
> > staload JNI = “{$JNI}/SATS/jni.sats”
> > 
> > How do you set $JNI? Environment variables seems to not be the answer.

[Calculator.dats](https://us1.discourse-cdn.com/flex019/uploads/ats_lang/original/1X/4cb601dff5cd46facb4b157e351d59b6cd9f6840.dats) (2.29 KB)

[Calculator\_dats.c](https://us1.discourse-cdn.com/flex019/uploads/ats_lang/original/1X/5b1063f63199d4471d6331630044957efd52b96f.c) (781 KB)

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 6:18pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/12 "2014-12-10T18:18:46Z")

</div>

If you paste your code here, then we should be able to find out.On Wednesday, December 10, 2014 1:12:24 PM UTC-5, Brandon Barker wrote:

> It seems to be correct in the environment:
> 
> echo $PATSHOMERELOC  
> /home/brandon/ATS-Postiats-contrib
> 
> On Wed, Dec 10, 2014 at 1:05 PM, gmhwxi \<[gmh...@gmail.com](mailto:gmh...@gmail.com) \<javascript:\>\> wrote:
> 
> > Maybe PATSHOMERELOC was not properly set.
> > 
> > On Wednesday, December 10, 2014 12:55:10 PM UTC-5, Brandon Barker wrote:
> > 
> > > I defined this in e.g Gradle/Calculator.dats (trying several  
> > > permutations of fulling expanding $PATSHOMERELOC and setting within %{^ %})  
> > > to no avail.
> > > 
> > > On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:
> > > 
> > > > You can set it as follows:
> > > > 
> > > > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> > > > 
> > > > On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker [brand...@gmail.com](mailto:brand...@gmail.com) wrote:
> > > > 
> > > > > Sorry if it has been asked before, I will try to update the  
> > > > > approrpiate docs as needed. If you have something like:
> > > > > 
> > > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > > 
> > > > > How do you set $JNI? Environment variables seems to not be the answer.
> > > > > 
> > > > > –  
> > > > > 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](mailto:ats-lang...@googlegroups.com).  
> > > > > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com).  
> > > > > Visit this group at [http://groups.google.com/group/ats-lang-users](http://groups.google.com/group/ats-lang-users).  
> > > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > > msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%  
> > > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > > [https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > > .
> > > > 
> > > > –  
> > > > 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](mailto:ats-lang...@googlegroups.com) \<javascript:\>.  
> > > > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com)  
> > > > \<javascript:\>.  
> > > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/ats-lang-users/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> 
> –  
> Brandon Barker  
> [brand...@gmail.com](mailto:brand...@gmail.com) \<javascript:\>

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 5:57pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/13 "2014-12-10T17:57:22Z")

</div>

You can also do it this way:

patsopt -DATS JNI\_targetloc="${JNI}" …

if you set JNI as an environment variable.On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:

> Sorry if it has been asked before, I will try to update the approrpiate  
> docs as needed. If you have something like:
> 
> staload JNI = “{$JNI}/SATS/jni.sats”
> 
> How do you set $JNI? Environment variables seems to not be the answer.

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 7:07pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/14 "2014-12-10T19:07:16Z")

</div>

FYI. I have fixed it in the Github.On Wednesday, December 10, 2014 2:02:13 PM UTC-5, gmhwxi wrote:

> You got it 🙂
> 
> Please change PATSHOME to PATSHOMERELOC.
> 
> In my setting, these two are the same.
> 
> On Wednesday, December 10, 2014 1:53:46 PM UTC-5, Brandon Barker wrote:
> 
> > I think I may have spotted a problem but need to step out for a few  
> > minutes:
> > 
> > “${INCLUDE} -IIATS ${PATSHOME}/contrib -I${JNIincl} -c Calculator.dats”  
> > } // end of [Calculator\_dats\_o]
> > 
> > I think it should be reloc; do you have a symlink there to  
> > ATS-contrib/contrib?
> > 
> > On Wed, Dec 10, 2014 at 1:44 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:
> > 
> > > I tried your source code and encountered no problems.
> > > 
> > > By the way, JNI\_targetloc is already defined in share/atspre\_define.hats:
> > > 
> > > [https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre\_define.hats](https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre_define.hats)
> > > 
> > > There is no need to define it again unless your new definition is  
> > > different.
> > > 
> > > On Wednesday, December 10, 2014 1:29:51 PM UTC-5, gmhwxi wrote:
> > > 
> > > > If you can already generate \*\_dats.c, it means the following line  
> > > > worked:
> > > > 
> > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > 
> > > > On Wed, Dec 10, 2014 at 1:24 PM, Brandon Barker wrote:
> > > > 
> > > > > I tried this one too, but it seems to be the same (I have attached the  
> > > > > file):
> > > > > 
> > > > > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > > > > Gradle $ echo $JNI  
> > > > > /home/brandon/ATS-Postiats-contrib/contrib/JNI  
> > > > > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > > > > Gradle $ patsopt -DATS JNI\_targetloc="${JNI}" -d Calculator.dats |  
> > > > > grep JNI  
> > > > > /home/brandon/ATS-Postiats-contrib/contrib/JNI/SATS/jni.sats:  
> > > > > 249(line=15, offs=1) – 284(line=17, offs=3)  
> > > > > #include “JNI/CATS/jni.cats”  
> > > > > ATSdyncst\_mac(atscntrb\_JNI\_GetStringUTFChars)  
> > > > > ATSdyncst\_mac(atscntrb\_JNI\_ReleaseStringUTFChars)  
> > > > > ATSdyncst\_mac(atscntrb\_JNI\_RaiseExceptionByClassName)  
> > > > > ATSINSflab(\_\_patsflab\_JNI\_eval):  
> > > > > ATSINSmove(tmp960, atscntrb\_JNI\_GetStringUTFChars(arg0, arg2)) ;  
> > > > > ATSINSmove\_void(tmp962, atscntrb\_JNI\_ReleaseStringUTFChars(arg0,  
> > > > > arg2, tmp960)) ;  
> > > > > ATSINSmove\_void(tmp964, atscntrb\_JNI\_RaiseExceptionByClassName(arg0,  
> > > > > ATSPMVstring(“java/lang/IllegalArgumentException”), ATSPMVstring("  
> > > > > ParsingError"))) ;
> > > > > 
> > > > > On Wednesday, December 10, 2014 12:57:22 PM UTC-5, gmhwxi wrote:
> > > > > 
> > > > > > You can also do it this way:
> > > > > > 
> > > > > > patsopt -DATS JNI\_targetloc="${JNI}" …
> > > > > > 
> > > > > > if you set JNI as an environment variable.
> > > > > > 
> > > > > > On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:
> > > > > > 
> > > > > > > Sorry if it has been asked before, I will try to update the  
> > > > > > > approrpiate docs as needed. If you have something like:
> > > > > > > 
> > > > > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > > > > 
> > > > > > > How do you set $JNI? Environment variables seems to not be the  
> > > > > > > answer.
> > > > 
> > > > –  
> > > > 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](mailto:ats-lang...@googlegroups.com).  
> > > > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com).  
> > > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > 
> > –  
> > Brandon Barker  
> > [brand...@gmail.com](mailto:brand...@gmail.com)

---

<div class="post-metadata">

**Author:** ![Yannick\_Duchene](https://avatars.discourse-cdn.com/v4/letter/y/b77776/32.png) [@Yannick\_Duchene](https://discourse.ats-lang.org/u/Yannick_Duchene)\
**Post date:** [December 28, 2015, 7:26am UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/15 "2015-12-28T07:26:43Z")

</div>

> 1. The character ‘\_’ can be used in path names

Path variable names, I assume.

> 1. Say you use $FOO but FOO is not defined (or defined as a non-string),  
> the $FOO changes to FOO.

Okay.

> 1. Recursive substitution is not supported (it can be easily supported if  
> needed).
> 
> That’s OK, not an issue. This is just for a tool which needs to be able  
> to locate file the same way Postiats do, and it was worth to ask for  
> documentation too.

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [December 10, 2014, 5:55pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/16 "2014-12-10T17:55:10Z")

</div>

I defined this in e.g Gradle/Calculator.dats (trying several permutations  
of fulling expanding $PATSHOMERELOC and setting within %{^ %}) to no avail.On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:

> You can set it as follows:
> 
> #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> 
> On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker \<[brand...@gmail.com](mailto:brand...@gmail.com) \<javascript:\>\> wrote:
> 
> > Sorry if it has been asked before, I will try to update the approrpiate  
> > docs as needed. If you have something like:
> > 
> > staload JNI = “{$JNI}/SATS/jni.sats”
> > 
> > How do you set $JNI? Environment variables seems to not be the answer.
> > 
> > –  
> > 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](mailto:ats-lang...@googlegroups.com) \<javascript:\>.  
> > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com)  
> > \<javascript:\>.  
> > Visit this group at [http://groups.google.com/group/ats-lang-users](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/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 29, 2015, 3:30pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/17 "2015-12-29T15:30:34Z")

</div>

I changed the implementation a bit to support recursive substitution;  
the maximal recursion depth is set to be 100.On Monday, December 28, 2015 at 2:26:44 AM UTC-5, Yannick Duchêne wrote:

> Le lundi 28 décembre 2015 04:36:57 UTC+1, gmhwxi a écrit :
> 
> > 1. The character ‘\_’ can be used in path names
> 
> Path variable names, I assume.
> 
> > 1. Say you use $FOO but FOO is not defined (or defined as a non-string),  
> > the $FOO changes to FOO.
> 
> Okay.
> 
> > 1. Recursive substitution is not supported (it can be easily supported if  
> > needed).
> > 
> > That’s OK, not an issue. This is just for a tool which needs to be able  
> > to locate file the same way Postiats do, and it was worth to ask for  
> > documentation too.

---

<div class="post-metadata">

**Author:** ![gmhwxi](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gmhwxi](https://discourse.ats-lang.org/u/gmhwxi)\
**Post date:** [December 10, 2014, 6:05pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/18 "2014-12-10T18:05:19Z")

</div>

Maybe PATSHOMERELOC was not properly set.On Wednesday, December 10, 2014 12:55:10 PM UTC-5, Brandon Barker wrote:

> I defined this in e.g Gradle/Calculator.dats (trying several permutations  
> of fulling expanding $PATSHOMERELOC and setting within %{^ %}) to no avail.
> 
> On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:
> 
> > You can set it as follows:
> > 
> > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> > 
> > On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker [brand...@gmail.com](mailto:brand...@gmail.com) wrote:
> > 
> > > Sorry if it has been asked before, I will try to update the approrpiate  
> > > docs as needed. If you have something like:
> > > 
> > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > 
> > > How do you set $JNI? Environment variables seems to not be the answer.
> > > 
> > > –  
> > > 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](mailto:ats-lang...@googlegroups.com).  
> > > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com).  
> > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [December 10, 2014, 6:12pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/19 "2014-12-10T18:12:03Z")

</div>

It seems to be correct in the environment:

echo $PATSHOMERELOC  
/home/brandon/ATS-Postiats-contribOn Wed, Dec 10, 2014 at 1:05 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:

> Maybe PATSHOMERELOC was not properly set.
> 
> On Wednesday, December 10, 2014 12:55:10 PM UTC-5, Brandon Barker wrote:
> 
> > I defined this in e.g Gradle/Calculator.dats (trying several permutations  
> > of fulling expanding $PATSHOMERELOC and setting within %{^ %}) to no avail.
> > 
> > On Wednesday, December 10, 2014 12:33:37 PM UTC-5, gmhwxi wrote:
> > 
> > > You can set it as follows:
> > > 
> > > #define JNI\_targetloc “$PATSHOMERELOC/contrib/JNI”
> > > 
> > > On Wed, Dec 10, 2014 at 12:19 PM, Brandon Barker [brand...@gmail.com](mailto:brand...@gmail.com) wrote:
> > > 
> > > > Sorry if it has been asked before, I will try to update the approrpiate  
> > > > docs as needed. If you have something like:
> > > > 
> > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > 
> > > > How do you set $JNI? Environment variables seems to not be the answer.
> > > > 
> > > > –  
> > > > 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](mailto:ats-lang...@googlegroups.com).  
> > > > To post to this group, send email to [ats-l...@googlegroups.com](mailto:ats-l...@googlegroups.com).  
> > > > Visit this group at [http://groups.google.com/group/ats-lang-users](http://groups.google.com/group/ats-lang-users).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/10bef205-098c-48c0-85ba-f07b0ab6f76b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .
> > > 
> > > –  
> > > 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](mailto:ats-lang-user...@googlegroups.com).  
> > > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > > Visit this group at [http://groups.google.com/group/ats-lang-users](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/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/ats-lang-users/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/70ed9a31-c0db-43d4-b217-e6dbff5b2824%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .

Brandon Barker  
[brandon...@gmail.com](mailto:brandon...@gmail.com)

---

<div class="post-metadata">

**Author:** ![Brandon\_Barker](https://sea1.discourse-cdn.com/flex019/user_avatar/discourse.ats-lang.org/brandon_barker/32/61_2.png) [@Brandon\_Barker](https://discourse.ats-lang.org/u/Brandon_Barker)\
**Post date:** [December 10, 2014, 6:53pm UTC](https://discourse.ats-lang.org/t/variables-in-load-paths/814/20 "2014-12-10T18:53:26Z")

</div>

I think I may have spotted a problem but need to step out for a few minutes:

“${INCLUDE} -IIATS ${PATSHOME}/contrib -I${JNIincl} -c Calculator.dats”  
} // end of [Calculator\_dats\_o]

I think it should be reloc; do you have a symlink there to  
ATS-contrib/contrib?On Wed, Dec 10, 2014 at 1:44 PM, gmhwxi [gmh...@gmail.com](mailto:gmh...@gmail.com) wrote:

> I tried your source code and encountered no problems.
> 
> By the way, JNI\_targetloc is already defined in share/atspre\_define.hats:
> 
> [https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre\_define.hats](https://github.com/githwxi/ATS-Postiats/blob/master/share/atspre_define.hats)
> 
> There is no need to define it again unless your new definition is  
> different.
> 
> On Wednesday, December 10, 2014 1:29:51 PM UTC-5, gmhwxi wrote:
> 
> > If you can already generate \*\_dats.c, it means the following line worked:
> > 
> > staload JNI = “{$JNI}/SATS/jni.sats”
> > 
> > On Wed, Dec 10, 2014 at 1:24 PM, Brandon Barker wrote:
> > 
> > > I tried this one too, but it seems to be the same (I have attached the  
> > > file):
> > > 
> > > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > > Gradle $ echo $JNI  
> > > /home/brandon/ATS-Postiats-contrib/contrib/JNI  
> > > brandon@brandon-OEM ~/ATS-Postiats-contrib/projects/SMALL/Calculator/  
> > > Gradle $ patsopt -DATS JNI\_targetloc="${JNI}" -d Calculator.dats |  
> > > grep JNI  
> > > /home/brandon/ATS-Postiats-contrib/contrib/JNI/SATS/jni.sats:  
> > > 249(line=15, offs=1) – 284(line=17, offs=3)  
> > > #include “JNI/CATS/jni.cats”  
> > > ATSdyncst\_mac(atscntrb\_JNI\_GetStringUTFChars)  
> > > ATSdyncst\_mac(atscntrb\_JNI\_ReleaseStringUTFChars)  
> > > ATSdyncst\_mac(atscntrb\_JNI\_RaiseExceptionByClassName)  
> > > ATSINSflab(\_\_patsflab\_JNI\_eval):  
> > > ATSINSmove(tmp960, atscntrb\_JNI\_GetStringUTFChars(arg0, arg2)) ;  
> > > ATSINSmove\_void(tmp962, atscntrb\_JNI\_ReleaseStringUTFChars(arg0, arg2,  
> > > tmp960)) ;  
> > > ATSINSmove\_void(tmp964, atscntrb\_JNI\_RaiseExceptionByClassName(arg0,  
> > > ATSPMVstring(“java/lang/IllegalArgumentException”), ATSPMVstring("  
> > > ParsingError"))) ;
> > > 
> > > On Wednesday, December 10, 2014 12:57:22 PM UTC-5, gmhwxi wrote:
> > > 
> > > > You can also do it this way:
> > > > 
> > > > patsopt -DATS JNI\_targetloc="${JNI}" …
> > > > 
> > > > if you set JNI as an environment variable.
> > > > 
> > > > On Wednesday, December 10, 2014 12:19:00 PM UTC-5, Brandon Barker wrote:
> > > > 
> > > > > Sorry if it has been asked before, I will try to update the  
> > > > > approrpiate docs as needed. If you have something like:
> > > > > 
> > > > > staload JNI = “{$JNI}/SATS/jni.sats”
> > > > > 
> > > > > How do you set $JNI? Environment variables seems to not be the answer.
> > 
> > –  
> > 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](mailto:ats-lang-user...@googlegroups.com).  
> > To post to this group, send email to [ats-lan...@googlegroups.com](mailto:ats-lan...@googlegroups.com).  
> > Visit this group at [http://groups.google.com/group/ats-lang-users](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/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com](https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/ats-lang-users/e7fbc06e-c597-4f42-b473-acc81e664371%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .

Brandon Barker  
[brandon...@gmail.com](mailto:brandon...@gmail.com)

[Next page](https://discourse.ats-lang.org/t/variables-in-load-paths/814.md?page=2)
