GCC build with Myspell support
This commit is contained in:
parent
9a73874a6c
commit
eb17930b1c
@ -76,4 +76,6 @@
|
|||||||
# Uncomment to disable Synchronet BBS support
|
# Uncomment to disable Synchronet BBS support
|
||||||
#CPPFLAGS+=-DGCFG_NOSYNCHRONET
|
#CPPFLAGS+=-DGCFG_NOSYNCHRONET
|
||||||
# Uncomment to disable MS Office spellchecker support (win32 only)
|
# Uncomment to disable MS Office spellchecker support (win32 only)
|
||||||
CPPFLAGS+=-DGCFG_NOSPELLDLL
|
CPPFLAGS+=-DGCFG_NO_MSSPELL
|
||||||
|
# Uncomment to disable MySpell spellchecker support (multiplatform)
|
||||||
|
CPPFLAGS+=-DGCFG_NO_MYSPELL
|
||||||
|
2
Makefile
2
Makefile
@ -4,7 +4,7 @@ include GNUmakef.def
|
|||||||
|
|
||||||
.PHONY: all clean distclean dirs sourcelists deps docs
|
.PHONY: all clean distclean dirs sourcelists deps docs
|
||||||
|
|
||||||
LIBS=gall gcfg gmb3 glibc uulib smblib msgidlib
|
LIBS=gall gcfg gmb3 glibc uulib smblib msgidlib myspell
|
||||||
EXECUTABLES=golded3 goldnode rddt
|
EXECUTABLES=golded3 goldnode rddt
|
||||||
|
|
||||||
all: sourcelists
|
all: sourcelists
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
# to build debug binary
|
# to build debug binary
|
||||||
|
|
||||||
|
|
||||||
# Uncomment to disable MS Office spellchecker support (win32 only)
|
# Uncomment to disable MS Office spellchecker support
|
||||||
# CPP_EXTRA_FLAGS=$(CPP_EXTRA_FLAGS) /DDGCFG_NO_MSSPELL
|
# CPP_EXTRA_FLAGS=$(CPP_EXTRA_FLAGS) /DGCFG_NO_MSSPELL
|
||||||
# Uncomment to disable MySpell spellchecker support
|
# Uncomment to disable MySpell spellchecker support
|
||||||
# CPP_EXTRA_FLAGS=$(CPP_EXTRA_FLAGS) /DGCFG_NO_MYSPELL
|
# CPP_EXTRA_FLAGS=$(CPP_EXTRA_FLAGS) /DGCFG_NO_MYSPELL
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ LNK_OBJS= \
|
|||||||
$(OBJ_DIR)\gmarea.obj \
|
$(OBJ_DIR)\gmarea.obj \
|
||||||
$(OBJ_DIR)\golded3.obj \
|
$(OBJ_DIR)\golded3.obj \
|
||||||
$(OBJ_DIR)\myspell.obj \
|
$(OBJ_DIR)\myspell.obj \
|
||||||
$(OBJ_DIR)\suggestmgr.obj \
|
$(OBJ_DIR)\suggest.obj \
|
||||||
$(OBJ_DIR)\hashmgr.obj \
|
$(OBJ_DIR)\hashmgr.obj \
|
||||||
$(OBJ_DIR)\dictmgr.obj \
|
$(OBJ_DIR)\dictmgr.obj \
|
||||||
$(OBJ_DIR)\csutil.obj \
|
$(OBJ_DIR)\csutil.obj \
|
||||||
|
9
goldlib/myspell/myspell.all
Normal file
9
goldlib/myspell/myspell.all
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
affentry cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
affixmgr cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
csutil cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
dictmgr cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
example cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
hashmgr cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
hashmgr hxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
myspell cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
||||||
|
suggest cxx all ovl bcd bco bcx wcn wco wcx lnx emx djg rsx cyg be sun
|
@ -1,6 +1,6 @@
|
|||||||
#include "hashmgr.hxx"
|
#include "hashmgr.hxx"
|
||||||
#include "affixmgr.hxx"
|
#include "affixmgr.hxx"
|
||||||
#include "suggestmgr.hxx"
|
#include "suggest.hxx"
|
||||||
#include "csutil.hxx"
|
#include "csutil.hxx"
|
||||||
|
|
||||||
#define NOCAP 0
|
#define NOCAP 0
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "suggestmgr.hxx"
|
#include "suggest.hxx"
|
||||||
|
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER)
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -14,11 +14,11 @@ using namespace std;
|
|||||||
extern char * mystrdup(const char *);
|
extern char * mystrdup(const char *);
|
||||||
|
|
||||||
|
|
||||||
SuggestMgr::SuggestMgr(const char * tryme, int maxn,
|
SuggestMgr::SuggestMgr(const char * tryme, int maxn,
|
||||||
AffixMgr * aptr)
|
AffixMgr * aptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
// register affix manager and check in string of chars to
|
// register affix manager and check in string of chars to
|
||||||
// try when building candidate suggestions
|
// try when building candidate suggestions
|
||||||
pAMgr = aptr;
|
pAMgr = aptr;
|
||||||
ctry = mystrdup(tryme);
|
ctry = mystrdup(tryme);
|
||||||
@ -47,7 +47,7 @@ SuggestMgr::~SuggestMgr()
|
|||||||
|
|
||||||
int SuggestMgr::suggest(char** wlst, int ns, const char * word)
|
int SuggestMgr::suggest(char** wlst, int ns, const char * word)
|
||||||
{
|
{
|
||||||
|
|
||||||
int nsug = ns;
|
int nsug = ns;
|
||||||
|
|
||||||
// perhaps we made chose the wrong char from a related set
|
// perhaps we made chose the wrong char from a related set
|
||||||
@ -69,7 +69,7 @@ int SuggestMgr::suggest(char** wlst, int ns, const char * word)
|
|||||||
// did we add a char that should not be there
|
// did we add a char that should not be there
|
||||||
if ((nsug < maxSug) && (nsug > -1))
|
if ((nsug < maxSug) && (nsug > -1))
|
||||||
nsug = extrachar(wlst, word, nsug);
|
nsug = extrachar(wlst, word, nsug);
|
||||||
|
|
||||||
// did we just hit the wrong key in place of a good char
|
// did we just hit the wrong key in place of a good char
|
||||||
if ((nsug < maxSug) && (nsug > -1))
|
if ((nsug < maxSug) && (nsug > -1))
|
||||||
nsug = badchar(wlst, word, nsug);
|
nsug = badchar(wlst, word, nsug);
|
||||||
@ -98,7 +98,7 @@ int SuggestMgr::mapchars(char** wlst, const char * word, int ns)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns, const mapentry* maptable, int nummap)
|
int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns, const mapentry* maptable, int nummap)
|
||||||
{
|
{
|
||||||
char c = *(word + i);
|
char c = *(word + i);
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
@ -113,7 +113,7 @@ int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns, const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
int in_map = 0;
|
int in_map = 0;
|
||||||
for (int j = 0; j < nummap; j++) {
|
for (int j = 0; j < nummap; j++) {
|
||||||
if (strchr(maptable[j].set,c) != 0) {
|
if (strchr(maptable[j].set,c) != 0) {
|
||||||
@ -212,7 +212,7 @@ int SuggestMgr::badchar(char ** wlst, const char * word, int ns)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// error is word has an extra letter it does not need
|
// error is word has an extra letter it does not need
|
||||||
int SuggestMgr::extrachar(char** wlst, const char * word, int ns)
|
int SuggestMgr::extrachar(char** wlst, const char * word, int ns)
|
||||||
{
|
{
|
||||||
char candidate[MAXSWL];
|
char candidate[MAXSWL];
|
||||||
@ -234,7 +234,7 @@ int SuggestMgr::extrachar(char** wlst, const char * word, int ns)
|
|||||||
wlst[ns] = mystrdup(candidate);
|
wlst[ns] = mystrdup(candidate);
|
||||||
if (wlst[ns] == NULL) return -1;
|
if (wlst[ns] == NULL) return -1;
|
||||||
ns++;
|
ns++;
|
||||||
} else return ns;
|
} else return ns;
|
||||||
}
|
}
|
||||||
*r++ = *p++;
|
*r++ = *p++;
|
||||||
}
|
}
|
||||||
@ -265,7 +265,7 @@ int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns)
|
|||||||
wlst[ns] = mystrdup(candidate);
|
wlst[ns] = mystrdup(candidate);
|
||||||
if (wlst[ns] == NULL) return -1;
|
if (wlst[ns] == NULL) return -1;
|
||||||
ns++;
|
ns++;
|
||||||
} else return ns;
|
} else return ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*q++ = *p++;
|
*q++ = *p++;
|
||||||
@ -389,7 +389,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * word, HashMgr* pHMgr)
|
|||||||
lp = j;
|
lp = j;
|
||||||
lval = scores[j];
|
lval = scores[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// find minimum threshhold for a passable suggestion
|
// find minimum threshhold for a passable suggestion
|
||||||
@ -443,9 +443,9 @@ int SuggestMgr::ngsuggest(char** wlst, char * word, HashMgr* pHMgr)
|
|||||||
lval = gscore[j];
|
lval = gscore[j];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
free (glst[k].word);
|
free (glst[k].word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -453,14 +453,14 @@ int SuggestMgr::ngsuggest(char** wlst, char * word, HashMgr* pHMgr)
|
|||||||
|
|
||||||
// now we are done generating guesses
|
// now we are done generating guesses
|
||||||
// sort in order of decreasing score and copy over
|
// sort in order of decreasing score and copy over
|
||||||
|
|
||||||
bubblesort(&guess[0], &gscore[0], MAX_GUESS);
|
bubblesort(&guess[0], &gscore[0], MAX_GUESS);
|
||||||
int ns = 0;
|
int ns = 0;
|
||||||
for (i=0; i < MAX_GUESS; i++) {
|
for (i=0; i < MAX_GUESS; i++) {
|
||||||
if (guess[i]) {
|
if (guess[i]) {
|
||||||
int unique = 1;
|
int unique = 1;
|
||||||
for (j=i+1; j < MAX_GUESS; j++)
|
for (j=i+1; j < MAX_GUESS; j++)
|
||||||
if (guess[j])
|
if (guess[j])
|
||||||
if (!strcmp(guess[i], guess[j])) unique = 0;
|
if (!strcmp(guess[i], guess[j])) unique = 0;
|
||||||
if (unique) {
|
if (unique) {
|
||||||
wlst[ns++] = guess[i];
|
wlst[ns++] = guess[i];
|
||||||
@ -480,7 +480,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * word, HashMgr* pHMgr)
|
|||||||
int SuggestMgr::check(const char * word, int len)
|
int SuggestMgr::check(const char * word, int len)
|
||||||
{
|
{
|
||||||
struct hentry * rv=NULL;
|
struct hentry * rv=NULL;
|
||||||
if (pAMgr) {
|
if (pAMgr) {
|
||||||
rv = pAMgr->lookup(word);
|
rv = pAMgr->lookup(word);
|
||||||
if (rv == NULL) rv = pAMgr->affix_check(word,len);
|
if (rv == NULL) rv = pAMgr->affix_check(word,len);
|
||||||
}
|
}
|
Reference in New Issue
Block a user