home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 185_01 / ssort.doc < prev    next >
Text File  |  1985-08-21  |  6KB  |  151 lines

  1. SSORT.DOC
  2.  
  3.     SSORT is a merge sort utility.  That is, the limitations on
  4. the size of the file to be sorted is one of disk space rather
  5. than memory space. As configured, it allows up to 20 (recompile
  6. for more) sort keys to be specified.  SSORT has one built-in sort
  7. precedence order and has a command line option for overlaying an
  8. arbitrary number of others (one at a time) from a file called
  9. "SSORT.OVL".  This is useful, for instance, to select a
  10. descending sort.
  11.  
  12.    This file (SSORT.DOC) contains information to patch the SSORT
  13. system to install your favorite collating sequences.  The ones
  14. supplied are: Lexicographical, Reverse Lexicographical, ASCII,
  15. Reverse ASCII.
  16.  
  17.     As configured, the built-in collating sequence in SSORT
  18. treats all punctuation and non-printing characters as
  19. non-existent (not even consuming a column).  This means that
  20. A!@#$%^&*()B will sort adjacent to AB, for example. It also
  21. treats 'A' and 'a' as distinct but adjacent.  That is, a
  22. lexicographcal sort.  This is not REALLY lexicographical on a
  23. string basis.  To get that, 'A' and 'a' should have exactly the
  24. same sort percedence, but that would mean that several occurrences
  25. of the same string whose only difference was case would sort to a
  26. scrambled order within the equivalent strings, for instance.
  27.     AAAAA
  28.     aaaaa
  29.     aaaaa
  30.     AAAAA
  31.     AAAAA
  32.     aaaaa
  33. The drawback to the implemented version is that:
  34.     SSORT.C
  35.     SSORT.CSM
  36.     ssort.c
  37. is the results for the example data, since 's' is above 'S'
  38. in the collating sequence.  What is really wanted is "case blindness"
  39. on a string (not a character) basis, but I haven't figured out how to
  40. do that yet. Nor have I missed it much.
  41.  
  42. The rules for the precedence orders for characters are contained
  43. in a table in the lexlate() function which is in LEXLATE.CSM.
  44.  
  45.     The file called SSORT.OVL may contain an arbitrary number
  46. of collating sequences (actually only as many as 16384), any one
  47. of which may be overlayed at execution time by using the "-c"
  48. option (see below).  As configured, -c0 is reverse lecicographical,
  49. -c1 is ASCII, -c2 is reverse ASCII.
  50.  
  51.  
  52.  
  53. Usage: ssort <infile> <outfile> [-c<entry number>] [-k<sort key list>]
  54.  
  55. where -c<entry number> indicates:
  56.  
  57. Use the <entry number>'th collating sequence in SSORT.OVL.
  58.  
  59. where <sort key list> is:
  60.  
  61. A comma separated list of column numbers or ranges
  62. specifing the sort key positions.
  63.     e.g.
  64. ssort messy.dat neat.dat -c3 -k3-5,7-9,1-2,12
  65.  
  66. specifies that:
  67.  
  68. 1) The  input file is MESSY.DAT.
  69. 2) The output file is  NEAT.DAT.
  70. 3) The collating sequence to be used is number 3 in SSORT.OVL
  71.    note that the first sequence in SSORT.OVL is number 0.
  72. 4)        The primary sort key is columns  3 thru 5.
  73. 5) The first secondary sort key is columns  7 thru 9.
  74. 6) The next  secondary sort key is columns  1 thru 2.
  75. 7) The last  secondary sort key is columns 12 thru end of line.
  76.  
  77. A sort key of 1 column may be specified as 3-3 for example.
  78. A sort key which goes to end of line need NOT be the last one.
  79.  
  80. The leftmost column is numbered 1.
  81. The default sort key is the entire line.
  82.  
  83.  
  84. Files in SSORT.LBR
  85.  
  86. SSORT.DQC    - This file in squeezed format
  87. 'SSORT.SH    - MicroShell batch file to build SSORT.COM (similar to SUBMIT)
  88.            If you have MicroShell, I probably don't have to tell you not
  89.            to use it, since ASM gets confused when run from a shell file.
  90.            Just treat it as build instructions.
  91. SSORT.CQ     - BDS C source for lexsort in a squeezed format
  92. LEXLATE.CQM  - BDS C '.CSM' (assembly language) file for the sort
  93.            precedence routine.
  94. SSORT.OBJ    - SSORT.COM renamed so you can't execute on a RBBS
  95. SSORT.SYM    - The symbol table from the L2 linker for LEXSORT.COM
  96. SSORT.OVL    - A file of collating sequences (mentioned above)
  97. SORTORDR.AQM - ASM assembly language file (in squeezed format) to generate
  98.            a customized SSORT.OVL
  99.            instructions for use are contained within it.
  100.  
  101.  
  102. PATCH DATA:
  103.  
  104. 1)        For those users would a different "built-in"
  105.     precedence order but do not have BDS C, the
  106.     combination of LEXLATE.CSM and LEXSORT.SYM show where
  107.     the table ends up in memory and hence in LEXSORT.COM.
  108.     This is the address of LEXLATE + 0EH.  As configured,
  109.     the magic address is (251b + 000e = 2529).
  110.  
  111.         The rules are that this is a 256 byte table
  112.     corresponding to the 256 ASCII codes.  A code of 255
  113.     is used to indicate that the character should be
  114.     ignored entirely.  Any other value is the sort
  115.     precedence for the corresponding ASCII character.
  116.     Make sure that 0 translates to itself so that C will
  117.     be able to recognize end of string.
  118.  
  119. 2)    If you wish to change the name SSORT.OVL, it is located
  120.     at (24ff + 8 = 2507).  This is the address of the function
  121.     collate_name() + 8, see entry COLLATE_ in file SSORT.SYM (in
  122.     case someone has re-compiled SSORT since I worte this documentation
  123.     file. This address may be patched to contain
  124.     a specific drive and/or user reference according to
  125.     BDS C rules i.e. uu/d:nnnnnnnn.ttt. The file name must
  126.     be no longer than 19 characters and must be followed by
  127.     a zero byte to terminate the string.
  128.  
  129. 3)    If you wish to delete/re-arrange/add-to the collating
  130.     sequences in SSORT.OVL, see the instructions in SORTORDR.AQM
  131.  
  132.  
  133. HISTORY:
  134.  
  135.     SSORT.C is a modification to LEXSORT.C.  LEXSORT.C is a
  136. modification of SORT3.C.  SORT3.C is Leor Zolman's translation of
  137. Ratfor code, published in "Software Tools", into BDS C.
  138.  
  139. Both LEXSORT and SSORT modifications were done by Harvey Moran.
  140.  
  141.    If you have any comments about SSORT (good or bad), I can be
  142. reached through the BHEC RBBS (Baltimore Heath Electronic Center
  143. Remote Bulletin Board Service). The phone number is (301)
  144. 661-2175. This system operates at 300 and 1200 baud, 24 hrs a
  145. day, but 6:00-8:00 am Eastern Time is reserved for system
  146. maintenance. I am one of the SYSOP's on this system.
  147.  
  148.                 Harvey Moran
  149.                 2/26/84
  150. be patched to contain
  151.     a specific drive and/or user referen