IF Computer > MINERVA > Example Programs > MINERVA Features > MinervaToJava

MinervaToJava

MINERVA
ifcomputer logo
f
Expert Services on the Web

The use of metagen to automatically generate a MINERVA package from an existing Java class.

The example shows how to build a program "random.min" that provides one predicate for every constructor and method of defined by the Java class java.util.Random .

Note that metagen works for any class available at compile time.

To see it in action, use Go.* and Compile.* of this directory.

Here are the sources:

use_random.min

:- package(random).

main(_Args) :- random_create(RandomSequence), for(1,I,20), random_nextInt_1(RandomSequence,100,Random), write(Random),write(' '),flush_output, I = 20, nl,flush_output.

Compile.sh

#!/bin/sh
echo -n ':- ' > random.min
minerva -l $MINERVA_HOME/extender/metagen java.util.Random >> random.min
minervac random
minervac use_random

Go.sh

#!/bin/sh
minerva -l use_random

Please note that the class Random used in this example is not supported in current versions of Microsoft Java environments. Use some other class.

document: http://www.ifcomputer.co.jp/MINERVA/ExamplePrograms/MinervaFeatures/MinervaToJava/print_en.html
published 2008/7/21 update 2002/3/20 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 info@ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS