The most stylish method to create word lists, is of course, asking the SPELL device on the QL directly (Why refer to Linux if you can do the same thing on a proper computer...).
(This is also an example on how you use it: You simply print the word you try to check to a channel opened to the device, and will receive a "BAD PARAMETER" in case the word is completely wrong or a "NOT COMPLETE" if what you have submitted is the start of a valid word, but still missing characters - or, of course, OK if the word was correctly spelled.)
The program takes a while to run (think: hours, because it scans all 6-character permutations for validity), and could profit from Char FOR loops, but produces an impressive word list.
Code: Select all
100 WHEN ERRor
105 validWord = 0
110 CONTINUE
120 END WHEN
130 :
135 Scandict 6
137 :
140 DEFine PROCedure Scandict (n)
150 LOCal try$(n), splChan
160 splChan = FOPEN ("SPELL")
170 IF splChan < 0 THEN
180 PRINT #0;"Could not open spell device"
190 RETurn
200 END IF
210 :
220 try$= "aaaaaa"
230 :
240 FOR a = CODE('a') TO CODE('z')
250 try$(1) = CHR$(a)
260 FOR b = CODE('a') TO CODE('z')
270 try$(2) = CHR$(b)
280 FOR c = CODE('a') TO CODE('z')
290 try$(3) = CHR$(c)
300 FOR d = CODE('a') TO CODE('z')
310 try$(4) = CHR$(d)
320 FOR e = CODE('a') TO CODE('z')
330 try$(5) = CHR$(e)
340 FOR f = CODE('a') TO CODE('z')
350 try$(6) = CHR$(f)
355 validWord = 1
360 PRINT #splChan,try$
370 IF validWord = 1 THEN
380 PRINT try$
390 END IF
400 END FOR f
410 END FOR e
420 END FOR d
430 END FOR c
440 END FOR b
450 END FOR a
455 CLOSE #splChan
460 END DEFine