% Determine if object is of given type
meth InstanceOf =^ ( ·
var index : Int ·
var b : Bytecode ·
var entry : CpList ·
var e : Object ·
var Obj : ObjectInfo ·
var ref : Object ·
var cl : ClassInfo ·
var clName : String ·
var clType : String ·
var D : DataInfoInt ·
var subtype : boolean ·
var CurrentFrame : FrameInfo ·
TopFrame.GetFrame(CurrentFrame);
% getting the index of the constant pool of the current currentFrame.GetNextBytecode(b);
b.GetCode(index);
% searching the constant pool Finding the Class entry
currentFrame.FindCPList(index, entry);
entry.GetInfo(e);
if [] e isExactly CpentryClass ®
(CpentryClass)e.Getcl(cl)
[] not(e isExactly CpentryClass) ® miracle
fi
cl.Getname(clName);
% getting the the DataInfo that holds the Object
currentFrame.Pop(Ref);
if [] ref isExactly ObjectInfo ® Obj:= (ObjectInfo) ref;
[] not (ref isExactly ObjectInfo) ® miracle
fi
% getting object type
Obj.Getcl(cl);
cl.GetName(cltype);
subtype:=false;
cl.Conforms(clname,subtype);
D:= new DataInfoInt
if [] subtype ®
D.SetInfo(1);
[] not subtype ®
D.SetInfo(0);
Fi
TopFrame.SetFrame(CurrentFrame);
end end end end end end end end end end end end
)
end