T
Thomas Zangl
Hi,
Quote:
I have some piece of code which I want to convert to Java using the
BCEL. Methodcalls etc work fine but now I am stuck with the "if then
else" structure.
Can someone please post an example for something simple like:
if y > x then
Foo()
else
Bar()
-- End of Quote
I have already posted this and now I am stuck with the following.
I use the InstructionFactory from BCEL to generate a "IFEQ" branch
insttruction:
aIh = some intruction handle. the target as far as I can figure out.
Must this be some single instruction or can I have multiple ones? (Like
in java if I have an "if" with braces containing multiple statements.)
aBranch = factory_.createBranchInstruction(Constants.IFEQ,aIh);
How can I generate the "else" statement? I thought of adding an
"inverse" branche (IFNE) with the code in the "else" branch but is there
something easier and more elegant?
Maybe somebody can post a small example how to generate this if then
else snippet to BCEL (Using InstructionList, InstructionFactory):
if ( dummyFunction(x) > 0 ) {
foo(x-1)
} else {
return 0;
}
TIA!
Best regards,
Quote:
I have some piece of code which I want to convert to Java using the
BCEL. Methodcalls etc work fine but now I am stuck with the "if then
else" structure.
Can someone please post an example for something simple like:
if y > x then
Foo()
else
Bar()
-- End of Quote
I have already posted this and now I am stuck with the following.
I use the InstructionFactory from BCEL to generate a "IFEQ" branch
insttruction:
aIh = some intruction handle. the target as far as I can figure out.
Must this be some single instruction or can I have multiple ones? (Like
in java if I have an "if" with braces containing multiple statements.)
aBranch = factory_.createBranchInstruction(Constants.IFEQ,aIh);
How can I generate the "else" statement? I thought of adding an
"inverse" branche (IFNE) with the code in the "else" branch but is there
something easier and more elegant?
Maybe somebody can post a small example how to generate this if then
else snippet to BCEL (Using InstructionList, InstructionFactory):
if ( dummyFunction(x) > 0 ) {
foo(x-1)
} else {
return 0;
}
TIA!
Best regards,