🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.borland
1 messages
1 total messages Started by ANGEL CEPA Sat, 06 Jan 2001 15:07
LISTAS GENERICAS EN PASCAL
#660
Author: ANGEL CEPA
Date: Sat, 06 Jan 2001 15:07
45 lines
2171 bytes
Necesito q alguien me ayude y me pase el codigo de un objeto lista generica
en pascal parecida a esta:
TPuntero=^nodo;

  nodo=RECORD
   info:pointer;
   sig:TPuntero;
  END;

  TLista=OBJECT
   PRIVATE
    primero,ultimo:TPuntero;
    espacio:integer;
   PUBLIC
    CONSTRUCTOR Inicializar(espacio:integer);
    PROCEDURE Insertar(VAR direccion:pointer);
    PROCEDURE Sacar(VAR direccion:pointer);
    PROCEDURE Actual(VAR direccion:pointer);
    PROCEDURE Siguiente(VAR direccion:pointer);
    FUNCTION Vacia:boolean;
    DESTRUCTOR Liberar;
  END;

He hecho un codigo con este objeto y no me da errores de compilacion, sino q
me da errores de acceso a memoria en tiempo de ejecucion. Posiblemente sea x
la manera en la q llamo al los procedimientos de Insertar, Sacar, Actual o
siguiente. Esto es lo q hago:

VAR datos:TLista;
  .....
  FUNCTION Sacar:char;
   VAR
    x:char;
    p,q:pointer;
   BEGIN
    datos.sacar(p);
    q:=@x;
    move(p,q,sizeof(char));
    Sacar:=x;
   END;
 ......
Me ayudaria mucho ver el codigo completo de un objeto lista generica como
esta. Se q es un problema un poco extra�o pero es q es la 1� vez q me tengo
q pegar con una lista generica y no tengo ni idea de como hacerlo. Muchas
gracias.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads