_____ _______ ___ SPELL Version 1.9 ________ _______ Spelling Checker ___ ___ __ _____ for the HP e3000 _____ ____ ______ Spell User Manual _______ _________ __________ ____ Robelle Solutions Technology Inc. ____ ___ _______ _____ ___ 7360 137 Street, Suite 372 _______ ____ ______ ___ ___ Surrey, B.C. Canada V3W 1A3 __________ _____________ Toll-free: 1.888.robelle ________________ (1.888.762.3553) ______ ____________ Phone: 604.501.2001 ____ ____________ Fax: 604.501.2003 ___________________ support@robelle.com _______________ www.robelle.com _____ ____ March 2000 Program and Manual Copyright Robelle Solutions Technology Inc. 1991-2007 ___ Permission is granted to reprint this document (but not for profit), provided that copyright notice is given. QEDIT and SUPRTOOL are trademarks of Robelle Solutions Technology Inc. Other product and company names mentioned herein may be the trademarks of their respective owners. 1 _______ _ _______ __ _____ Chapter 1 Welcome to Spell _ _____________ ü Documentation _ _____________ __ ___ ___ _____ _______ ü Authorization to Use the Spell Program _ ___ ________ __ _____ ü New Features of Spell Welcome to version 1.9 of Spell -- a spelling checker for the HP e3000. It is fast, and reads both Qedit and Editor files. Spell comes with an 80,000 word dictionary, and you can choose to incorporate British or American spellings. You can add additional words with either a global auxiliary dictionary or a local user dictionary. _____________ Documentation This manual describes how to install Spell, how to access it, and how to create and maintain the dictionaries. At the end of the manual, you will find an index - use it when you have trouble. There is also an appendix describing common errors with Spell and their resolution. ___ ___ _____ ____ ___ ______ __ ___ ______________ ___ ____ You can print your own copies of the documentation. The user ______ ___ ______ ______ _______ ___ ______ _______ __ ______ __ manual and change notice require the latest version of Prose. Be ____ __ _______ _ ___ ____ __ _____ ____ ___ _______ ______ sure to install a new copy of Prose when you install Spell. To print the user manual on your printer, whether LaserJet or lineprinter, run the Printdoc program. :run printdoc.pub.robelle;info="spell.doc.robelle" Printdoc is menu-driven, and very easy to use. Printdoc asks you for information, and if you are not sure of your answer, you can ask for help by typing a question mark (?) and pressing the Return key. There are two steps in printing a manual. First, tell Printdoc which document to print, either through the Run Command as shown above, or by selecting one of the user manuals from the Printdoc menu. Second, tell Printdoc what kind of printer you have. Printdoc supports all types of LaserJet printers and regular lineprinters. You can also print documentation other than user manuals, if you know the file name. You can include the file name in the :Run Command, or type it in answer to a prompt on the menu. For example, to print the change notice for Spell, type :run printdoc.pub.robelle;info="spell.docchg.robelle" Printdoc uses a message catalog, and requires Prose version 3.1 or later. It will look for these files in the same account as Printdoc. Also, Printdoc will only correctly print Prose _______ _ _______ __ _____ 2 Chapter 1 Welcome to Spell documents that use the Output JCWs and the Prose If Commands to choose the output device. _____________ __ ___ _____ Authorization to Use Spell Spell is a "bonus" program for Robelle customers. You receive a copy of it when you order Qedit, Suprtool or Xpress. As a Robelle customer you may install Spell on your CPUs which are licensed for any of these products. There is no charge for using Spell, but ___ you are not free to distribute it. Please install Spell only on your primary licensed CPUs, or on CPUs which are registered secondary CPUs. Spell is in the PUB group to remind you that it is a bonus product, and not part of any library that you can freely distribute. There is another category of programs from Robelle, called the "Qlib". These are programs which you may use on any ___ CPU and may distribute freely to your friends. Spell is not part of the Qlib. If you have questions on whether you are authorized to install Spell on a particular CPU, please call us for advice. ___ ________ __ _____ New Features of Spell Here are the highlights of the new features in Spell. For a complete list of changes, plus details on how to take advantage of all the new features, see the change notice that accompanied your tape. All changes discussed in the change notice have been incorporated into the user manual and help file, but the change notice gives you everything new in one convenient document. ___ ________ __ _______ ____ New Features in Version 1.9: ü Spell now detects if Time Machine is installed. ___ ________ __ _______ ____ New Features in Version 1.8: ü Two-user site licenses can now run Spell. ü Spell no longer misses the last few lines of certain Jumbo Qedit files. ___ ________ __ _______ ____ New Features in Version 1.7: ü Spell now works with Time Machine and the HP utility Setdate. _______ _ _______ __ _____ Chapter 1 Welcome to Spell 3 ___ ________ __ _______ ____ New Features in Version 1.6: ü Internal changes now allow trials to be extended in a more automated fashion. ___ ________ __ _______ ____ New Features in Version 1.5: ü Spell can read Jumbo text files that are greater than 256 characters wide. ___ ________ __ _______ ____ New Features in Version 1.4: ü Spell can read Qedit's new Jumbo files. ___ ________ __ _______ ____ New Features in Version 1.3: ü Internal changes now allow trials to be extended in a more automated fashion. ___ ________ __ _______ ____ New Features in Version 1.2: ü You can exclude lines that begin with a letter. ü You can check lines that only begin with certain characters. ü New intrinsics for searching for words in the dictionaries by prefix or by soundex. ___ ________ __ _______ ____ New Features in Version 1.1: ü A bug in reading a Keep file user dictionary was fixed. ü Spell can suspend. ü Variable-length Keep files can be checked for spelling. ü Dictionary words are case sensitive. ü After stopping Spell with Control-Y, the list of misspelled words is printed. 4 _______ _ _________ _____ Chapter 2 Accessing Spell _ _____ _____ ü Spell Files _ ______ __ ____ _____ ________ ü Output to Your Logon Terminal _ ____ _______ _______ ü User Defined Command _ _______ ______ ü Version Number _ ____ ______ ü Help Screen _ __________ _____ ü Suspending Spell _ _____________ ___ ü SpellCondWord JCW _ _____________ ___ ü SpellOutCount JCW _ _______ ____ ü On-line Help _ _________ ü Control-Y _ _____ ________ ü Stack Overflow Accessing Spell is a simple matter of two :File commands and a :Run command. :file infile=YourFile :file outfile=$stdlist :run spell.pub.robelle Spell/Copyright Robelle Solutions Technology Inc. 1991-2007 (Version 1.9) _____ _____ Spell Files Spell accesses the following files: Infile: File containing text to spell-check. This can be a Qedit file or an Editor Keep file, fixed or variable length. The default is INFILE. Outfile: Ascii file to receive the formatted results. The file will be created if necessary. The default is OUTFILE. You can direct this file to $STDLIST. Spuser: User dictionary file containing additional words for Spell to recognize. This can be a Qedit or Editor Keep file. ______ __ ____ _____ ________ Output to Your Logon Terminal If you want the list of misspelled words to print on your screen (i.e., $STDLIST), you just use the :FILE command to set Outfile to $STDLIST. _____ ____ :file infile=input file :file outfile=$stdlist _______ _ _________ _____ Chapter 2 Accessing Spell 5 ____ _______ _______ User Defined Command We suggest that you use the following UDC to invoke Spell. Subsequent examples of invoking Spell in this manual will use this UDC. Note that we called the UDC Spellf instead of Spell. This is to avoid conflict with Robelle's Qedit, which has a built-in Spell command. spellf parmin="infile", parmout="$STDLIST", infostr="" file infile=!parmin file outfile=!parmout run spell.pub.robelle;info="!infostr" reset infile reset outfile **** To invoke this UDC, you merely specify the UDC name and the name of the Infile document. The Outfile parameter is optional and defaults to $STDLIST. Error messages from Spell are always written to $STDLIST. The Infostr parameter is also optional, and it defaults to a null string. When you specify the Infostr parameter, you do not need to have quotes around it unless you have blanks in the parameter. :Spellf letter :Spellf letter,spellout :Spellf letter,spellout,i.h\ :Spellf letter,,"i. h\" A copy of the Spellf UDC and Spellerr UDC is included in the file Spelludc.Catalog.Robelle. To invoke this UDC from within Qedit, use these commands: /set udc spelludc.catalog.robelle /Spellf letter _______ ______ Version Number When you run Spell, it will always print the version number to the screen. To check the version number without spell-checking any file, run Spell with the V option in the Info= string. :Spellf,,v Spell/Copyright Robelle Solutions Technology Inc. 1991-2007 (Version 1.9) _______ _ _________ _____ 6 Chapter 2 Accessing Spell ____ ______ Help Screen If you forget what options are set, you can have Spell print a quick summary of the options without spell-checking anything by using the ? option in the Info= string. :Spellf,,? Spell/Copyright Robelle Solutions Technology Inc. 1991-2007 (Version 1.9) Infile = input file Outfile = output file Spuser = user dictionary file info="[AELNTW[+-]] [Hc] [Ic] [Oc] [Xc] [V] [?]" ?: display this help information A: warn if aux. dictionaries not found (def. on) E: create Editerror output H: ignore hyphenation char c I: ignore lines beginning with chars c L: show input lines that has errors N: show line numbers (def. on) O: only check lines beginning with chars c T: print timing info V: display program version X: exclude lines beginning with chars c W: print misspelled word list (def. on) __________ _____ Suspending Spell When you run Spell from another program, such as Qedit, Spell will suspend instead of terminate when it finishes spell-checking a file. This way, the father process can awaken Spell quickly later, rather than doing another :Run, which is much slower. When you run a suspended copy of Spell, you will be using the same info= options and the same user dictionary as the initial copy of Spell. To use different options or an updated user dictionary, you will have to manually kill Spell and run it again. You can force Spell to terminate on exit rather than suspend by running Spell with PARM=32. :run spell.pub.robelle;parm=32 _____________ ___ SpellCondWord JCW Spell sets a JCW named SpellCondWord to indicate whether an error has occurred. If there was no error, this JCW is set to zero. If there was an error, this JCW is set to the status value displayed in the SpellExplain error message. If the error is a fatal error, the system job control word JCW is also set to a fatal state. Only the high-order bit of JCW is set. _______ _ _________ _____ Chapter 2 Accessing Spell 7 _____________ ___ SpellOutCount JCW After Spell has finished checking a file, it sets a JCW named SpellOutCount with the number of misspellings it has found. This is the same number reported in the "n misspellings" message. _______ ____ On-Line Help There is a help file available for Spell for use with the Qhelp on-line help system. If you are inside Qedit, you can get help on Spell by using Qedit's Qhelp command. /Qhelp spell.help.robelle If you are not inside Qedit (i.e., in MPE V or MPE XL), you can get help by running Qhelp. :run qhelp.qlib.robelle;info="spell.help.robelle" _________ Control-Y While Spell is checking a file, you can interrupt it by pressing Control-Y (hold down Control while pressing Y). Spell will print out how many lines it has checked so far, and ask you if you wish to stop. Press the Return key to continue spell-checking, or type YES to stop. _____ ________ Stack Overflow It is possible with the CM version of Spell to abort with a stack overflow. This can occur when you are spell-checking many misspelled words (e.g., several hundred) that are in alphabetical order. For most documents and manuals, this error does not occur. For example, our Qedit and Suprtool manuals (over 300 pages each) can be checked without any problem. If you are spell-checking a long list of alphabetized words, and this error occurs, you can work around the problem by putting the words into the auxiliary or user dictionary. Although this approach causes these words to be accepted, it does allow the remainder of the document to be checked without the stack overflow. 8 _______ _ ________ _____ Chapter 3 Applying Spell _ _______ _____ ü Example Input _ _______ ______ ü Example Output _ ___________ _____ ______ ü Redirecting Spell Output _ ______ __ _____ ü Casing of words _ ________ _______ ü Run-Time Options _ ___ _____ ____________ ü The Three Dictionaries _ ___________ ___ ____________ ü Maintaining the Dictionaries _ _______ __ _____ _______ ü Summary of Spell Options Spell is a non-interactive spelling checker. It will read your entire input file, then print a list of the words that are misspelled. It does not allow you to interactively correct spelling errors as it checks your file. Use your text editor to do the corrections after Spell has finished. Spell reads your input file one line at a time, and checks each word in the line. Spell defines a word as any sequence of alphanumeric characters and apostrophes surrounded by punctuation or blanks. Here, punctuation is any character which is not alphanumeric. For example, the line "One 2Three4-five's" contains three words: "one", "Three4", and "five's". Notice that the dash is treated as punctuation. This means a word such as "input-line" will be treated as two words. Also notice that the leading digit "2" is dropped from the word "2Three4". Spell deletes leading digits from a word, but keeps the other digits in a word. Because apostrophes are considered to be part of a word, Spell will delete a leading apostrophe, a trailing apostrophe, and a trailing apostrophe-s from a word before spell-checking it. This way, possessives and words at the beginning and end of a quotation __________ will be spell checked correctly. For example, 'writer's' will be ______ ________ correctly spell-checked as writer, but ''writer will be checked as _______ 'writer, which will be a misspelling. _______ _____ Example Input For the following examples we will use an input file called "example" that contains the following four lines: 1 This liine contains two errrors. 2 .inx this is index information 3 There are hyphen\ated errrors here. 4 This line has no errors. This example is typical of the type of input used for a text formatter such as Robelle's Prose. The ".inx" at the beginning of line 2 is a command to the text formatter. The back slash in line 3 indicates a hyphenation point. The following examples will show _______ _ ________ _____ Chapter 3 Applying Spell 9 you different ways of spell-checking this file, and show you how to get Spell to recognize the text formatter commands. _______ ______ Example Output The output from running Spell on the example file is as follows: :Spellf example 1 ated 3 2 errrors 1 3 1 inx 2 1 liine 1 4 misspellings Spell prints the list of misspelled words in alphabetical order after it has checked the entire file. The number preceding a word tells you how many times the word occurred, and the numbers following a word tells you which lines contain the word. Spell only prints the first five line numbers of each misspelling. Spell also prints the number of misspelled words at the end. In the example, there are a total of 5 misspellings, but only four misspelled words (since the word "errrors" occurred twice). ___________ _____ ______ Redirecting Spell Output You can send Spell's output to another file by using a file equation to redirect the file Outfile. In our Spellf UDC, you specify the output file as the second parameter. This is useful if you are spell-checking a long manual and you want to have a printout of the words to review later. You can also use this feature to produce a word list to add to the auxiliary or user dictionary. If you do not build the output file first, then a temporary file of the same name will be used. :Spellf example,slist2 {output to slist2,temp} :build slist;rec=-80,16,f,ascii;disc=1000 :Spellf example,slist {output to permanent slist} The file slist now contains all the output from the previous example. ______ __ _____ Casing of Words When a word is spell-checked, Spell also looks at the casing of the word. For example, "comPuter" would be a misspelling. Spell recognizes the common forms of capitalization: all lowercase, initial cap, and all caps. Ordinary words such as "computer" can appear as as "computer", "Computer", or "COMPUTER". Proper nouns such as "David" can appear as "David" or "DAVID", but not "david". _______ _ ________ _____ 10 Chapter 3 Applying Spell Acronyms and mixed-case proper nouns such as "IBM" and "LaserJet" can only appear as "IBM" and "LaserJet". See the section "Maintaining the Dictionaries" for more information on specifying the case of words. ________ _______ Run-Time Options Spell has several run-time options, which you can specify as the Info= string in the :Run Command. In our Spellf UDC, the Info= string is the third parameter. All option names consist of a single letter, which can be in either uppercase or lowercase. Some options are switches; that is, they are either on or off. Switches are set On by adding a plus "+" after its name (e.g., L+), and set Off by adding a minus "-" after its name (e.g., W-). If you specify a switch without using a plus or minus, the switch will be set to On. Other options accept a character or a string of characters immediately their name, with no blanks after the name (e.g., H\). _________ _______ Combining Options Several options can be specified in the Info= string. In most cases you do not have to use blanks to separate the options. The exceptions are options which accept a string of non-blank characters, such as the "X" and "O" option. For these options, you must use a blank to separate the option from the following option. When you have blanks in the Info= string, you will need to use quotes around the Info= string in the UDC. :Spellf example,,L+I.h\ :Spellf example,,"L+X. h\" 1 This liine contains two errrors. ^ ^ 3 There are hyphen\ated errrors here. ^ 2 errrors 1 3 1 liine 1 2 misspellings _____ _____ ____ ______ Print Lines with Errors Set the "L" switch to On to have Spell print the lines that have spelling errors. The lines will be printed as they are read. You may find this type of output helpful in seeing the context of the misspellings. :Spellf example,,L+ _______ _ ________ _____ Chapter 3 Applying Spell 11 1 This liine contains two errrors. ^ ^ 2 .inx this is index information ^ 3 There are hyphen\ated errrors here. ^ ^ 1 ated 3 2 errrors 1 3 1 inx 2 1 liine 1 4 misspellings Each line is printed with its line number, followed by a line containing carets "^" that point to the misspelled words in the line. __ ___ _____ ____ ____ Do Not Print Word List Set the "W" switch to Off to have Spell not print the list of misspelled words. You may want to do this if you are also using the "L+" option, so that you only see the lines that contain misspellings. :Spellf example,,L+W- 1 This liine contains two errrors. ^ ^ 2 .inx this is index information ^ 3 There are hyphen\ated errrors here. ^ ^ 4 misspellings _________ Editerror Instead of the W+ or L+ type of output, set the "E" switch to On __________ to produce an error-file that can be used by Qedit's :Editerror command. This way you can spell-check your file, and use Qedit's :Editerror and Visual commands to correct your misspellings without having to refer to the line numbers of the misspellings. When you use the E+ option, make sure you send the output to a file. Refer to the :Editerror command in the Qedit manual for more information on using Editerror. /spellf example,errfile,E+ 4 misspellings /editerror errfile visual /Visual We have included a UDC called Spellerr that will do the previous _______ _ ________ _____ 12 Chapter 3 Applying Spell steps automatically if you are running Qedit. The Spellerr UDC is in the file Spelludc.Catalog.Robelle, and accepts the same parameters as the Spellf UDC. /Spellerr example ___________ _________ Hyphenation Character Normally, a non-alphanumeric character appearing within a word will make Spell break the word into separate words. However, a character used to indicate a hyphenation point does not break up the word, and will not appear in the output. For example, the word "character" can be hyphenated as "char\acter". You can define a character as a hyphenation character in Spell by using the "H" option followed by the character you choose. For example, we use the back slash as a hyphenation character in our Prose text formatter documents. In this case, we would spell-check with the "H\" option to set the hyphenation character to a back slash. There can only be one hyphenation character at a time. :Spellf example,,H\ 2 errrors 1 3 1 inx 2 1 liine 1 3 misspellings Notice that the word "hyphen\ated" is treated as one word, and is correctly spell-checked. ______ _____ Ignore Lines Sometimes there are lines in a file you don't want to spell-check. For example, you might have a file that contains lines that are actually commands for a text formatter, and these lines all begin with a special character. For example, our Prose text formatter uses lines that begin with a period as Prose commands. To have Spell ignore lines that begin with certain characters, use the "I" or "X" option followed by a list of the characters. For example, use "I." or "X." to avoid checking lines that begin with a period. The "X" option accepts all non-blank characters, including letters, but needs a blank to separate it from the next option. The "I" option only accepts punctuation characters, and does not need a blank to separate it from the next option. The "I" option is easier to type when you are using the Spellf UDC, since you do not need either the separating blank or quotes around the Info= string. :Spellf example,,I.H\ :Spellf example,,"X. H\" 2 errrors 1 3 _______ _ ________ _____ Chapter 3 Applying Spell 13 1 liine 1 2 misspellings Notice that the word "inx" is no longer in the word list. Be careful in using this option, since the lines you are ignoring might contain words you want to spell-check. For example, a text formatter command to store text in the index or table of contents should be spell-checked. ____ _____ _____ Only These Lines Occasionally, you will want to only spell-check specific lines in a file. For example, you might have a program or script file that identifies different types of lines by preceding them with special characters. To spell-check only the lines that begin with certain characters, use the "O" option followed by a list of the characters. For example, use "O*Q" as an option to check only the lines that begin with an asterisk or the letter "Q." The "O" option accepts all non-blank characters, including letters, but needs a blank to separate it from the next option. :Spellf example,,O. 1 inx 2 1 misspelling Notice that the word "inx" is the only misspelling found, because only the lines beginning with a period were spell-checked. ____ ____ _______ ____ _______ Word List Without Line Numbers You can create a list of only the misspelled words, without any counts or line numbers, by setting the "N" option Off. This way, by redirecting the output to a file, you can create a list of the misspelled words that you you can quickly edit and add to your user dictionary. :Spellf example,wordlist,N- The file "wordlist" will contain the following words: ated errrors inx liine _______ _ ________ _____ 14 Chapter 3 Applying Spell __ _________ __________ _______ No Auxiliary Dictionary Warning If you do not have an auxiliary dictionary or a user dictionary, Spell will print a warning message saying so. Use the "A-" option to suppress this warning message. See the next section and the section "Maintaining the Dictionaries" for more information about auxiliary and user dictionaries. ___ _____ ____________ The Three Dictionaries Spell uses three dictionaries: a main dictionary, an auxiliary dictionary, and a user dictionary. ____ __________ Main Dictionary Spell has a main dictionary with over 80,000 words, which includes many common proper nouns. On the tape that contains Spell, the main dictionary is stored in several word lists. There is a list for the American spellings, a list for the British spellings, and a list for the spellings common to both. These lists of words are not immediately usable by Spell. During the installation of Spell, the main dictionary is created from these lists. The main dictionary contains the common words, plus either the American or the British words. You should not add or delete words from the main dictionary, because a new version of Spell could overwrite those changes. But because the main dictionary can't possibly contain all the words that everyone needs, Spell has two additional dictionaries that you can add words to: an auxiliary dictionary, and a user dictionary. _________ __________ Auxiliary Dictionary The auxiliary dictionary affects all Spell users, and can be as large as, or even larger than, the main dictionary. This dictionary is meant to contain words specific to your company and your industry. For example, it could contain your company name, your product names, names of key personnel of the company, the technical terms in your industry, and HP e3000 terms. You maintain the auxiliary word list as a text file called Auxtxt in the Spdata group of the Robelle account. Each line of the file contains one word. The casing of the words is specified in a straightforward way: just enter the word the way it would usually appear. Ordinary words are in lowercase (e.g., computer), proper nouns start with a capital letter (e.g., David), acronyms are in all uppercase, (e.g., IBM), and mixed-case proper nouns appear as is (e.g., NewWave). _______ _ ________ _____ Chapter 3 Applying Spell 15 As with the main dictionary, the word list is not immediately usable by Spell. To create a dictionary usable by Spell, you stream a job that we provide. Because the auxiliary dictionary affects all Spell users, there should be someone who is responsible for setting up and maintaining the auxiliary dictionary. ____ __________ User Dictionary The user dictionary affects only the current user of Spell. Typically each user will have his or her own user dictionary. This dictionary is meant for words and names customized for a particular user or a particular document. For example, it could contain all the special terms and command names for a manual, or it could contain the names of people and places that a user regularly corresponds with. The user dictionary is a text file called Spuser in the logon group of the logon account. The file can be either a Qedit file or an Editor keep file. The format of the word list is the same as that for the Auxiliary dictionary. However, the maximum number of words is limited to 2,500. The words should be sorted in ascending order regardless of case. This file can be redirected by a file equation, ___________ ___ ____________ Maintaining the Dictionaries Spell uses three dictionaries: a main dictionary, an auxiliary dictionary, and a user dictionary. The main dictionary is the most critical to Spell. It must be created, since Spell will not work without it. You do not have to create the auxiliary and user dictionaries. Spell will only issue a warning if these two dictionaries are not found. The main dictionary's words should not be altered, because a new version of Spell may contain an updated word list that will overwrite your changes. The auxiliary dictionary should be maintained by the Mgr.Robelle. The users can each maintain their own user dictionaries. When a word is spell-checked, Spell looks at the dictionaries in this order: user, auxiliary, main. If Spell finds a word in a dictionary but it has incorrect case, Spell will not look in the other dictionaries, and will report the word as misspelled. ____ ____ ______ Word List Casing The words in the auxiliary and user dictionaries are maintained via a word list. Each word list is a text file, containing one word per line. The allowed casings of each word are specified by how the word in the word list is cased, and by an optional suffix _______ _ ________ _____ 16 Chapter 3 Applying Spell after the word. For most words, you can just type in the word the way it is usually spelled. The following table summarizes how you can case the words in the word list and the possible casings allowed in a document: Dictionary wordAccepted casings in document lower lower, Lower, LOWER Initcap Initcap, INITCAP ALLCAP ALLCAP MixedCase MixedCase Exactcase! Exactcase anycase@ anycase, AnyCase, ANYCASE, ... Lowercase words in the dictionary are used for ordinary words (e.g., computer). Initial cap words are used for proper nouns (e.g., David). All cap words are used for acronyms (e.g., IBM). Mixed-case and exact-case words are used for special proper nouns (e.g., LaserJet). A non-lowercase word that has an "!" at the end of the word means the word can only be spelled in that case. Words that are in MixedCase have an implicit "!" added at the end. The same word may appear multiple times with different casings or suffixes. If a word is in mixed or exact-case, then all other forms of that word must also be in mixed or exact-case. For ________ example, if you have the word "LaserJet" and also want to include ________ _________ ________ "LASERJET", you must use "LASERJET!", not "LASERJET". A word that has an "@" at the end of the word means the word can be spelled with any case whatsoever. Use anycase words very sparingly, if at all. ____ __________ Main Dictionary We supply the words to the main dictionary as text files in the Spdata group. The words common to British and American spellings are in MainComm, the American spellings are in MainAmer, and the British spellings are in MainBrit. These text files are not accessed directly by Spell, but are used to build the main dictionary. The main dictionary is a KSAM file, called Main.Spdata, in the Robelle account. We supply a job, DictMain.Spjob.Robelle, that builds the KSAM dictionary file from the text files. To use DictMain.Spjob, first log on as Mgr.Robelle. Then :Run Qedit (or Editor) and Text in the DictMain.Spjob job. Modify the first line to use the Robelle password. Next, decide whether to install the American spellings (e.g., color) or the British spellings (e.g., colour). The default is to install the American spellings. To install the British spellings, change the line that sets the SpellAmerican JCW to False. Finally, stream the job. _______ _ ________ _____ Chapter 3 Applying Spell 17 This job will take about 20 to 40 minutes to run. :hello mgr.robelle :warn @;please stop using Spell NOW! :run qedit.pub.robelle {or use :Editor} /text dictmain.spjob /modify first {Mgr.Robelle passwords} /modify "setjcw SpellAmerican" {For British spelling...} /keep robtemp {...change True to False} /exit :stream robtemp :purge robtemp _________ __________ Auxiliary Dictionary The auxiliary dictionary is a KSAM file called Aux.Spdata in the Robelle account. The text file containing the words is AuxTxt.Spdata. This must be an Editor keep file, with one word per line. The words do not have to be in sorted order, although you'll find it is easier to maintain the words if they are. The format of the words is described above in "Word List Casing". This text file is not immediately usable by Spell. We supply a job, DictAux.Spjob.Robelle, that will build the KSAM dictionary file from the text file. To use DictAux.Spjob, first log on as Mgr.Robelle. Then :Run Qedit (or Editor) and Text in the DictAux.Spjob job. Modify the first line to use the Robelle password. Finally, stream the job. :hello mgr.robelle :warn @;please stop using Spell NOW! :run qedit.pub.robelle {or use :Editor} /text dictaux.spjob /modify first {Mgr.Robelle passwords} /keep robtemp /exit :stream robtemp :purge robtemp {discard password file!} ____ __________ User Dictionary The user dictionary is very easy to maintain. It is just a text file called Spuser in the logon group of the logon account. The file can be a Qedit or Editor file. Each line contains one word, and each word can be up to 24 letters long. There can be at most 2500 words in the user dictionary. The format of the words is described above in "Word List Casing". Although the words do not have to be sorted, we strongly recommend that you keep the words sorted in ascending order, especially if you have several hundred words or more. This will reduce the amount of time it takes for Spell to start. If you have different user dictionaries for different documents, you can use a file equation to redirect _______ _ ________ _____ 18 Chapter 3 Applying Spell Spuser to the appropriate file. _______ __ _____ _______ Summary of Spell Options You specify run-time options for Spell in the Info= string of the run command. Options names are a single letter, and can be in either upper or lowercase. Most options are switches (i.e., they are either on or off). A switch option is set On by adding a "+" after the name, or just by specifying it. A switch option is set Off by adding a "-" after the name. Example: info="L" {turn option L on} info="L+" {turn option L on} info="L-" {turn option L off} You can specify several options at once. Options can be separated by blanks, and can appear in any order. There can not be any blanks between the option name and its parameters. For example, the following INFO= strings are all equivalent; info="L+ W- A-" info="L+W-A-" info="w- a- l" info="L A-W-" Some options require a blank to separate them from the following option. Without the blank, the next option would be considered part of the string of the first option. info="X. H\" {Correct: Exclude . Hyphen \ } info="X.H\" {Probably incorrect: } {Exclude . H \ } ______ ____ _______ _______ Option Type Default Meaning ? -- off display help screen A switch on warn if no aux dictionaries E switch off produce Editerror output H char none hyphenation character I chars none ignore lines beginning with the chars L switch off show lines with spelling errors N switch on don't print number info O chars* none check lines beginning with the chars T switch off print timing info V -- off print version W switch on print misspelled words X chars* none exclude lines beginning with the chars chars* must have a blank after the characters _______ _ ________ _____ Chapter 3 Applying Spell 19 ____ ______ Help Screen ?: This will print a help screen of the run-time options. No spell-checking will be done. ____ __ __ _________ __________ Warn if no auxiliary dictionary A: Issue a warning message if either the main auxiliary dictionary or the user auxiliary dictionary is not found. _________ ______ Editerror output E: Produce output that can be used by Qedit's :Editerror command. This option overrides the L+ and W+ options. The output file that you specify will be the error-file that is used in the :Editerror command. ___________ _________ Hyphenation Character H: This character will be considered as part of a word, but will not be included in the word. For example, if the back slash is the hyphenation character, then the sentence "reading, writing, arith\metic" contains three words. If there was no hyphenation character, then the previous example contains four words, the last two being "arith" and "metic". There can only be one hyphenation character at a time. Hyphenation characters can only be punctuation characters. ______ _____ _____ Ignore These Lines I: Lines beginning with any of the specified characters will not be spell-checked. This is useful for skipping lines which contain formatting information. For example, our Prose text formatter treats lines beginning with a period as command lines. Specifying "I." as a spell option will cause Spell not to spell-check the command lines. You do not need to have a blank after the final character. Ignore Line characters can only be punctuation characters. If you need to ignore lines beginning with letters, use the "X" option instead. _____ _____ ____ ________ ______ Print Lines With Spelling Errors _______ _ ________ _____ 20 Chapter 3 Applying Spell L: You may find it useful to see the lines that have the spelling errors. This option will cause Spell to print each line that has a spelling error, followed by another line containing ^'s that point to the words that are misspelled. An example of the output is 314.15 This liine contains three errrors. ^ ^ _____ ____ _______ Print Line Numbers N: When Spell prints out the list of misspelled words, it also prints out how many times a misspelled word occurs, and the first five lines that it occurs in. If you specify "N-", then this numeric information will not be printed, and you will just have a list of words. ____ _____ _____ Only These Lines O: Only lines beginning with the characters that you specify will be spell-checked. This is the opposite of the "X" Option. The "O" Option is useful for checking specialized program files that identify lines of text by preceding them with a certain character. For example, you may have a file in which text lines begin with the letter "T", and all other lines are command lines. Specifying "OtT" as an option will cause Spell to only spell-check the lines beginning with the letters "t" or "T". Any non-blank character can be used in this option. However, use a blank to separate this option from the next. _____ ______ ___________ Print Timing Information T: This prints out the time it takes to spell-check a file, along with other timing information. Although you can use this option to compare the effect of different KSAM file parameters on the speed of Spell, this option is intended primarily for internal Robelle use. _____ _______ Print Version V: This prints out the version of the spelling checker. No spell-checking will occur. _____ __________ _____ Print Misspelled Words _______ _ ________ _____ Chapter 3 Applying Spell 21 W: After a file is spell-checked, a list of the misspelled words will be printed in alphabetical order (uppercase words first). _______ _____ _____ Exclude These Lines X: Lines beginning with the characters that you specify will not be spell-checked. This is similar to the "I" option, and the opposite of the "O" option. The "X" Option is useful for skipping lines which contain formatting information. For example, you may have a file in which command lines are preceded by the letter "Q" or "*". Specifying "XqQ*" as an option will cause Spell to ignore lines beginning with a "q", "Q", or "*". Any non-blank characters can be used as Exclude characters, including letters. However, use a blank to separate this option from the next. 22 _______ _ __________ _____ Chapter 4 Installing Spell _ ____________ ü Introduction _ ____ __ _____________ ___ _______ _______ ü Step 1: Build/Upgrade the Robelle Account _ ____ __ _______ ___ _____ ü Step 2: Restore the Files _ ____ __ ____________ ___ ______ ü Step 3: Installation Job Stream _ ____ __ _____ ___ ____ __________ ü Step 4: Build the Main Dictionary _ _____ _____ ü Spell Files _ _____________ ü Documentation _ ______ _____________ ü System Configuration ____________ Introduction There are four steps to installing Spell on your system: first, upgrade the Robelle account; second, restore the files from tape; third, install the software; and fourth, build the main dictionary. For the first two steps, log on as Manager.Sys. For the last two steps, log on as Mgr.Robelle. It should take about ten minutes to complete the first three steps of the installation, and about 30 minutes to run the job that builds the dictionary. ___ ______ ___ _____ _____________ Who Should Use These Instructions? ___ ___ _________ ____________ ____________ __ ___ ____ ____ Use the following installation instructions if you have just _________ _____ ___ ___ __________ __ ___ ___ _____ _____ __ ___ purchased Spell and are installing it for the first time. If you _______ ____ _____ __ ____ _______ ___ ___ __________ __ ______ __ already have Spell on your system, and are installing an update or ___________ __ ______ ___ ____ ____ ________ ____________ pre-release of Spell, you will find specific installation ____________ ____ ____ _____ _____ ______ _____ __ ___ _____ instructions with your tape. Trial users, refer to the Trial ____________ _____ ____ ___________ ____ _____ _____ Installation Notes that accompanied your trial tape. ___ __ _______ ___ _____ __________ How to Install the Spell Intrinsics Complete instructions for installing the Spell intrinsics can be found in the next part of this manual, dealing with the Spell intrinsics. See the sections "Compiling and Linking" and the ______ __ ____________ appendix System SL Installation. ______ ______ Change Notice If a change notice accompanied this tape, please check to see if it contains a modified installation procedure. If you can't find your change notice, you can print another copy. _______ _ __________ _____ Chapter 4 Installing Spell 23 ____ __ _____________ _______ _______ Step 1: Build/Upgrade Robelle Account Even if you already have the Robelle account, the first thing you must do is stream the Robelle job. This ensures that any new groups will be built with the proper capabilities and security. :hello manager.sys :file robtape;dev=tape :restore *robtape; robelle.job.robelle; create :run qedit.pub.robelle {or use :Editor} /text robelle.job.robelle /modify first {Manager.Sys password} /change "XXXX","password",ALL {Robelle acct password} /keep robtemp /exit :stream robtemp :purge robtemp {discard password file!} This job stream launches a second job, which will send you a message when it has completed. ____ __ _______ ___ _____ Step 2: Restore the Files Stay logged on as Manager.Sys and restore the Robelle files: :file robtape;dev=tape :restore *robtape;@.@.robelle ____ __ ____________ ___ ______ Step 3: Installation Job Stream Our installation job installs the compatibility-mode or native-mode version of Spell. No can can be using Spell when you do the installation. Warn people not to use Spell and then stream our installation job: :hello mgr.robelle :warn @;please exit from Spell NOW! :run qedit.pub.robelle {or use :Editor} /text install.spjob /modify first {Mgr.Robelle passwords} /keep robtemp /exit :stream robtemp :purge robtemp {discard password file!} The installation job will send you a message when it is done. If it does not, check the installation job $STDLIST. If anyone was using Spell, or attempting to back it up, the job will fail. Chase away any users, ensure that backup is not in progress, then stream the installation job again. The installation job renames your current versions of Spell to the _______ _ __________ _____ 24 Chapter 4 Installing Spell PubOld group of the Robelle account. If you need to move these versions back into production, use the Previous.SPJob job stream. ____ __ _____ ___ ____ __________ Step 4: Build the Main Dictionary See the previous section "Maintaining the Dictionaries" for instructions on how to create the Main and Auxiliary Dictionaries. _____ _____ Spell Files If you are short of disc space, the following are the minimal files that you need to run Spell: spell.pub.robelle {program file that you :RUN} spellusl.pub.robelle {contains spell intrinsics} spellxl.pub.robelle {native-mode spell intrinsics} main.spdata.robelle {main dictionary} mainkey.spdata.robelle {compatibility-mode key file} aux.spdata.robelle {auxiliary dictionary} auxkey.spdata.robelle {compatibility-mode key file _____________ Documentation To print the Spell User Manual and the latest change notice, run the Printdoc program. :run printdoc.pub.robelle Printdoc will ask you which manual to print, and what type of printer you have. You can select the Spell manuals from the Bonus products menu. Most of Printdoc is menu driven, and you can get on-line help for every prompt by typing in a question mark (?). ______ _____________ System Configuration Spell always allocates two extra data segment for global storage. The extra data segments are 64K bytes each. Before installing Spell, you should check your system configuration with the :SYSDUMP command. The maximum extra data segment size is found under "SEGMENT LIMIT CHANGES". If this value is less than 65,536, you must create a new COLDLOAD tape with the limit increased, then restart your HP e3000 with the COLDLOAD option. 25 _______ _ _____ _________ _______ Chapter 5 Spell Intrinsic Library _ __________ _____ ü Extracting Words _ _________ ___ _____ __________ ü Accessing the Spell Intrinsics _ _________ ___ _______ __ ___ _ ü Compiling and Linking on MPE V _ _________ ___ _______ __ ___ __ ü Compiling and Linking on MPE XL Welcome to version 1.9 of the Spell Intrinsic Library. This intrinsic library provides a set of subroutines that can be called from any 3GL programming language. These routines provide these functions: * Check whether a word is spelled correctly. * Extract words from a line. * Search for similar words in the dictionary. These two low-level functions can be used as building blocks to create a spelling checker (in fact, that is what we have done in creating Spell). However, there are many other higher level spelling checker functions that these intrinsics do not perform. Examples of these other functions include the handling of the list of bad words, the reading of the input file, and the correcting of misspelled words. __________ _____ Extracting Words You might be wondering why the Spell intrinsics also provide a function to extract words from a line. As it turns out, word extraction is one of the central components of spelling checker, because how well a spelling checker performs also depends on the how well it decides what constitutes a word. Some of the decisions are: * What are the punctuation characters? * Are numbers part of words? * How do we handle hyphenation characters? * Can we handle words split over two lines? By providing a function to extract words, the intrinsics help solve part of the word extraction problem. _________ ___ _____ __________ Accessing the Spell Intrinsics The Spell intrinsics are a set of intrinsics that can be called from compatibility- or native-mode programs. You access Spell by calling these intrinsics, just as you would the IMAGE or VPLUS intrinsics. The Spell program uses these intrinsics to do the actual spell-checking. _______ _ _____ _________ _______ 26 Chapter 5 Spell Intrinsic Library _______ ________ Calling Sequence These steps are required to use the Spell intrinsics: 1. A workspace must be declared in your program. This workspace must not change between calls to the various Spell intrinsics. 2. The SpellInit intrinsic must be called successfully. 3. Other Spell intrinsics can be called as needed. 4. When the program is finished, it can tidy things up by calling the SpellEnd intrinsic. _____ ______ ____ COBOL Sample File The file Cobol4.Pub.Robelle contains COBOL declarations for all parameters required by the Spell intrinsics. It also contains template calls to each of the intrinsics. _____ ___________ Spell Pseudo-Code The pseudo-code for a simple spelling checker using the Spell intrinsics might look like the following: SpellInit SpellConfig while read_line(line,linelen) do SpellWordInit(line,linelen) while SpellWordNext(word,wordlen) <> no_more do if SpellFind(word,wordlen) <> 0 then add_word_to_list(word,wordlen) end end print_list SpellEnd _________ ___ _______ __ ___ _ Compiling and Linking on MPE V You require DS capability in order to use the Spell intrinsics. The classic object code for the intrinsics resides in Spellusl.Pub.Robelle. The name of the segment is RobelleSpell. The intrinsics are installed in SL files. The following commands demonstrate how to compile and prepare your program to use the Spell intrinsics. This example assumes that the intrinsics have been installed in the system SL: _______ _ _____ _________ _______ Chapter 5 Spell Intrinsic Library 27 :cobol example.source :prep $oldpass,example.pub;cap=ds :save example.pub :run example.pub _____ ____ Using Lib= The installation chapter of the manual tells how to install the intrinsics so that they are available to every program. You can also install the intrinsics in an SL file and run your program with Lib=. Here is an example of how to add the Spell segment from Spellusl.Pub to your existing SL file. :run fcopy.pub.sys >from=spellusl.pub.robelle;to=spellusl.pub;new >exit :segmenter -buildsl sl.pub,400,4 {fails if you already have an SL} -sl sl.pub -usl spellusl.pub -addsl RobelleSpell -exit ______ You can run your program (e.g., callsp) with the LIB=P parameter: :cobol callsp.source :prep $oldpass,callsp.program;cap=ds :save callsp.program :run callsp.program;lib=p _____ Notes If your program requires other capabilities, they should also be specified (e.g., cap=ph,ds). _______ Warning: The Spell intrinsics will change over time. The intrinsics should never be installed directly into a program file. They should only be installed into SL files. _________ ___ _______ __ ___ __ Compiling and Linking on MPE XL You require DS capability in order to use the Spell intrinsics. The native mode object code for the intrinsics resides in Spellxl.Pub.Robelle. The name of the Lset is RobelleSpell. The following commands demonstrate how to compile and link your program to use the Spell/XL intrinsics. _______ _ _____ _________ _______ 28 Chapter 5 Spell Intrinsic Library :cob74xl example.source :link from=$oldpass;to=example.pub;cap=ds :run example.pub;xl='spellxl.pub.robelle' ____ __ _____ User XL Files You can use MPE XL's Linkedit Command to add the Spell intrinsics to your own XL file. For example, :linkedit -xl xl.pub -copyxl from=spellxl.pub.robelle -exit :run example.pub;xl='xl.pub' 29 _______ _ _____ __________ Chapter 6 Spell Intrinsics _ _________ __________ ü Intrinsic Parameters _ ___________ _________ ü SpellConfig Intrinsic _ ________ _________ ü SpellEnd Intrinsic _ ____________ _________ ü SpellExplain Intrinsic _ _________ _________ ü SpellFind Intrinsic _ _________ _________ ü SpellInit Intrinsic _ _____________ _________ ü SpellWordInit Intrinsic _ _____________ _________ ü SpellWordNext Intrinsic _________ __________ Intrinsic Parameters In this chapter we describe the Spell intrinsics in alphabetical order. The parameters for each intrinsic are word arrays (just like IMAGE intrinsic calls). You must include every parameter or pass a dummy variable as a place holder. The condition code is not returned by any Spell intrinsic. _________ _____ Workspace Array The workspace array is a 1140-byte array that contains all of the Spell intrinsics' internal variables. The only user-accessible part of the workspace is the first word, which contains the version number of the intrinsics. ____________ Declaration. Here is a typical declaration for the workspace array: 01 Spell-work-area. 05 Spell-version-no pic s9(4) comp. 05 filler pic s9(4) comp occurs 569 times. You should isolate declarations for the workspace, and other spell intrinsic parameters, in a Copylib or in an include file. You can also use CobolX files. ______ _____ Status Array The status array is a ten-word array. You can use the standard IMAGE status array or you can declare a custom status parameter for the Spell intrinsics. If an error occurs, you should call the SpellExplain intrinsic. Because the Spell intrinsics do not return a value, errors and warnings are indicated by the first word in the status array. A zero indicates no error, a negative value indicates a fatal error, and a positive value indicates a warning. _______ _ _____ __________ 30 Chapter 6 Spell Intrinsics ____________ Declaration. Here is a typical declaration for the status array: 01 Spell-status-area. 05 Spell-cond-word pic s9(4) comp. 88 Spell-stat-ok value zeros. 88 Spell-found value 0. 88 Spell-not-found value 1. 05 filler1 pic s9(4) comp occurs 3 times. 05 Spell-wordstart pic s9(4) comp. 05 filler2 pic s9(4) comp occurs 5 times. _____ _________ Dummy Parameter Some of the intrinsics also require a dummy parameter. Although this parameter is currently not used, it allows current calls to intrinsics to be compatible with future versions of the intrinsics, where the dummy parameter can pass in or pass out important information to the intrinsics. ____________ Declaration. Here is a typical declaration for the dummy parameter: 01 Spell-dummy-arg pic s9(4) comp. _______ _ _____ __________ _ ___________ Chapter 6 Spell Intrinsics - SpellConfig 31 ___________ _________ SpellConfig Intrinsic Sets up various options in the Spell intrinsics, depending on the mode parameter. __________ _____ _______ ______ _____ SpellConfig Workspace, Mode, Status, Parm1, Parm2 _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and it indicates what you want to configure. Currently, there are two configurations options. ______ Mode-1 Assign a new hyphenation character. There can only be one hyphenation character at a time. The first word of the Parm1 parameter contains the ASCII value of the hyphenation character. 01 spell-hyphen pic x(1). move "\" to spell-hyphen. call "SpellConfig" using spell-workspace spell-mode1 spell-status-area spell-hyphen spell-dummy. if not spell-stat-ok then perform 98-spell-error. ______ Mode-2 Determine how "precise" a soundex search will be. The first word of Parm1 determines the length of the soundex code. The range of the soundex length is from 2 to 8. When a longer soundex code is used, the matches will be more precise. The default is 8. 01 spell-soundex pic s9(4) comp. move 4 to spell-hyphen. call "SpellConfig" using spell-workspace spell-mode2 spell-status-area spell-soundex spell-dummy. if not spell-stat-ok then _______ _ _____ __________ _ ___________ 32 Chapter 6 Spell Intrinsics - SpellConfig perform 98-spell-error. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if there were no errors. _____ Parm1 This is a general parameter containing values used in the configuration. For mode 1, the first word of parm1 contains the hyphenation character. The hyphenation character is stored in the first byte. For mode-2, the first work of parm1 contains the soundex length. 01 spell-hyphen pic x(2) value "\". 01 spell-soundex pic s9(4) value 8. _____ Parm2 This is a general parameter containing values used in the configuration. Currently, this parameter is not used and may contain anything. 01 spell-dummy pic s9(4) comp. _______ _ _____ __________ _ ________ Chapter 6 Spell Intrinsics - SpellEnd 33 ________ _________ SpellEnd Intrinsic Shuts down the Spell intrinsic library. __________ _____ _______ _____ SpellEnd Workspace, Mode, Status, Dummy _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and must contain a value of one. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if the call to SpellEnd is successful. _____ Dummy This is a dummy parameter and it may contain anything. _______ Example call "SpellEnd" using Spell-workspace Spell-mode1 Spell-status-area Spell-dummy-arg. if not Spell-stat-ok then perform 98-Spell-error. _______ _ _____ __________ _ ____________ 34 Chapter 6 Spell Intrinsics - SpellExplain ____________ _________ SpellExplain Intrinsic Prints a three- or four-line message on $STDLIST which describes the results of a Spell intrinsic call based on information in the status array. ______ SpellExplain status ______ Status ______ The status is a ten-word array of 16-bit integers used to call any Spell intrinsic. _____ ________ Error Messages An example of the message printed by SpellExplain looks like the following: SpellExplain Status = -4 Called from SpellInit Mode=1 Incorrect version. Called with 0. Need version 1 If the Spell error is caused by a file system error, additional lines are printed describing the file system error. _______ _ _____ __________ _ _________ Chapter 6 Spell Intrinsics - SpellFind 35 _________ _________ SpellFind Intrinsic Checks if a word is in the dictionary. __________ _____ _______ _____ _______ SpellFind Workspace, Mode, Status, Word, Wordlen _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and must contain a value of one. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if the word passed to SpellFind exists. If the word does not exist, one is returned in the first word. If the word exist but is in the incorrect case, ten is returned. ____ Word This is the word that you are checking. It can be up to 24 characters long, and need not be padded with spaces. The word can be in lowercase, uppercase, or mixed-case. 01 word pic x(24) value "dictionary". _______ Wordlen This is the length of the word that you are checking. The values can range from 1 to 24 inclusive. In COBOL, this should be a fixed value, and the word should be padded with blanks. In other programming languages with variable length strings, it is easier to pass in the length of a string instead of a string padded with blanks. 01 wordlen pic s9(4) comp. value 24. _______ _ _____ __________ _ _________ 36 Chapter 6 Spell Intrinsics - SpellFind _______ Example call "SpellFind" using Spell-workspace Spell-mode1 Spell-status-area word wordlen. if not Spell-stat-ok then perform 98-Spell-error. _____ Notes Single letter words and words beginning with a number are considered to be correctly spelled. _________ Words ending with an apostrophe-s (e.g., program's) will be _______ checked against the main word (e.g., program). Also, a leading apostrophe and trailing apostrophe will be deleted before a word _________ _______ is checked (e.g., 'program' will be checked as program). _______ _ _____ __________ _ _________ Chapter 6 Spell Intrinsics - SpellInit 37 _________ _________ SpellInit Intrinsic Initializes the Spell intrinsic library. __________ _____ _______ _____ SpellInit Workspace, Mode, Status, Dummy _________ Workspace The workspace is used by the Spell intrinsics to store global information. This workspace must not change between calls to SpellInit and any of the other Spell intrinsics. The COBOL declaration and initial values for the workspace are 01 Spell-workspace. 05 Spell-version-no pic s9(4) comp value 3. 05 filler pic s9(4) comp occurs 569 times. ____ Mode This is a single word integer and must contain a value of one. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if the call to SpellInit is successful. _____ Dummy This is a dummy parameter and it may contain anything. _______ Example call "SpellInit" using Spell-workspace Spell-mode1 Spell-status-area Spell-dummy-arg. if not Spell-stat-ok then perform 98-Spell-error. _____ Notes The SpellInit intrinsic opens the main and auxiliary dictionaries, then reads in and sorts the user dictionary. You should keep the user dictionary sorted in ascending order to reduce the amount of start-up time. We have designed the Spell intrinsics so that you would call SpellInit once at the start of your program. You cannot call any other Spell intrinsic until you have successfully _______ _ _____ __________ _ _________ 38 Chapter 6 Spell Intrinsics - SpellInit called the SpellInit intrinsic. It is common to get a non-zero status from SpellInit. A positive status indicate a warning (such as no auxiliary or user dictionary found) and can be safely ignored. To use the SpellSearch intrinsics, you need at least version 2 of the workspace. To read user dictionaries in Qedit's new Jumbo file format, you need at least version 3 of the workspace. _______ _ _____ __________ _ _______________ Chapter 6 Spell Intrinsics - SpellSearchInit 39 _______________ _________ SpellSearchInit Intrinsic Sets up a search word for SpellSearchNext. __________ _____ _______ _____ _______ SpellSearchInit Workspace, Mode, Status, Word, Wordlen _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and must contain a value of one or two. Mode-1 indicates a prefix search, and mode-2 indicates a soundex search. In both types of searches, the case of the words is not taken into account. ______ Mode-1 A prefix search returns words that begin with the same letter as the search word. ______ Mode-2 A soundex search returns words that have the same soundex code as the search word. That is, it returns words that sound similar to the search word according to the soundex scheme. In a soundex match, the first letter of the words must match. For example, the words "Stefan" and "Stephen" form a soundex match, but the words "fone" and "phone" do not form a soundex match. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if the search word is accepted. ____ Word This is the string that you want to search for, called the search word. It can be up to 24 characters long, and does not need to be padded with spaces. 01 word pic x(24). _______ _ _____ __________ _ _______________ 40 Chapter 6 Spell Intrinsics - SpellSearchInit _______ Wordlen This is the length of the search word. The values can range from 1 to 24 inclusive. In COBOL, it should be a fixed value, and the word should be padded with blanks. In other programming languages with variable length strings, it is easier to pass in the length of a string instead of a string padded with blanks. 01 wordlen pic s9(4) comp value 24. _______ Example call "SpellSearchInit" using Spell-workspace Spell-mode1 Spell-status-area word wordlen. if not Spell-stat-ok perform 98-Spell-error. _____ Notes This intrinsic must be called once for each search word, before you call SpellSearchNext. Typically, you choose a search word, call SpellSearchInit, and then call SpellSearchNext repeatedly until all the related words have found. Then, you choose the next word and repeat the search process until there are no more words for which to search. You can call SpellWordInit and SpellWordNext to extract words from a line, and then call SearchInit and SearchNext. SpellSearchInit(work, mode, status, key, keylen) repeat SpellSearchNext(work, mode, status, word, wordlen) print word until status<>0 _______ _ _____ __________ _ _______________ Chapter 6 Spell Intrinsics - SpellSearchNext 41 _______________ _________ SpellSearchNext Intrinsic Searches for the next matching word. __________ _____ _______ _____ _______ SpellSearchNext Workspace, Mode, Status, Word, Wordlen _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and must contain a value of one. ______ Status A ten-word array of 16-bit integers. The return value of the first status word will be zero if no error occurred. When there are no more words found, the return value of the first status word will be nine. ____ Word This will contain the next word found. The word will be padded with blanks. 01 word pic x(24). _______ Wordlen This is the length of the next word found, not including the padded blanks. When there are no more words, Wordlen will be zero. 01 wordlen pic s9(4) comp. _______ Example call "SpellSearchNext" using Spell-workspace Spell-mode1 Spell-status-area word wordlen if not Spell-stat-ok then perform 98-Spell-error. _______ _ _____ __________ _ _______________ 42 Chapter 6 Spell Intrinsics - SpellSearchNext _____ Notes You must call SpellSearchInit once for each search word before calling SpellSearchNext. Even after SpellSearchNext has returned the status value 9, you can call SpellSearchNext again and it will still return the status value 9. _______ _ _____ __________ _ _____________ Chapter 6 Spell Intrinsics - SpellWordInit 43 _____________ _________ SpellWordInit Intrinsic Sets up a line for word extraction by SpellWordNext. __________ _____ _______ _____ _______ SpellWordInit Workspace, Mode, Status, Line, Linelen _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and must contain a value of one. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if the line is accepted. ____ Line This is the line that you will be extracting words from. The line can be up to 256 characters long, and need not be padded with spaces. 01 line pic x(256). _______ Linelen This is the length of the line. The values can range from 0 to 256 inclusive. In COBOL, this should be a fixed value, and the line should be padded with blanks. In other programming languages with variable length strings, it is easier to pass in the length of a string instead of a string padded with blanks. 01 wordlen pic s9(4) comp value 256. _______ Example call "SpellWordInit" using Spell-workspace Spell-mode1 Spell-status-area line linelen. if not Spell-stat-ok perform 98-Spell-error. _______ _ _____ __________ _ _____________ 44 Chapter 6 Spell Intrinsics - SpellWordInit _____ Notes This intrinsic must be called once for each line that you want to extract words from, before you call SpellWordNext. Typically, you would get a line of text, call SpellWordInit, then repeatedly call SpellWordNext and SpellFind until there are no more words. Then you get the next line of text and repeat the process until there are no more lines. _______ _ _____ __________ _ _____________ Chapter 6 Spell Intrinsics - SpellWordNext 45 _____________ _________ SpellWordNext Intrinsic Gets the next word from the line. __________ _____ _______ _____ ________ SpellWordNext Workspace, Mode, Status, Word, Wordlen, _________ WordStart _________ Workspace This is the workspace that was passed to SpellInit. This workspace must not have changed since the call to SpellInit. ____ Mode This is a 16-bit integer and must contain a value of one or two. When the mode is one, punctuation is considered white space. Punctation marks delimit words and are not considered to be parts of words. When the mode is two, blanks are the only word delimiters. Punctuation marks are considered to be words or parts of words. Mode-1 is the mode most commonly used to extract words from a line. Mode-2 is used when you have words prefixed or suffixed with certain symbols that you need the calling routine to see. For example, you might use words ending in an "@" sign to indicate a prefix search, and words ending in an "!" sign to indicate a soundex search. Mode-1 will filter out these characters, while mode-2 will retain them at the end of the words. ______ Status A ten-word array of 16-bit integers. The return value of the first word will be zero if no error occurred. When there are no more words in the line, the return value of the first word will be nine. ____ Word This will contain the next word extracted from the line. The word will be padded with blanks. 01 word pic x(24). _______ _ _____ __________ _ _____________ 46 Chapter 6 Spell Intrinsics - SpellWordNext _______ Wordlen This is the length of the word extracted, not counting the padded blanks. When there are no more words, Wordlen will be zero. 01 wordlen pic s9(4) comp. _________ WordStart This will contain the starting position of the word in the line. The first character of the line is at position one, then the next character is at position two, and so on. When there are no more words, WordStart will be zero. 01 wordstart pic s9(4) comp. _______ Example call "SpellWordNext" using Spell-workspace Spell-mode1 Spell-status-area word wordlen wordstart. if not Spell-stat-ok then perform 98-Spell-error. _____ Notes SpellWordInit must be called once for each line before calling SpellWordInit. A word consists of alphanumeric characters or single quotes surrounded by punctuation or white spaces. Here punctuation is any character that is not alphanumeric or is not a single quote. In mode 1, leading digits in a word will be omitted, but subsequent digits in a word will be retained. For example, ______ ___ SpellWordNext will extract two words from the line "999abc 123 ______ ___ ______ def456": "abc", and "def456". This allows Prose constructs such __________ _______ as "|2Heading|" and words such as "F92286F" to be spell-checked. In mode 2, all characters except blanks are significant. For _____ ______ example, "this, 123abc ." contains three words: "this,", "123abc", _ and ".". Even after SpellWordNext has returned the status value 9, you can call SpellWordNext again and it will still return the status value 9. 47 ________ _ _ _____ _____ ________ Appendix A - Spell Error Messages Spell returns error numbers in the first word of the status array. Each error is associated with an error number. A positive error number indicate a warning (e.g., the program can still continue). A negative error number indicate a fatal problem (e.g., the program should exit). If an error occurs, always check that the Spell workspace has not been overwritten. The following are the error numbers, descriptions, and causes that can be returned by any Spell intrinsic. ___ _____ _______ ____ __________ -1: Error opening main dictionary The main dictionary could not be opened for read access. Check that the dictionary has been created and is not being exclusively accessed. Also, check for file equations redirecting the dictionary. The name of the main dictionary is Main.Spdata. Robelle. ___ _____ _______ ____ __________ -2: Error closing main dictionary The main dictionary could not be closed. ___ _____ _______ ____ __________ -3: Error reading main dictionary The dictionary could not be read. Check that no one is trying to alter the dictionary file. ___ _________ _______ -4: Incorrect version The version number assigned to workspace does not have a valid value. Valid values are 1 or 2. The version number passed to SpellInit is printed. Ensure that the version number of the run parameter is the first field and that it is declared as a 16-bit integer with the correct value. ___ _________ _________ -5: Workspace corrupted Between calls to the Spell intrinsics, the Spell workspace has been changed. You must also ensure the workspace is a global data structure. ________ _ _ _____ _____ ________ 48 Appendix A - Spell Error Messages ___ ______ __ ______ _____ ____ _______ -6: Unable to create extra data segment You machine should be configured so that extra data segments of 64K bytes can be created. The machine must also have the resources to support the extra data segments. ___ ______ __ ____ ____ _____ ____ _______ -7: Unable to copy from extra data segment This error should never occur. If it does, please report it to Robelle Solutions Technology Inc. ___ ______ __ ____ __ _____ ____ _______ -8: Unable to copy to extra data segment This error should never occur. If it does, please report it to Robelle Solutions Technology Inc. ___ ______ __ ____ _____ ____ _______ -9: Unable to free extra data segment This error should never occur. If it does, please report it to Robelle Solutions Technology Inc. ____ _____________ ______ ______ _____________ -10: SpellWordNext called before SpellWordInit This error occurs when SpellWordNext is called before any calls have been made to SpellWordInit. Once SpellWordInit has been called, this error should never occur. Repeated calls to SpellWordNext after all the words have been extracted will result in warning 9, "No more words." ____ _____ _______ _________ __________ -11: Error opening auxiliary dictionary The main auxiliary dictionary could not be open for read access. Check that the dictionary has been created and ensure that there is no file equation redirecting the dictionary. The name of the auxiliary dictionary is Aux.Spdata.Robelle. ____ _____ _______ _________ __________ -12: Error closing auxiliary dictionary The auxiliary dictionary could not be closed. ____ _____ _______ _________ __________ -13: Error reading auxiliary dictionary The auxiliary dictionary could not be read. Check that no one is trying to alter the dictionary file. ________ _ _ _____ _____ ________ Appendix A - Spell Error Messages 49 ____ _____ _______ ____ __________ -14: Error opening user dictionary The user dictionary could not be open for read access. Check that there is no file equation redirecting the dictionary, and no one is trying exclusively accessing the file. The name of the user dictionary is Spuser in the logon group of the logon account. ____ _____ _______ ____ __________ -15: Error closing user dictionary The user dictionary could not be closed. ____ _____ _______ ____ __________ -16: Error reading user dictionary The user dictionary could not be read. Check that no one is trying to alter the dictionary. ____ _______ ____ -17: Invalid mode The mode passed to a Spell intrinsic is not valid. Check that the mode is being passed as the second parameter and ensure that a valid value is being specified. ____ _____ _______ -18: Spell expired Your trial version of Spell has expired. ____ _______ ______________ ____ -19: Invalid capitalization code Spell has found an invalid capitalization code in the dictionary. A possible cause of this error is using an old version of the dictionary with Spell. Try rebuilding the main and auxiliary dictionaries and run Spell again. See the section on Maintaining the Dictionaries for instructions on building the dictionaries. ____ ____ __________ __ ___ _ _____ __________ -20: Main dictionary is not a Spell dictionary Spell was not able to use the dictionary because it wasn't a KSAM file. Check file equations for the main dictionary. See the section on Maintaining the Dictionaries for instructions on building the dictionaries. ____ _______ ____ __________ -21: Invalid main dictionary Spell was not able to use the main dictionary. A common cause of this error is using an old version of the dictionary with Spell. Try rebuilding the main dictionary with the most recent job stream. See the section on Maintaining the Dictionaries for ________ _ _ _____ _____ ________ 50 Appendix A - Spell Error Messages instructions on building the dictionaries. ____ ___ __________ __ ___ _ _____ __________ -22: Aux dictionary is not a Spell dictionary Spell was not able to use the dictionary because it wasn't a KSAM file. Check file equations for the auxiliary dictionary. See the section on Maintaining the Dictionaries for instructions on building the dictionaries. ____ _______ ___ __________ -23: Invalid aux dictionary Spell was not able to use the auxiliary dictionary. A common cause of this error is using an old version of the dictionary with Spell. Try rebuilding the auxiliary dictionary with the most recent job stream. See the section on Maintaining the Dictionaries for instructions on building the dictionaries. ____ ___ _____ _________ -24: Old Spell workspace You are trying to access a new intrinsic with an old version of the workspace. Re-declare your Spell workspace to use the newer version required by the intrinsic. ____ _______________ ______ ______ _______________ -25: SpellSearchNext called before SpellSearchInit This error occurs when SpellSearchNext is called before SpellSearchInit has been successfully called. Repeated calls to SpellSearchNext after all the words have been found will result in warning 9, "No more words." __ ____ ___ _____ 1: Word not found Returned when SpellFind cannot find the requested word in the dictionaries. __ _______ ____ ______ 2: Invalid word length A word length of less than one or greater than 24 was specified. __ _______ ____ ______ 3: Invalid line length A line length of less than zero or greater than 256 was specified. ________ _ _ _____ _____ ________ Appendix A - Spell Error Messages 51 __ __ _________ __________ 4: No auxiliary dictionary No auxiliary dictionary was found. __ __ ____ __________ 5: No user dictionary No user dictionary was found. __ __ _________ __ ____ __________ 6: No auxiliary or user dictionary Neither an auxiliary nor user dictionary was found. __ ____ __________ ____ 7: User dictionary full Too many words were in the user dictionary. The maximum is 2503. __ ____ __________ ____ ___ ____ 8: User dictionary word too long A word in the user dictionary is greater than 24 characters long. __ __ ____ _____ 9: No more words There are no more words in the line when SpellWordNext was called. ___ _________ ____ 10: Incorrect case Returned when SpellFind finds the specified word in a dictionary, but the word is incorrectly cased. ___ ___________ __ _________ ____ ____ 11: Conflicting or duplicate user word A word has been entered twice in the user dictionary, or two incompatible casings have been specified for a word. ___ _____ ____ _____ ____ __________ 12: Can't read Jumbo user dictionary You are trying to read a user dictionary in Qedit's new Jumbo format but you are still using an old version of the workspace. 52 ________ _ _ _____ _______ Appendix B - COBOL Example The following program asks you to enter a line of text. Then it will check the spelling of each word in the line, and tells you whether each word is found or not found. It then asks for another another line, until you enter a blank line. $control nolist,uslinit $control source,errors=10 identification division. program-id. testcob. author. David Lo, Robelle Solutions Technology Inc. date-written. Mar 28, 1991. security. Copyright Robelle Solutions Technology Inc. remarks. ************************************************************ * * * testcob - test spell intrinsics. * * * * version: 1.3 * * purpose: * * * * General-purpose program to test the SPELL intrinsics. * * * * Demonstrates that you can call all SPELL routines from * * COBOL in CM and NM. * * * ************************************************************ environment division. configuration section. special-names. top is new-page. $page "constants" data division. working-storage section. 01 true-value pic x value "T". 01 false-value pic x value "F". $page "variables" 01 input-line pic x(80). 88 answer-spaces value spaces. $page "spell- variables" 01 spell-workspace. 05 spell-version-no pic s9(4) comp value 3. 05 filler pic s9(4) comp occurs 569 times. 01 spell-status-area. ________ _ _ _____ _______ Appendix B - COBOL Example 53 05 spell-cond-word pic s9(4) comp. 88 spell-stat-ok value zeros. 88 spell-found value 0. 88 spell-not-found value 1. 88 spell-bad-word-len value 2. 88 spell-bad-line-len value 3. 88 spell-no-main-aux value 4. 88 spell-no-user-aux value 5. 88 spell-no-both-aux value 6. 88 spell-user-full value 7. 88 spell-bad-user-len value 8. 88 spell-no-more value 9. 88 spell-wrong-case value 10. 88 spell-user-dup value 11. 05 filler pic s9(4) comp occurs 9 times. 01 spell-mode pic s9(4) comp. 01 spell-mode1 pic s9(4) comp value 1. 01 spell-mode2 pic s9(4) comp value 2. 01 spell-dummy-arg pic s9(4) comp. 01 spell-hyphen pic x(2). 01 spell-line pic x(256). 01 spell-linelen pic s9(4) comp value 256. 01 spell-word pic x(24). 01 spell-wordlen pic s9(4) comp value 24. 01 spell-wordstart pic s9(4) comp. $page "[00] mainline" procedure division. 00-main section. perform 00-10-init-spell. perform 00-20-config-spell. move "x" to input-line. perform 10-prompt-and-check until answer-spaces. perform 00-90-end-spell. go to 00-main-exit. 00-10-init-spell. call "SPELLINIT" using spell-workspace spell-mode1 spell-status-area spell-dummy-arg. if spell-cond-word < 0 then ________ _ _ _____ _______ 54 Appendix B - COBOL Example perform 98-spell-error. 00-20-config-spell. move "" to spell-hyphen. call "SPELLCONFIG" using spell-workspace spell-mode1 spell-status-area spell-hyphen spell-dummy-arg. if not spell-stat-ok then perform 98-spell-error. 00-30-find-word. call "SPELLFIND" using spell-workspace spell-mode1 spell-status-area spell-word spell-wordlen. if spell-found display "---- word found: ", spell-word else if spell-not-found display "---- word not found: ", spell-word else if spell-wrong-case display "---- word incorrectly cased: ", spell-word else perform 98-spell-error. 00-90-end-spell. call "SPELLEND" using spell-workspace spell-mode1 spell-status-area spell-dummy-arg. if not spell-stat-ok then perform 98-spell-error. 00-main-exit. goback. $page "[10] mainline" 10-prompt-and-check section. perform 10-10-get-input. if not answer-spaces then perform 10-20-check-line. go to 10-prompt-and-check-exit. 10-10-get-input. move spaces to input-line. display "Enter line:". accept input-line. move input-line to spell-line. move 80 to spell-linelen. ________ _ _ _____ _______ Appendix B - COBOL Example 55 10-20-check-line. call "SPELLWORDINIT" using spell-workspace spell-mode1 spell-status-area spell-line spell-linelen. if not spell-stat-ok then perform 98-spell-error. move 1 to spell-wordlen. perform 10-30-check-word until spell-wordlen = 0. 10-30-check-word. call "SPELLWORDNEXT" using spell-workspace spell-mode1 spell-status-area spell-word spell-wordlen spell-wordstart. if not spell-stat-ok and not spell-no-more then perform 98-spell-error else if spell-wordlen > 0 then perform 00-30-find-word. 10-prompt-and-check-exit. exit. $page "[98] spell-error" 98-spell-error section. call "SPELLEXPLAIN" using spell-status-area. call intrinsic "QUIT" using spell-cond-word. 98-spell-error-exit. goback. 56 ________ _ _ ______ _______ Appendix C - Pascal Example The following Pascal program works exactly like our example COBOL program. This example program compiles and runs in native-mode ________ under MPE XL, but you must delete the declaration for shortint. $list off$ $HP3000_16$ {Remove for MPE V} program driver(input,output); const SpellMaxLineLen = 256; SpellMaxWordLen = 24; SpellFound = 0; SpellNotFound = 1; SpellWrongCase = 10; SpellVersion = 3; type longint = integer; shortint = -32768 .. +32767; {Remove for MPE XL} SpellWorkType = record version : shortint; filler : array[1..570] of shortint; end; SpellStatType = record errnum : shortint; filler : array[1..9] of shortint; end; SpellConfig1Type = record case integer of 1: (s : packed array[1..10] of char); 2: (soundexlen : shortint); end; SpellConfig2Type = record s : packed array[1..10] of char; end; SpellModeType = shortint; SpellLineType = record s: packed array[1..SpellMaxLineLen] of char; end; SpellWordType = record s: packed array[1..SpellMaxWordLen] of char; ________ _ _ ______ _______ Appendix C - Pascal Example 57 end; SpellDummyType = shortint; var spell_workspace : SpellWorkType; spell_status_area : SpellStatType; line : SpellLineType; linelen : shortint; word : SpellWordType; wordlen : shortint; wordstart: shortint; find_stat: integer; $check_formal_parm 2$ $check_actual_parm 2$ procedure SpellExplain( var status : SpellStatType ); external spl; procedure SpellInit( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var dummy : SpellDummyType ); external spl; procedure SpellEnd ( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var dummy : SpellDummyType ); external spl; procedure SpellFind( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var keyvalue : SpellWordType; var keylength: shortint ); external spl; procedure SpellConfig( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var parm1 : SpellConfig1Type; var parm2 : SpellConfig2Type ); external spl; procedure SpellWordInit( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var line : SpellLineType; var linelen : shortint ); external spl; ________ _ _ ______ _______ 58 Appendix C - Pascal Example procedure SpellWordNext( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var word : SpellWordType; var wordlen : shortint; var wordstart: shortint ); external spl; procedure SpellSearchInit( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var word : SpellWordType; var wordlen : shortint ); external spl; procedure SpellSearchNext( var workspace: SpellWorkType; var mode : SpellModeType; var status : SpellStatType; var word : SpellWordType; var wordlen : shortint ); external spl; procedure quit; intrinsic; procedure putjcw; intrinsic; procedure getinfo; intrinsic; $check_formal_parm 3$ $check_actual_parm 3$ procedure fatal_spell_error; begin SpellExplain(spell_status_area); quit(spell_status_area.errnum ); end; {fatal_spell_error} procedure spell_warning; begin SpellExplain(spell_status_area); end; {fatal_spell_error} procedure init_spell; var spell_mode : SpellModeType; dummy_arg : SpellDummyType; begin spell_workspace.version := SpellVersion; spell_mode := 1; SpellInit(spell_workspace ,spell_mode ,spell_status_area ,dummy_arg ); if spell_status_area.errnum < 0 then ________ _ _ ______ _______ Appendix C - Pascal Example 59 fatal_spell_error else if spell_status_area.errnum > 0 then spell_warning; end; {init_spell} procedure end_spell; var spell_mode : SpellModeType; dummy_arg : SpellDummyType; begin spell_mode := 1; SpellEnd(spell_workspace ,spell_mode ,spell_status_area ,dummy_arg ); if spell_status_area.errnum < 0 then fatal_spell_error else if spell_status_area.errnum > 0 then spell_warning; end; {end_spell} procedure config_hyphen( hyphen:char ); var spell_mode : SpellModeType; dummy_arg : SpellDummyType; config1 : SpellConfig1Type; config2 : SpellConfig2Type; begin spell_mode := 1; config1.s[1] := hyphen; SpellConfig(spell_workspace ,spell_mode ,spell_status_area ,config1 ,config2 ); if spell_status_area.errnum < 0 then fatal_spell_error else if spell_status_area.errnum > 0 then spell_warning; end; {config_hyphen} function find_word( var word:SpellWordType; wordlen:shortint ) : integer; var spell_mode : SpellModeType; begin find_word := SpellNotFound; spell_mode := 1; SpellFind(spell_workspace ,spell_mode ,spell_status_area ________ _ _ ______ _______ 60 Appendix C - Pascal Example ,word ,wordlen ); if spell_status_area.errnum < 0 then fatal_spell_error else if (spell_status_area.errnum <> SpellFound) and (spell_status_area.errnum <> SpellNotFound) and (spell_status_area.errnum <> SpellWrongCase) then spell_warning else find_word := spell_status_area.errnum; end; {find_word} procedure init_word( var line:SpellLineType; linelen:shortint ); var spell_mode : SpellModeType; begin spell_mode := 1; SpellWordInit(spell_workspace ,spell_mode ,spell_status_area ,line ,linelen ); if spell_status_area.errnum < 0 then fatal_spell_error else if spell_status_area.errnum > 0 then spell_warning; end; {init_word} function next_word( var word:SpellWordType; var wordlen:shortint ) : boolean; var spell_mode : SpellModeType; begin next_word := false; spell_mode := 1; SpellWordNext(spell_workspace ,spell_mode ,spell_status_area ,word ,wordlen ,wordstart ); if spell_status_area.errnum < 0 then fatal_spell_error else if spell_status_area.errnum = 0 then next_word := true; end; {next_word} function get_line( var line:SpellLineType; var linelen: shortint) :boolean; begin ________ _ _ ______ _______ Appendix C - Pascal Example 61 get_line := false; line.s := ''; writeln('Enter a line:'); readln( line.s ); if line.s<>'' then begin get_line := true; linelen := SpellMaxLineLen; end else linelen := 0; end; begin {mainline} init_spell; while get_line( line, linelen ) do begin init_word( line, linelen ); while next_word( word, wordlen ) do begin find_stat := find_word( word, wordlen ); if find_stat=SpellFound then writeln('---- word found: ', word.s ) else if find_stat=SpellNotFound then writeln('---- word not found: ', word.s ) else if find_stat=SpellWrongCase then writeln('---- word incorrectly cased: ', word.s ); end; {next_word} end; {get_line} end_spell; end. {mainline} 62 ________ _ _ ______ __ ____________ Appendix D - System SL Installation These instructions describe how to install the Spell intrinsics into the system SL on Classic versions of MPE. The job stream Spcall.Spjob.Robelle installs the Spell intrinsics so that they can be used by any program on the system. Use it either to update the interface when you receive a new version of Spell or to re-install the interface after a MIT update from HP. You will need a small tape for a new ColdLoad tape to contain the Spell segment. You can also install the Spell intrinsics in a pub or group SL (see the sections on Compiling and Linking). 1. Make sure that the Robelle account has been created and all files have been restored. 2. Ensure that no one will use the intrinsics until the installation is complete. No one can be running a program which calls any Spell intrinsic. Stop all jobs and send an operator warning. :showjob :warn @;please stop for 20 minutes ___ :abortjob #snnn 3. Log on as Manager.Sys if you have not already. 4. Either remove the passwords from Manager.Sys or modify the first line of the Spcall job to include the passwords. Then :Stream the job. :altacct sys;pass= :altuser manager;pass= :stream Spcall.Spjob.robelle __ or :editor /text spcall.spjob.robelle _________ /modify first {insert passwords into the line} /keep robtemp {keep local copy} /exit :stream robtemp {stream local copy} :purge robtemp {discard password file!} 5. Spell uses the Segmenter to add the Spell intrinsics into SL.Pub.Sys. It then requests a tape ("ColdLoad") to create a new ColdLoad tape containing MPE plus the Spell intrinsic library. Mount a tape with a write ring and :Reply. Save this tape and use it for any future cold loads. ________ _ _ ______ __ ____________ Appendix D - System SL Installation 63 6. If everything goes well, Spcall prints a final message on the console. 7. Replace the Manager.Sys passwords (if removed in step 4 above). ________ :altuser manager;pass=password ________ :altacct sys;pass=password 8. Please save the job listing for future reference. The Spell intrinsics are now installed and you should be able to use them in your application programs. 64 _____ Index ! means exact case.................16 $STDLIST output....................4 ? option...........................6,19 @ means anycase....................16 _ A A option...........................14 access.............................25 accessing Spell....................4 acronyms, case.....................9 adding your personal words.........15 American spelling..................14,16 apostrophes........................8 Aux.Spdata file....................17 Aux.Spdata.Robelle.................48 auxiliary dictionary...............14,17 AuxTxt.Spdata file.................17 _ B Bonus programs.....................2 British spelling...................14,16 _ C calling sequence...................26 Cap=DS.............................26,27 capitalization.....................9 casing of words....................9 change notice......................22 COBOL example......................52 Cobol4.Pub.Robelle.................26 combining options..................10,18 common spelling....................16 compiling..........................26,27 condition code.....................29 configuring MPE....................24 Control-Y..........................7 _ D demo users.........................22 DictAux.Spjob.Robelle..............17 dictionary look-up order...........15 dictionary, auxiliary..............14,17 dictionary, main...................14 _____ 65 Index dictionary, user...................4,13,15,17,37 DictMain.Spjob.Robelle.............16 disc space, short of...............24 documentation......................24 don't print word list..............11 DS capability......................26,27 dummy parameter....................30,33,37 _ E E option...........................11,19 Editerror..........................11,19 error messages.....................34,47 error-file.........................11 example input......................8 example output.....................9 exclude lines......................12 exclude these lines................21 extracting words...................25 _ F files..............................4 files, minimum.....................24 _ G global dictionary..................14 _ H H option...........................12,19 help screen........................6,19 hyphenation character..............12,19,31 _ I I option...........................12,19 ignore lines.......................12,19 Infile file........................4 info=..............................5,10,18 installing spell...................22 interrupting Spell.................7 intrinsics.........................29 introduction.......................1 _____ Index 66 _ J JCW, SpellCondWord.................6 JCW, SpellOutCount.................7 Job Control Word...................6 _ K KSAM file..........................16,17,20 _ L L option...........................10,19 Lib=...............................27 library............................25 line numbers.......................13,20 line parameter.....................43 linelen parameter..................43 linkedit...........................27 linking............................26,27 Lset RobelleSpell..................27 _ M main dictionary....................14,16 Main.Spdata file...................16 Main.Spdata.Robelle................47 MainAmer.Spdata file...............16 MainBrit.Spdata file...............16 MainComm.Spdata file...............16 maximum extra data segment size....24 minimal files......................24 misspelled word count..............9 misspelled word in line............11 misspelled word list...............9,20 mixed-case words...................9 mode parameter.....................31,33,35,37,39,41,43,45 mode-1.............................31 mode-2.............................31 MPE V..............................26 MPE XL.............................27 multiple options...................10,18 _ N N option...........................13,20 new features.......................2 new version of workspace...........38 no auxiliary dictionary warning....14,19 no numbering.......................13,20 _____ 67 Index _ O O option...........................13,20 on-line help.......................7 only these lines...................13,20 option names.......................10,18 order of dictionaries used.........15 Outfile file.......................4,9 _ P parameter, dummy...................33,37 parameter, hyphen..................31,32 parameter, line....................43 parameter, linelen.................43 parameter, mode....................31,33,35,37,39,41,43,45 parameter, parm1...................32 parameter, parm2...................32 parameter, status..................32,33,34,35,37,39,41,43,45 parameter, word....................35,39,41,45 parameter, wordlen.................35,40,41,46 parameter, wordstart...............46 parameter, workspace...............31,33,35,37,39,41,43,45 parm1 parameter....................32 parm2 parameter....................32 parm=32, no suspend................6 Pascal example.....................56 personal dictionary................15,17 prep...............................26 print lines with errors............10,19 Printdoc...........................24 Printdoc program...................1 printing manuals...................24 proper nouns, case.................9 pseudo-code for spell..............26 punctuation........................8 _ Q Qedit..............................1,4,5,7,11,15,17 Qhelp..............................7 Qlib programs......................2 _ R redirecting Spell output...........9 Robelle account....................23 RobelleSpell.......................26,27 run-time options...................10 running Spell......................4 _____ Index 68 _ S sample COBOL program...............26 sample Cobol program...............52 sample Pascal program..............56 segment RobelleSpell...............26 skip leading digits................8,46 skip lines.........................12,19,21 SL files...........................26 sorted words.......................17,37 soundex precision..................31 Spell installation.................27 spell intrinsic installation.......22 Spell intrinsics...................25 Spell options......................10,18 spell output.......................9 Spell.Pub.Robelle..................62 SpellAmerican JCW..................16 SpellCondWord JCW..................6 SpellConfig Intrinsic..............31 SpellEnd Intrinsic.................33 Spellerr UDC.......................5,11 SpellExplain.......................7 SpellExplain Intrinsic.............34 SpellExplain status value..........6 Spellf UDC.........................5 SpellFind Intrinsic................35 SpellInit Intrinsic................37 SpellOutCount JCW..................7 SpellSearchInit Intrinsic..........39 SpellSearchNext Intrinsic..........41 Spelludc.Catalog.Robelle...........5,12 SpellUsl file......................26 SpellWordInit Intrinsic............43 SpellWordNext Intrinsic............45 SpellXl file.......................27 Spuser file........................4,15,17 stack overflow.....................7 starting word position.............46 status area........................29 status parameter...................32,33,34,35,37,39,41,43,45 stopping Spell.....................7 summary of options.................18 suspending Spell...................6 switches...........................10,18 system dictionary..................14 system job control word............6 System SL..........................62 System SL installation.............62 _____ 69 Index _ T T option...........................20 timing.............................20 trial users........................22 _ U UDC for Spell......................5 udc to check spelling..............12 uppercase/lowercase................9 user dictionary....................4,13,15,17,37 user dictionary size...............15 user XL files......................28 USL file...........................26 _ V V option...........................5,20 version number.....................5,20 _ W W option...........................11,19,20 warnings...........................14,19 what is a word.....................8 word list..........................11 word list casing...................15 word parameter.....................35,39,41,45 wordlen parameter..................35,40,41,46 words for auxiliary dictionary.....17 words for main dictionary..........16 words for user dictionary..........17 wordstart parameter................46 workspace array....................29 workspace parameter................26,31,33,35,37,39,41,43,45 _ X X option...........................12,21 XL file............................27 ^..................................11 ______ _______ _____ Reader Comment Sheet _____ ___ ____ ______ SPELL 1.9 User Manual Your opinion of this manual is a valuable resource for helping us improve the quality of our documentation. We invite you to rate the manual on this form. Name: Date: Company: Position: Address: Phone: ______ ______ ___ ______ ___ _____ Please circle one number for each: ____ _______ ____ Good Average Poor ü General organization 1 2 3 ü Technical accuracy 1 2 3 ü Writing clarity 1 2 3 ü Convenience of size and format 1 2 3 ü Ease of locating information 1 2 3 ü Thoroughness of material 1 2 3 ü Quality of examples 1 2 3 ________ ___ ____________ _______ ___ ________ __ __________ Comments and suggestions: (please use reverse, or additional ______ __ _______ sheets as needed) _______________________________________________________________ _______________________________________________________________ _______________________________________________________________ _______________________________________________________________ _______________________________________________________________ Thank you for your feedback. We appreciate your time and interest. Please send you comments to us at one of the following numbers or addresses. Robelle Solutions Technology Inc. Toll-free: 1.888.robelle (1.888.762.3553) 7360 137 Street, Suite 372 Phone: 604.501.2001 Surrey, B.C. Canada V3W 1A3 Fax: 604.501.2003 E-mail: support robelle.com WWW: http://www.robelle.com iii _____ ____ ______ SPELL User Manual ________ Contents _______ _ _______ __ _____ Chapter 1 Welcome to Spell Documentation.........................1 Authorization to use Spell............2 New features of Spell.................2 _______ _ _________ _____ Chapter 2 Accessing Spell Spell files...........................4 Output to your logon terminal.........4 User Defined Command..................5 Version number........................5 Help screen...........................6 Suspending Spell......................6 SpellCondWord JCW.....................6 SpellOutCount JCW.....................7 On-line help..........................7 Control-Y.............................7 Stack overflow........................7 _______ _ ________ _____ Chapter 3 Applying Spell Example input.........................8 Example output........................9 Redirecting Spell output..............9 Casing of words.......................9 Run-time options......................10 The Three Dictionaries................14 Maintaining the Dictionaries..........15 Summary of Spell options..............18 ________ iv Contents _______ _ __________ _____ Chapter 4 Installing Spell Introduction..........................22 Who should use these instructions?....22 Change notice.........................22 Step 1: Build/upgrade Robelle account.23 Step 2: Restore the files.............23 Step 3: Installation job stream......23 Step 4: Build the main dictionary.....24 Spell files...........................24 Documentation.........................24 System configuration..................24 _______ _ _____ _________ _______ Chapter 5 Spell Intrinsic Library Extracting words......................25 Accessing the Spell intrinsics........25 Calling sequence......................26 COBOL sample file.....................26 Spell pseudo-code.....................26 Compiling and linking on MPE V........26 Using Lib=............................27 Notes.................................27 Compiling and linking on MPE XL.......27 User XL files.........................28 _______ _ _____ __________ Chapter 6 Spell Intrinsics Intrinsic Parameters..................29 Workspace array....................29 Status array.......................29 Dummy parameter....................30 SpellConfig intrinsic.................31 SpellEnd intrinsic....................33 SpellExplain intrinsic................34 SpellFind intrinsic...................35 SpellInit intrinsic...................37 SpellSearchInit intrinsic.............39 SpellSearchNext intrinsic.............41 SpellWordInit intrinsic...............43 SpellWordNext intrinsic...............45 ________ _ _ _____ _____ ________ Appendix A - Spell Error Messages................47 ________ _ _ _____ _______ Appendix B - COBOL example.......................52 ________ _ _ ______ _______ Appendix C - Pascal Example......................56 ________ _ _ ______ __ ____________ Appendix D - System SL Installation..............62 ________ Contents v _____ Index............................................64