Pascal / Objects / RegisterType
Abstract, CallPointerConstructor, CallPointerLocal, CallPointerMethod, CallPointerMethodLocal, CallVoidConstructor, CallVoidLocal, CallVoidMethod, CallVoidMethodLocal, DisposeStr, LongDiv, LongMul, NewStr, RegisterObjects, » RegisterType, SetStr,
Funcion: RegisterType()
Sintaxis:
procedure RegisterType(
 
  var S: TStreamRec
 
);

Descripcion: Registra nuevos objetos por corriente.

ObjType: Sw_Word
VmtLink: pointer
Load : Pointer
Store: Pointer

VmtLink: Ofs(TypeOf(MyType)^);

Ejemplo:
Unit MyObject;
 
 
Interface
 
Uses Objects;
 
Type
     PMyObject = ^TMyObject;
     TMyObject = Object(TObject)
       Field : Longint;
       Constructor Init;
       Constructor Load (Var Stream : TStream);
       Destructor Done;
       Procedure Store (Var Stream : TStream);
       Function  GetField : Longint;
       Procedure SetField (Value : Longint);
       end;
 
Implementation
 
Constructor TMyobject.Init;
 
begin
  Inherited Init;
  Field:=-1;
end;
 
Constructor TMyobject.Load (Var Stream : TStream);
 
begin
  Stream.Read(Field,Sizeof(Field));
end;
 
Destructor TMyObject.Done;
 
begin
end;
 
Function TMyObject.GetField : Longint;
 
begin
  GetField:=Field;
end;
 
Procedure TMyObject.SetField (Value : Longint);
 
begin
  Field:=Value;
end;
 
Procedure TMyObject.Store (Var Stream : TStream);
 
begin
  Stream.Write(Field,SizeOf(Field));
end;
 
Const MyObjectRec : TStreamRec = (
        Objtype : 666;
        vmtlink : Ofs(TypeOf(TMyObject)^);
        Load : @TMyObject.Load;
        Store : @TMyObject.Store;
        );
 
begin
  RegisterObjects;
  RegisterType (MyObjectRec);
end.

Librerias Pascal

Libreria crt - CRT - Pantalla y teclado del PASCAL de Turbo que maneja la unidad
Libreria dos - DOS - Interface Turbo Pascal MS-DOS
Libreria Graph - Unidad para manipular los graficos de la pantalla compatible con TP
Libreria Objects - Objetos basicos compatible con TP
Libreria math - Rutinas adicionales matematicas
Libreria Printer - Provee de acceso a la impresora
Libreria strings - Rutinas para el manejo de cadenas
Libreria BaseUnix - Funcionalidad Basica de Linux
Libreria System - Manejo de Archivos - Funciones para la manipulacion de archivos en Pascal