Home » Archimedes archive » Acorn User » AU 1998-06 A.adf » Regulars » StarInfo/Nonsense/Gook

StarInfo/Nonsense/Gook

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1998-06 A.adf » Regulars
Filename: StarInfo/Nonsense/Gook
Read OK:
File size: 06CC bytes
Load address: 0000
Exec address: 0000
File contents
   10bufsize = 512
   20DIM buffer bufsize
   30SYS "OS_GetEnv" TO in$
   40in$=MID$(in$,INSTR(in$,CHR$34+" ")+2)
   50type=0
   60IF INSTR(in$,"-typo") type = type OR 1
   70IF INSTR(in$,"-fuzzy") type = type OR 2
   80IF INSTR(in$,"-anagram") type = type OR 4
   81IF type=0 type=3
   90in$=LEFT$(in$,INSTR(in$+" "," ")-1)
  100in=OPENIN(in$)
  110ON ERROR CLOSE #in:ERROR EXT ERR,REPORT$+" at line "+STR$ERL
  120b$=""
  130WHILE NOT EOF#in
  140 c=BGET#in
  150 IF (c>=ASC"A" AND c<=ASC"Z") OR (c>=ASC"a" AND c<=ASC"z") THEN
  160  b$+=CHR$c
  170 ELSE
  180  IF b$<>"" THEN
  190   PRINT FNreplace(b$,type);
  200   b$=""
  210  ENDIF
  220  IF c=10 PRINT
  230  IF c>31 PRINT CHR$c;
  240 ENDIF
  250ENDWHILE
  260CLOSE #in
  270END
  280
  290DEF FNreplace(in$, type)
  300rnd=0
  310upper1=MID$(in$,1,1)>="A" AND MID$(in$,1,1)<="Z"
  320upper2=MID$(in$,2,1)>="A" AND MID$(in$,2,1)<="Z"
  330IFFNenum(in$, rnd, type)="" THEN =in$
  340IF rnd=0 THEN =in$
  350rnd=-rnd
  360IF rnd>1 rnd=RND(rnd)
  370out$=FNenum(in$, rnd, type)
  380IF NOT upper1 THEN
  390 MID$(out$,1,1)=CHR$(32+ASCMID$(out$,1,1))
  400ENDIF
  410IF NOT upper2 THEN
  420 FOR i=2 TO LENout$
  430 MID$(out$,i,1)=CHR$(32+ASCMID$(out$,i,1))
  440 NEXT
  450ENDIF
  460=out$
  470
  480DEF FNenum(in$, RETURN rnd, type)
  490SYS "XSpell_EnumWord",in$ TO ;ok
  500IF (ok AND 1) THEN =""
  510IF type AND 1 THEN
  520  pos=-1
  530  REPEAT
  540   SYS "XSpell_Typo",in$,buffer,bufsize,0,pos TO ,,,used,pos
  550   at=buffer
  560   WHILE used>0
  570    rnd-=1
  580    IF rnd=0 THEN =$at
  590    len=LEN$at+1
  600    used-=len
  610    at+=len
  620   ENDWHILE
  630  UNTIL pos<0
  640ENDIF
  650
  660IF type AND 2 THEN
  670  pos=-1
  680  REPEAT
  690   SYS "XSpell_Fuzzy",in$,buffer,bufsize,0,pos TO ,,,used,pos
  700   at=buffer
  710   WHILE used>0
  720    rnd-=1
  730    IF rnd=0 THEN =$at
  740    len=LEN$at+1
  750    used-=len
  760    at+=len
  770   ENDWHILE
  780  UNTIL pos<0
  790ENDIF
  800
  810IF type AND 4 THEN
  820  pos=-1
  830  REPEAT
  840   SYS "XSpell_Anagram",in$,buffer,bufsize,0,pos TO ,,,used,pos
  850   at=buffer
  860   WHILE used>0
  870    rnd-=1
  880    IF rnd=0 THEN =$at
  890    len=LEN$at+1
  900    used-=len
  910    at+=len
  920   ENDWHILE
  930  UNTIL pos<0
  940ENDIF
  950=in$

bufsize = 512
� buffer bufsize
ș "OS_GetEnv" � in$
(in$=�in$,�in$,�34+" ")+2)
2
type=0
<#� �in$,"-typo") type = type � 1
F$� �in$,"-fuzzy") type = type � 2
P&� �in$,"-anagram") type = type � 4
Q� type=0 type=3
Zin$=�in$,�in$+" "," ")-1)
d
in=�(in$)
n%� � � #in:� � �,�$+" at line "+Þ
x	b$=""
�
ȕ � �#in
� c=�#in
�2 � (c>=�"A" � c<=�"Z") � (c>=�"a" � c<=�"z") �
�  b$+=�c
� �
�  � b$<>"" �
�   � �replace(b$,type);
�   b$=""
�  �
�  � c=10 �
�  � c>31 � �c;
� �
��
	� #in
�

"� �replace(in$, type)
,	rnd=0
6*upper1=�in$,1,1)>="A" � �in$,1,1)<="Z"
@*upper2=�in$,2,1)>="A" � �in$,2,1)<="Z"
J$�enum(in$, rnd, type)="" � =in$
T� rnd=0 � =in$
^rnd=-rnd
h� rnd>1 rnd=�(rnd)
rout$=�enum(in$, rnd, type)
|� � upper1 �
�! �out$,1,1)=�(32+��out$,1,1))
��
�� � upper2 �
� � i=2 � �out$
�! �out$,i,1)=�(32+��out$,i,1))
� �
��
�	=out$
�
�� �enum(in$, � rnd, type)
�"ș "XSpell_EnumWord",in$ � ;ok
�� (ok � 1) � =""
�� type � 1 �
  pos=-1
  �
>   ș "XSpell_Typo",in$,buffer,bufsize,0,pos � ,,,used,pos
&   at=buffer
0   ȕ used>0
:    rnd-=1
D    � rnd=0 � =$at
N    len=�$at+1
X    used-=len
b    at+=len
l   �
v
  � pos<0
��
�
�� type � 2 �
�  pos=-1
�  �
�?   ș "XSpell_Fuzzy",in$,buffer,bufsize,0,pos � ,,,used,pos
�   at=buffer
�   ȕ used>0
�    rnd-=1
�    � rnd=0 � =$at
�    len=�$at+1
�    used-=len
�    at+=len
   �

  � pos<0
�
 
*� type � 4 �
4  pos=-1
>  �
HA   ș "XSpell_Anagram",in$,buffer,bufsize,0,pos � ,,,used,pos
R   at=buffer
\   ȕ used>0
f    rnd-=1
p    � rnd=0 � =$at
z    len=�$at+1
�    used-=len
�    at+=len
�   �
�
  � pos<0
��
�=in$
�
00000000  0d 00 0a 11 62 75 66 73  69 7a 65 20 3d 20 35 31  |....bufsize = 51|
00000010  32 0d 00 14 14 de 20 62  75 66 66 65 72 20 62 75  |2..... buffer bu|
00000020  66 73 69 7a 65 0d 00 1e  18 c8 99 20 22 4f 53 5f  |fsize...... "OS_|
00000030  47 65 74 45 6e 76 22 20  b8 20 69 6e 24 0d 00 28  |GetEnv" . in$..(|
00000040  1d 69 6e 24 3d c1 69 6e  24 2c a7 69 6e 24 2c bd  |.in$=.in$,.in$,.|
00000050  33 34 2b 22 20 22 29 2b  32 29 0d 00 32 0a 74 79  |34+" ")+2)..2.ty|
00000060  70 65 3d 30 0d 00 3c 23  e7 20 a7 69 6e 24 2c 22  |pe=0..<#. .in$,"|
00000070  2d 74 79 70 6f 22 29 20  74 79 70 65 20 3d 20 74  |-typo") type = t|
00000080  79 70 65 20 84 20 31 0d  00 46 24 e7 20 a7 69 6e  |ype . 1..F$. .in|
00000090  24 2c 22 2d 66 75 7a 7a  79 22 29 20 74 79 70 65  |$,"-fuzzy") type|
000000a0  20 3d 20 74 79 70 65 20  84 20 32 0d 00 50 26 e7  | = type . 2..P&.|
000000b0  20 a7 69 6e 24 2c 22 2d  61 6e 61 67 72 61 6d 22  | .in$,"-anagram"|
000000c0  29 20 74 79 70 65 20 3d  20 74 79 70 65 20 84 20  |) type = type . |
000000d0  34 0d 00 51 13 e7 20 74  79 70 65 3d 30 20 74 79  |4..Q.. type=0 ty|
000000e0  70 65 3d 33 0d 00 5a 1d  69 6e 24 3d c0 69 6e 24  |pe=3..Z.in$=.in$|
000000f0  2c a7 69 6e 24 2b 22 20  22 2c 22 20 22 29 2d 31  |,.in$+" "," ")-1|
00000100  29 0d 00 64 0d 69 6e 3d  8e 28 69 6e 24 29 0d 00  |)..d.in=.(in$)..|
00000110  6e 25 ee 20 85 20 d9 20  23 69 6e 3a 85 20 a2 20  |n%. . . #in:. . |
00000120  9f 2c f6 24 2b 22 20 61  74 20 6c 69 6e 65 20 22  |.,.$+" at line "|
00000130  2b c3 9e 0d 00 78 09 62  24 3d 22 22 0d 00 82 0d  |+....x.b$=""....|
00000140  c8 95 20 ac 20 c5 23 69  6e 0d 00 8c 0b 20 63 3d  |.. . .#in.... c=|
00000150  9a 23 69 6e 0d 00 96 32  20 e7 20 28 63 3e 3d 97  |.#in...2 . (c>=.|
00000160  22 41 22 20 80 20 63 3c  3d 97 22 5a 22 29 20 84  |"A" . c<=."Z") .|
00000170  20 28 63 3e 3d 97 22 61  22 20 80 20 63 3c 3d 97  | (c>=."a" . c<=.|
00000180  22 7a 22 29 20 8c 0d 00  a0 0c 20 20 62 24 2b 3d  |"z") .....  b$+=|
00000190  bd 63 0d 00 aa 06 20 cc  0d 00 b4 10 20 20 e7 20  |.c.... .....  . |
000001a0  62 24 3c 3e 22 22 20 8c  0d 00 be 1b 20 20 20 f1  |b$<>"" .....   .|
000001b0  20 a4 72 65 70 6c 61 63  65 28 62 24 2c 74 79 70  | .replace(b$,typ|
000001c0  65 29 3b 0d 00 c8 0c 20  20 20 62 24 3d 22 22 0d  |e);....   b$="".|
000001d0  00 d2 07 20 20 cd 0d 00  dc 0e 20 20 e7 20 63 3d  |...  .....  . c=|
000001e0  31 30 20 f1 0d 00 e6 12  20 20 e7 20 63 3e 33 31  |10 .....  . c>31|
000001f0  20 f1 20 bd 63 3b 0d 00  f0 06 20 cd 0d 00 fa 05  | . .c;.... .....|
00000200  ce 0d 01 04 09 d9 20 23  69 6e 0d 01 0e 05 e0 0d  |...... #in......|
00000210  01 18 04 0d 01 22 19 dd  20 a4 72 65 70 6c 61 63  |.....".. .replac|
00000220  65 28 69 6e 24 2c 20 74  79 70 65 29 0d 01 2c 09  |e(in$, type)..,.|
00000230  72 6e 64 3d 30 0d 01 36  2a 75 70 70 65 72 31 3d  |rnd=0..6*upper1=|
00000240  c1 69 6e 24 2c 31 2c 31  29 3e 3d 22 41 22 20 80  |.in$,1,1)>="A" .|
00000250  20 c1 69 6e 24 2c 31 2c  31 29 3c 3d 22 5a 22 0d  | .in$,1,1)<="Z".|
00000260  01 40 2a 75 70 70 65 72  32 3d c1 69 6e 24 2c 32  |.@*upper2=.in$,2|
00000270  2c 31 29 3e 3d 22 41 22  20 80 20 c1 69 6e 24 2c  |,1)>="A" . .in$,|
00000280  32 2c 31 29 3c 3d 22 5a  22 0d 01 4a 24 e7 a4 65  |2,1)<="Z"..J$..e|
00000290  6e 75 6d 28 69 6e 24 2c  20 72 6e 64 2c 20 74 79  |num(in$, rnd, ty|
000002a0  70 65 29 3d 22 22 20 8c  20 3d 69 6e 24 0d 01 54  |pe)="" . =in$..T|
000002b0  12 e7 20 72 6e 64 3d 30  20 8c 20 3d 69 6e 24 0d  |.. rnd=0 . =in$.|
000002c0  01 5e 0c 72 6e 64 3d 2d  72 6e 64 0d 01 68 16 e7  |.^.rnd=-rnd..h..|
000002d0  20 72 6e 64 3e 31 20 72  6e 64 3d b3 28 72 6e 64  | rnd>1 rnd=.(rnd|
000002e0  29 0d 01 72 1e 6f 75 74  24 3d a4 65 6e 75 6d 28  |)..r.out$=.enum(|
000002f0  69 6e 24 2c 20 72 6e 64  2c 20 74 79 70 65 29 0d  |in$, rnd, type).|
00000300  01 7c 10 e7 20 ac 20 75  70 70 65 72 31 20 8c 0d  |.|.. . upper1 ..|
00000310  01 86 21 20 c1 6f 75 74  24 2c 31 2c 31 29 3d bd  |..! .out$,1,1)=.|
00000320  28 33 32 2b 97 c1 6f 75  74 24 2c 31 2c 31 29 29  |(32+..out$,1,1))|
00000330  0d 01 90 05 cd 0d 01 9a  10 e7 20 ac 20 75 70 70  |.......... . upp|
00000340  65 72 32 20 8c 0d 01 a4  12 20 e3 20 69 3d 32 20  |er2 ..... . i=2 |
00000350  b8 20 a9 6f 75 74 24 0d  01 ae 21 20 c1 6f 75 74  |. .out$...! .out|
00000360  24 2c 69 2c 31 29 3d bd  28 33 32 2b 97 c1 6f 75  |$,i,1)=.(32+..ou|
00000370  74 24 2c 69 2c 31 29 29  0d 01 b8 06 20 ed 0d 01  |t$,i,1)).... ...|
00000380  c2 05 cd 0d 01 cc 09 3d  6f 75 74 24 0d 01 d6 04  |.......=out$....|
00000390  0d 01 e0 1d dd 20 a4 65  6e 75 6d 28 69 6e 24 2c  |..... .enum(in$,|
000003a0  20 f8 20 72 6e 64 2c 20  74 79 70 65 29 0d 01 ea  | . rnd, type)...|
000003b0  22 c8 99 20 22 58 53 70  65 6c 6c 5f 45 6e 75 6d  |".. "XSpell_Enum|
000003c0  57 6f 72 64 22 2c 69 6e  24 20 b8 20 3b 6f 6b 0d  |Word",in$ . ;ok.|
000003d0  01 f4 14 e7 20 28 6f 6b  20 80 20 31 29 20 8c 20  |.... (ok . 1) . |
000003e0  3d 22 22 0d 01 fe 10 e7  20 74 79 70 65 20 80 20  |=""..... type . |
000003f0  31 20 8c 0d 02 08 0c 20  20 70 6f 73 3d 2d 31 0d  |1 .....  pos=-1.|
00000400  02 12 07 20 20 f5 0d 02  1c 3e 20 20 20 c8 99 20  |...  ....>   .. |
00000410  22 58 53 70 65 6c 6c 5f  54 79 70 6f 22 2c 69 6e  |"XSpell_Typo",in|
00000420  24 2c 62 75 66 66 65 72  2c 62 75 66 73 69 7a 65  |$,buffer,bufsize|
00000430  2c 30 2c 70 6f 73 20 b8  20 2c 2c 2c 75 73 65 64  |,0,pos . ,,,used|
00000440  2c 70 6f 73 0d 02 26 10  20 20 20 61 74 3d 62 75  |,pos..&.   at=bu|
00000450  66 66 65 72 0d 02 30 10  20 20 20 c8 95 20 75 73  |ffer..0.   .. us|
00000460  65 64 3e 30 0d 02 3a 0e  20 20 20 20 72 6e 64 2d  |ed>0..:.    rnd-|
00000470  3d 31 0d 02 44 16 20 20  20 20 e7 20 72 6e 64 3d  |=1..D.    . rnd=|
00000480  30 20 8c 20 3d 24 61 74  0d 02 4e 12 20 20 20 20  |0 . =$at..N.    |
00000490  6c 65 6e 3d a9 24 61 74  2b 31 0d 02 58 11 20 20  |len=.$at+1..X.  |
000004a0  20 20 75 73 65 64 2d 3d  6c 65 6e 0d 02 62 0f 20  |  used-=len..b. |
000004b0  20 20 20 61 74 2b 3d 6c  65 6e 0d 02 6c 08 20 20  |   at+=len..l.  |
000004c0  20 ce 0d 02 76 0d 20 20  fd 20 70 6f 73 3c 30 0d  | ...v.  . pos<0.|
000004d0  02 80 05 cd 0d 02 8a 04  0d 02 94 10 e7 20 74 79  |............. ty|
000004e0  70 65 20 80 20 32 20 8c  0d 02 9e 0c 20 20 70 6f  |pe . 2 .....  po|
000004f0  73 3d 2d 31 0d 02 a8 07  20 20 f5 0d 02 b2 3f 20  |s=-1....  ....? |
00000500  20 20 c8 99 20 22 58 53  70 65 6c 6c 5f 46 75 7a  |  .. "XSpell_Fuz|
00000510  7a 79 22 2c 69 6e 24 2c  62 75 66 66 65 72 2c 62  |zy",in$,buffer,b|
00000520  75 66 73 69 7a 65 2c 30  2c 70 6f 73 20 b8 20 2c  |ufsize,0,pos . ,|
00000530  2c 2c 75 73 65 64 2c 70  6f 73 0d 02 bc 10 20 20  |,,used,pos....  |
00000540  20 61 74 3d 62 75 66 66  65 72 0d 02 c6 10 20 20  | at=buffer....  |
00000550  20 c8 95 20 75 73 65 64  3e 30 0d 02 d0 0e 20 20  | .. used>0....  |
00000560  20 20 72 6e 64 2d 3d 31  0d 02 da 16 20 20 20 20  |  rnd-=1....    |
00000570  e7 20 72 6e 64 3d 30 20  8c 20 3d 24 61 74 0d 02  |. rnd=0 . =$at..|
00000580  e4 12 20 20 20 20 6c 65  6e 3d a9 24 61 74 2b 31  |..    len=.$at+1|
00000590  0d 02 ee 11 20 20 20 20  75 73 65 64 2d 3d 6c 65  |....    used-=le|
000005a0  6e 0d 02 f8 0f 20 20 20  20 61 74 2b 3d 6c 65 6e  |n....    at+=len|
000005b0  0d 03 02 08 20 20 20 ce  0d 03 0c 0d 20 20 fd 20  |....   .....  . |
000005c0  70 6f 73 3c 30 0d 03 16  05 cd 0d 03 20 04 0d 03  |pos<0....... ...|
000005d0  2a 10 e7 20 74 79 70 65  20 80 20 34 20 8c 0d 03  |*.. type . 4 ...|
000005e0  34 0c 20 20 70 6f 73 3d  2d 31 0d 03 3e 07 20 20  |4.  pos=-1..>.  |
000005f0  f5 0d 03 48 41 20 20 20  c8 99 20 22 58 53 70 65  |...HA   .. "XSpe|
00000600  6c 6c 5f 41 6e 61 67 72  61 6d 22 2c 69 6e 24 2c  |ll_Anagram",in$,|
00000610  62 75 66 66 65 72 2c 62  75 66 73 69 7a 65 2c 30  |buffer,bufsize,0|
00000620  2c 70 6f 73 20 b8 20 2c  2c 2c 75 73 65 64 2c 70  |,pos . ,,,used,p|
00000630  6f 73 0d 03 52 10 20 20  20 61 74 3d 62 75 66 66  |os..R.   at=buff|
00000640  65 72 0d 03 5c 10 20 20  20 c8 95 20 75 73 65 64  |er..\.   .. used|
00000650  3e 30 0d 03 66 0e 20 20  20 20 72 6e 64 2d 3d 31  |>0..f.    rnd-=1|
00000660  0d 03 70 16 20 20 20 20  e7 20 72 6e 64 3d 30 20  |..p.    . rnd=0 |
00000670  8c 20 3d 24 61 74 0d 03  7a 12 20 20 20 20 6c 65  |. =$at..z.    le|
00000680  6e 3d a9 24 61 74 2b 31  0d 03 84 11 20 20 20 20  |n=.$at+1....    |
00000690  75 73 65 64 2d 3d 6c 65  6e 0d 03 8e 0f 20 20 20  |used-=len....   |
000006a0  20 61 74 2b 3d 6c 65 6e  0d 03 98 08 20 20 20 ce  | at+=len....   .|
000006b0  0d 03 a2 0d 20 20 fd 20  70 6f 73 3c 30 0d 03 ac  |....  . pos<0...|
000006c0  05 cd 0d 03 b6 08 3d 69  6e 24 0d ff              |......=in$..|
000006cc