home *** CD-ROM | disk | FTP | other *** search
-
- unit OpList;
-
- interface
- uses
- ObjOp,ObjList;
- type TOpList=class
- protected
- fList:TObjList;
- public
- constructor Create;
- destructor Destroy;override;
- procedure Register(OpCode:integer;OpClass:TObjOpClass);
- function Find(OpCode:integer):TObjOp;
- end;
- implementation
- constructor TOpList.Create;
- begin
- Inherited Create;
- fList:=TObjList.Create;
- end;
- destructor TOpList.Destroy;
- begin
- fList.Free;
- Inherited Destroy;
- end;
- procedure TOpList.Register;
- Var Op:TObjOp;
- begin
- Op:=OpClass.Create;
- Op.OpCode:=OpCode;
- fList.Add(Op);
- end;
- function TOpList.Find;
- Var i:Integer;
- begin
- Result:=nil;
- for i:=0 to fList.Count-1 do
- begin
- if (fList.Obj[i] as TObjOp).OpCode=OpCode then
- begin
- Result:=fList.Obj[i] as TObjOp;
- exit;
- end;
- end;
- end;
-
- end.
-