Home » Archimedes archive » Acorn User » AU 1993-09.adf » !Bio_Bio » !Bio/Library/WordCount
!Bio/Library/WordCount
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 1993-09.adf » !Bio_Bio |
Filename: | !Bio/Library/WordCount |
Read OK: | ✔ |
File size: | 0324 bytes |
Load address: | 0000 |
Exec address: | 0000 |
Duplicates
There is 1 duplicate copy of this file in the archive:
- Archimedes archive » Acorn User » AU 1993-08.adf » !Bio_Bio » !Bio/Library/WordCount
- Archimedes archive » Acorn User » AU 1993-09.adf » !Bio_Bio » !Bio/Library/WordCount
File contents
10REM >WordCount 20REM Word and line count 30: 40DEF FNwordcount_name = "Word & line count" 50DEF FNwordcount_args = "-in Text -results 2" 60DEF FNwordcount_init 70LOCAL i% 80DIM word_count_is_char%(255) 90FOR i%=0 TO 255 100 word_count_is_char%(i%)=i%>32 AND i%<>127 AND INSTR(",.;:/\",CHR$i%)=0 110NEXT 120=0 130: 140DEF FNwordcount(in$,RETURN title$,RETURN s1$,RETURN s2$) 150LOCAL in%,words%,lines%,c%,inword%,lastc%,char% 160in%=OPENIN(in$) 170words%=0 180lines%=0 190inword%=FALSE 200lastc%=-1 210WHILE NOT EOF#in% 220 IF PTR#in% MOD 100=0 PROChourglass(PTR#in%,EXT#in%) 230 c%=BGET#in% 240 IF (c%=10 OR c%=13) AND lastc%<>23-c% lines%+=1 250 char%=word_count_is_char%(c%) 260 IF char% THEN 270 IF NOT inword% inword%=TRUE 280 ELSE 290 IF inword% inword%=FALSE:words%+=1 300 ENDIF 310 lastc%=c% 320ENDWHILE 330CLOSE#in% 340title$=FNleaf_name(in$) 350s1$="Word count: "+STR$words% 360s2$="Line count: "+STR$lines% 370=0
� >WordCount � Word and line count : (+� �wordcount_name = "Word & line count" 2-� �wordcount_args = "-in Text -results 2" <� �wordcount_init F� i% P� word_count_is_char%(255) Z� i%=0 � 255 d? word_count_is_char%(i%)=i%>32 � i%<>127 � �",.;:/\",�i%)=0 n� x=0 �: �*� �wordcount(in$,� title$,� s1$,� s2$) �/� in%,words%,lines%,c%,inword%,lastc%,char% �in%=�(in$) �words%=0 �lines%=0 � inword%=� � lastc%=-1 �ȕ � �#in% �, � �#in% � 100=0 �hourglass(�#in%,�#in%) � c%=�#in% �0 � (c%=10 � c%=13) � lastc%<>23-c% lines%+=1 �" char%=word_count_is_char%(c%) � char% � � � inword% inword%=� � "# � inword% inword%=�:words%+=1 , � 6 lastc%=c% @� J �#in% Ttitle$=�leaf_name(in$) ^s1$="Word count: "+�words% hs2$="Line count: "+�lines% r=0 �
00000000 0d 00 0a 10 f4 20 3e 57 6f 72 64 43 6f 75 6e 74 |..... >WordCount| 00000010 0d 00 14 19 f4 20 57 6f 72 64 20 61 6e 64 20 6c |..... Word and l| 00000020 69 6e 65 20 63 6f 75 6e 74 0d 00 1e 05 3a 0d 00 |ine count....:..| 00000030 28 2b dd 20 a4 77 6f 72 64 63 6f 75 6e 74 5f 6e |(+. .wordcount_n| 00000040 61 6d 65 20 3d 20 22 57 6f 72 64 20 26 20 6c 69 |ame = "Word & li| 00000050 6e 65 20 63 6f 75 6e 74 22 0d 00 32 2d dd 20 a4 |ne count"..2-. .| 00000060 77 6f 72 64 63 6f 75 6e 74 5f 61 72 67 73 20 3d |wordcount_args =| 00000070 20 22 2d 69 6e 20 54 65 78 74 20 2d 72 65 73 75 | "-in Text -resu| 00000080 6c 74 73 20 32 22 0d 00 3c 15 dd 20 a4 77 6f 72 |lts 2"..<.. .wor| 00000090 64 63 6f 75 6e 74 5f 69 6e 69 74 0d 00 46 08 ea |dcount_init..F..| 000000a0 20 69 25 0d 00 50 1e de 20 77 6f 72 64 5f 63 6f | i%..P.. word_co| 000000b0 75 6e 74 5f 69 73 5f 63 68 61 72 25 28 32 35 35 |unt_is_char%(255| 000000c0 29 0d 00 5a 10 e3 20 69 25 3d 30 20 b8 20 32 35 |)..Z.. i%=0 . 25| 000000d0 35 0d 00 64 3f 20 77 6f 72 64 5f 63 6f 75 6e 74 |5..d? word_count| 000000e0 5f 69 73 5f 63 68 61 72 25 28 69 25 29 3d 69 25 |_is_char%(i%)=i%| 000000f0 3e 33 32 20 80 20 69 25 3c 3e 31 32 37 20 80 20 |>32 . i%<>127 . | 00000100 a7 22 2c 2e 3b 3a 2f 5c 22 2c bd 69 25 29 3d 30 |.",.;:/\",.i%)=0| 00000110 0d 00 6e 05 ed 0d 00 78 06 3d 30 0d 00 82 05 3a |..n....x.=0....:| 00000120 0d 00 8c 2a dd 20 a4 77 6f 72 64 63 6f 75 6e 74 |...*. .wordcount| 00000130 28 69 6e 24 2c f8 20 74 69 74 6c 65 24 2c f8 20 |(in$,. title$,. | 00000140 73 31 24 2c f8 20 73 32 24 29 0d 00 96 2f ea 20 |s1$,. s2$).../. | 00000150 69 6e 25 2c 77 6f 72 64 73 25 2c 6c 69 6e 65 73 |in%,words%,lines| 00000160 25 2c 63 25 2c 69 6e 77 6f 72 64 25 2c 6c 61 73 |%,c%,inword%,las| 00000170 74 63 25 2c 63 68 61 72 25 0d 00 a0 0e 69 6e 25 |tc%,char%....in%| 00000180 3d 8e 28 69 6e 24 29 0d 00 aa 0c 77 6f 72 64 73 |=.(in$)....words| 00000190 25 3d 30 0d 00 b4 0c 6c 69 6e 65 73 25 3d 30 0d |%=0....lines%=0.| 000001a0 00 be 0d 69 6e 77 6f 72 64 25 3d a3 0d 00 c8 0d |...inword%=.....| 000001b0 6c 61 73 74 63 25 3d 2d 31 0d 00 d2 0e c8 95 20 |lastc%=-1...... | 000001c0 ac 20 c5 23 69 6e 25 0d 00 dc 2c 20 e7 20 8f 23 |. .#in%..., . .#| 000001d0 69 6e 25 20 83 20 31 30 30 3d 30 20 f2 68 6f 75 |in% . 100=0 .hou| 000001e0 72 67 6c 61 73 73 28 8f 23 69 6e 25 2c a2 23 69 |rglass(.#in%,.#i| 000001f0 6e 25 29 0d 00 e6 0d 20 63 25 3d 9a 23 69 6e 25 |n%).... c%=.#in%| 00000200 0d 00 f0 30 20 e7 20 28 63 25 3d 31 30 20 84 20 |...0 . (c%=10 . | 00000210 63 25 3d 31 33 29 20 80 20 6c 61 73 74 63 25 3c |c%=13) . lastc%<| 00000220 3e 32 33 2d 63 25 20 6c 69 6e 65 73 25 2b 3d 31 |>23-c% lines%+=1| 00000230 0d 00 fa 22 20 63 68 61 72 25 3d 77 6f 72 64 5f |..." char%=word_| 00000240 63 6f 75 6e 74 5f 69 73 5f 63 68 61 72 25 28 63 |count_is_char%(c| 00000250 25 29 0d 01 04 0e 20 e7 20 63 68 61 72 25 20 8c |%).... . char% .| 00000260 0d 01 0e 1b 20 20 e7 20 ac 20 69 6e 77 6f 72 64 |.... . . inword| 00000270 25 20 69 6e 77 6f 72 64 25 3d b9 0d 01 18 06 20 |% inword%=..... | 00000280 cc 0d 01 22 23 20 20 e7 20 69 6e 77 6f 72 64 25 |..."# . inword%| 00000290 20 69 6e 77 6f 72 64 25 3d a3 3a 77 6f 72 64 73 | inword%=.:words| 000002a0 25 2b 3d 31 0d 01 2c 06 20 cd 0d 01 36 0e 20 6c |%+=1..,. ...6. l| 000002b0 61 73 74 63 25 3d 63 25 0d 01 40 05 ce 0d 01 4a |astc%=c%..@....J| 000002c0 09 d9 23 69 6e 25 0d 01 54 1a 74 69 74 6c 65 24 |..#in%..T.title$| 000002d0 3d a4 6c 65 61 66 5f 6e 61 6d 65 28 69 6e 24 29 |=.leaf_name(in$)| 000002e0 0d 01 5e 1e 73 31 24 3d 22 57 6f 72 64 20 63 6f |..^.s1$="Word co| 000002f0 75 6e 74 3a 20 22 2b c3 77 6f 72 64 73 25 0d 01 |unt: "+.words%..| 00000300 68 1e 73 32 24 3d 22 4c 69 6e 65 20 63 6f 75 6e |h.s2$="Line coun| 00000310 74 3a 20 22 2b c3 6c 69 6e 65 73 25 0d 01 72 06 |t: "+.lines%..r.| 00000320 3d 30 0d ff |=0..| 00000324