home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
l
/
lnklst10.zip
/
LINKLIST.H
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-19
|
2KB
|
53 lines
/*
*
* LINKLIST.H: Typedefs and #defines for Linked list functions and
* macros.
*
* All code is (c) Copyright 1993 Ben Morris and SpeedSOFT Development.
* Ben Morris Retains all intellectual rights and copyrights to this
* code. Under no circumstances is the author's name to be removed from
* the header file, source file or object code created by compiling the
* source code.
*
* Other than the above restriction, this code may be used freely with
* any software, commercial or otherwise.
*
* Ben Morris also disclaims all warranties, express or implied, with
* regards to the fitness of this code for any purpose. Under no
* circumstances shall Ben Morris or SpeedSOFT Development be held liable
* for any damages, losses, or claim for loss of profit, resulting from
* the use or inability to use this software and all accompanying
* documentation.
*
*/
#ifndef LINKLIST__H
#define LINKLIST__H
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
typedef struct node_struc
{
struct node_struc *prev;
struct node_struc *next;
void *data;
} NODE, *NODEPTR;
#define NodePrev(ndp) ((NODEPTR)((ndp)->prev))
#define NodeNext(ndp) ((NODEPTR)((ndp)->next))
#define NodeFirst(hndp) ((NODEPTR)((hndp)->next))
#define NodeLast(hndp) ((NODEPTR)((hndp)->prev))
#define NodeTotal(hndp) (NodePtrtoNum((hndp)->prev, (hndp)))
NODEPTR InitList( void );
NODEPTR NodeInsert( NODEPTR prev_ndp, size_t size );
void NodeDelete( NODEPTR ndp );
NODEPTR NodeNumtoPtr( int num, NODEPTR head_ndp );
int NodePtrtoNum( NODEPTR sndp, NODEPTR head_ndp );
void DestroyList( NODEPTR head_ndp );
#endif /* LINKLIST__H */