Contents of the SPELL.DOC file
THE GRUMPFISH SPELLCHECKER
Table of Contents
Legal Niceties............. 1
License Agreement.......... 2
Limitation of Liability.... 2
Linking It In.............. 3
Memory Requirements........ 3
Calling The Spellchecker... 4
Required Parameter...... 4
Optional Parameters..... 4
Return Value............ 4
Index Files................ 4
Spellchecker In Action..... 5
Spellchecker In Action..... 5
Sample Usage............... 6
With the Grumpfish notepad. 7
The Grumpfish Spellchecker, Page 1
Grumpfish Spellchecker is a comprehensive spell-check utility that
can be linked instantly into your Clipper applications. You may
use it to check the spelling of any character field or expression,
memo field or expression, or DOS text file. When the
spell-checking process is complete, it will display the number of
GrumpSpell comes complete with a 10,000+ word dictionary in the
form of a database (.dbf) file, which you can easily add to. Also
included in GrumpSpell is a unique filtering algorithm that gives
you semi-intelligent substitution choices for misspelled words.
The Grumpfish Spellchecker is written 99.5% in Clipper Summer
'87. The Clipper source code is provided, and is written and
commented to be as easy to follow as possible. Assembler is used
only for the transparent shadowing effect.
The Grumpfish Spellchecker is only guaranteed to support the
Summer '87 release of Clipper; use with earlier versions of
Clipper may cause inconsistent results and numerous compiler or
CLIPPER is a registered trademark of Nantucket Corporation.
PLINK86 is a registered trademark of Phoenix Technologies.
MICROSOFT and DOS are registered trademarks of Microsoft Corporation.
TLINK is a registered trademark of Borland International.
GRUMPFISH is a registered trademark of Grumpfish Incorporated.
The Grumpfish Spellchecker, Page 2
The Grumpfish Spellchecker has been released into the public
domain by Greg Lief. You are hereby free to use it in any way that
you see fit. If you find it useful in your Clipper programming
endeavors, drop me a line and let me know. You can reach me at:
P. O. Box 17761
Salem, Oregon 97305
Tel (503) 588-1815
Fax (503) 588-1980 (24 hr)
BBS (503) 588-7572 (24 hr)
Don't expect any on this one. I still maintain that Clipper is
hardly the optimum language in which to write such a product,
which is one of the big reasons why I am no longer marketing it.
Support was getting to be ridiculous, because I was fighting the
inherent idiosyncracies of MEMOEDIT() every step of the way.
The reason I have released this into the public domain is because
I continue to get calls from people who want to purchase it.
LIMITATION OF LIABILITY
This software is provided ** AS IS **. As already implied above,
it is definitely not perfect. You assume all risk for using it in
your applications. I will not be liable for consequential,
special, indirect or other similar damages or claims, including
loss of profits or any other commercial damage. In no event will my
liability for damages to you or any other person ever exceed the
price paid for the Grumpfish Spellchecker, regardless of any form
of the claim.
I specifically disclaim all other warranties, expressed or
implied. I make no representations or warranties with respect to
the merchantability or fitness of the Grumpfish Spellchecker for
any particular purpose, business or application.
The Grumpfish Spellchecker, Page 3
LINKING IT IN
For the sake of convenience, copy GRUMPSPL.LIB to the same
subdirectory where CLIPPER.LIB and EXTEND.LIB are located.
To use the Grumpfish Spellchecker, you must link in both the
Spellchecker library (GRUMPSPL.LIB) and Clipper's Extend
The following are examples of what you would enter at the DOS
prompt for the three most commonly used linkers.
represents the name of your object (.obj) files, and we are
assuming that all of the libraries are in the CLIPPER
Phoenix Technologies' PLINK86
/ pros: bundled with Clipper, handles overlays /
/ cons: painfully slow /
PLINK86 FI LI \CLIPPER\GRUMPSPL, \CLIPPER\EXTEND,
/ pros: handles overlays, faster than PLINK86 /
/ cons: not as fast as TLINK /
Borland's TLINK (any version prior to 2.0!!)
/ pros: the fastest linker available /
/ cons: does not handle overlays /
TLINK ,,,\CLIPPER\GRUMPSPL \CLIPPER\EXTEND
If you also own the Grumpfish Library, it does not matter what
order you list them in for linking. Just be sure to link all
Grumpfish products BEFORE calling EXTEND.LIB.
The Grumpfish Spellchecker will add approximately 17K to the size
of your .EXE file. If you are not using the MEMOEDIT() function
anywhere else in your program, the total increase will be about
30K (MEMOEDIT alone takes about 11-12K).
At run-time, you must ensure that the dictionary (DICT.DBF) is
either in the same subdirectory as the executable file (.EXE) or
available via the SET PATH command. You will also need around 440K
of disk space available on your hard disk to accommodate the two
index files used in conjunction with the dictionary.
If you do not have a hard disk, please return the Grumpfish
Spellchecker this very instant because you will be thoroughly
frustrated in your attempts to use it on a floppy-disk system!
The Grumpfish Spellchecker, Page 4
CALLING THE SPELLCHECKER
The name of the function is Spellit(), and the syntax is as
Spellit( , , , , ,
is a character string representing the character
expression, memo field, or text file to be spellchecked. If you
are passing the name of a text file, it must be enclosed in quotes.
Otherwise, you should not enclosed this parameter in quotes. See
page 7 for examples.
, , , are all numeric type variables
representing the coordinates to be used for displaying the text
being checked. If you do not pass these parameters, the entire
screen will be used to display the text (@0,0 TO @24,79). Either
pass all or none of them.
is a character expression representing, obviously
enough, the color to display the text in. The default is high
intensity white on black (+W/N).
is a character expression the color to use for the
highlight bar when flagging misspelled words. The default is
inverse video (N/W).
Spellit() returns the corrected item in the form of a character
string. It is up to you to process it thereafter. Lucid examples
on how to do this will follow.
When the Spellchecker is called for the first time, it will
automatically create two index files for the dictionary (DICT.DBF),
DICT.NTX and DICT2.NTX. DICT.NTX is an alphabetical index of all
of the words. The key field for DICT2.NTX is based on the
SOUNDEX() algorithm, which determines the phonetic complement of a
word. It is used for displaying substitution choices.
As mentioned above, these two index files will occupy about 440K
bytes on your hard disk. If you add words to the dictionary, they
will grow accordingly.
The Grumpfish Spellchecker, Page 5
THE SPELLCHECKER IN ACTION
If you are calling the Spellchecker for the first time, it will
create the above-mentioned index files. This process will take a
moment or two.
A message box will then appear on-screen, which says "Checking
words". If no misspelled words are found, this box will vanish
and control will return to your calling program.
However, as soon as a misspelled word is found, the text of the
item being spellchecked will be displayed in the specified
coordinates. The misspelled word will be highlighted in the
specified highlight color. A box will appear with the message
"Word not found in dictionary", along with the following five
1) See Choices - pops up a scrolling window of words that you
may substitute for the misspelled word. Use the arrow keys to
highlight the desired word and press Enter to select it. If
you do not wish to use any of these choices, press Esc to
return to the previous menu.
2) Edit Word - allows you to edit the word as necessary.
3) Add Word - adds the flagged word to the dictionary (DICT.DBF)
4) Skip Word - ignores the word and continues spellchecking
5) Skip All - ignores the word now and for the remainder of this
document, and continues spellchecking. This is useful for
cases where you use the name of a company several times in
one letter, yet do not wish to add the name to your dictionary.
6) Quit - exits the Spellchecker
This process will continue until the end of the character/memo/
text file is reached, at which time the Spellchecker will return
the corrected character string back to your calling program.
Please note that if you select the "Quit" option, any corrections
that you made up to that point will be reflected in the returned
Whenever you select "Skip All", that word is added to a temporary
array. The current maximum number of words (elements) that may be
entered into this array is 75. If you feel that you will need more,
simply change the array declaration (line 45) and line 297.
The Grumpfish Spellchecker, Page 6
(a) Character Fields and Expressions
1) Replace field ADDRESS with the corrected version of itself
REPLACE address WITH Spellit(address)
2) Get a character string from the user and spellcheck it
mCOMMENTS = SPACE(60)
@ 10,1 GET mCOMMENTS
mCOMMENTS = Spellit(mCOMMENTS, 10, 1, 10, 60)
(b) Memo Fields
1) Replace memofield SHIPNOTE with corrected version of itself
REPLACE shipnote WITH Spellit(shipnote)
2) Get a memofield NOTES from the user and spellcheck it
notes = MEMOEDIT(notes, 8, 20, 16, 59, .T.)
notes = Spellit(notes, 8, 20, 16, 59)
3) Get a memofield NOTES from the user and spellcheck it
notes = Spellit(MEMOEDIT(notes,8,20,16,59,.T.),8,20,16,59)
(c) DOS Text Files
1) Spellcheck the contents of the text file CUST.TXT, then
write the corrected results into the memofield COMMENTS
REPLACE comments WITH Spellit('cust.txt')
2) Spellcheck the contents of text file OLD.TXT, then write
the corrected version to text file NEW.TXT.
The Grumpfish Spellchecker, Page 7
WITH THE GRUMPFISH NOTEPAD
Those of you who also own the Grumpfish Library are probably
wondering "how can I use this amazing incredible spell-checker
with that amazing incredible Grumpfish notepad"? Simple. You
will need to add the following blocks of code to POPNOTE.PRG.
Around line 497 (just after the logic for the Alt-Y keypress),
please insert the following:
CASE KEY = 300 && Alt-Z: spell check
ret_val = 23
Then at line 129, insert the following (just after the DO CASE
CASE KEY = 300 && Alt-Z: spell-check this file then continue
temptext = spellit(workfile, 1, lmargin, 21, MIN(rmargin,78))
Then recompile POPNOTE.PRG and be sure to link POPNOTE.OBJ into
your application. If you need further assistance, please contact
me and I will be more than happy to guide you through this process.
As you add more words to the dictionary, it is highly recommended
that you resort it from time to time to optimize the searches.
Included on the distribution diskette is the program SETUP.PRG,
which will handle this chore for you. To make things really
simple, I have also included three batch files to compile and link
SETUP_P.BAT - for use with PLINK86
SETUP_L.BAT - for use with the Microsoft Linker
SETUP_T.BAT - for use with TLINK
All you have to do is run the batch file corresponding to your
linker. For example, if you are using TLINK, just type "SETUP_T"
at the DOS prompt. Naturally, make sure that SETUP.EXE and
DICT.DBF are in the same subdirectory.
Special thanks to Bill Bird of Yorkstone Tech for his invaluable input...
*** that's all we wrote ***