home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / FLEXLIST.ZIP / FLEXLIST.H < prev    next >
Text File  |  1989-07-20  |  2KB  |  83 lines

  1.     /*
  2.  
  3.         flexlist.h
  4.  
  5.         Copyright 1989
  6.         John W. Small
  7.         All rights reserved
  8.  
  9.         PSW / Power SoftWare
  10.         P.O. Box 10072
  11.         McLean, Virginia 22102 8072
  12.         (703) 759-3838
  13.  
  14.         1/14/89
  15.  
  16.     */
  17.  
  18.     #include    <stddef.h>      /*  size_t  */
  19.  
  20.     typedef int FlistData;      /* force host alignment */
  21.  
  22.  
  23.  
  24.     typedef struct FlistNode  *FlistN;
  25.  
  26.     struct  FlistNode {
  27.       FlistN        next, prev;
  28.       FlistData     data;
  29.     };
  30.  
  31.  
  32.  
  33.     struct FlistHeader  {
  34.       FlistN    front,  current, rear;
  35.       unsigned  ncurrent, nodes;
  36.       size_t    ndlen, hdlen;
  37.       FlistData data;
  38.     };
  39.  
  40.     typedef struct  FlistHeader *Flist;
  41.  
  42.  
  43.  
  44.     /* housekeeping primitives */
  45.  
  46.     Flist       mkFlist     (size_t  ndsize, size_t  hdsize);
  47.     int         clrFlist    (Flist lptr);
  48.     int         rmFlist     (Flist *lptrAddr);
  49.     unsigned    nempty      (Flist lptr);
  50.     void       *Flistdptr   (Flist lptr);
  51.  
  52.     /* stack and queue primitives */
  53.  
  54.     void       *pushdptr    (Flist lptr, void *bufAddr);
  55.     int         pushn       (Flist lptr, FlistN nptr);
  56.     int         popd        (Flist lptr, void *bufAddr);
  57.     FlistN      popn        (Flist lptr);
  58.     void       *topdptr     (Flist lptr, void *bufAddr);
  59.     void       *iquedptr    (Flist lptr, void *bufAddr);
  60.     int         iquen       (Flist lptr, FlistN nptr);
  61.  
  62.     /* current node primitives */
  63.  
  64.     unsigned    ncur        (Flist lptr);
  65.     void       *curdptr     (Flist lptr);
  66.     void       *mkcdptr     (Flist lptr, unsigned loc);
  67.  
  68.     /* list primitives */
  69.  
  70.     void       *insdptr     (Flist lptr, void *bufAddr);
  71.     int         insn        (Flist lptr, FlistN nptr);
  72.     int         deld        (Flist lptr, void *bufAddr);
  73.     FlistN      deln        (Flist lptr);
  74.     void       *nextdptr    (Flist lptr, void *bufAddr);
  75.     void       *prevdptr    (Flist lptr, void *bufAddr);
  76.     int         getd        (Flist lptr, void *bufAddr);
  77.     int         putd        (Flist lptr, void *bufAddr);
  78.  
  79.     /* array primitives */
  80.  
  81.     int   stod  (Flist lptr, void *bufAddr, unsigned loc);
  82.     int   rcld  (Flist lptr, void *bufAddr, unsigned loc);
  83.