[Info-vax] Most popular application programming languages on VMS ?

Arne Vajhøj arne at vajhoej.dk
Thu Jan 10 20:22:38 EST 2019


On 1/10/2019 9:53 AM, Kevin Monceaux wrote:
> On Thu, Jan 10, 2019 at 02:19:57AM -0000, Simon Clubley via Info-vax wrote:
>> Can Perl or PHP be directly integrated into an application in the
>> same way as Python can ?
>>
>> https://docs.python.org/2/extending/embedding.html
> 
> I haven't tried it with Perl, but from the documentation it looks like
> it can be:
> 
>      https://PerlDoc.Perl.org/perlembed.html
> 
> I only use PHP occasionally, and have never tried to embed it either.
> One Bing search result recommended the book Extending and Embedding
> PHP.

In the J world we got the JSR 223 standard for interface to
script engines.

Pretty nifty.

$ java -version
java version "1.8.0.11-OpenVMS"
Java(TM) SE Runtime Environment (build 1.8.0.11-vms-b1)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b1, mixed mode)
$ type Scripting.java
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import javax.script.ScriptException;

public class Scripting {
     public static void test(String language, String source) throws 
ScriptException {
         System.out.println(language);
         System.out.print(source);
         ScriptEngineManager sem = new ScriptEngineManager();
         ScriptEngine se = sem.getEngineByName(language);
         if(se != null) {
             se.eval(source);
         } else {
             System.out.printf("%s language not available\n", language);
         }
     }
     public static void main(String[] args) throws ScriptException {
         test("javascript",
              "for(i = 0; i < 3; i++) {\r\n" +
              "    print(\"Hi from JavaScript\");\r\n" +
              "}\r\n");
         test("python",
              "for i in range(3):\r\n" +
              "    print('Hi from Python')\r\n");
         test("php",
              "<?php\r\n" +
              "for($i = 0; $i < 3; $i++) {\r\n" +
              "    echo \"Hi from PHP\\r\\n\";\r\n" +
              "}\r\n" +
              "?>\r\n");
     }
}
$ javac Scripting.java
$ java -cp .:quercus.jar:jython-standalone-2_7_1.jar Scripting
javascript
for(i = 0; i < 3; i++) {
     print("Hi from JavaScript");
}
Hi from JavaScript
Hi from JavaScript
Hi from JavaScript
python
for i in range(3):
     print('Hi from Python')
Hi from Python
Hi from Python
Hi from Python
php
<?php
for($i = 0; $i < 3; $i++) {
     echo "Hi from PHP\r\n";
}
?>
Hi from PHP
Hi from PHP
Hi from PHP

Arne






More information about the Info-vax mailing list