home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / club100 / txt / wc.do < prev    next >
Text File  |  2006-10-19  |  2KB  |  39 lines

  1.                 Documentation for WC.BA, version 2.0
  2.                 Original program by Gregory Sandow
  3.                 Modified and edited by Robert Benson
  4.  
  5.         At 930 bytes this program isn't as compact as it might be
  6. for I have modified it so that it will run on either the Model 100
  7. or the Model 200, and I have move the machine code to the previous
  8. screen buffer so it won't conflict with any other machine language
  9. programs. Writers will love it for it counts words in a text file,
  10. and counts them fast. It counts 2000 words in barely two seconds!
  11.  
  12.         It's fast because the word counting routine is written in
  13. machine language. You will be asked for the name of the text file
  14. that you want to count, type the name (you can leave off the .DO)
  15. and hit ENTER. Moments later you will have the count and see this
  16. prompt: A)gain E)dit Q)uit, type "a" if you want to count another
  17. file, type "e" and enter a name at the prompt if you want to edit
  18. a file without returning to the main menu or type "q" to exit.
  19.  
  20.         Quibbles about accuracy; every word count program has its
  21. own ideas about what counts as a word. WC thinks hyphenated words
  22. are two words; this is because making that assumption allowed me
  23. to handle both hyphens and dashes with a subroutine I had already
  24. written for spaces, carriage returns, linefeeds, and tabs which
  25. helped make the program more compact. If you don't end your files
  26. with a carriage return WC will give you a count one word short of
  27. the actually length, you can fix this by adding "+1" to line 5 of
  28. the program so that it reads:
  29.  
  30.  CALLS:PRINTPEEK(S+64)+(256*PEEK(S+65))+1"words"
  31.  
  32. It would have been easy enough to write code to handle every absurd
  33. detail, but on a machine with limited memory it simply did not seem
  34. worth the extra bytes. One detail that might matter more to writers,
  35. WC knows about ellipses which are not uncommon in scholarly writing.
  36. For example; WC will correctly tell you that "I . . . love you" is
  37. three words, but will be helpless if you use any other punctuation.
  38. For example; WC will think that "Hey ! ! ! you" is five words.
  39.