home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / reviewed / volume03 / chipset2 / 08 < prev    next >
Encoding:
Text File  |  1993-03-13  |  18.8 KB  |  779 lines

  1. From decwrl!athertn!sander.cupertino.ca.us!paul@cs.purdue.edu Wed Jan  6 13:53:38 EST 1993
  2. Submit chipset-2 08/10 
  3. #! /bin/sh
  4. # This is a shell archive.  Remove anything before this line, then unpack
  5. # it by saving it into a file and typing "sh file".  To overwrite existing
  6. # files, type "sh file -c".  You can also feed this as standard input via
  7. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  8. # will see the following message at the end:
  9. #        "End of archive 8 (of 10)."
  10. # Contents:  src/list/dlist.man
  11. # Wrapped by paul@sander on Sun Nov 22 15:41:54 1992
  12. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  13. if test -f src/list/dlist.man -a "${1}" != "-c" ; then 
  14.   echo shar: Will not over-write existing file \"src/list/dlist.man\"
  15. else
  16. echo shar: Extracting \"src/list/dlist.man\" \(16973 characters\)
  17. sed "s/^X//" >src/list/dlist.man <<'END_OF_src/list/dlist.man'
  18. X.TH DLIST
  19. X.SH NAME
  20. Xdll_dump, dll_setup, dll_freeSetup, dll_new, dll_destroy, 
  21. Xdll_traverse, dll_rank, dll_delRank, dll_data, dll_setData,
  22. Xdll_first, dll_next, dll_last, dll_prev, dll_join
  23. X-- General purpose doubly-linked list manipulation
  24. X.sp
  25. Xdll_search, dll_insert, dll_delete -- Sorted doubly-linked list manipulation
  26. X.sp
  27. Xdll_pushf, dll_pushr, dll_push, dll_popf, dll_popr, dll_pop, dll_peekf,
  28. Xdll_peekr, dll_peek
  29. X-- Unsorted doubly-linked list manipulation
  30. X.SH SYNOPSIS
  31. X#include <dlist.h>
  32. X.sp
  33. X#ifdef __STDC__
  34. X.sp
  35. XDLL_SETUP dll_setup(int(*comp)(void*,void*), void *data)
  36. X.sp
  37. Xvoid dll_freeSetup(DLL_SETUP setup)
  38. X.sp
  39. XDL_LIST dll_new(DLL_SETUP setup)
  40. X.sp
  41. Xvoid dll_destroy(DL_LIST list, void (*free_key)(void*,void*),
  42. Xvoid (*free_data)(void*,void*), void *info)
  43. X.sp
  44. Xint dll_insert(DL_LIST list, void *key, void *data)
  45. X.sp
  46. Xvoid    *dll_delete(DL_LIST list, void *key, void **data)
  47. X.sp
  48. Xvoid *dll_search(DL_LIST list, void *target, void **data)
  49. X.sp
  50. Xvoid dll_traverse(DL_LIST list, void (*fn)(void*,void*,void*), void *parms)
  51. X.sp
  52. Xvoid dll_dump(DL_LIST list, void (*key_dump)(void*,void*,void*), void *info)
  53. X.sp
  54. Xvoid *dll_first(DL_LIST list, void **data)
  55. X.sp
  56. Xvoid *dll_last(DL_LIST list, void **data)
  57. X.sp
  58. Xvoid *dll_next(DL_LIST list, void **data)
  59. X.sp
  60. Xvoid *dll_prev(DL_LIST list, void **data)
  61. X.sp
  62. XDL_LIST dll_join(DL_LIST list1, DL_LIST list2)
  63. X.sp
  64. Xvoid *dll_rank(DL_LIST list, int rank, void **data)
  65. X.sp
  66. Xvoid *dll_delRank(DL_LIST list, int rank, void **data)
  67. X.sp
  68. Xvoid *dll_data(DL_LIST list)
  69. X.sp
  70. Xvoid dll_setData(DL_LIST list, void *data)
  71. X.sp
  72. Xvoid *dll_pushf(DL_LIST list, void *key, void *data)
  73. X.sp
  74. Xvoid *dll_pushr(DL_LIST list, void *key, void *data)
  75. X.sp
  76. Xvoid *dll_push(DL_LIST list, int where, void *key, void *data)
  77. X.sp
  78. Xvoid *dll_popf(DL_LIST list, void **data)
  79. X.sp
  80. Xvoid *dll_popr(DL_LIST list, void **data)
  81. X.sp
  82. Xvoid *dll_pop(DL_LIST list, int where, void **data)
  83. X.sp
  84. Xvoid *dll_peekf(DL_LIST list, void **data)
  85. X.sp
  86. Xvoid *dll_peekr(DL_LIST list, void **data)
  87. X.sp
  88. Xvoid *dll_peek(DL_LIST list, int where, void **data)
  89. X.sp
  90. X#else
  91. X.sp
  92. XDLL_SETUP dll_setup(comp, data)
  93. X.br
  94. Xint    (*comp)();
  95. X.br
  96. Xvoid    *data;
  97. X.sp
  98. Xvoid dll_freeSetup(setup)
  99. X.br
  100. XDLL_SETUP    setup;
  101. X.sp
  102. XDL_LIST dll_new(setup)
  103. X.br
  104. XDLL_SETUP    setup;
  105. X.sp
  106. Xvoid dll_destroy(list,free_key,free_data,info)
  107. X.br
  108. XDL_LIST    list;
  109. X.br
  110. Xvoid    (*free_key)();
  111. X.br
  112. Xvoid    (*free_data)();
  113. X.br
  114. Xvoid    *info;
  115. X.sp
  116. Xint dll_insert(list,key,data)
  117. X.br
  118. XDL_LIST    list;
  119. X.br
  120. Xvoid    *key;
  121. X.br
  122. Xvoid    *data;
  123. X.sp
  124. Xvoid    *dll_delete(list,key,data)
  125. X.br
  126. XDL_LIST    list;
  127. X.br
  128. Xvoid    *key;
  129. X.br
  130. Xvoid    **data;
  131. X.sp
  132. Xvoid *dll_search(list,target,data)
  133. X.br
  134. XDL_LIST    list;
  135. X.br
  136. Xvoid    *target;
  137. X.br
  138. Xvoid    **data;
  139. X.sp
  140. Xvoid dll_traverse(list,fn,parms)
  141. X.br
  142. XDL_LIST    list;
  143. X.br
  144. Xvoid    (*fn)();
  145. X.br
  146. Xvoid    *parms;
  147. X.sp
  148. Xvoid dll_dump(list,key_dump,info)
  149. X.br
  150. XDL_LIST    list;
  151. X.br
  152. Xvoid    (*key_dump)();
  153. X.br
  154. Xvoid    *info;
  155. X.sp
  156. Xvoid *dll_first(list,data)
  157. X.br
  158. XDL_LIST    list;
  159. X.br
  160. Xvoid    **data;
  161. X.sp
  162. Xvoid *dll_last(list,data)
  163. X.br
  164. XDL_LIST    list;
  165. X.br
  166. Xvoid    **data;
  167. X.sp
  168. Xvoid *dll_next(list,data)
  169. X.br
  170. XDL_LIST    list;
  171. X.br
  172. Xvoid    **data;
  173. X.sp
  174. Xvoid *dll_prev(list,data)
  175. X.br
  176. XDL_LIST    list;
  177. X.br
  178. Xvoid    **data;
  179. X.sp
  180. XDL_LIST dll_join(list1,list2)
  181. X.br
  182. XDL_LIST list1;
  183. X.br
  184. XDL_LIST list2;
  185. X.sp
  186. Xvoid *dll_rank(list,rank,data)
  187. X.br
  188. XDL_LIST    list;
  189. X.br
  190. Xint    rank;
  191. X.br
  192. Xvoid    **data;
  193. X.sp
  194. Xvoid *dll_delRank(list,rank,data)
  195. X.br
  196. XDL_LIST    list;
  197. X.br
  198. Xint    rank;
  199. X.br
  200. Xvoid    **data;
  201. X.sp
  202. Xvoid *dll_data(list)
  203. X.br
  204. XDL_LIST    list;
  205. X.sp
  206. Xvoid dll_setData(list,data)
  207. X.br
  208. XDL_LIST    list;
  209. X.br
  210. Xvoid    *data;
  211. X.sp
  212. Xvoid *dll_pushf(list,key,data)
  213. X.br
  214. XDL_LIST    list;
  215. X.br
  216. Xvoid    *key;
  217. X.br
  218. Xvoid    *data;
  219. X.sp
  220. Xvoid *dll_pushr(list,key,data)
  221. X.br
  222. XDL_LIST    list;
  223. X.br
  224. Xvoid    *key;
  225. X.br
  226. Xvoid    *data;
  227. X.sp
  228. Xvoid *dll_push(list,where,key,data)
  229. X.br
  230. XDL_LIST    list;
  231. X.br
  232. Xint    where;
  233. X.br
  234. Xvoid    *key;
  235. X.br
  236. Xvoid    *data;
  237. X.sp
  238. Xvoid *dll_popf(list,data)
  239. X.br
  240. XDL_LIST    list;
  241. X.br
  242. Xvoid    **data;
  243. X.sp
  244. Xvoid *dll_popr(list,data)
  245. X.br
  246. XDL_LIST    list;
  247. X.br
  248. Xvoid    **data;
  249. X.sp
  250. Xvoid *dll_pop(list,where,data)
  251. X.br
  252. XDL_LIST    list;
  253. X.br
  254. Xint    where;
  255. X.br
  256. Xvoid    **data;
  257. X.sp
  258. Xvoid *dll_peekf(list,data)
  259. X.br
  260. XDL_LIST    list;
  261. X.br
  262. Xvoid    **data;
  263. X.sp
  264. Xvoid *dll_peekr(list,data)
  265. X.br
  266. XDL_LIST    list;
  267. X.br
  268. Xvoid    **data;
  269. X.sp
  270. Xvoid *dll_peek(list,where,data)
  271. X.br
  272. XDL_LIST    list;
  273. X.br
  274. Xint    where;
  275. X.br
  276. Xvoid    **data;
  277. X.sp
  278. X#endif
  279. X.SH DESCRIPTION
  280. XThese functions implement a doubly-linked list data structure.  The list
  281. Xitself stores only pointers to the client's data, and relies on
  282. Xclient-provided functions for any comparisons and storage deallocation.
  283. X.sp
  284. X.B dll_setup
  285. Xbuilds a setup structure before a doubly-linked list can be created,
  286. Xand returns a pointer to it;
  287. XNULL is returned if an error occurs.  The setup structure is a magic
  288. Xcookie that can be used to set up many doubly-linked lists.
  289. XIt must be freed by calling
  290. X.BR dll_freeSetup .
  291. XThe setup structure can be freed any time after
  292. X.B dll_new
  293. Xis called.
  294. XThe client specifies a pointer to a function that compares two
  295. Xclient-provided data structures.  The comparison function, 
  296. X.BR comp ,
  297. Xhas the following interface:
  298. X.RS
  299. X.B
  300. Xint comp(k1,k2)
  301. X.br
  302. X.B
  303. Xvoid *k1,*k2;
  304. X.RE
  305. XThe result of this function is less than 0 if the object pointed to by k1 is
  306. X"less than"
  307. Xthe object pointed to by k2, 0 if they are "equal", and greater than 0
  308. Xotherwise.
  309. XClient-provided data structures that
  310. Xcompare greater by this function will appear later in the lexical order
  311. Xof the data stored in the list.
  312. XThis pointer may be NULL if none of the sorted list functions are called.
  313. XThe client may also specify the initial value of the data returned by
  314. X.B dll_getData
  315. Xafter a list is instantiated.
  316. X.sp
  317. X.B dll_freeSetup
  318. Xfrees the setup structure created by
  319. X.BR dll_setup .
  320. XIt can be called any time after
  321. X.B dll_new
  322. Xis called.  Doubly-linked lists do not require their setup structures to exist
  323. Xafter they are created.
  324. X.sp
  325. X.B dll_new
  326. Xcreates a new doubly-linked list.  Given a DLL_SETUP setup structure,
  327. X.B dll_new
  328. Xreturns a pointer to a handle for the doubly-linked list,
  329. Xor NULL if an error occurs.
  330. X.sp
  331. X.B dll_destroy
  332. Xdeallocates all storage allocated to a doubly-linked list.
  333. XThe client provides pointers
  334. Xto visitation functions that are called once for each item stored in the
  335. Xlist.  The items are visited in arbitrary order.  If
  336. XNULL is passed instead of a pointer to a function, no action is taken for
  337. Xthe client-provided data or key, but the list structure itself is freed.
  338. XThe
  339. X.B free_key
  340. Xand
  341. X.B free_data
  342. Xparameters specify functions that free the keys and user-specified data
  343. Xstored in the list.  The
  344. X.B free_data
  345. Xfunction is always called before the
  346. X.B free_key
  347. Xfunction.  The
  348. X.B info
  349. Xparameter is passed along to the visitation functions without modification.
  350. XThe interfaces for these functions follow:
  351. X.sp
  352. X    void freeThis(keyOrData,info)
  353. X.br
  354. X    void    *keyOrData;
  355. X.br
  356. X    void    *info;
  357. X.sp
  358. X.B dll_insert
  359. Xinserts a new item into a sorted list.  1 is returned if the insertion was
  360. Xsuccessful, -1 is returned if the new key matches another key that has
  361. Xalready been inserted into the list, and 0 is returned in the event of an
  362. Xerror.  The
  363. X.B data
  364. Xparameter is a pointer to a user-defined data structure that is stored with
  365. Xthe key, and can be retrieved by any access or deletion function.
  366. X.sp
  367. X.B dll_delete
  368. Xdeletes an item from an sorted list.
  369. XThe value returned is the key value passed to
  370. X.B dll_insert
  371. Xwhen the item was inserted, or NULL if the item is not found.  The
  372. X.B data
  373. Xparameter returns the pointer stored with the key when
  374. X.B dll_insert
  375. Xwas called, or is undefined when the key is not found.
  376. X.sp
  377. X.B dll_search
  378. Xsearches for an item in a sorted list.
  379. XThe value returned is the key value passed to
  380. X.B dll_insert
  381. Xwhen the item was inserted, or NULL if the item is not found.  The
  382. X.B data
  383. Xparameter returns the pointer stored with the key when
  384. X.B dll_insert
  385. Xwas called, or is undefined if the key is not found.
  386. X.sp
  387. X.B dll_traverse
  388. Xtraverses the list, calling a client-provided visitation function
  389. X.B fn
  390. Xonce for each item stored there.
  391. X.B fn
  392. Xhas the following interface:
  393. X.RS
  394. X.B
  395. Xvoid fn(item,parms,data)
  396. X.br
  397. X.B
  398. Xvoid *item;
  399. X.B
  400. X.br
  401. X.B
  402. Xvoid *parms;
  403. X.br
  404. X.B
  405. Xvoid *data;
  406. X.RE
  407. X.B item
  408. Xis the key pointer stored when the item was inserted into the list.
  409. X.B parms
  410. Xis an arbitrary pointer that the client wishes to pass to the visitation
  411. Xfunction, but is otherwise unused by the doubly-linked list implementation.
  412. X.B data
  413. Xis a pointer to a user-defined structure that is stored with the key when
  414. Xthe item is stored in the list.
  415. XItems are visited in their lexical order if the list is sorted.  If the list
  416. Xis not sorted, items are visited in the order they were inserted via
  417. X.B dll_pushr
  418. Xor in the reverse order they were inserted via
  419. X.BR dll_pushf .
  420. X.sp
  421. X.B dll_dump
  422. Xdisplays the contents of the list to stdout, along with some diagnostic and
  423. Xstatistical information.  The
  424. X.B key_dump
  425. Xfunction is called once for each item in the list, in arbitrary order.  It
  426. Xmay be NULL if no action is desired.  Its interface follows:
  427. X.RS
  428. X.B
  429. Xvoid key_dump(key,data,info)
  430. X.br
  431. X.B
  432. Xvoid *key;
  433. X.br
  434. X.B
  435. Xvoid *data;
  436. X.br
  437. X.B
  438. Xvoid *info;
  439. X.RE
  440. XWhere
  441. X.B key
  442. Xis a key stored in the doubly-linked list, and
  443. X.B data
  444. Xis the user-defined pointer stored with the key at the time the item was
  445. Xinserted into the list.
  446. X.sp
  447. X.B dll_first
  448. Xreturns the item that falls earliest in the lexical order of the items
  449. Xstored in an ordered list,
  450. Xthe earliest item pushed onto the list via dll_pushr,
  451. Xthe latest item pushed onto the list via dll_pushf,
  452. Xor NULL if the list is empty.  The user-defined pointer
  453. Xstored with the key is also returned in the
  454. X.B data
  455. Xparameter.
  456. X.sp
  457. X.B dll_last
  458. Xreturns the item that falls latest in the lexical order of the items
  459. Xstored in a sorted list,
  460. Xthe latest item pushed onto the list via dll_pushr,
  461. Xthe earliest item pushed onto the list via dll_pushl,
  462. Xor NULL if the list is empty.  The user-defined pointer
  463. Xstored with the key is also returned in the
  464. X.B data
  465. Xparameter.
  466. X.sp
  467. X.B dll_next
  468. Xreturns the next item toward the end of the doubly-linked list after the last
  469. Xcall to
  470. X.BR dll_first ,
  471. X.BR dll_next ,
  472. X.BR dll_prev ,
  473. X.BR dll_rank ,
  474. Xor
  475. X.BR dll_search.
  476. XIf the list is sorted, the key is the next higher one in the lexical order
  477. Xof the keys stored in the list.
  478. XIf
  479. X.B dll_search
  480. Xfailed to find an item,
  481. X.B dll_next
  482. Xreturns the next item higher in the lexical order that was stored in the list.
  483. XNULL is returned if the end of the list is overrun, or if the list has been
  484. Xmodified since the last call to
  485. X.BR dll_first ,
  486. X.BR dll_next ,
  487. X.BR dll_prev ,
  488. X.BR dll_rank ,
  489. Xor
  490. X.BR dll_search.
  491. XIf an item is found, the user-defined pointer stored with the key is also
  492. Xreturned in the
  493. X.B data
  494. Xparameter.
  495. X.sp
  496. X.B dll_prev
  497. Xreturns the next item toward the beginning of the doubly-linked list after the
  498. Xlast call to
  499. X.BR dll_last ,
  500. X.BR dll_next ,
  501. X.BR dll_prev ,
  502. X.BR dll_rank ,
  503. Xor
  504. X.BR dll_search.
  505. XIf the list is sorted, the key is the next lower one in the lexical order
  506. Xof the keys stored in the list.
  507. XIf
  508. X.B dll_search
  509. Xfailed to find an item,
  510. X.B dll_prev
  511. Xreturns the next item lower in the lexical order that was stored in the list.
  512. XNULL is returned if the beginning of the list is overrun, or if the list has
  513. Xbeen modified since the last call to
  514. X.BR dll_last ,
  515. X.BR dll_next ,
  516. X.BR dll_prev ,
  517. X.BR dll_rank ,
  518. Xor
  519. X.BR dll_search.
  520. XIf an item is found, the user-defined pointer stored with the key is also
  521. Xreturned in the
  522. X.B data
  523. Xparameter.
  524. X.sp
  525. X.B dll_join
  526. Xconcatenates two lists and returns the result.  The lists can be concatenated
  527. Xonly if the following conditions are met:  Both lists are non-empty; if the
  528. Xlists are ordered, their comparison function pointers must be identical, and
  529. Xthe last item in the first list must not be lexically higher than the first
  530. Xitem in the second list; if both lists have their global data items set, then
  531. Xthey must be identical (otherwise, at most one of the global data items can
  532. Xbe set and it is added to the result).  If either list pointer is NULL, then
  533. Xthe other list is returned.  If one list is empty and the other list's global
  534. Xdata item is set, then the non-empty list is returned with its global data
  535. Xitem set to the second list's global data item.  In any case, both parameters
  536. Xpassed to
  537. X.B dll_join
  538. Xshould be considered invalid after the call, and only its return value should
  539. Xbe used.  List handles are destroyed as appropriate.
  540. X.sp
  541. X.B dll_rank
  542. Xreturns the key in the doubly-linked list that falls in the
  543. X.BR rank th
  544. Xposition in the list.
  545. XThe
  546. X.B rank
  547. Xparameter is zero-based.
  548. XNULL is returned if the specified rank is less than 0 or greater or equal to
  549. Xthe number of keys stored in the list.
  550. XIf the call succeeds, the list is left in a state such that
  551. X.B dll_next
  552. Xand
  553. X.B dll_prev
  554. Xbehave as expected.  The user-defined pointer stored with the key is also
  555. Xreturned in the
  556. X.B data
  557. Xparameter.
  558. X.sp
  559. X.B dll_delRank
  560. Xdeletes the key stored in the specified position in the doubly-linked list.
  561. XThe value returned is the same as that passed to
  562. X.BR dll_insert ,
  563. X.BR dll_pushf ,
  564. Xor
  565. X.B dll_pushr
  566. Xwhen the item was inserted, or NULL if the specified
  567. X.B rank
  568. Xis invalid.
  569. X.B rank
  570. Xis zero-based, and must be less than the number of keys stored in the list.
  571. XThe user-defined pointer stored with the key is also returned in the
  572. X.B data
  573. Xparameter.
  574. X.sp
  575. X.B dll_data
  576. Xreturns a client-defined pointer that is stored in the list handle.  This
  577. Xpointer is set by calling
  578. X.BR dll_setData .
  579. XThis pointer is otherwise unused by the doubly-linked list implementation,
  580. Xbut is useful for storing data with the list as a whole.
  581. X.sp
  582. X.B dll_setData
  583. Xsets a list's global pointer that is returned by
  584. X.BR dll_data .
  585. X.sp
  586. X.B dll_pushf
  587. Xinserts an item at the beginning of an unsorted list.  It returns the
  588. X.B key
  589. Xparameter if it is successful, NULL otherwise.
  590. X.sp
  591. X.B dll_pushr
  592. Xinserts an item at the back of an unsorted list.  It returns the
  593. X.B key
  594. Xparameter if it is successful, NULL otherwise.
  595. X.sp
  596. X.B dll_push
  597. Xinserts an item at one end of an unsorted list.
  598. XIf DLL_FRONT is passed as the
  599. X.B where
  600. Xparameter, the item is pushed onto the front of the list.
  601. XIf DLL_BACK is passed as the
  602. X.B where
  603. Xparameter, the item is pushed onto the back of the list.  It returns the
  604. X.B key
  605. Xparameter if it is successful, NULL otherwise.
  606. X.sp
  607. X.B dll_popf
  608. Xdeletes an item from the beginning of a list, returning the key stored when
  609. Xthe item was inserted.  The data stored with the key is returned in the
  610. X.B data
  611. Xparameter.
  612. X.sp
  613. X.B dll_popr
  614. Xdeletes an item from the back of a list, returning the key stored when the
  615. Xitem was inserted.  The data stored with the key is returned in the
  616. X.B data
  617. Xparameter.
  618. X.sp
  619. X.B dll_pop
  620. Xdeletes an item from one end of a list, returning the key stored when the
  621. Xitem was inserted.  The data stored with the key is returned in the
  622. X.B data
  623. Xparameter.
  624. XIf DLL_FRONT is passed as the
  625. X.B where
  626. Xparameter, the item is deleted from the front of the list.
  627. XIf DLL_BACK is passed as the
  628. X.B where
  629. Xparameter, the item is deleted from the back of the list.
  630. X.sp
  631. X.B dll_peekf
  632. Xreturns the key stored at the beginning of the list, without modifying the
  633. Xstate of the list in any way.  It differs from
  634. X.B dll_first
  635. Xin that it does not affect subsequent calls to
  636. X.B dll_next
  637. Xor
  638. X.BR dll_prev .
  639. XThe data stored with the key is returned in the
  640. X.B data
  641. Xparameter.
  642. X.sp
  643. X.B dll_peekr
  644. Xreturns the key stored at the back of the list, without modifying the
  645. Xstate of the list in any way.  It differs from
  646. X.B dll_last
  647. Xin that it does not affect subsequent calls to
  648. X.B dll_next
  649. Xor
  650. X.BR dll_prev .
  651. XThe data stored with the key is returned in the
  652. X.B data
  653. Xparameter.
  654. X.sp
  655. X.B dll_peek
  656. Xreturns the key stored at one end of the list, without modifying the
  657. Xstate of the list in any way.  If DLL_FRONT is passed as the
  658. X.B where
  659. Xparameter, the key at the beginning of the list is returned.  If DLL_BACK
  660. Xis passed as the
  661. X.B where
  662. Xparameter, the key at the back of the list is returned.
  663. XThis call does not affect subsequent calls to
  664. X.B dll_next
  665. Xor
  666. X.BR dll_prev .
  667. XThe data stored with the key is returned in the
  668. X.B data
  669. Xparameter.
  670. X.sp
  671. X.B NOTE:
  672. XNULL can safely be passed as the
  673. X.B data
  674. Xparameter in any of the access functions
  675. X.RB ( dll_search ,
  676. X.BR dll_first ,
  677. X.BR dll_next ,
  678. X.BR dll_last ,
  679. X.BR dll_peek ,
  680. X.BR dll_peekf ,
  681. X.BR dll_peekr ,
  682. X.BR dll_prev ,
  683. Xor
  684. X.BR dll_rank )
  685. Xor deletion functions
  686. X.RB ( dll_pop ,
  687. X.BR dll_popf ,
  688. X.BR dll_popr ,
  689. X.BR dll_delete ,
  690. Xor
  691. X.BR dll_delRank ).
  692. X.sp
  693. XWorst case performance characteristics are listed below.
  694. XHere, "n" is the number of items stored in the list.
  695. X.RS
  696. Xdll_search:    O(n)
  697. X.br
  698. Xdll_new:        O(1)
  699. X.br
  700. Xdll_destroy:    O(n)
  701. X.br
  702. Xdll_insert:    O(n)
  703. X.br
  704. Xdll_pushf:    O(1)
  705. X.br
  706. Xdll_pushr:    O(1)
  707. X.br
  708. Xdll_push:    O(1)
  709. X.br
  710. Xdll_delete:    O(n)
  711. X.br
  712. Xdll_popf:    O(1)
  713. X.br
  714. Xdll_popr:    O(1)
  715. X.br
  716. Xdll_pop:    O(1)
  717. X.br
  718. Xdll_traverse:    O(n)
  719. X.br
  720. Xdll_next:        O(1)
  721. X.br
  722. Xdll_prev:        O(1)
  723. X.br
  724. Xdll_first:        O(1)
  725. X.br
  726. Xdll_last:        O(1)
  727. X.br
  728. Xdll_rank:    O(n)
  729. X.br
  730. Xdll_delRank:    O(n)
  731. X.br
  732. Xdll_peekf:    O(1)
  733. X.br
  734. Xdll_peekr:    O(1)
  735. X.br
  736. Xdll_peek:    O(1)
  737. X.br
  738. Xdll_data:    O(1)
  739. X.br
  740. Xdll_setData:    O(1)
  741. X.RE
  742. X.SH BUGS
  743. XThis implementation has not been tested on nearly
  744. Xenough platforms.
  745. X.sp
  746. X.B dll_dump
  747. Xassumes that pointers are the same size as integers, and that they can be
  748. Xdisplayed in total in eight hexidecimal digits.
  749. X.sp
  750. X.B dll_destroy
  751. Xdoes not touch the list's global data pointer, i.e. the pointer returned by
  752. X.BR dll_data .
  753. XIf this pointer is used, the client must explicitly free any data.
  754. END_OF_src/list/dlist.man
  755. if test 16973 -ne `wc -c <src/list/dlist.man`; then
  756.     echo shar: \"src/list/dlist.man\" unpacked with wrong size!
  757. fi
  758. # end of overwriting check
  759. fi
  760. echo shar: End of archive 8 \(of 10\).
  761. cp /dev/null ark8isdone
  762. MISSING=""
  763. for I in 1 2 3 4 5 6 7 8 9 10 ; do
  764.     if test ! -f ark${I}isdone ; then
  765.     MISSING="${MISSING} ${I}"
  766.     fi
  767. done
  768. if test "${MISSING}" = "" ; then
  769.     echo You have unpacked all 10 archives.
  770.     echo "Now edit common.mk and do a 'make all'"
  771.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  772. else
  773.     echo You still need to unpack the following archives:
  774.     echo "        " ${MISSING}
  775. fi
  776. ##  End of shell archive.
  777. exit 0
  778.  
  779.