Java/.NET to BETA converters

In order to interface Java class libraries and .NET framework libraries from BETA, currently one needs to declare the classes/types/interfaces etc. of these libraries in BETA, using e.g. the ExternalClass mechanism described in [Special.html].

In order to releave the BETA programmer of this tedious work, two command line tools have been created, thart does this for Java and .NET respectively.
Most of the files in the directories javalib and dotnetlib in the root of your BETA.Net/BETA.Java installation were generated using these tools.
If you encounter an external class that you need to use from BETA, and which has not yet been converted, you may do it yourself, as described below.

java2beta

For the Java platform, a command line tool called java2beta is provided. Basic usage is e.g.
java2beta[.bat] java.lang.String
which will open the java/lang/String class and produce the file <BETALIB>/javalib/java/lang/String.bet (where <BETALIB> denotes the placement of your BETA installation as set in the BETALIB environment variable, see Installation of BETA.Net and BETA.Java.
In some command line shells (e.g. cygwin), you will have to type java2beta.bat and not just java2beta to invoke the tool.

A few options are available as will be revealed by invoking java2beta -h:

Usage:

Script: java2beta [-h][-v][-l][-f|-F|-] <java class name>
 e.g.   java2beta java.lang.String

Output files will be placed in $BETALIB/javalib in a directory
structure corresponding to the package of the class.
 e.g.   $BETALIB/javalib/java/lang/String.bet

Options:
   -h  Display this help
   -v  Verbose output
   -l  Generate to local directory instead of to $BETALIB/javalib
   -f  Force overwrite of existing output file
   -F  Force overwrite of existing output file
       AND files for refered classes
   -   Output to terminal instead of file

Converting custom classes

If you are generating BETA interfaces for a class, that is not part of the standard Java installation, you may need to set the environment variable CLASSPATH before calling java2beta:

If you are converting the class

org.myplace.myclass
and the class is placed in a directory named
/users/smith/java/classes/org/myplace
you should set CLASSPATH to
/users/smith/java/classes
You should also include paths to any non-standard refered classes in your CLASSPATH. So if a method in org.myplace.myclass has a parameter of type
org.otherplace.otherclass
and this class is found in directory
/users/jones/java/classes/org/otherplace
you should set CLASSPATH to
/users/smith/java/classes:/users/jones/java/classes
(on windows the CLASSPATH separator is semicolon instead of colon).

Finally, if your custom classes are packed into JAR files, each JAR file should be listed in the CLASSPATH. So in the example, of the two involved packages where placed in two JAR files, in the previously named directories, and these JAR files were named in the conventional way, you should set CLASSPATH to

/users/smith/java/classes/org.myplace.jar:/users/jones/java/classes/org.otherplace.jar

dotnet2beta

For the .NET platform, a command line tool called dotnet2beta is provided. Basic usage is e.g.
dotnet2beta System.String
which will open the System.String class and produce the file <BETALIB>/dotnetlib/System/String.bet (where <BETALIB> denotes the placement of your BETA installation as set in the BETALIB environment variable, see Installation of BETA.Net and BETA.Java.

A few options are available as will be revealed by invoking dotnet2beta -h:

Usage:

dotnet2beta [-h][-v][-w][-f][-F][-][-tt][-tf][-tr] <dotnet class name>
 e.g.   dotnet2beta System.String

Output files will be placed in BETALIB/dotnetlib in a directory
structure corresponding to the namespace of the class.
 e.g.   c:/beta/r5.3/dotnetlib/System/String.bet

Options:
   -h  Display this help
   -v  Verbose output
   -w  Suppress warnings (ignored if -v)
   -f  Force overwrite of existing output file
   -F  Force overwrite of existing output file AND files for refered classes
   -   Output to terminal instead of file
   -tt Debug: type related verbose output
   -tf Debug: file related verbose output
   -tr Debug: runtime related verbose output

dotnet2beta configuration: conversion-rules.txt

A little configuration of how dotnet2beta operates can be configured by editing the file <BETALIB>/dotnetlib/conversion-rules.txt.

...

Implementation of converters

The implementation of the two tools is outlined in implementation.html.