Re: Setting environment variables

Alan Ruttenberg <[email protected]> Tue, 2 May 2023 15:16:52 -0400
Newsgroups gmane.editors.j.devel
Message-ID <CAFKQJ8=+uturOzRMv9uRDVzFs+RO7YKcnV587WM+mnu64DS=qw@mail.gmail.com>
--000000000000d31a5405fabac960
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, May 2, 2023 at 2:37=E2=80=AFAM Mark Evenson <[email protected]> wro=
te:

>
> A patch for ABCL to add this would be appreciated, but the implementation
> should somehow be changed to the =E2=80=9Cstandard=E2=80=9D load for JNA =
by the ABCL-ASDF
> contrib, namely something like
>
>    (require :abcl-contrib)
>    (asdf:make :jna)
>
>
> As I understand it, Alan=E2=80=99s implementation only works if ABCL-ASDF=
:RESOLVE
> is present, meaning it cannot be put =E2=80=9Cas is=E2=80=9D in the base =
ABCL system.  I
> believe this is possible because the OWL2 application uses the ABCL-AIO
> build of ABCL which merges abcl.jar which abcl-contrib.jar, but I could b=
e
> wrong.


It's true that I use aio. TBH I've never understood the point of separating
the contribs from the base. File size isn't an issue any more. What's the
upside of splitting them apart? A bit of extra time indexing the classes in
the jar?

Conceptually, we should somehow place the implementation of setting
> environment variables via the C syscall as a patch in the contrib system =
in
> a new contrib called (?) USE-POSIX-SYSCALLS (terrible name, please
> change).  Such a new contrib would a) depend on
>  JNA and b) have to be used via
>
>    (asdf:make :use-posix-syscalls)
>

I don't know what asdf:make does. I tried it in a situation (autoloading
the java parser when #1 was used the first time) where I expected it to
load a system and it didn't seem to.

Would it be sufficient to do something like:

(defun ensure-jna-loaded ()
  (or *jna-loaded*
      (progn
        (when (not (ignore-errors (find-java-class 'jna.nativelibrary)))
          (require 'abcl-asdf)
          (add-to-classpath (funcall (intern "RESOLVE" 'abcl-asdf
"net.java.dev.jna/jna/LATEST")))
          (setq *jna-loaded* t)))))

This is assuming that abcl-contrib is available. Since I've never used
contrib separately, I'm not sure what the standard pattern is for using
something in contrib if it's not on the classpath.
Mind you find-java-class is also part of jss, which is a contrib, which I
always load...

Bottom line is that I don't know how to package this under whatever the
assumptions are when not using abcl-aio

Alan



>
>
>
> --
> "A screaming comes across the sky.  It has happened before but there is
> nothing
> to compare to it now."
>
>
>
>
>
>

--000000000000d31a5405fabac960
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Tue, May 2, 2023 at 2:37=E2=80=AFA=
M Mark Evenson &lt;<a href=3D"mailto:[email protected]">[email protected]</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><b=
r>
A patch for ABCL to add this would be appreciated, but the implementation s=
hould somehow be changed to the =E2=80=9Cstandard=E2=80=9D load for JNA by =
the ABCL-ASDF contrib, namely something like <br>
<br>
=C2=A0 =C2=A0(require :abcl-contrib)<br>
=C2=A0 =C2=A0(asdf:make :jna)<br>
<br>
<br>
As I understand it, Alan=E2=80=99s implementation only works if ABCL-ASDF:R=
ESOLVE is present, meaning it cannot be put =E2=80=9Cas is=E2=80=9D in the =
base ABCL system.=C2=A0 I believe this is possible because the OWL2 applica=
tion uses the ABCL-AIO build of ABCL which merges abcl.jar which abcl-contr=
ib.jar, but I could be wrong.=C2=A0 </blockquote><div><br></div><div>It&#39=
;s true that I use aio. TBH I&#39;ve never understood the point of separati=
ng the contribs from the base. File size isn&#39;t an issue any more. What&=
#39;s the upside of splitting them apart? A bit of extra time indexing the =
classes in the jar?<br></div><div> <br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204=
);padding-left:1ex">Conceptually, we should somehow place the implementatio=
n of setting environment variables via the C syscall as a patch in the cont=
rib system in a new contrib called (?) USE-POSIX-SYSCALLS (terrible name, p=
lease change).=C2=A0 Such a new contrib would a) depend on <br>
=C2=A0JNA and b) have to be used via <br>
<br>
=C2=A0 =C2=A0(asdf:make :use-posix-syscalls)<br></blockquote><div><br></div=
><div>I don&#39;t know what asdf:make does. I tried it in a situation (auto=
loading the java parser when #1 was used the first time) where I expected i=
t to load a system and it didn&#39;t seem to. <br></div><div><br></div><div=
>Would it be sufficient to do something like:</div><div><br></div><span sty=
le=3D"font-family:monospace">(defun ensure-jna-loaded ()<br>=C2=A0 (or *jna=
-loaded*<br>=C2=A0 =C2=A0 =C2=A0 (progn<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (whe=
n (not (ignore-errors (find-java-class &#39;jna.nativelibrary)))<br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (require &#39;abcl-asdf)<br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (add-to-classpath (funcall (intern &quot;RESOLVE&quot; &#=
39;abcl-asdf &quot;net.java.dev.jna/jna/LATEST&quot;)))<br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 (setq *jna-loaded* t)))))</span></div><div class=3D"gm=
ail_quote"><span style=3D"font-family:monospace"><br></span></div><div clas=
s=3D"gmail_quote"><span style=3D"font-family:arial,sans-serif"><font size=
=3D"2">This is assuming that abcl-contrib is available. Since I&#39;ve neve=
r used contrib separately, I&#39;m not sure what the standard pattern is fo=
r using something in contrib if it&#39;s not on the classpath.</font></span=
></div><div class=3D"gmail_quote"><span style=3D"font-family:arial,sans-ser=
if"><font size=3D"2">Mind you find-java-class is also part of jss, which is=
 a contrib, which I always load...</font></span></div><div class=3D"gmail_q=
uote"><span style=3D"font-family:arial,sans-serif"><font size=3D"2"><br></f=
ont></span></div><div class=3D"gmail_quote"><font size=3D"2">Bottom line is=
 that I don&#39;t know how to package this under whatever the assumptions a=
re when not using abcl-aio</font></div><div class=3D"gmail_quote"><font siz=
e=3D"2"><br></font></div><div class=3D"gmail_quote"><font size=3D"2">Alan</=
font><br></div><div class=3D"gmail_quote"><div><br></div><div><br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
<br>
<br>
-- <br>
&quot;A screaming comes across the sky.=C2=A0 It has happened before but th=
ere is nothing <br>
to compare to it now.&quot;<br>
<br>
<br>
<br>
<br>
<br>
</blockquote></div></div>

--000000000000d31a5405fabac960--