TempleOSTS_140317.ISO
This commit is contained in:
1 parent
2d2a65d572
commit
7ef616a20e
1416 files changed
+223873
-53917
No files matched your search
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
This does a really crappy job of
|
||||
suggesting spellings. Write a better
|
||||
one for fun.
|
||||
*/
|
||||
|
||||
U8 *SuggestMatchForm(U8 *src)
|
||||
{
|
||||
I64 ch,ch1=0;
|
||||
U8 *result=MStrUtil(src,SUF_TO_UPPER),*dst;
|
||||
dst=src=result;
|
||||
while (ch=*src++) {
|
||||
if (!StrOcc("AEIOU",ch)) {
|
||||
if (ch=='C') ch='K';
|
||||
if (ch=='Z') ch='S';
|
||||
if (ch!=ch1) //F64 chars to single
|
||||
*dst++=ch;
|
||||
}
|
||||
ch1=ch;
|
||||
}
|
||||
*dst=0;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
Fmt of word lst entry:
|
||||
U8 WSD_WORD_CHAR
|
||||
U8 word[] with terminating zero
|
||||
I16 block; //definition offset in ::/Adam/WordStat/WSDefs.DAT
|
||||
*/
|
||||
|
||||
U0 SuggestSpelling(U8 *word)
|
||||
{
|
||||
U8 *dict=ws_dict_word_lst,
|
||||
*pf=SuggestMatchForm(word),
|
||||
*wf;
|
||||
I64 len=StrLen(pf),
|
||||
num_cols=Fs->win_width/16,
|
||||
col=0;
|
||||
while (*dict) {
|
||||
wf=SuggestMatchForm(dict+1);
|
||||
if (!StrNCmp(pf,wf,len)) {
|
||||
"%16s",dict+1;
|
||||
if (++col==num_cols) {
|
||||
col=0;
|
||||
NewLine;
|
||||
}
|
||||
}
|
||||
Free(wf);
|
||||
dict+=StrLen(dict+1)+4;
|
||||
}
|
||||
Free(pf);
|
||||
NewLine;
|
||||
}
|
||||
|
||||
|
||||
U0 SuggestSpellingDemo()
|
||||
{
|
||||
U8 *w;
|
||||
while (TRUE) {
|
||||
w=PmtStr("Word:");
|
||||
if (*w) {
|
||||
SuggestSpelling(w);
|
||||
Free(w);
|
||||
} else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
If you "Adam Include" this file, it will
|
||||
install this command as a hot-key.
|
||||
*/
|
||||
|
||||
U0 CtrlAltL(I64)
|
||||
{
|
||||
//$LK,"ws_cur_word",A="MN:ws_cur_word"$ is only set if WordStat
|
||||
//is running.
|
||||
PopUp("SuggestSpelling(ws_cur_word);View;");
|
||||
}
|
||||
|
||||
if (Fs!=adam_task)
|
||||
SuggestSpellingDemo;
|
||||
else {
|
||||
SetCtrlAltLetCB('L',&CtrlAltL,"Cmd/Suggest Spelling");
|
||||
//Appears in the Adam Task Window
|
||||
"<CTRL-ALT-L> installed\n";
|
||||
}
|
||||
|
||||
//Note: It would be more appropriate
|
||||
//to define a key in $LK,"MyPutKey",A="MN:MyPutKey"$().
|
||||
Reference in new issue
Block a user