head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	93.07.23.16.09.35;	author ids;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@MODULE LinkedList;

FROM Storage IMPORT DEALLOCATE;

TYPE
  List     = POINTER TO ListNode;
  ListNode = RECORD
               item : INTEGER; (* or whatever *)
               next : List
             END;


PROCEDURE DeleteItem (i : INTEGER; VAR L : List);
(* pre:  there is at most one ("special") list-node in L with item-value i
 * post: deletes the list-node in L with item-value i, if such there be,
 *       preserving the order of the remainder of L. Or, if there is
 *       no such special list-node, has no effect.
 *)

VAR
  temp : List;

BEGIN
  IF L # NIL THEN
    IF L^.item = i THEN
      temp := L;
      L := L^.next;
      DISPOSE(temp)
    ELSE
      DeleteItem(i, L^.next)
    END(*IF*)
  END(*IF*)
END DeleteItem;


BEGIN
END LinkedList.
@
