/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#include "dthdr.h"
/* List, Deque, Stack, Queue.
**
** Written by Kiem-Phong Vo (05/25/96)
*/
typedef struct _dtlist_s
} Dtlist_t;
#ifdef DEBUG
{
int k;
return -1;
*endb++ = '(';
*endb++ = ')';
*endb++ = '\n';
}
return 0;
}
#endif
/* terminal objects: DT_FIRST|DT_LAST */
#if __STD_C
#else
int type;
#endif
{
}
}
/* DT_CLEAR */
#if __STD_C
#else
#endif
{
}
}
}
/* DT_FLATTEN|DT_EXTRACT|DT_RESTORE */
#if __STD_C
#else
int type;
#endif
{
{ if(lnk) /* error on calling */
if(type&DT_EXTRACT)
}
}
else /* if(type&DT_RESTORE) */
}
}
#if __STD_C
#else
#endif
{
if(st)
}
}
#if __STD_C
#else
int type;
#endif
{
Dtlink_t *r, *t, *h;
if(!(type&DT_OPERATIONS) )
if(!obj)
goto dt_delete;
}
goto do_insert;
}
goto dt_queue; /* append at end */
else goto dt_stack; /* insert at top */
}
{ if(!h || !h->_rght)
goto dt_queue;
r->_left = h;
}
else
goto dt_stack;
r->_rght = h;
}
}
{ dt_stack:
if(t)
t->_left = r;
}
else r->_left = r;
}
else /* if(dt->meth->type&DT_QUEUE) */
{ dt_queue:
t->_left = r;
}
else
r->_left = r;
}
}
}
/* define key to match */
}
/* try to find a matching object */
r = h; /* match at the finger, no search needed */
else /* linear search through the list */
continue;
{ if(o == obj) /* got exact object, done */
break;
h = r;
h = h ? h : r;
else continue;
}
else if(type & DT_ATLEAST )
h = r; /* track last object */
else break;
}
r = h ? h : r;
}
if(!r)
{ dt_delete:
if(r->_rght)
}
else
if(r == t->_left)
}
}
r = r->_rght;
/* else: if(type&(DT_SEARCH|DT_MATCH|DT_ATLEAST|DT_ATMOST)) */
if(r)
return obj;
}
#if __STD_C
#else
int event;
#endif
{
{ if(list) /* already initialized */
return 0;
return -1;
}
return 1;
}
{ if(!list) /* already closed */
return 0;
return 0;
}
else return 0;
}
#ifdef NoF
#endif