Finally figured out that some Oxidized Delphi code using type ‘Word’ was malfunctioning. That is, simple arithmetic comparisons were failing. I tried to isolate this to a simple test case and can’t create a variable of type ‘Word’. Even RemObjects.Oxygene.System.Word is ‘unknown’, however my large project compiles fine with type ‘Word’, it simple doesn’t run properly.
I thought perhaps Word was only allowed is Oxidizing Delphi code, so I created the procedure testWordArithmetic shown below and Oxidized it into the tiny_hello_world example as follows, but it will not compile:
namespace hello_world;
interface
type
ConsoleApp = class
public
class method Main(args : array of String);
end;
implementation
class method ConsoleApp.Main(args : array of String);
var
myLine:String;
bX, bWidth: Integer;
begin
writeLn('Hello World!');
//Console.ReadLine;
System.in.read;
end;
// namespace expected
procedure testWordArithmetic;
var
a,b : RemObjects.Oxygene.System.Word;
begin
a := 80;
b := 10;
if b >= a then
b := a-1
else
b := 0;
writeLn('b='+b);
end;
end.
You need to reference com.remobjects.elements.rtl.jar, to use unsigned types on Java, as these are not supported by the Java platform itself. We’ll fix the project templates(s) to automatically reference this by default, for the next release.
That’s not all there is to it. I added the rtl.jar as a reference and ran the following test case. It shows ‘b=79’ indicating that the comparison if b >= a was treated as true, rather than false.
[code]namespace hello_world;
interface
type
ConsoleApp = class
public
class method Main(args : array of String);
end;
implementation
class method ConsoleApp.Main(args : array of String);
var
myLine:String;
bX, bWidth: Integer;
begin
testWordArithmetic;
writeLn(‘Hello World!’); //Console.ReadLine;
System.in.read;
end;
// namespace expected
procedure testWordArithmetic;
var
a,b : RemObjects.Oxygene.System.Word;
begin
a := 80;
b := 10;
if b >= a then
b := a-1
else
b := 0;
writeLn(‘b=’+b);
end;