Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - pickinit() initialize a list in dynamic memory http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 pickinit()          Initialize a list in dynamic memory
------------------------------------------------------------------------------
 Declaration
   pick.hdr

 Syntax
   func _LIST pickinit extern

 Arguments
   None.

 Return
   A pointer to a generic list.

 Description
   The pickinit() function initializes a new list, and allocates dynamic
   memory to store the initial list data. The pointer returned by
   pickinit() is expected by all generic and string list manipulation
   functions which access the list. Therefore, the pickinit() function must
   be called before using any other list function.

   Lists initialized with the pickinit() function can be used for storing
   character strings, added by the pickadd() or pickaddid() functions.
   Alternatively a list can store generic (non-character) data, added by the
   listput() function.

 Example
   #define EXAMPLE_LIST
   #include example.hdr

   proc Test_pickinit
   vardef
      _LIST pList
      uint  n
   enddef
   ? "Memory", istr( coreleft() )  // display memory
   pList := pickinit()             // initialize a list
   do while coreleft() > 10000     // use most of free memory
      listput( pList, &istr, 512 ) // add 512-byte items to the list
   enddo                           // (contents is meaningless in this example)
   ? "Memory", istr( coreleft() )  // free memory is under 10 Kbytes
   ? "Number of list elements", istr( pickcount( pList ) )
   pickclear( pList )              // clear the list
   ? "Memory", istr( coreleft() )  // display memory
   endproc

   proc main
   Test_pickinit()
   endproc

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson