#!/usr/bin/perl -w
#
# Converting MOF-files to .mo-files, Step 2
#
# Author: Christian Schiller
# Date: 08/15/98
#
# output filename
$_ = $ARGV[0];
/(_\w+)\.mof/i;
$filename = $1 . ".mo";
print STDERR "output will be written to $filename\n";
open (OUTPUT, ">$filename");
while(<>) {
if (/class.*:/) {
# defined class extends another class
s/(.*)class\s+(\w+):(\w+)/public $1class $2Impl extends $3Impl implements $2/i;
} else {
# defined class extends ManagedObject
s/(.*)class\s+(\w+)/public $1class $2Impl extends ManagedObjectImpl implements $2/i;
}
# convert data types
s/\bbool\b/boolean/i;
s/\bstring\b/String/i;
s/\buint8\b/short/i;
s/\bsint8\b/byte/i;
s/\buint16\b/int/i;
s/\bsint16\b/short/i;
s/\buint32\b/long/i;
s/\bsint32\b/int/i;
s/\buint64\b/BigInteger/i;
s/\bsint64\b/long/i;
s/\breal32\b/float/i;
s/\breal64\b/double/i;
s/\bchar16\b/char/i;
s/\bdatetime\b/String/i;
# no semicolon after '}'
s/\}(\s)*;/\}/;
print OUTPUT;
}