home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 1
/
ARM_CLUB_CD.iso
/
contents
/
sillies
/
silly10
/
!Yow
/
Sort
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1993-11-22
|
2KB
|
95 lines
> Sort the YowLines file.
-&F00+1000000 :
Set
to simulate Next slot
File$="<Yow$Dir>.YowLines"
!NewFile$="<Yow$Dir>.NewLines"
MaxLines%=10000
P%(MaxLines%),S%(MaxLines%)
W$(100)
*NW%=-1:
NW%+=1:
W$(NW%):
W$(NW%)=""
Boring words ignored in sorting
ABOUT,ALSO,ALWAYS,BECAUSE,BEEN,BEING,DOES
COULD,DIDN,ELSE,EVEN,EVER,EVERY,FROM
GETS,HAVE,HAVING,HERE,JUST,LIKE
MADE,MAKE,MAKES,MANY,MIGHT,MORE,MOST,MUCH
MUST,NEVER,OFTEN,ONCE,ONLY,OVER
SAID,SHALL,SOME,SOON,STILL,SUCH
THAT,THEM,THEN,THERE,THESE,THEY
THIS,THOSE,VERY,YOUR,WANT,WASN,WELL,WERE
WHAT,WHEN,WHERE,WHICH,WHOM,WILL,WITH,WOULD
Load the file into RAM
File$:L%=
#F%:
M% L%:E%=M%+L%
"Load "+File$+" "+
Quick test for a letter
L%(128)
"&L%()=
"Z":L%(C%)=
"Setting pointers"
Set P%() to point to start and S%() to point to interesting bit.
Fold to upper case for comparison with boring words.
P%=M%:N%=0
P%(N%)=P%:W$="":Done%=
C%=?P%
L%(C%)
W$="" S%(N%)=P%
W$+=
1
2!
W$>3 Done%=
Sig(W$)
31
Done%
?P%=0 S%(N%)=P%(N%):Done%=
W$=""
5
P%+=1
Done%
P%?-2:P%+=1:
Skip to after \0\n
Q%=P%(N%):WHILE Q%<S%(N%) VDU?Q%:Q%+=1:ENDWHILE:PRINT"//";:WHILE ?Q%:VDU?Q%:Q%+=1:ENDWHILE:PRINT
N%+=1
N%;" ";(P%-M%);"/";L%;" ";
P%>=E%
NewFile$
"SetType "+NewFile$+" Text"
Sort according to interesting bit ignoring case
'"Sorting ";N%
C%=0
127 :
Set up map to fold upper to lower case
G7 L%(C%)=C%:
C%>=
C%<=
"z" L%(C%)+=
N%>0
Min%=0
I%=0
N%-1
I%<>Min%
N7 J%=0:
L%(J%?S%(I%))=L%(J%?S%(Min%)):J%+=1:
O1
L%(J%?S%(I%))<L%(J%?S%(Min%)) Min%=I%
P
P%=P%(Min%)
#O%,?P%:P%+=1:
P%?-2=0
T+ N%-=1:P%(Min%)=P%(N%):S%(Min%)=S%(N%)
N%;" ";
File$,:
"Count "+File$
NewFile$,:
"Count "+NewFile$
Sig(W$)
I%:I%=0
W$=W$(I%)
I%+=1
I%=NW%