home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / DOC / U4SORT.DOC < prev    next >
Encoding:
Text File  |  1990-03-04  |  2.7 KB  |  100 lines

  1.  
  2. (c) Copyright Sequiter Software Inc. 1988-1990.  All rights reserved.
  3.  
  4.  
  5. This is information on the Code Base 4 low level sorting routines.
  6. It is not intended for the user to call these routines directly; it is
  7. to help those trying to understand Code Base 4 internals.  These routines 
  8. are used by the higher level routines 'i4reindex' and 'x4sort'.
  9.  
  10. We recognize that some users have specialized sorting requirments.  If you
  11. fall into this category of user, use routine 'x4sort' as an example.  However,
  12. be prepared to invest a substantial amount of time.  This is not for the
  13. average user.
  14.  
  15.  
  16.  
  17. u4sort_add()
  18.  
  19. Usage        int  u4sort_add( sort_data_ptr, info_ptr )
  20.  
  21. Description     Specifies some additional information to be sorted.
  22.  
  23. Parameters      Name               Meaning
  24.  
  25.                 sort_data_ptr      An item of data to sort.
  26.  
  27.                 info_ptr           A pointer to associated information
  28.                                    such as a record number or a database
  29.                                    record.
  30.  
  31.  
  32. u4sort_alloc()
  33.  
  34. Usage            int  u4sort_alloc( int num_spools, long tot_records,
  35.                                   int len_sort_and_info )
  36.  
  37. Description     Allocates memory for the sort.
  38.  
  39. Returns         Value       Meaning
  40.  
  41.           0         Memory Allocated
  42.          -1         Not enough memory
  43.  
  44.  
  45.  
  46.  
  47. u4sort_free()
  48.  
  49. Description     If 'u4sort_get' signals that all of the sorted values
  50.                 have been returned or if an error has been returned 
  51.                 by a 'sort' routine, it is not necessary to call
  52.                 'u4sort_free'.  However, it is possible to free the
  53.                 'sort' memory prematurely by calling 'u4sort_free'.
  54.  
  55.  
  56.  
  57.  
  58. u4sort_get()
  59.  
  60. Usage            int  u4sort_get( (char F_PTR *) ptr_ptr )
  61.  
  62. Description     'u4sort_get' is used to retrieve all of the sorted values
  63.                 in sorted order.
  64.  
  65. Parameters      '*ptr_ptr' is modified to point to the next sort value.
  66.                 This value is set to NULL if there are no more items
  67.                 to retrieve.
  68.  
  69. Returns         Value       Meaning
  70.  
  71.           0         Success
  72.          -1         Error
  73.  
  74.  
  75.  
  76.  
  77. u4sort_init()
  78.  
  79. Usage            int u4sort_init( long num_records, int sort_width, 
  80.                                 int info_width )
  81.  
  82. Description     Allocates memory and initializes.
  83.  
  84. Returns         Value       Meaning
  85.  
  86.             >= 0        The number of spools used.
  87.          -1         Error
  88.          -2         Not enough memory
  89.  
  90.  
  91.  
  92.  
  93. u4sort_quick()
  94.  
  95. Usage           void  u4sort_quick( (char F_PTR H_PTR) ptr_ptr,
  96.                              long n, int width )
  97.  
  98. Description     Performs an itterative quick sort.  As recursion is
  99.                 not used, the amount of stack memory required is limited.
  100.