home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / sillies / silly10 / !Yow / Sort (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1993-11-22  |  2KB  |  95 lines

  1.  > Sort the YowLines file.
  2. -&F00+1000000 :
  3.  Set 
  4.  to simulate Next slot
  5. File$="<Yow$Dir>.YowLines"
  6. !NewFile$="<Yow$Dir>.NewLines"
  7. MaxLines%=10000
  8.  P%(MaxLines%),S%(MaxLines%)
  9.  W$(100)
  10. *NW%=-1:
  11.  NW%+=1:
  12.  W$(NW%):
  13.  W$(NW%)=""
  14.  Boring words ignored in sorting
  15.  ABOUT,ALSO,ALWAYS,BECAUSE,BEEN,BEING,DOES
  16.  COULD,DIDN,ELSE,EVEN,EVER,EVERY,FROM
  17.  GETS,HAVE,HAVING,HERE,JUST,LIKE
  18.  MADE,MAKE,MAKES,MANY,MIGHT,MORE,MOST,MUCH
  19.  MUST,NEVER,OFTEN,ONCE,ONLY,OVER
  20.  SAID,SHALL,SOME,SOON,STILL,SUCH
  21.  THAT,THEM,THEN,THERE,THESE,THEY
  22.  THIS,THOSE,VERY,YOUR,WANT,WASN,WELL,WERE
  23.  WHAT,WHEN,WHERE,WHICH,WHOM,WILL,WITH,WOULD
  24.  Load the file into RAM
  25.  File$:L%=
  26.  #F%:
  27.  M% L%:E%=M%+L%
  28.  "Load "+File$+" "+
  29.  Quick test for a letter
  30.  L%(128)
  31. "&L%()=
  32. "Z":L%(C%)=
  33.  "Setting pointers"
  34.  Set P%() to point to start and S%() to point to interesting bit.
  35.  Fold to upper case for comparison with boring words.
  36. P%=M%:N%=0
  37.   P%(N%)=P%:W$="":Done%=
  38.     C%=?P% 
  39.  L%(C%) 
  40.       
  41.  W$="" S%(N%)=P%
  42.       W$+=
  43. 1        
  44. 2!      
  45.  W$>3 Done%=
  46. Sig(W$)
  47. 31      
  48.  Done% 
  49.  ?P%=0 S%(N%)=P%(N%):Done%=
  50.       W$=""
  51. 5        
  52.     P%+=1
  53.  Done%
  54.  P%?-2:P%+=1:
  55.  Skip to after \0\n
  56.  Q%=P%(N%):WHILE Q%<S%(N%) VDU?Q%:Q%+=1:ENDWHILE:PRINT"//";:WHILE ?Q%:VDU?Q%:Q%+=1:ENDWHILE:PRINT
  57.   N%+=1
  58.  N%;" ";(P%-M%);"/";L%;" ";
  59.  P%>=E%
  60.  NewFile$
  61.  "SetType "+NewFile$+" Text"
  62.  Sort according to interesting bit ignoring case
  63.  '"Sorting ";N%
  64.  C%=0 
  65.  127  :
  66.  Set up map to fold upper to lower case
  67. G7  L%(C%)=C%:
  68.  C%>=
  69.  C%<=
  70. "z" L%(C%)+=
  71.  N%>0
  72.   Min%=0
  73.  I%=0 
  74.  N%-1
  75.  I%<>Min% 
  76. N7      J%=0:
  77.  L%(J%?S%(I%))=L%(J%?S%(Min%)):J%+=1:
  78. O1      
  79.  L%(J%?S%(I%))<L%(J%?S%(Min%)) Min%=I%
  80. P        
  81.   P%=P%(Min%)
  82.  #O%,?P%:P%+=1:
  83.  P%?-2=0
  84. T+  N%-=1:P%(Min%)=P%(N%):S%(Min%)=S%(N%)
  85.  N%;" ";
  86.  File$,:
  87.  "Count "+File$
  88.  NewFile$,:
  89.  "Count "+NewFile$
  90. Sig(W$)
  91.  I%:I%=0
  92.  W$=W$(I%) 
  93.   I%+=1
  94.  I%=NW%
  95.