home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
club100
/
txt
/
wc.do
< prev
next >
Wrap
Text File
|
2006-10-19
|
2KB
|
39 lines
Documentation for WC.BA, version 2.0
Original program by Gregory Sandow
Modified and edited by Robert Benson
At 930 bytes this program isn't as compact as it might be
for I have modified it so that it will run on either the Model 100
or the Model 200, and I have move the machine code to the previous
screen buffer so it won't conflict with any other machine language
programs. Writers will love it for it counts words in a text file,
and counts them fast. It counts 2000 words in barely two seconds!
It's fast because the word counting routine is written in
machine language. You will be asked for the name of the text file
that you want to count, type the name (you can leave off the .DO)
and hit ENTER. Moments later you will have the count and see this
prompt: A)gain E)dit Q)uit, type "a" if you want to count another
file, type "e" and enter a name at the prompt if you want to edit
a file without returning to the main menu or type "q" to exit.
Quibbles about accuracy; every word count program has its
own ideas about what counts as a word. WC thinks hyphenated words
are two words; this is because making that assumption allowed me
to handle both hyphens and dashes with a subroutine I had already
written for spaces, carriage returns, linefeeds, and tabs which
helped make the program more compact. If you don't end your files
with a carriage return WC will give you a count one word short of
the actually length, you can fix this by adding "+1" to line 5 of
the program so that it reads:
CALLS:PRINTPEEK(S+64)+(256*PEEK(S+65))+1"words"
It would have been easy enough to write code to handle every absurd
detail, but on a machine with limited memory it simply did not seem
worth the extra bytes. One detail that might matter more to writers,
WC knows about ellipses which are not uncommon in scholarly writing.
For example; WC will correctly tell you that "I . . . love you" is
three words, but will be helpless if you use any other punctuation.
For example; WC will think that "Hey ! ! ! you" is five words.