- Unit Objects;
-
- {$O+,F+,X+,I-,S-}
-
- INTERFACE
-
- Const
-
- { Modes d'accès TStream }
- stCreate = $3C00; { Créer un nouveau fichier }
- stOpenRead = $3D00; { Accès en lecture uniquement }
- stOpenWrite = $3D01; { Accès en écriture uniquement }
- stOpen = $3D02; { Accès en lecture et en écriture }
-
- { Codes d'erreur TStream }
-
- stOk = 0; { Pas d'erreur }
- stError = -1; { Erreur d'accès }
- stInitError = -2; { Impossible d'initialiser le flux }
- stReadError = -3; { Lecture au-delà de la fin du flux de données }
- stWriteError = -4; { Impossible d'étendre le flux de données }
- stGetError = -5; { Obtenir un type d'objet non enregistré }
- stPutError = -6; { Mettre de type d'objet non enregistré }
-
- { Taille maximale de TCollection }
-
- MaxCollectionSize = 65520 div SizeOf(Pointer);
-
- { Codes d'erreur TCollection }
-
- coIndexError = -1; { Index hors intervalle }
- coOverflow = -2; { Débordement }
-
- { Taille d'entête VMT }
-
- vmtHeaderSize = 8;
-
- Type
-
- { Type des enregistrements de conversion }
- WordRec=Record
- Lo,Hi:Byte;
- End;
-
- LongRec=Record
- Lo,Hi:Word;
- End;
-
- PtrRec=Record
- Ofs,Seg:Word;
- End;
-
- { Pointeurs de chaîne de caractères }
-
- PString = ^String;
-
- { Type d'ensemble de caractères }
-
- PCharSet = ^TCharSet;
- TCharSet = Set of Char;
-
- { Tableaux généraux }
-
- PByteArray = ^TByteArray;
- TByteArray = Array[0..32767] of Byte;
-
- PWordArray = ^TWordArray;
- TWordArray = Array[0..16383] of Word;
-
- { Objet de base TObject }
-
- PObject = ^TObject;
- TObject = Object
- Constructor Init;
- Procedure Free;
- Destructor Done; Virtual;
- End;
-
- { TStreamRec }
-
- PStreamRec=^TStreamRec;
- TStreamRec=Record
- ObjType:Word;
- VmtLink:Word;
- Load:Pointer;
- Store:Pointer;
- Next:Word;
- End;
-
- { TStream }
-
- PStream=^TStream;
- TStream=Object(TObject)
- Status:Integer;
- ErrorInfo: Integer;
- Procedure CopyFrom(Var S:TStream;Count:Longint);
- Procedure Error(Code,Info:Integer);Virtual;
- Procedure Flush;Virtual;
- Function Get:PObject;
- Function GetPos:Longint; Virtual;
- Function GetSize:Longint; Virtual;
- Procedure Put(P:PObject);
- Procedure Read(Var Buf;Count:Word);Virtual;
- Function ReadStr:PString;
- Procedure Reset;
- Procedure Seek(Pos: Longint); Virtual;
- Procedure Truncate; Virtual;
- Procedure Write(Var Buf; Count: Word); Virtual;
- Procedure WriteStr(P:PString);
- End;
-
- {Chaîne de caractères nom de fichier DOS }
-
- FNameStr = string[79];
-
- { TDosStream }
-
- PDosStream=^TDosStream;
- TDosStream=Object(TStream)
- Handle:Word;
- Constructor Init(FileName: FNameStr; Mode: Word);
- Destructor Done; virtual;
- Function GetPos:Longint; Virtual;
- Function GetSize:Longint; Virtual;
- Procedure Read(Var Buf;Count:Word);Virtual;
- Procedure Seek(Pos:Longint);Virtual;
- Procedure Truncate;Virtual;
- Procedure Write(Var Buf;Count:Word);Virtual;
- End;
-
- { TBufStream }
-
- PBufStream = ^TBufStream;
- TBufStream = Object(TDosStream)
- Buffer: Pointer;
- BufSize: Word;
- BufPtr: Word;
- BufEnd: Word;
- Constructor Init(FileName:FNameStr;Mode,Size:Word);
- Destructor Done; Virtual;
- Procedure Flush; Virtual;
- Function GetPos: Longint; Virtual;
- Function GetSize: Longint; Virtual;
- Procedure Read(Var Buf;Count:Word); Virtual;
- Procedure Seek(Pos:Longint); Virtual;
- Procedure Truncate; Virtual;
- Procedure Write(Var Buf; Count:Word); Virtual;
- End;
-
- { TEmsStream }
-
- PEmsStream = ^TEmsStream;
- TEmsStream = Object(TStream)
- Handle:Word;
- PageCount:Word;
- Size:Longint;
- Position:Longint;
- Constructor Init(MinSize, MaxSize: Longint);
- Destructor Done; Virtual;
- Function GetPos:Longint; Virtual;
- Function GetSize:Longint; Virtual;
- Procedure Read(Var Buf; Count:Word); Virtual;
- Procedure Seek(Pos:LongInt); Virtual;
- Procedure Truncate; Virtual;
- Procedure Write(Var Buf; Count:Word);Virtual;
- End;
-
- { Types TCollection }
-
- PItemList = ^TItemList;
- TItemList = Array[0..MaxCollectionSize - 1] of Pointer;
-
- { Objet TCollection }
-
- PCollection = ^TCollection;
- TCollection = Object(TObject)
- Items:PItemList;
- Count:Integer;
- Limit:Integer;
- Delta:Integer;
- Constructor Init(ALimit,ADelta:Integer);
- Constructor Load(Var S:TStream);
- Destructor Done; Virtual;
- Function At(Index:Integer): Pointer;
- Procedure AtDelete(Index:Integer);
- Procedure AtFree(Index:Integer);
- Procedure AtInsert(Index:Integer; Item:Pointer);
- Procedure AtPut(Index:Integer; Item:Pointer);
- Procedure Delete(Item:Pointer);
- Procedure DeleteAll;
- Procedure Error(Code,Info:Integer); Virtual;
- Function FirstThat(Test:Pointer):Pointer;
- Procedure ForEach(Action:Pointer);
- Procedure Free(Item:Pointer);
- Procedure FreeAll;
- Procedure FreeItem(Item:Pointer); Virtual;
- Function GetItem(Var S:TStream): Pointer; Virtual;
- Function IndexOf(Item:Pointer): Integer; Virtual;
- Procedure Insert(Item:Pointer); Virtual;
- Function LastThat(Test:Pointer):Pointer;
- Procedure Pack;
- Procedure PutItem(Var S:TStream; Item:Pointer); Virtual;
- Procedure SetLimit(ALimit:Integer); Virtual;
- Procedure Store(Var S: TStream);
- End;
-
- { Objet TSortedCollection }
-
- PSortedCollection=^TSortedCollection;
- TSortedCollection=Object(TCollection)
- Duplicates:Boolean;
- Constructor Load(var S:TStream);
- Function Compare(Key1,Key2: Pointer): Integer; Virtual;
- Function IndexOf(Item:Pointer): Integer; Virtual;
- Procedure Insert(Item:Pointer); Virtual;
- Function KeyOf(Item:Pointer):Pointer; Virtual;
- Function Search(Key:Pointer;Var Index:Integer):Boolean; Virtual;
- Procedure Store(Var S:TStream);
- End;
-
- { Objet TStringCollection }
-
- PStringCollection=^TStringCollection;
- TStringCollection=Object(TSortedCollection)
- Function Compare(Key1,Key2:Pointer):Integer;Virtual;
- Procedure FreeItem(Item:Pointer);Virtual;
- Function GetItem(Var S:TStream):Pointer; Virtual;
- Procedure PutItem(Var S:TStream;Item:Pointer); Virtual;
- End;
-
- { Objet TResourceCollection }
-
- PResourceCollection=^TResourceCollection;
- TResourceCollection=Object(TStringCollection)
- Procedure FreeItem(Item:Pointer);Virtual;
- Function GetItem(Var S:TStream):Pointer; Virtual;
- Function KeyOf(Item:Pointer):Pointer; Virtual;
- Procedure PutItem(Var S:TStream;Item:Pointer); Virtual;
- End;
-
- { Objet TResourceFile }
-
- PResourceFile = ^TResourceFile;
- TResourceFile=Object(TObject)
- Stream:PStream;
- Modified:Boolean;
- Constructor Init(AStream:PStream);
- Destructor Done; Virtual;
- Function Count: Integer;
- Procedure Delete(Key:String);
- Procedure Flush;
- Function Get(Key:String):PObject;
- Function KeyAt(I:Integer):String;
- Procedure Put(Item:PObject;Key:String);
- Function SwitchTo(AStream:PStream; Pack:Boolean):PStream;
- End;
-
- { Objet TStringList }
-
- TStrIndexRec=Record
- Key,Count,Offset:Word;
- End;
-
- PStrIndex=^TStrIndex;
- TStrIndex=Array[0..9999] of TStrIndexRec;
-
- PStringList=^TStringList;
- TStringList=Object(TObject)
- Constructor Load(Var S:TStream);
- Destructor Done;Virtual;
- Function Get(Key:Word):String;
- End;
-
- { Objet TStrListMaker }
- PStrListMaker = ^TStrListMaker;
- TStrListMaker = object(TObject)
- Constructor Init(AStrSize,AIndexSize:Word);
- Destructor Done;Virtual;
- Procedure Put(Key:Word;S:String);
- Procedure Store(Var S:TStream);
- End;
-
- { Objet TPoint }
-
- TPoint = Object
- X,Y:Integer;
- End;
-
- { Objet Rectangle }
-
- TRect = Object
- A,B:TPoint;
- Procedure Assign(XA,YA,XB,YB:Integer);
- Procedure Copy(R:TRect);
- Procedure Move(ADX,ADY:Integer);
- Procedure Grow(ADX,ADY:Integer);
- Procedure Intersect(R:TRect);
- Procedure Union(R:TRect);
- Function Contains(P:TPoint):Boolean;
- Function Equals(R:TRect):Boolean;
- Function Empty:Boolean;
- End;
-
- { Routines de gestion dynamique des chaînes de caractères }
- Function NewStr(Const S:String):PString;
- Procedure DisposeStr(P:PString);
-
- { Routines LongInt }
- Function LongMul(X,Y:Integer):Longint;Inline($5A/$58/$F7/$EA);
- Function LongDiv(X:Longint;Y:Integer):Integer;Inline($59/$58/$5A/$F7/$F9);
-
- { Routines de flux de données }
- Procedure RegisterType(Var S: TStreamRec);
-
- { Procédure de notification d'abrégé }
- Procedure Abstract;
-
- { Procédure d'enregistrement des objets }
- Procedure RegisterObjects;
-
- Const
- { Procédure d'erreur de flux de données }
-
- StreamError: Pointer = nil;
-
- { Variables d'état du flux de données EMS }
-
- EmsCurHandle:Word=$FFFF;
- EmsCurPage:Word=$FFFF;
-
- { Enregistrements d'enregistrement de flux de données }
-
- Const
- RCollection: TStreamRec = (
- ObjType: 50;
- VmtLink: Ofs(TypeOf(TCollection)^);
- Load: @TCollection.Load;
- Store: @TCollection.Store);
-
- Const
- RStringCollection: TStreamRec = (
- ObjType: 51;
- VmtLink: Ofs(TypeOf(TStringCollection)^);
- Load: @TStringCollection.Load;
- Store: @TStringCollection.Store);
-
- Const
- RStringList: TStreamRec = (
- ObjType: 52;
- VmtLink: Ofs(TypeOf(TStringList)^);
- Load: @TStringList.Load;
- Store: nil);
-
- Const
- RStrListMaker: TStreamRec = (
- ObjType: 52;
- VmtLink: Ofs(TypeOf(TStrListMaker)^);
- Load: nil;
- Store: @TStrListMaker.Store);
Dernière mise à jour : Dimanche, le 20 avril 2014