| Computer Science 2574 |
Intro to Data Structures & Soft Eng
|
/*---------------------------------------------------------------
Module name: dlist.h
Header File: dlist.h
Implemenation File: dlist.c
Purpose:
This module is responsible for the encapsulated list
creation and management functions for a double linked list.
The user is repsonsible for providing a datatype file called:
listdata.h
in a directory where it will be found by the search path.
the data structure will need to be in the format:
struct listdata
{
define internal data items here
};
struct listtitle
{
define header data items here
};
this data file will be used by this module in its definition
of the list.
Functions:
Created by: Jon Ford
Version: 1.00
Modified: 3/6/96
--------------------------------------------------------------*/
#ifndef DLIST_H
#define DLIST_H
#include
#include
#include"listdata.h"
#define NEW_LIST 0
#define CURR_LIST 1
typedef struct listtitle lsttitle;
typedef struct listdata lstruct;
struct liststruct
{
lstruct item;
struct liststruct *next;
struct liststruct *previous;
};
typedef struct liststruct *ElemPtr;
struct mainstruct
{
lsttitle title;
ElemPtr head;
ElemPtr tail;
};
typedef struct mainstruct *ListMgr;
ListMgr GetList(int listexist);
int EmptyList(ListMgr listmgr);
ElemPtr CreateElement(void);
void InsertElement(ListMgr listmgr, ElemPtr element);
void RemoveElem(ListMgr listmgr, ElemPtr element);
int sizelist(ListMgr listmgr);
void DestroyList(ListMgr listmgr);
ElemPtr ReturnElemen