home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / CPROG / FLEXLIST.ZIP / FLEXLIST.HTX < prev    next >
Text File  |  1989-09-28  |  57KB  |  1,544 lines

  1.  
  2.  
  3.  
  4.  
  5.         flexlist.htx
  6.         Copyright  1989, John W. Small, All rights reserved
  7.         PSW / Power SoftWare, P.O. Box 10072
  8.         McLean, Virginia 22102 8072
  9.         (703) 759-3838
  10.         7/26/89
  11.  
  12. manual
  13.         Copyright  1989, John W. Small, All rights reserved
  14.  
  15.  
  16.         Welcome to the FlexList hypertext manual!
  17.  
  18.         See:
  19.  
  20.             Introduction intro
  21.  
  22.             Programming with FlexList programming
  23.  
  24.             FlexList Primitives primitives
  25.  
  26.             Common Mistakes mistakes
  27.  
  28.  
  29.         If you acquired the FlexList ToolBox through 'shareware'
  30.         and find it useful, a registration fee of $49.95 would
  31.         be appreciated.  Upon registion you will be sent a 50+
  32.         page manual, the latest example programs and precompiled
  33.         libraries, and notices of updates.
  34.  
  35.             PSW, P.O. Box 10072, McLean, VA 22102 8072
  36. intro
  37.  
  38.  
  39.  
  40.           Introduction
  41.  
  42.  
  43.         FlexList builds doubly linked lists flexlist of any type data.
  44.         A unique stack-queue-list-array hybrid data structure is
  45.         utilized thus enabling a flexlist to be accessed as an array,
  46.         pushed and popped like a stack, or queued and dequeued like a
  47.         queue.  A flexlist can even be made to contain global data global
  48.         for the list.  FlexList primitives also allow direct pointer dptr
  49.         access to data in nodes as well as the unlinking and relinking FlistN
  50.         of nodes within or between flexlists.  Since all primitives primitives
  51.         are generic, any type of data can be stored in a flexlist.
  52.         Lists of lists and variant record nodes can be easily
  53.         constructed with FlexList.
  54.  
  55.  
  56.  
  57.  
  58.         What does all this mean?  You don't have to code any linked
  59.         lists, or be bothered with pointers or dynamic memory
  60.         allocation again.  The FlexList toolbox handles it all.  And
  61.         no matter how many different types of stacks, queues, or
  62.         lists your application has, the one set of generic primitives
  63.         operates on them all.  The complete set of FlexList
  64.         primitives compiles to less than 3 Kbytes with Turbo C's
  65.         small memory model.  There's no magic involved; full
  66.         Draft-Proposed ANSI C source code is provided allowing
  67.         compilation with any compatible C compiler on any machine.
  68.  
  69. programming
  70.  
  71.         Progamming with FlexList is easy!  Consider the following
  72.         program that reverses a string via a stack.  The six
  73.         hyperlinks on your screen cover the six points to keep in
  74.         mind when programming with FlexList
  75.  
  76.         #include <stdio.h>
  77.         #include <flexlist.h> step1
  78.  
  79.         main ()
  80.         {
  81.             Flist s; step2
  82.             int c;
  83.  
  84.             if ((s = mkFlist(sizeof(c),0)) step3 != (Flist) 0)  {
  85.                 while ((c = getchar()) != '\n')
  86.                     pushdptr(s,&c); step4
  87.                 while (popd(s,&c) step5)
  88.                     putchar(c);
  89.                 rmFlist(&s); step6
  90.             }
  91.         }
  92. step1
  93.  
  94.  
  95.  
  96.         Include the FlexList header file in your application:
  97.  
  98.             #include <flexlist.h> |view flexlist.h
  99.  
  100.         Link your compiled application's object module(s) with the
  101.         FlexList object module compiled from flexlist.c |view flexlist.c or preferably
  102.         with the FlexList library installed by the installation
  103.         program.
  104. step2
  105.  
  106.  
  107.  
  108.         Declare your stack, queue, or list as type Flist, e.g.
  109.  
  110.             Flist Flist myStack, myQueue, myList;
  111. step3
  112.  
  113.  
  114.  
  115.         Before using a FlexList you must activate it for the type of
  116.         data you will be storing in the FlexList nodes FlistNode and header FlistHeader with
  117.         a call to mkFlist() mkFlist.
  118. step4
  119.  
  120.  
  121.  
  122.         Now you are ready to operate on your FlexLists flexlist.
  123.  
  124.         See FlexList Primitives primitives.
  125. step5
  126.  
  127.  
  128.  
  129.         Each FlexList primitive returns an integer or pointer dptr that can
  130.         be interpreted as a boolean value indicating success or failure
  131.         of the primitive.  The following code pops all nodes off the
  132.         queue.
  133.  
  134.             while ( popd popd ( myQueue, (char *) 0) );
  135.  
  136. step6
  137.  
  138.         After you are finished with a FlexList or before you begin using
  139.         it for a different type of data you must deactivate it with a
  140.         call to rmFlist(), e.g.
  141.  
  142.             rmFlist rmFlist ( & myStack );
  143. mistakes
  144.  
  145.  
  146.  
  147.         Some common coding mistakes are listed below.
  148.  
  149.  
  150.         1.  Passing an address bufAddr for an item other than the type the
  151.             FlexList was activated for could corrupt data and/or
  152.             crash the program.  Suppose you popd() popd a node into a
  153.             local variable of a shorter data length.  This would
  154.             corrupt other data on C's stack, perhaps the return
  155.             address from that function.  If the address passed is
  156.             the item instead of its address then the item's contents
  157.             will be wrongly interpreted as an address resulting in
  158.             the copying of garbage from a wrong address or good data
  159.             to a wrong address.
  160.  
  161.  
  162.  
  163.  
  164.         2.  Failing to deactivate a FlexList with rmFlist() rmFlist before
  165.             reactivating it with mkFlist() mkFlist would prevent the memory
  166.             allocated to the old structure's header FlistHeader and any remaining
  167.             nodes FlistNode from being returned to the heap.
  168.  
  169.         3.  Using a FlexList before activating it with mkFlist()
  170.             would cause FlexList primitives to interpret the memory
  171.             pointed to by the Flist variable Flist, e.g. Flist myStack, as
  172.             the FlexList control block.  Since FlexList primitives
  173.             read and write to this control block FlistHeader there's no telling
  174.             what might happen.
  175.  
  176.  
  177.  
  178.  
  179.         4.  Porting FlexList to a host machine without changing
  180.             FlistData |view flexlist.h 20 in flexlist.h to the most restrictive alignment
  181.             type required by the host would cause errors when
  182.             returning from FlexList primitives returning data
  183.             pointers, i.e. suffix "dptr" dptr, to nodal and
  184.             global data areas if those data types are more
  185.             restrictive in their alignment requirements.
  186.  
  187. primitives
  188.  
  189.         FlexList primitives can be divided into five logical catagories:
  190.  
  191.             Housekeeping            Stack and Queue
  192.  
  193.                 mkFlist mkFlist                    pushdptr pushdptr
  194.                 clrFlist clrFlist                pushn pushn
  195.                 rmFlist rmFlist                 popd popd
  196.                 nempty nempty                  topdptr topdptr
  197.                 Flistdptr Flistdptr               iquedptr iquedptr
  198.  
  199.             List                    Current Node
  200.  
  201.                 insdptr insdptr                    ncur cur
  202.                 insn insn                    curdptr curdptr
  203.                 deld deld                    mkcdptr mkcdptr
  204.                 deln deln
  205.                 nextdptr nextdptr            Array
  206.                 prevdptr prevdptr
  207.                 getd getd                    stod stod
  208.                 putd putd                    rcld rcld
  209.  
  210.         View:   flexlist.h |view flexlist.h                flexlist.c |view flexlist.c
  211. Flist
  212.  
  213.  
  214.  
  215.         FlexLists are defined as type Flist, e.g.
  216.  
  217.             Flist myList;
  218.  
  219.         MyList is really a pointer to a FlexList header FlistHeader.  To see
  220.         this you should find the following typedef statement in
  221.         flexlist.h:
  222.  
  223.             typedef struct FlistHeader *Flist; |view flexlist.h 40
  224.  
  225.         The Flist variable identifies which object the FlexList
  226.         primitives will operate on.  It will always be the first
  227.         parameter in any FlexList primitive's formal parameter
  228.         list except for mkFlist() mkFlist which returns this pointer to
  229.         a newly allocated FlexList and rmFlist() rmFlist which requires
  230.         the address of a Flist variable as its first formal
  231.         parameter.
  232. FlistNode
  233.  
  234.  
  235.  
  236.         A FlexList node has both next and previous node pointers.
  237.         The data field is a variable length field whose length is
  238.         determined by ndlen FlistHeader in FlistHeader.  The type FlistN FlistN points
  239.         to the whole node starting at the next field.  Void pointers
  240.         returned by primitives with the suffix "dptr dptr" point to the
  241.         start of the data field.
  242.  
  243.  
  244.                 struct FlistNode |view flexlist.h 26
  245.  
  246.                 --------
  247.                 ! next ! --->
  248.                 !------!
  249.            <--- ! prev !
  250.                 !------!
  251.                 ! data !
  252.                 !      !
  253.                 !      !
  254.                 --------
  255. FlistHeader
  256.  
  257.  
  258.         FlistHeader |view flexlist.h 33 is the control block for a FlexList flexlist.
  259.  
  260.             ----------------
  261.             ! front        ! --->  points to first node in list
  262.             !--------------!
  263.             ! current current      ! --->  points to last node accessed
  264.             !--------------!
  265.             ! rear         ! --->  points to rear node in list
  266.             !--------------!
  267.             ! ncurrent     !       number of the current node
  268.             !--------------!
  269.             ! nodes        !       number of nodes in list
  270.             !--------------!
  271.             ! ndlen        !       length of data field in node
  272.             !--------------!
  273.             ! hdlen        !       length of data field in header
  274.             !--------------!
  275.             ! data global         !       global data for the list
  276.             !              !
  277.             ----------------
  278. flexlist
  279.  
  280.  
  281.  
  282.         General Structure
  283.  
  284.         A doubly linked list is used to implement a FlexList.  Actually
  285.         this list is a unique hybrid stack-queue-list-array generic
  286.         data structure.  Since all FlexList primitives preserve this
  287.         "s-q-l-a" hybrid structure they can be used interchangeably on
  288.         any FlexList.  Thus a FlexList can be treated as a stack, queue,
  289.         list, or even an array once it has nodes in it.
  290.  
  291.         Node sizes are determined when a FlexList is activated, thus a
  292.         FlexList can be made to hold any type of data at runtime.  In
  293.         fact FlexList variables themselves can be created at runtime.
  294.  
  295.         Data, global to a list, can also be defined when a FlexList is
  296.         activated. (see mkFlist() mkFlist).
  297.  
  298.         A typical FlexList is shown on the next page.
  299.  
  300.       --------------                     ----------------------
  301.       !  myList    !  (Flist Flist)            !   myListItem  29   !
  302.       --------------                     ----------------------
  303.             !
  304.             !            _________________________
  305.             !            !                       !          (FlistNode FlistNode)
  306.            \!/           !                      \!/
  307.       ----------------   !      --------      --------      --------
  308.       ! front        ! --!----> ! next ! ---> ! next ! ---> ! next ! ---!
  309.       !--------------!   !      !------!      !------!      !------!    !
  310.       ! current      ! --!  !-- ! prev ! <--- ! prev ! <--- ! prev !    !
  311.       !--------------!      !   !------!      !------!      !------!   _!_
  312.       ! rear         ! --!  !   ! data !      ! data !      ! data !   \!/
  313.       !--------------!   ! _!_  !      !      !      !      !      !    `
  314.       ! ncurrent   2 !   ! \!/  !  45  !      !  29  !      !  37  !
  315.       !--------------!   !  `   --------      --------      --------
  316.       ! nodes      3 !   !                                     ,
  317.       !--------------!   !                                    /!\
  318.       ! ndlen      2 !   !_____________________________________!
  319.       !--------------!
  320.       ! hdlen      0 !
  321.       !--------------!
  322.         data             (FlistHeader FlistHeader)        See next page for code listing!
  323.       ----------------
  324.  
  325.  
  326.  
  327.  
  328.           The data structure on the previous page is the result of
  329.           having executed the following code.
  330.  
  331.           Flist Flist myList;
  332.           int   myListItem;  /*  assume sizeof(int) == 2 bytes  */
  333.  
  334.           {
  335.             if ((myList = mkFlist mkFlist(sizeof(myListItem),0)) != NULL)  {
  336.                myListItem = 45;
  337.                pushdptr pushdptr(myList,&myListItem);
  338.                myListItem = 37;
  339.                iquedptr iquedptr(myList,&myListItem);
  340.                mkcdptr mkcdptr(myList,1);
  341.                myListItem = 29;
  342.                insdptr insdptr(myList,&myListItem);
  343.             }
  344.           }
  345.  
  346. bufAddr
  347.  
  348.  
  349.  
  350.         Notice the formal parameter: "void *bufAddr" as found in:
  351.  
  352.             void *pushdptr pushdptr(Flist lptr, void *bufAddr);
  353.  
  354.         This parameter contains the address of the data to be pushed.
  355.         This is a untyped pointer, i.e. "void *."  The buffer is in
  356.         effect being called by reference but without a type specified.
  357.         This feature allows FlexList primitives to be generic.  The
  358.         newly allocated node FlistNode is sized by pushdptr() to accommodate the
  359.         data in the buffer.  Remember when a FlexList is activated with
  360.         mkFlist() mkFlist you have to specify the size of the data to be stored
  361.         in the nodes.  This value is recorded in the header FlistHeader, struct
  362.         FlistHeader, pointed to by the first parameter: "Flist Flist lptr."
  363.         Moral: pushdptr() knows how big to make the new node and how many
  364.         bytes to copy from the address, "void *bufAddr", but you the
  365.         programmer must give the address of the proper type of data!
  366.         With power comes responsibility!
  367.  
  368.  
  369.  
  370.  
  371.         Please note that when present, "void *bufAddr" will always be the
  372.         second formal parameter of a primitive with a suffix of "d" or
  373.         "dptr dptr".
  374.  
  375.         If you want to create a dummy node (one containing garbage) or
  376.         destroy a node and discard its contents then call the desired
  377.         primitive with "void *bufAddr" assigned to NULL.
  378.  
  379. dptr
  380.  
  381.  
  382.  
  383.         Pointers to the data in FlexList nodes are returned by primitives
  384.         named with the suffix "dptr".  Using these data pointers to
  385.         manipulate the data within the nodes is much quicker then copying
  386.         the data from the node, modifying it, and then copying it back.
  387.         You must consider the nature of you application to decide if the
  388.         use of data pointers would prove to be beneficial.
  389.  
  390.         Let's look at nextdptr():
  391.  
  392.             void *nextdptr nextdptr(Flist lptr, void *bufAddr);
  393.  
  394.         Nextdptr() returns a typeless pointer, i.e. "void *", to the data
  395.         area of the next node of the list.  This pointer can be used in a
  396.         boolean test to see if nextdptr() was successful in finding a next
  397.         node or simply ignored.
  398.  
  399.  
  400.  
  401.  
  402.         To see how this pointer would be useful otherwise consider the
  403.         call:
  404.  
  405.             dptr = nextdptr(myList,NULL);
  406.  
  407.         where dptr is a pointer to myListItem.  The NULL tells nextdptr()
  408.         not to copy the contains of the next node to a buffer.  After the
  409.         call dptr points to the next node's data area FlistNode so that you can
  410.         directly manipulate the data in the node without having to copy
  411.         it back and forth between the node and a buffer.  Again, you the
  412.         programmer must insure that dptr is an appropriate type pointer.
  413. global
  414.  
  415.  
  416.  
  417.         Global data for a list is accessed in a manner similar to node
  418.         data via primitives ending in "dptr dptr."  In fact the only way to
  419.         access global data for the list FlistHeader is with the primitive:
  420.  
  421.             void *Flistdptr Flistdptr ( Flist lptr );
  422.  
  423.         After the list has been allocated with mkFlist() mkFlist, the global data
  424.         will contain garbage until you the programmer write to it.  The
  425.         following code segment illustrates.
  426.  
  427.             Flist myList;
  428.             struct  { ??? } myListItem;
  429.             struct  { ??? } myListGlobal, *myListGlobalPtr;
  430.             {
  431.                 myList = mkFlist(sizeof(myListItem),sizeof(myListGlobal));
  432.                 myListGlobalPtr = Flistdptr(myList);
  433.                 ...
  434.             }
  435.  
  436.         Use myListGlobalPtr to initialize the global data area of myList.
  437. FlistN
  438.  
  439.  
  440.  
  441.         FlistN is a pointer to a dangling FlistNode FlistNode.  A node is dangling
  442.         when it momentarily does not belong to any FlexList.  FlistN is
  443.         declared in flexlist.h as:
  444.  
  445.             typedef struct FlistNode *FlistN; |view flexlist.h 24
  446.  
  447.         The following code segment will remove the current current node from
  448.         srclist making the previous node current, and insert this dangling
  449.         node into dstlist after its current node making the newly inserted
  450.         node current.
  451.  
  452.             insn insn ( dstlist, deln deln ( srclist ) );
  453.  
  454.  
  455.  
  456.  
  457.  
  458.         The node is simply unlinked from srclist and relinked into dstlist
  459.         thus saving the time required to first deallocate the node in
  460.         srclist after copying its data to a buffer, then reallocating a
  461.         new node in dstlist, and finally copying the data back from the
  462.         buffer into the new node.
  463.  
  464.         All FlexList primitives that deal with the unlinking and relinking
  465.         of nodes have the suffix "n".  Again, you the programmer must
  466.         insure when moving nodes between FlexLists that the data types
  467.         are compatible.
  468.  
  469. current
  470.  
  471.  
  472.  
  473.         Current Node Concept
  474.  
  475.         Inherent to the list structure is the notion of a current node.
  476.         You can insert after the current node making the new node current,
  477.         delete the current node making the previous node current, or
  478.         move to the next or previous node relative to the current node,
  479.         etc.
  480.  
  481.         Stack and queue primitives do not disturb the current node.
  482.         Suppose the current node is the fifth node in the list.  After
  483.         popping the top node the current node will be the fourth node.
  484.         If you pop the current node then the current node becomes
  485.         undefined.
  486.  
  487.  
  488.  
  489.  
  490.         Array primitives (stod() and rcld()) set the current node as the
  491.         most recently accessed node.  When randomly accessing a list,
  492.         mkcdptr() mkcdptr is called by both stod() and rcld() to make the
  493.         requested node current.  Mkcdptr() determines which pointer
  494.         (front, current, or rear FlistHeader) is closest to the requested node then
  495.         follows the list's linkage to the newly requested node leaving
  496.         the current pointer positioned on the new node.  This algorithm
  497.         was chosen to speed up random accesses over what would be
  498.         obtained with a sequential access treatment.
  499.  
  500.  
  501.  
  502.  
  503.         The number of the current node can range from zero to the number
  504.         of nodes in the list.  The nodes in the list are numbered starting
  505.         from one.  What does current node zero represent then?  If the
  506.         current node is zero then there is no current node assigned and
  507.         the current node is said to be undefined.  By using mkcdptr() to
  508.         set the current node as undefined, nextdptr() and prevdptr() can
  509.         be used to start processing the front or rear of the list
  510.         respectively.  Both nextdptr() and prevdptr() fail after reaching
  511.         the end of the list which once again sets the current node as
  512.         undefined in either case.  Thus the wrap around process can begin
  513.         anew on the next call to nextdptr() or prevdptr().
  514. 
  515.  
  516.  
  517.                        DETAIL FORM (ALPHABETICALLY)
  518. clrFlist
  519.  
  520.  
  521.  
  522.           -----------------------------------------------------------
  523.           clrFlist |view flexlist.c 52                                           FlexList flexlist
  524.           -----------------------------------------------------------
  525.  
  526.           Category       housekeeping
  527.  
  528.           Function       Removes all nodes from a FlexList.
  529.  
  530.           Prototype      int  clrFlist (Flist Flist lptr);
  531.  
  532.           Returns        boolean value indicating success or failure.
  533.  
  534.           Remarks        lptr is the FlexList to clear.
  535.                          The current node current is set as undefined.
  536.                          Global data for the list is left unchanged.
  537.  
  538.  
  539.  
  540.  
  541.  
  542.           -----------------------------------------------------------
  543.           clrFlist |view flexlist.c 52                                           FlexList flexlist
  544.           -----------------------------------------------------------
  545.  
  546.           See also       rmFlist() rmFlist
  547.  
  548.           Example        Flist myStack;
  549.                          struct { ??? } myStackItem;
  550.  
  551.                          {
  552.                            myStack = mkFlist(sizeof(myStackItem),0);
  553.                            ...
  554.                            clrFlist(myStack);
  555.                            ...
  556.                          }
  557. curdptr
  558.  
  559.  
  560.  
  561.           -----------------------------------------------------------
  562.           curdptr |view flexlist.c 239                                            FlexList flexlist
  563.           -----------------------------------------------------------
  564.  
  565.           Category       current node current
  566.  
  567.           Function       Return a pointer to the data in the current
  568.                          node or NULL if there is no node current.
  569.  
  570.           Prototype      void * dptrcurdptr (Flist Flist lptr);
  571.  
  572.           Remarks        lptr is the FlexList to query.
  573.  
  574.           See also       mkcdptr() mkcdptr, ncur() ncur
  575.  
  576.           Example        see stod() stod
  577.  
  578. deld
  579.  
  580.  
  581.  
  582.           -----------------------------------------------------------
  583.           deld |view flexlist.c 359                                               FlexList flexlist
  584.           -----------------------------------------------------------
  585.  
  586.           Category       list
  587.  
  588.           Function       Delete the current node current after copying its
  589.                          contents to bufAddr.  If  bufAddr is NULL
  590.                          discard the data with the node.  Make the
  591.                          previous node current.  If there is no
  592.                          previous node then set current node as
  593.                          undefined but report the success of the
  594.                          deletion.  If there is no current node to
  595.                          begin with the deletion obviously fails.
  596.  
  597.           Prototype      int  deld (Flist Flist lptr, void *bufAddr bufAddr);
  598.  
  599.           Returns        boolean value indicating success or failure.
  600.  
  601.  
  602.  
  603.  
  604.  
  605.           -----------------------------------------------------------
  606.           deld |view flexlist.c 359                                               FlexList flexlist
  607.           -----------------------------------------------------------
  608.  
  609.           Remarks        lptr is the FlexList to operate on.
  610.                          bufAddr is the untyped parameter called by
  611.                          reference.  The address passed is the address
  612.                          of the item to copy the data to.  If bufAddr
  613.                          is NULL no data is copied.
  614.  
  615.           See also       insdptr() insdptr, deln() deln, getd() getd
  616.  
  617.           Example        see insdptr() insdptr
  618.  
  619.  
  620. deln
  621.  
  622.  
  623.  
  624.           -----------------------------------------------------------
  625.           deln |view flexlist.c 384                                               FlexList flexlist
  626.           -----------------------------------------------------------
  627.  
  628.           Category       list
  629.  
  630.           Function       Unlink the current node current from the list and
  631.                          return a pointer to this dangling node.  Make
  632.                          the previous node current.  If there is no
  633.                          previous node then set current node as
  634.                          undefined but report the success of the
  635.                          unlinking.  If there is no current node to
  636.                          begin with the unlinking obviously fails.
  637.                          A node is said to be dangling when it
  638.                          momentarily does not belong to any FlexList.
  639.  
  640.           Prototype      FlistN FlistN  deln (Flist Flist lptr);
  641.  
  642.           Returns        pointer to the dangling node or NULL if deln()
  643.                          fails.
  644.  
  645.  
  646.  
  647.  
  648.           -----------------------------------------------------------
  649.           deln |view flexlist.c 384                                               FlexList flexlist
  650.           -----------------------------------------------------------
  651.  
  652.           Remarks        lptr is the FlexList to extract the node from.
  653.  
  654.           Restrictions   Dangling nodes should only be linked into
  655.                          compatible FlexLists.  FlexLists are closely
  656.                          compatible if they both contain the same type
  657.                          of data.  They are loosely compatible if the
  658.                          data they contain is of the same length in
  659.                          bytes.  In the case of loosely compatible
  660.                          types some form of tag field would need to be
  661.                          maintained in the data to allow the
  662.                          application to differentiate between the data
  663.                          types.
  664.  
  665.           See also       insn() insn, pushn() pushn, iquen() iquen, popn() popn, deld() deld
  666.  
  667.           Example        see insn() insn
  668.  
  669. Flistdptr
  670.  
  671.  
  672.  
  673.           -----------------------------------------------------------
  674.           Flistdptr |view flexlist.c 83                                          FlexList flexlist
  675.           -----------------------------------------------------------
  676.  
  677.           Category       housekeeping
  678.  
  679.           Function       Return pointer to global data for a list.
  680.  
  681.           Prototype      void * globalFlistdptr (Flist Flist lptr);
  682.  
  683.           Remarks        lptr is the FlexList to inspect.
  684.  
  685.           Example        see chapter 4, "Global Data for a List"
  686.  
  687.  
  688. getd
  689.  
  690.  
  691.  
  692.           -----------------------------------------------------------
  693.           getd |view flexlist.c 451                                               FlexList flexlist
  694.           -----------------------------------------------------------
  695.  
  696.           Category       list
  697.  
  698.           Function       Read the contents of the current node current.
  699.  
  700.           Prototype      int getd (Flist Flist lptr, void *bufAddr bufAddr);
  701.  
  702.           Returns        boolean value indicating success or failure.
  703.  
  704.           Remarks        lptr is the FlexList to read from.
  705.                          bufAddr is the untyped parameter called by
  706.                          reference.  The address passed is the address
  707.                          of item to which the node's contents will be
  708.                          copied to.
  709.  
  710.  
  711.  
  712.  
  713.  
  714.           -----------------------------------------------------------
  715.           getd |view flexlist.c 451                                               FlexList flexlist
  716.           -----------------------------------------------------------
  717.  
  718.           See also       putd() putd, curdptr() curdptr
  719.  
  720.           Example        Flist myList;
  721.                          int i, j;
  722.                          {
  723.                            myList = mkFlist(sizeof(int),0);
  724.                            for (i=1;i<=10,i++)
  725.                              iquedptr(myList,&i);
  726.                            for (i=1;mkcdptr(myList,i);i++)  {
  727.                              getd(myList,&j);
  728.                              printf("\n  %d",j);
  729.                            }
  730.                            rmFlist(&myList);
  731.                          }
  732.  
  733. insdptr
  734.  
  735.  
  736.  
  737.           -----------------------------------------------------------
  738.           insdptr |view flexlist.c 300                                            FlexList flexlist
  739.           -----------------------------------------------------------
  740.  
  741.           Category       list
  742.  
  743.           Function       Insert new node after current node current and copy
  744.                          the data pointed to by bufAddr to it.  If
  745.                          bufAddr is NULL then go ahead and insert the
  746.                          node but don't copy anything to it.  Make the
  747.                          new node current.  If the current node is
  748.                          undefined insert the new node at the front of
  749.                          the list.
  750.  
  751.           Prototype      void * dptrinsdptr (Flist Flist lptr, void *bufAddr bufAddr);
  752.  
  753.           Returns        pointer to the data area of the newly
  754.                          inserted node.  If the function fails then
  755.                          NULL is returned.
  756.  
  757.  
  758.  
  759.  
  760.  
  761.           -----------------------------------------------------------
  762.           insdptr |view flexlist.c 300                                            FlexList flexlist
  763.           -----------------------------------------------------------
  764.  
  765.           Remarks        lptr is the FlexList to operate on.
  766.                          bufAddr is the untyped parameter called by
  767.                          reference.  The address passed is the address
  768.                          of the item to insert.
  769.  
  770.           See also       deld() deld, insn() insn, putd() putd
  771.  
  772.  
  773.  
  774.  
  775.  
  776.           -----------------------------------------------------------
  777.           insdptr |view flexlist.c  300                                            FlexList flexlist
  778.           -----------------------------------------------------------
  779.  
  780.           Example        Flist myList;
  781.                          struct { ??? } myListItem;
  782.                          {
  783.                            myList = mkFlist(sizeof(myListItem),0);
  784.                            myListItem.? = ???;  /* etc. */
  785.                            insdptr(myList,&myListItem);
  786.                            ...
  787.                            deld(myList,&myListItem);
  788.                            ...
  789.                          }
  790.  
  791. insn
  792.  
  793.  
  794.  
  795.           -----------------------------------------------------------
  796.           insn |view flexlist.c 332                                               FlexList flexlist
  797.           -----------------------------------------------------------
  798.  
  799.           Category       list
  800.  
  801.           Function       Insert dangling node after current node current.  Make
  802.                          the inserted node current.  If the current
  803.                          node is undefined insert the dangling node at
  804.                          the front of the list.  In this case the front
  805.                          node of the list becomes current.  A node is
  806.                          said to be dangling when it momentarily does
  807.                          not belong to any FlexList.
  808.  
  809.           Prototype      int insn (Flist Flist lptr, FlistN FlistN nptr);
  810.  
  811.           Returns        boolean value indicating success or failure.
  812.  
  813.  
  814.  
  815.  
  816.  
  817.           -----------------------------------------------------------
  818.           insn |view flexlist.c 332                                               FlexList flexlist
  819.           -----------------------------------------------------------
  820.  
  821.           Remarks        lptr is the FlexList to insert the node into.
  822.                          nptr is a pointer to the dangling node to be
  823.                          inserted.
  824.  
  825.           Restrictions   Dangling nodes should only be linked into
  826.                          compatible FlexLists.  FlexLists are closely
  827.                          compatible if they both contain the same type
  828.                          of data.  They are loosely compatible if the
  829.                          data they contain is of the same length in
  830.                          bytes.  In the case of loosely compatible
  831.                          types some form of tag field would need to be
  832.                          maintained in the data to allow the
  833.                          application to differentiate between the data
  834.                          types.
  835.  
  836.  
  837.  
  838.  
  839.  
  840.           -----------------------------------------------------------
  841.           insn |view flexlist.c 332                                               FlexList flexlist
  842.           -----------------------------------------------------------
  843.  
  844.           See also       pushn() pushn, iquen() iquen, deln() deln, insdptr() insdptr
  845.  
  846.           Example        Flist srcList, dstList;
  847.                          struct { ??? } ListItem;
  848.                          {
  849.                            srcList = mkFlist(sizeof(ListItem),0);
  850.                            dstList = mkFlist(sizeof(ListItem),0);
  851.                            ...
  852.                            if (srcList && dstList)
  853.                               insn ( dstList, deln ( srcList ) );
  854.                            ...
  855.                          }
  856.  
  857. iquedptr
  858.  
  859.  
  860.  
  861.           -----------------------------------------------------------
  862.           iquedptr |view flexlist.c 193                                           FlexList flexlist
  863.           -----------------------------------------------------------
  864.  
  865.           Category       stack and queue
  866.  
  867.           Function       Insert item into queue.
  868.  
  869.           Prototype      void * dptriquedptr (Flist Flist lptr, void *bufAddr bufAddr);
  870.  
  871.           Returns        pointer to the data area of the queued node or
  872.                          NULL if iquedptr() fails.
  873.  
  874.  
  875.  
  876.  
  877.  
  878.           -----------------------------------------------------------
  879.           iquedptr |view flexlist.c 193                                           FlexList flexlist
  880.           -----------------------------------------------------------
  881.  
  882.           Remarks        lptr is the FlexList to queue.
  883.                          bufAddr is the untyped parameter called by
  884.                          reference.  The address passed is the address
  885.                          of the item to insert.  If bufAddr is NULL a
  886.                          new node is still queued but without any data
  887.                          being copied to it.
  888.  
  889.           See also       popd() popd, topdptr() topdptr, iquen() iquen
  890.  
  891.           Example        see topdptr() topdptr
  892.  
  893.  
  894. iquen
  895.  
  896.  
  897.  
  898.           -----------------------------------------------------------
  899.           iquen |view flexlist.c 214                                              FlexList flexlist
  900.           -----------------------------------------------------------
  901.  
  902.           Category       stack and queue
  903.  
  904.           Function       Insert dangling node into queue.
  905.  
  906.           Prototype      int iquen (Flist Flist lptr, FlistN FlistN nptr);
  907.  
  908.           Returns        boolean value indicating success or failure.
  909.  
  910.           Remarks        lptr is the FlexList to queue.
  911.                          nptr is the pointer to the dangling node to
  912.                          queue which was return by popn() or deln().
  913.  
  914.           See also       popn() popn, deln() deln, iquedptr() iquedptr
  915.  
  916.           Example        chapter 4, "Pointers to Nodes and Data"
  917.  
  918. mkcdptr
  919.  
  920.  
  921.  
  922.           -----------------------------------------------------------
  923.           mkcdptr |view flexlist.c 249                                            FlexList flexlist
  924.           -----------------------------------------------------------
  925.  
  926.           Category       current node
  927.  
  928.           Function       Make the indicated node current current and return a
  929.                          pointer to this node's data.
  930.  
  931.           Prototype      void * dptrmkcdptr (Flist Flist lptr, unsigned loc);
  932.  
  933.           Returns        pointer to current node's data or NULL if it
  934.                          fails.
  935.  
  936.  
  937.  
  938.  
  939.  
  940.           -----------------------------------------------------------
  941.           mkcdptr |view flexlist.c 249                                            FlexList flexlist
  942.           -----------------------------------------------------------
  943.  
  944.           Remarks        lptr is the FlexList to manipulate.
  945.                          loc is the number of the node to make current.
  946.                          Nodes are numbered starting at one.
  947.                          Requesting a current node outside the range of
  948.                          nodes in the FlexList resets the current node
  949.                          as undefined.  Mkcdptr() determines which
  950.                          pointer is closest to the requested node, i.e.
  951.                          front, current, or rear, and then proceeds to
  952.                          traverse the necessary links to arrive at the
  953.                          requested node.  Be sure to read "Current Node
  954.                          Concept" in chapter 4.  Mkcdptr() is called by
  955.                          stod() and rcld().
  956.  
  957.           See also       ncur() ncur, stod() stod, rcld() rcld
  958.  
  959.           Example        see putd() putd
  960.  
  961. mkFlist
  962.  
  963.  
  964.  
  965.           -----------------------------------------------------------
  966.           mkFlist |view flexlist.c 35                                            FlexList flexlist
  967.           -----------------------------------------------------------
  968.  
  969.           Category       housekeeping
  970.  
  971.           Function       Allocates and initializes the FlexList's
  972.                          control block FlistHeader.
  973.  
  974.           Prototype      Flist Flist  mkFlist (size_t ndsize, size_t hdsize);
  975.  
  976.           Returns        pointer to the control block or NULL if
  977.                          mkFlist() fails.
  978.  
  979.  
  980.  
  981.  
  982.  
  983.           -----------------------------------------------------------
  984.           mkFlist |view flexlist.c 35                                            FlexList flexlist
  985.           -----------------------------------------------------------
  986.  
  987.           Remarks        ndsize is the size of the data in bytes that
  988.                          will be stored in the nodes.  Use sizeof() to
  989.                          calculate.
  990.                          hdsize is the size of the data in bytes that
  991.                          will be stored in the control block.  This is
  992.                          a FlexList's global data size.
  993.  
  994.                          Call mkFlist() before using any FlexList
  995.                          variable to activate it for the size of the
  996.                          data item that you intend to store.
  997.  
  998.           Restrictions   A FlexList must not already be activated or
  999.                          else its control block and any nodes will
  1000.                          never be returned to the heap.
  1001.  
  1002.  
  1003.  
  1004.  
  1005.           -----------------------------------------------------------
  1006.           mkFlist |view flexlist.c 35                                            FlexList flexlist
  1007.           -----------------------------------------------------------
  1008.  
  1009.  
  1010.           See also       clrFlist() clrFlist, rmFlist() rmFlist
  1011.  
  1012.           Example        Flist myList;
  1013.                          struct { ??? } myListItem;
  1014.                          struct { ??? } myListGlobal;
  1015.                          {
  1016.                            myList = mkFlist (
  1017.                              sizeof(myListItem),sizeof(myListGlobal)
  1018.                            );
  1019.                            if (myList)  {
  1020.                               ...
  1021.                               rmFlist(&myList);
  1022.                            }
  1023.                          }
  1024.  
  1025. ncur
  1026.  
  1027.  
  1028.  
  1029.           -----------------------------------------------------------
  1030.           ncur |view flexlist.c 234                                               FlexList flexlist
  1031.           -----------------------------------------------------------
  1032.  
  1033.           Category       current node
  1034.  
  1035.           Function       Return the number of the current node current.
  1036.  
  1037.           Prototype      unsigned  ncur (Flist Flist lptr);
  1038.  
  1039.           Remarks        lptr is the FlexList of interest.
  1040.                          If the current node is undefined then zero
  1041.                          is returned.
  1042.  
  1043.           See also       curdptr() curdptr, nempty() nempty, mkcdptr() mkcdptr
  1044.  
  1045.  
  1046. nempty
  1047.  
  1048.  
  1049.  
  1050.           -----------------------------------------------------------
  1051.           nempty |view flexlist.c 78                                             FlexList flexlist
  1052.           -----------------------------------------------------------
  1053.  
  1054.           Category       housekeeping
  1055.  
  1056.           Function       Returns the number of nodes in the FlexList
  1057.                          which is also the boolean answer to the
  1058.                          question "is the FlexList not empty?" hence
  1059.                          it name.
  1060.  
  1061.           Prototype      unsigned  nempty (Flist Flist lptr);
  1062.  
  1063.           See also       ncur() ncur
  1064.  
  1065.           Example        while (nempty(myList))  /* clrFlist(myList) */
  1066.                            popd(myList,NULL);
  1067.  
  1068.  
  1069. nextdptr
  1070.  
  1071.  
  1072.  
  1073.           -----------------------------------------------------------
  1074.           nextdptr |view flexlist.c 408                                           FlexList flexlist
  1075.           -----------------------------------------------------------
  1076.  
  1077.           Category       list
  1078.  
  1079.           Function       Make the next node current current, read its contents
  1080.                          if bufAddr is not NULL, and return a pointer
  1081.                          to the node's data.
  1082.  
  1083.           Prototype      void * dptrnextdptr (Flist Flist lptr, void *bufAddr bufAddr);
  1084.  
  1085.           Remarks        lptr is the FlexList to operate on.
  1086.                          bufAddr is the untyped parameter called by
  1087.                          reference.  The address passed is the address
  1088.                          of the item to which the contents of the node
  1089.                          is copied to.  If the address is NULL then
  1090.                          no data is copied.
  1091.  
  1092.  
  1093.  
  1094.  
  1095.           -----------------------------------------------------------
  1096.           nextdptr |view flexlist.c 408                                           FlexList flexlist
  1097.           -----------------------------------------------------------
  1098.  
  1099.                          If the formerly current node is undefined
  1100.                          (zero) the first node of the list is made
  1101.                          current and its contents read.  If the
  1102.                          formerly current node is the rear of the list
  1103.                          then the current node is set as undefined and
  1104.                          the function fails.
  1105.  
  1106.           See also       prevdptr() prevdptr, mkcdptr() mkcdptr
  1107.  
  1108.  
  1109.  
  1110.  
  1111.           -----------------------------------------------------------
  1112.           nextdptr |view flexlist.c 408                                           FlexList flexlist
  1113.           -----------------------------------------------------------
  1114.  
  1115.  
  1116.           Example        Flist myList;
  1117.                          int i;
  1118.                          {
  1119.                            myList = mkFlist(sizeof(int),0);
  1120.                            for (i=1;i<=10;i++)
  1121.                              iquedptr(myList,&i);
  1122.                            while (nextdptr(myList,&i))
  1123.                              printf("\n  %d  ",i);
  1124.                            rmFlist(&myList);
  1125.                          }
  1126. popd
  1127.  
  1128.  
  1129.  
  1130.           -----------------------------------------------------------
  1131.           popd |view flexlist.c 136                                               FlexList flexlist
  1132.           -----------------------------------------------------------
  1133.  
  1134.           Category       stack and queue
  1135.  
  1136.           Function       Pop the top item off the stack - remove the
  1137.                          front item of the queue.
  1138.  
  1139.           Prototype      int  popd (Flist Flist lptr, void *bufAddr bufAddr);
  1140.  
  1141.           Returns        boolean value indicating success or failure.
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.           -----------------------------------------------------------
  1148.           popd |view flexlist.c 136                                               FlexList flexlist
  1149.           -----------------------------------------------------------
  1150.  
  1151.           Remarks        lptr is the FlexList to pop.
  1152.                          bufAddr is the untyped parameter called by
  1153.                          reference.  The address passed is the address
  1154.                          of where to pop the data to.  If bufAddr is
  1155.                          NULL then the data is discarded with the node.
  1156.  
  1157.           See also       topdptr() topdptr, pushdptr() pushdptr, iquedptr() iquedptr, popn() popn
  1158.  
  1159.           Example        see topdptr() topdptr
  1160.  
  1161. popn
  1162.  
  1163.  
  1164.  
  1165.           -----------------------------------------------------------
  1166.           popn |view flexlist.c 159                                               FlexList flexlist
  1167.           -----------------------------------------------------------
  1168.  
  1169.           Category       stack and queue
  1170.  
  1171.           Function       Pop the top node off the stack - remove the
  1172.                          front node of the queue.
  1173.  
  1174.           Prototype      FlistN FlistN  popn (Flist Flist lptr);
  1175.  
  1176.           Returns        boolean value indicating success or failure.
  1177.  
  1178.           Remarks        lptr is the FlexList to pop.
  1179.  
  1180.           See also       deln() deln, insn() insn, iquen() iquen, pushn() pushn, popd() popd
  1181.  
  1182.           Example        iquen(myStack, popn(myStack));
  1183.                          /* rolldown stack */
  1184.  
  1185. prevdptr
  1186.  
  1187.  
  1188.  
  1189.           -----------------------------------------------------------
  1190.           prevdptr |view flexlist.c 428                                           FlexList flexlist
  1191.           -----------------------------------------------------------
  1192.  
  1193.           Category       list
  1194.  
  1195.           Function       Make the previous node current current, read its
  1196.                          contents if bufAddr is not NULL, and return
  1197.                          a pointer to the node's data.
  1198.  
  1199.           Prototype      void * dptrprevdptr (Flist Flist lptr, void *bufAddr bufAddr);
  1200.  
  1201.           Remarks        lptr is the FlexList to traverse.
  1202.                          bufAddr is the untyped parameter called by
  1203.                          reference.  The address passed is the address
  1204.                          of the item to which the contents of the node
  1205.                          is copied to.  If the address is NULL then
  1206.                          no data is copied.
  1207.  
  1208.  
  1209.  
  1210.  
  1211.           -----------------------------------------------------------
  1212.           prevdptr |view flexlist.c 428                                           FlexList flexlist
  1213.           -----------------------------------------------------------
  1214.  
  1215.  
  1216.                          If the formerly current node is undefined
  1217.                          (zero) the last node of the list is made
  1218.                          current and its contents read.  If the
  1219.                          formerly current node is the front of the list
  1220.                          then the current node is set as undefined and
  1221.                          the primitive fails.
  1222.  
  1223.           See also       nextdptr() nextdptr, getd() getd, mkcdptr() mkcdptr
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.           -----------------------------------------------------------
  1230.           prevdptr |view flexlist.c 428                                           FlexList flexlist
  1231.           -----------------------------------------------------------
  1232.  
  1233.           Example        Flist myList;
  1234.                          int i;
  1235.                          {
  1236.                            myList = mkFlist(sizeof(int),0);
  1237.                            for (i=1;i<=10;i++)
  1238.                              iquedptr(myList,&i);
  1239.                            while (prevdptr(myList,&i))
  1240.                              printf("\n  %d  ",i);
  1241.                            rmFlist(&myList);
  1242.                          }
  1243.  
  1244. pushdptr
  1245.  
  1246.  
  1247.  
  1248.           -----------------------------------------------------------
  1249.           pushdptr |view flexlist.c 95                                           FlexList flexlist
  1250.           -----------------------------------------------------------
  1251.  
  1252.           Category       stack and queue
  1253.  
  1254.           Function       Push item onto stack.
  1255.  
  1256.           Prototype      void * dptrpushdptr (Flist Flist lptr, void *bufAddr bufAddr);
  1257.  
  1258.           Returns        pointer to the data in the top node of the
  1259.                          stack or NULL if pushdptr() fails.
  1260.  
  1261.           Remarks        lptr is the FlexList to push.
  1262.                          bufAddr is the untyped parameter called by
  1263.                          reference.  The address passed is the address
  1264.                          of the item to push.  If bufAddr is NULL a
  1265.                          node is still pushed but no data is copied to
  1266.                          it.
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.           -----------------------------------------------------------
  1273.           pushdptr |view flexlist.c 95                                           FlexList flexlist
  1274.           -----------------------------------------------------------
  1275.  
  1276.           See also       popd() popd, pushn() pushn
  1277.  
  1278.           Example        Flist myStack;
  1279.                          int i;
  1280.                          {
  1281.                            myStack = mkFlist(sizeof(int),0);
  1282.                            for (i=1;i<=10;i++)
  1283.                              pushdptr(myStack,&i);
  1284.                            while (nextdptr(myStack,&i))
  1285.                              printf("\n  %d  ",i);
  1286.                            rmFlist(&myStack);
  1287.                          }
  1288.  
  1289. pushn
  1290.  
  1291.  
  1292.  
  1293.           -----------------------------------------------------------
  1294.           pushn |view flexlist.c 117                                              FlexList flexlist
  1295.           -----------------------------------------------------------
  1296.  
  1297.           Category       stack and queue
  1298.  
  1299.           Function       Push node onto stack.
  1300.  
  1301.           Prototype      int pushn (Flist Flist lptr, FlistN FlistN nptr);
  1302.  
  1303.           Returns        boolean value indicating success or failure.
  1304.  
  1305.           Remarks        lptr is the FlexList to push.
  1306.                          nptr is the pointer to the dangling node to
  1307.                          push.
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.           -----------------------------------------------------------
  1314.           pushn |view flexlist.c 117                                              FlexList flexlist
  1315.           -----------------------------------------------------------
  1316.  
  1317.           See also       iquen() iquen, popn() popn, insn() insn, deln() deln, pushdptr() pushdptr,
  1318.                          and chapter 4, "Pointers to Nodes and Data"
  1319.  
  1320.           Example        /* rollup stack */
  1321.                          mkcdptr(myStack, nempty(myStack));
  1322.                          pushn(myStack, deln(myStack));
  1323.  
  1324.  
  1325. putd
  1326.  
  1327.  
  1328.  
  1329.           -----------------------------------------------------------
  1330.           putd |view flexlist.c 462                                               FlexList flexlist
  1331.           -----------------------------------------------------------
  1332.  
  1333.           Category       list
  1334.  
  1335.           Function       Write item to current node current.
  1336.  
  1337.           Prototype      int  putd (Flist Flist lptr, void *bufAddr bufAddr);
  1338.  
  1339.           Returns        boolean value indicating success or failure.
  1340.  
  1341.           Remarks        lptr is the FlexList to write to.
  1342.                          bufAddr is the untyped parameter called by
  1343.                          reference.  The address passed is the address
  1344.                          of the item to write to the current node.
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.           -----------------------------------------------------------
  1351.           putd |view flexlist.c 462                                               FlexList flexlist
  1352.           -----------------------------------------------------------
  1353.  
  1354.           See also       getd() getd, curdptr() curdptr
  1355.  
  1356.           Example        Flist myList;
  1357.                          int i;
  1358.                          {
  1359.                            myList = mkFlist(sizeof(int),0);
  1360.                            for (i=1;i<=10;i++)
  1361.                              iquedptr(myList,&i);
  1362.                            mkcdptr(myList,7);
  1363.                            if (getd(myList,&i))
  1364.                               printf("\n  %d  ",i);
  1365.                            ...
  1366.                          }
  1367.  
  1368. rcld
  1369.  
  1370.  
  1371.  
  1372.           -----------------------------------------------------------
  1373.           rcld |view flexlist.c 485                                               FlexList flexlist
  1374.           -----------------------------------------------------------
  1375.  
  1376.           Category       array
  1377.  
  1378.           Function       Recall the contents of the indicated node.
  1379.                          The indicated node becomes the new current current
  1380.                          node.
  1381.  
  1382.           Prototype      int rcld(Flist Flist lptr,void *bufAddr bufAddr,unsigned loc);
  1383.  
  1384.           Returns        boolean value indicating success or failure.
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.           -----------------------------------------------------------
  1391.           rcld |view flexlist.c 485                                               FlexList flexlist
  1392.           -----------------------------------------------------------
  1393.  
  1394.           Remarks        lptr is the FlexList to recall from.
  1395.                          bufAddr is the untyped parameter called by
  1396.                          reference.  The address passed is the address
  1397.                          of the item to which the contents of the
  1398.                          indicated node will be copied to.
  1399.                          loc is the number of the target node.
  1400.  
  1401.                          Mkcdptr() is called internally with loc as the
  1402.                          requested node.
  1403.  
  1404.           See also       stod() stod, mkcdptr() mkcdptr, getd() getd
  1405.  
  1406.           Example        see stod() stod
  1407.  
  1408. rmFlist
  1409.  
  1410.  
  1411.  
  1412.           -----------------------------------------------------------
  1413.           rmFlist |view flexlist.c 68                                            FlexList flexlist
  1414.           -----------------------------------------------------------
  1415.  
  1416.           Category       housekeeping
  1417.  
  1418.           Function       Removes all nodes from the FlexList then
  1419.                          deallocates the FlexList control block FlistHeader.
  1420.  
  1421.           Prototype      int  rmFlist (Flist Flist *lptrAddr);
  1422.  
  1423.           Returns        boolean value indicating success or failure.
  1424.  
  1425.           Remarks        lptrAddr is the address of the FlexList flexlist
  1426.                          variable to deactivate.
  1427.                          Calls clrFlist() internally.
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.           -----------------------------------------------------------
  1434.           rmFlist |view flexlist.c 68                                            FlexList flexlist
  1435.           -----------------------------------------------------------
  1436.  
  1437.           See also       clrFlist() clrFlist, mkFlist() mkFlist
  1438.  
  1439.           Example        Flist myList;
  1440.                          struct { ??? } myListItem;
  1441.                          {
  1442.                            myList = mkFlist(sizeof(myListItem),0);
  1443.                            ...
  1444.                            rmFlist(&myList);
  1445.                          }
  1446.  
  1447. stod
  1448.  
  1449.  
  1450.  
  1451.           -----------------------------------------------------------
  1452.           stod |view flexlist.c 476                                               FlexList flexlist
  1453.           -----------------------------------------------------------
  1454.  
  1455.           Category       array
  1456.  
  1457.           Function       Store the item in the indicated node.  The
  1458.                          indicated node becomes the new current node current.
  1459.  
  1460.           Prototype      int stod(Flist Flist lptr,void *bufAddr bufAddr,unsigned loc);
  1461.  
  1462.           Returns        boolean value indicating success or failure.
  1463.  
  1464.           Remarks        lptr is the FlexList to store data in.
  1465.                          bufAddr is the untyped parameter called by
  1466.                          reference.  The address passed is the address
  1467.                          of the item to store in the indicated node.
  1468.                          loc is the number of the target node.
  1469.                          Mkcdptr() is called internally with loc as the
  1470.                          requested node.
  1471.  
  1472.  
  1473.  
  1474.  
  1475.           -----------------------------------------------------------
  1476.           stod |view flexlist.c 476                                               FlexList flexlist
  1477.           -----------------------------------------------------------
  1478.  
  1479.           See also       rcld() rcld, mkcdptr() mkcdptr, putd() putd
  1480.  
  1481.           Example        Flist myArray;
  1482.                          int i, *iptr;
  1483.                          {
  1484.                            myArray = mkFlist(sizeof(int),0);
  1485.                            for (i=1;i<=10;i++)
  1486.                              iquedptr(myArray,&i);
  1487.                            if (rcld(myArray,&i,7))
  1488.                               printf("\n  %d  ",i);
  1489.                            i = 4;
  1490.                            stod(myArray,&i,7);
  1491.                            if ((iptr = curdptr(myArray)) != NULL)
  1492.                               printf("\n  %d  ",*iptr);
  1493.                            rmFlist(&myArray);
  1494.                          }
  1495.  
  1496. topdptr
  1497.  
  1498.  
  1499.  
  1500.           -----------------------------------------------------------
  1501.           topdptr |view flexlist.c 181                                            FlexList flexlist
  1502.           -----------------------------------------------------------
  1503.  
  1504.           Category       stack and queue
  1505.  
  1506.           Function       Examine the top item of the stack - examine
  1507.                          the front item of the queue.
  1508.  
  1509.           Prototype      void * dptrtopdptr (Flist Flist lptr, void *bufAddr bufAddr);
  1510.  
  1511.           Returns        pointer to the data in the front node or NULL
  1512.                          if there are no nodes.
  1513.  
  1514.           Remarks        lptr is the FlexList to examine.
  1515.                          bufAddr is the untyped parameter called by
  1516.                          reference.  The address passed is the address
  1517.                          of where to copy the data to in order to
  1518.                          examine it.  If bufAddr is NULL then no data
  1519.                          is copied
  1520.  
  1521.  
  1522.  
  1523.  
  1524.           -----------------------------------------------------------
  1525.           topdptr |view flexlist.c 181                                            FlexList flexlist
  1526.           -----------------------------------------------------------
  1527.  
  1528.           See also       popd() popd
  1529.  
  1530.           Example        Flist myQueue;
  1531.                          int i;
  1532.                          {
  1533.                            myQueue = mkFlist(sizeof(int),0);
  1534.                            for (i=1;i<=10;i++)
  1535.                              iquedptr(myQueue,&i);
  1536.                            while (topdptr(myQueue,&i))  {
  1537.                              printf("\n  %d  ",i);
  1538.                              popd(myQueue,NULL);
  1539.                            }
  1540.                            rmFlist(&myQueue);
  1541.                          }
  1542.  
  1543. 
  1544.