Compiling NetRexx-sources with NetRexx ?

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher
Maybe a question that can be answered quickly by the ones in the know: is it possible to use NetRexx
to compile NetRexx code? If so, which class, which method, or even better: is there a sample somewhere?

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Jason Martin
NetRexx is https://urldefense.proofpoint.com/v2/url?u=https-3A__en.wikipedia.org_wiki_Self-2Dhosting&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=4Pe1bqKVMhpzvXDP1uC2o6iEhs1VPZh6kVBcSqf1yBI&s=En3uimm7WXCQDGET5To1oRtyz--tJJcb99ndh05TAsU&e=

Look at the ant build.xml to see how it all goes together.

You could also do java -jar NetRexxC.jar list_of_needed_files_per_needed_dir
 and put it all together without ant

On 2/25/18, Rony G. Flatscher <[hidden email]> wrote:

> Maybe a question that can be answered quickly by the ones in the know: is it
> possible to use NetRexx
> to compile NetRexx code? If so, which class, which method, or even better:
> is there a sample somewhere?
>
> ---rony
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIBaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=4Pe1bqKVMhpzvXDP1uC2o6iEhs1VPZh6kVBcSqf1yBI&s=Q5Mmi0qJF9Ko9pztyT6XntsSc9Dw_b4nr2bZkyUjtOc&e=
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Mike Cowlishaw
In reply to this post by Rony G. Flatscher
 
> Maybe a question that can be answered quickly by the ones in
> the know: is it possible to use NetRexx to compile NetRexx
> code? If so, which class, which method, or even better: is
> there a sample somewhere?

The NetRexx compiler is written in NetRexx, if that's what you're asking.

Mike

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher
On 26.02.2018 10:30, Mike Cowlishaw wrote:
>  
>> Maybe a question that can be answered quickly by the ones in
>> the know: is it possible to use NetRexx to compile NetRexx
>> code? If so, which class, which method, or even better: is
>> there a sample somewhere?
> The NetRexx compiler is written in NetRexx, if that's what you're asking.
Yes, I am aware of that, which BTW I think is cool! :)

Probably my question was not so clear after all.

Given a String of NetRexx source code at runtime, is there a way to have a running
NetRexx/Java/BSF4ooRexx application supply that NetRexx source code to NetRexx and receive a
compiled class back from it that one can interact with and use to instantiate instances? If so,
which NetRexx class and which method would have to be used for that?

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

rvjansen
Hi Rony,

yes, and documented in Programmers’s Guide if I am not mistaken.
Used to be only from a file, but since a number of years also from a memory buffer.

best regards,

René.


> On 26 Feb 2018, at 07:34, Rony G. Flatscher <[hidden email]> wrote:
>
> On 26.02.2018 10:30, Mike Cowlishaw wrote:
>>
>>> Maybe a question that can be answered quickly by the ones in
>>> the know: is it possible to use NetRexx to compile NetRexx
>>> code? If so, which class, which method, or even better: is
>>> there a sample somewhere?
>> The NetRexx compiler is written in NetRexx, if that's what you're asking.
> Yes, I am aware of that, which BTW I think is cool! :)
>
> Probably my question was not so clear after all.
>
> Given a String of NetRexx source code at runtime, is there a way to have a running
> NetRexx/Java/BSF4ooRexx application supply that NetRexx source code to NetRexx and receive a
> compiled class back from it that one can interact with and use to instantiate instances? If so,
> which NetRexx class and which method would have to be used for that?
>
> ---rony
>
>
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=WMQr_5RKPVBP1rL3OY1mXez0i7KqO3GrAoCMIDWTsJ0&s=iNByMaGUk9LbkeNPhNN1MRgXo_VnhDHCYAGX2pCneE0&e=
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

rvjansen
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)


On 26 Feb 2018, at 09:30, René Jansen <[hidden email]> wrote:

Hi Rony,

yes, and documented in Programmers’s Guide if I am not mistaken.
Used to be only from a file, but since a number of years also from a memory buffer.

best regards,

René.


On 26 Feb 2018, at 07:34, Rony G. Flatscher <[hidden email]> wrote:

On 26.02.2018 10:30, Mike Cowlishaw wrote:

Maybe a question that can be answered quickly by the ones in 
the know: is it possible to use NetRexx to compile NetRexx 
code? If so, which class, which method, or even better: is 
there a sample somewhere?
The NetRexx compiler is written in NetRexx, if that's what you're asking.
Yes, I am aware of that, which BTW I think is cool! :)

Probably my question was not so clear after all.

Given a String of NetRexx source code at runtime, is there a way to have a running
NetRexx/Java/BSF4ooRexx application supply that NetRexx source code to NetRexx and receive a
compiled class back from it that one can interact with and use to instantiate instances? If so,
which NetRexx class and which method would have to be used for that?

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : https://urldefense.proofpoint.com/v2/url?u=http-3A__ibm-2Dnetrexx.215625.n3.nabble.com_&d=DwIFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=_6rXNpPJ1fYV-3bV1za02NiR4PUelvicfHXwtnTXpXE&m=WMQr_5RKPVBP1rL3OY1mXez0i7KqO3GrAoCMIDWTsJ0&s=iNByMaGUk9LbkeNPhNN1MRgXo_VnhDHCYAGX2pCneE0&e=


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
> import org.netrexx.
>
> /* NetRexx compile from string example  */
>
> programstring = "say 'hello there via NetRexxC'"
>
> NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher
Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

ThSITC

Rony,

for getting the Java source code in a file You shall have to use nrc option -saveasjava

never tried the incore compile with the API's Rene did mention, sorry.

Kindly,

Thomas Schneider.

====================================================================


Am 06.03.2018 um 18:52 schrieb Rony G. Flatscher:
Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



Virus-free. www.avg.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

ThSITC

sorry, i think the correct nrc option is -keepasjava ...

did now not use netrexx for a while, and alzheimer is progressing ;-)

Thomas.



Am 06.03.2018 um 19:14 schrieb Thomas Schneider:

Rony,

for getting the Java source code in a file You shall have to use nrc option -saveasjava

never tried the incore compile with the API's Rene did mention, sorry.

Kindly,

Thomas Schneider.

====================================================================


Am 06.03.2018 um 18:52 schrieb Rony G. Flatscher:
Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



Virus-free. www.avg.com


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

rvjansen
In reply to this post by Rony G. Flatscher
NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Mike Cowlishaw
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.


From: [hidden email] [mailto:[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher
On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Mike Cowlishaw
I guess I don't understand the question, then.  It's hard to anything without "the" file system.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Rony G. Flatscher
Sent: 07 March 2018 11:43
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher

On 07.03.2018 20:21, Mike Cowlishaw wrote:
I guess I don't understand the question, then.  It's hard to anything without "the" file system.
The idea is to not have NetRexx programs stored in the file system, but in ::RESOURCE section in the new ooRexx 5.0 and compile them from there and denote a class that should then be loaded and returned from that compilation.

This is possible with various compilers for "pure" Java code, e.g. Janino (cf. <http://janino-compiler.github.io/janino/>), which is used currently by BSF4ooRexx. The example that starts this thread demonstrates what will be possible with it (compiling the source code and using the Java class as if it was an ooRexx class and interact with it immediately).

I would like to allow the same with NetRexx code: supply a String, get it compiled, and get the denoted class object returned [the first argument to bsf.compile() is the fully qualified class name to be returned from the code (using whatever ClassLoader needs to be used after compilation) that gets compiled off the second argument, which is a string or an array of strings]. As plain Java code can be compiled already with "bsf.compile(className,sourceCode)", getting a Java representation (source code) from the supplied NetRexx source code with the help of NetRexx would also allow for such a feature.

---rony





From: [hidden email] [[hidden email]] On Behalf Of Rony G. Flatscher
Sent: 07 March 2018 11:43
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

rvjansen
In reply to this post by Mike Cowlishaw
I think I do understand where Rony wants to go:

1) No clutter left on the file system
2) ‘on the fly’ work - see lambda’s etc - going to the file system would incur an extra pathlength of multiple K’s of instructions
3) threading issues and file system locks with parallel processes - you could have 50 threads running that all want to read/write the same class on disk
4) you might have a remote compiler and want the serialized class over TCP/IP 
5) you might want to store class files in a database instead of a file system, like SAP or Visualage does (did) 

best regards,

René.


On 7 Mar 2018, at 15:21, Mike Cowlishaw <[hidden email]> wrote:

I guess I don't understand the question, then.  It's hard to anything without "the" file system.


From: [hidden email] [[hidden email]] On Behalf Of Rony G. Flatscher
Sent: 07 March 2018 11:43
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Rony G. Flatscher

On 07.03.2018 20:36, René Jansen wrote:
I think I do understand where Rony wants to go:

1) No clutter left on the file system
2) ‘on the fly’ work - see lambda’s etc - going to the file system would incur an extra pathlength of multiple K’s of instructions
3) threading issues and file system locks with parallel processes - you could have 50 threads running that all want to read/write the same class on disk
4) you might have a remote compiler and want the serialized class over TCP/IP 
5) you might want to store class files in a database instead of a file system, like SAP or Visualage does (did)

Indeed # 2) was the main motivation for the new "bsf.compile()" in the upcoming version of BSF4ooRexx: starting with Java 8 lambdas get used all over the places, even in corners where lambdas would not help. It seems that no matter whether it makes sense, lambdas get used by some anyways. It is conceivable therefore that applications may use tons of lambda invocations (with simple functions to be supplied by the programmers) which incurs performance penalties (if running in the ten- or hundred-thousands of invocations) for an interpreted language.

Having the simple lambda functions implemented in NetRexx should be possible for any Rexx programmer with a little background info. Such NetRexx code would allow to be compiled then to Java bytecode and supplied as the lambda function executing in (just-in-time) compiled speed. One could code multiple functions in NetRexx that should be applied to the streams of (collected) objects and still be able to compile and take advantage of it at runtime from ooRexx.

---rony



On 7 Mar 2018, at 15:21, Mike Cowlishaw <[hidden email]> wrote:

I guess I don't understand the question, then.  It's hard to anything without "the" file system.


From: [hidden email] [[hidden email]] On Behalf Of Rony G. Flatscher
Sent: 07 March 2018 11:43
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony


_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Mike Cowlishaw
In reply to this post by rvjansen
Clutter isn't an issue if using a RAM disk .. you just delete (unmount) it when done.   But yes, strings should be faster.
 
For some reason I thought that NetRexx could already do something like this, but I may be thinking of something else (I know my Wiki2HTML program does, for example).
 
Mike


From: [hidden email] [mailto:[hidden email]] On Behalf Of René Jansen
Sent: 07 March 2018 19:36
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

I think I do understand where Rony wants to go:

1) No clutter left on the file system
2) ‘on the fly’ work - see lambda’s etc - going to the file system would incur an extra pathlength of multiple K’s of instructions
3) threading issues and file system locks with parallel processes - you could have 50 threads running that all want to read/write the same class on disk
4) you might have a remote compiler and want the serialized class over TCP/IP 
5) you might want to store class files in a database instead of a file system, like SAP or Visualage does (did) 

best regards,

René.


On 7 Mar 2018, at 15:21, Mike Cowlishaw <[hidden email]> wrote:

I guess I don't understand the question, then.  It's hard to anything without "the" file system.


From: [hidden email] [[hidden email]] On Behalf Of Rony G. Flatscher
Sent: 07 March 2018 11:43
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

ThSITC

This message is for Rene Vincent Jansen:

I thought that Kermit Kiser did already implement an API to Generate the Java Code to a string !

AND TO COMPILE IT FROM THERE !

IS THAT NOT WORKING ?

THOMAS:

================================================================================


Am 08.03.2018 um 08:33 schrieb Mike Cowlishaw:
Clutter isn't an issue if using a RAM disk .. you just delete (unmount) it when done.   But yes, strings should be faster.
 
For some reason I thought that NetRexx could already do something like this, but I may be thinking of something else (I know my Wiki2HTML program does, for example).
 
Mike


From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 07 March 2018 19:36
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

I think I do understand where Rony wants to go:

1) No clutter left on the file system
2) ‘on the fly’ work - see lambda’s etc - going to the file system would incur an extra pathlength of multiple K’s of instructions
3) threading issues and file system locks with parallel processes - you could have 50 threads running that all want to read/write the same class on disk
4) you might have a remote compiler and want the serialized class over TCP/IP 
5) you might want to store class files in a database instead of a file system, like SAP or Visualage does (did) 

best regards,

René.


On 7 Mar 2018, at 15:21, Mike Cowlishaw <[hidden email]> wrote:

I guess I don't understand the question, then.  It's hard to anything without "the" file system.


From: [hidden email] [[hidden email]] On Behalf Of Rony G. Flatscher
Sent: 07 March 2018 11:43
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

On 06.03.2018 20:31, Mike Cowlishaw wrote:
Memory a bit fuzzy about this, but I rememember doing tests to virtual files/disks and they were only slightly slower than strings in memory.
It is not about speed in this case, but the ability to do (cross-)compilation without a need for storing anything in the file system.
(For that reason I have used asm in the past and then lately Janino for creating Java classes on-the-fly.)

---rony




From: [hidden email] [[hidden email]] On Behalf Of René Jansen
Sent: 06 March 2018 18:35
To: IBM Netrexx
Subject: Re: [Ibm-netrexx] Compiling NetRexx-sources with NetRexx ?

NetRexx always has been file-oriented; the from-memory-string-compilation was bolted on afterwards. I have noted it down as a requirement (as long as the issue tracker is still not operational). 

Note that for compilation, a Java compiler (javac, ecj) always produces the class file. NetRexx produces a (stub-)class file for interpretation of source, but you would not want to use that for anything.


The Java sourcecode is currently also written to a FilesStreamer object - you would have to do something analogues to capture that to memory and compile it from memory in turn.

best regards,

René.

On 6 Mar 2018, at 13:52, Rony G. Flatscher <[hidden email]> wrote:

Went through the source code and have not found a method that would return the compiled class object. These are the methods that I found that return a Class object:
process/NetRexxA.nrx:  method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/NetRexxInterpreter.nrx:   method getClassObject(pack=String, name=String, dim=int 0) returns Class
process/RxClassInfo.nrx: method getClassObject(loader=ClassLoader null) returns Class
process/RxMapClassLoader.nrx:     method findClass(name=String) signals ClassNotFoundException returns Class
process/RxType.nrx: method getClassObject(loader=ClassLoader null) returns Class
So it seems that there is no in-memory only compilation currently, returning a denoted (supplying the fully qualified Java class name) class object from that compilation unit?

How about a method that would translate the NetRexx source code to the Java source code, which one could fetch without going through the local filesystem?

---

What I would be interested in is to supply NetRexx source code and either get the denoted compiled class object back or, alternatively, the Java source code (which I could compile myself).

Here is an example which is written for the next (upcoming) version of BSF4ooRexx using ooRexx 5.0's resource directive to store the Java source code. The ooRexx program will fetch the source code compile it (supplying the fully qualified class name, "rony.Oha", to return) and then take advantage of the Java class object invoking methods, creating an instance, invoking the static main() method:
#!/usr/bin/env rexx
parse version "_" v "."
if v<5 then
do
   say "this program needs ooRexx 5.0 or later, aborting"
   exit -1
end
   -- compile a Java program and fetch the returned Java class object
clz=bsf.compile("rony.Oha", .resources~oha.java)
say 'clz~oha("aha"):' pp(clz~oha("abc"))  -- use the static method "oha" from Rexx
say "-"~copies(60)

o=clz~new            -- create an instance of the Java object
say 'o=clz~new     :' pp(o)
say "o~oha('zyx')  :" pp(o~oha('zyx'))     -- invoke the instance method
say "o~myInfo      :" pp(o~myInfo)  -- invoke the instance method
say "-"~copies(60)

say "now invoking the main method from ooRexx:"
args=.bsf~bsf.createArrayOf("java.lang.String", "Hello", "from", "ooRexx!")
o~main(args)         -- now invoke the Java class' main() method


::requires "BSF.CLS" -- get Java support

   -- source of a Java program, defining the class "rony.Oha" with three methods
   -- - the static method "main" and
   -- - the static method "oha" and
   -- - the instance method "myInfo"
::RESOURCE Oha.java  -- source code of a Java class with a static method o()

   package rony;
   import  java.util.Arrays;

   public class Oha {

       public static void main (String args[])
       {
           System.out.println("rony.Oha.main(), received arguments: "+Arrays.deepToString(args));
       }

       public static String oha(String str) // Java static method
       {
           return "oha->"+str+"<-oha";
       }

       public String myInfo()             // Java instance method
       {
           return "oha///"+this+"\\\\\\oha";
       }
   }
::END
Running this program yields:
clz~oha("aha"): [oha->abc<-oha]
------------------------------------------------------------
o=clz~new     : [rony.Oha@69a3d1d]
o~oha('zyx')  : [oha->zyx<-oha]
o~myInfo      : [oha///rony.Oha@69a3d1d\\\oha]
------------------------------------------------------------
now invoking the main method from ooRexx:
rony.Oha.main(), received arguments: [Hello, from, ooRexx!]]
I would like to be able to do the same with NetRexx source code, which for Rexx programmers is much more appropriate.

More about this at this year's Rexx symposium's workshop at the end of this month.

---rony



On 26.02.2018 15:20, Rony G. Flatscher wrote:
Dear René,

On 26.02.2018 14:36, René Jansen wrote:
import org.netrexx.

/* NetRexx compile from string example  */

programstring = "say 'hello there via NetRexxC'"

NetRexxC.main("myprogram",programstring)
super, thank you *very* much!

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/




_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



Virus-free. www.avg.com

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Compiling NetRexx-sources with NetRexx ?

Hugh Sweeney
On 8 March 2018 at 08:25, Thomas Schneider <[hidden email]> wrote:

This message is for Rene Vincent Jansen:

I thought that Kermit Kiser did already implement an API to Generate the Java Code to a string !

AND TO COMPILE IT FROM THERE !

IS THAT NOT WORKING ?

THOMAS:


That sounds like this one http://ibm-netrexx.215625.n3.nabble.com/NetRexx-JSR199-Compiler-API-support-td4027407.html
Hugh
--

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

12