Fix DJGPP build
This commit is contained in:
parent
717827510e
commit
b322344dae
@ -27,13 +27,18 @@
|
|||||||
Basic definitions and types.
|
Basic definitions and types.
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#ifndef __goldall_h
|
#ifndef __gdefs_h
|
||||||
#define __goldall_h
|
#define __gdefs_h
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
#include <gcmpall.h>
|
#include <gcmpall.h>
|
||||||
|
|
||||||
|
#ifdef __WIN32__
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
#define G_HAS_VSNPRINTF
|
||||||
|
#else
|
||||||
|
typedef char TCHAR;
|
||||||
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# include <cstddef>
|
# include <cstddef>
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
// File I/O class.
|
// File I/O class.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
#ifndef __gfilbase_h
|
#ifndef __gfile_h
|
||||||
#define __gfilbase_h
|
#define __gfile_h
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
@ -155,7 +155,7 @@ inline bool is_dir(const std::string &path) { return is_dir(path.c_str()); }
|
|||||||
#if defined(_taccess_s)
|
#if defined(_taccess_s)
|
||||||
inline bool fexist(const TCHAR *filename) { return *filename ? (0 == (_taccess_s(filename, R_OK)) && !is_dir(filename)) : false; }
|
inline bool fexist(const TCHAR *filename) { return *filename ? (0 == (_taccess_s(filename, R_OK)) && !is_dir(filename)) : false; }
|
||||||
#else
|
#else
|
||||||
inline bool fexist(const TCHAR *filename) { return *filename ? (0 == (_taccess(filename, R_OK)) && !is_dir(filename)) : false; }
|
inline bool fexist(const TCHAR *filename) { return *filename ? (0 == (access(filename, R_OK)) && !is_dir(filename)) : false; }
|
||||||
#endif
|
#endif
|
||||||
inline bool fexist(const std::string& filename) { return fexist(filename.c_str()); }
|
inline bool fexist(const std::string& filename) { return fexist(filename.c_str()); }
|
||||||
|
|
||||||
@ -197,8 +197,8 @@ int strschg_environ(std::string& s);
|
|||||||
char* MapPath(char* map, bool reverse = false); // gcarea.cpp
|
char* MapPath(char* map, bool reverse = false); // gcarea.cpp
|
||||||
inline char* ReMapPath(char* map) { return MapPath(map, true); }
|
inline char* ReMapPath(char* map) { return MapPath(map, true); }
|
||||||
|
|
||||||
inline long lseekset(int fh, long offset) { return _lseek(fh, offset, SEEK_SET); }
|
inline long lseekset(int fh, long offset) { return lseek(fh, offset, SEEK_SET); }
|
||||||
inline long lseekset(int fh, long record, long recordsize) { return _lseek(fh, record*recordsize, SEEK_SET); }
|
inline long lseekset(int fh, long record, long recordsize) { return lseek(fh, record*recordsize, SEEK_SET); }
|
||||||
|
|
||||||
int gchdir(const char* dir);
|
int gchdir(const char* dir);
|
||||||
|
|
||||||
|
@ -105,10 +105,10 @@ char* strunrevname(char* unreversedname, const char* name);
|
|||||||
|
|
||||||
inline char* strbtrim(char* st) { return strtrim(strltrim(st)); }
|
inline char* strbtrim(char* st) { return strtrim(strltrim(st)); }
|
||||||
|
|
||||||
inline bool streql (const TCHAR *str1, const TCHAR *str2) { return (0 == _tcscmp (str1, str2)); }
|
inline bool streql (const TCHAR *str1, const TCHAR *str2) { return (0 == strcmp (str1, str2)); }
|
||||||
inline bool strieql (const TCHAR *str1, const TCHAR *str2) { return (0 == _tcsicmp (str1, str2)); }
|
inline bool strieql (const TCHAR *str1, const TCHAR *str2) { return (0 == stricmp (str1, str2)); }
|
||||||
inline bool strneql (const TCHAR *str1, const TCHAR *str2, int n) { return (0 == _tcsncmp (str1, str2, n)); }
|
inline bool strneql (const TCHAR *str1, const TCHAR *str2, int n) { return (0 == strncmp (str1, str2, n)); }
|
||||||
inline bool strnieql(const TCHAR *str1, const TCHAR *str2, int n) { return (0 == _tcsnicmp(str1, str2, n)); }
|
inline bool strnieql(const TCHAR *str1, const TCHAR *str2, int n) { return (0 == strnicmp(str1, str2, n)); }
|
||||||
|
|
||||||
inline const char* strskip_to(const char* p, char* s) { return p+strcspn(p, s); }
|
inline const char* strskip_to(const char* p, char* s) { return p+strcspn(p, s); }
|
||||||
inline char* strskip_to(char* p, char* s) { return p+strcspn(p, s); }
|
inline char* strskip_to(char* p, char* s) { return p+strcspn(p, s); }
|
||||||
@ -163,8 +163,8 @@ public:
|
|||||||
TCHAR *First(TCHAR *buf) { token = _tcstok_s(buf, separator, &next_token); return token; }
|
TCHAR *First(TCHAR *buf) { token = _tcstok_s(buf, separator, &next_token); return token; }
|
||||||
TCHAR *Next() { token = _tcstok_s(NULL, separator, &next_token); return token; }
|
TCHAR *Next() { token = _tcstok_s(NULL, separator, &next_token); return token; }
|
||||||
#else
|
#else
|
||||||
TCHAR *First(TCHAR *buf) { token = _tcstok(buf, separator); return token; }
|
TCHAR *First(TCHAR *buf) { token = strtok(buf, separator); return token; }
|
||||||
TCHAR *Next() { token = _tcstok(NULL, separator); return token; }
|
TCHAR *Next() { token = strtok(NULL, separator); return token; }
|
||||||
#endif
|
#endif
|
||||||
TCHAR *Token() { return token; }
|
TCHAR *Token() { return token; }
|
||||||
};
|
};
|
||||||
|
@ -52,7 +52,7 @@ inline void tokenize(gstrarray &array, const TCHAR* str, const TCHAR *delim = NU
|
|||||||
TCHAR *next_token;
|
TCHAR *next_token;
|
||||||
TCHAR *token = _tcstok_s(tmp, delim, &next_token);
|
TCHAR *token = _tcstok_s(tmp, delim, &next_token);
|
||||||
#else
|
#else
|
||||||
TCHAR *token = _tcstok(tmp, delim);
|
TCHAR *token = strtok(tmp, delim);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (NULL != token)
|
while (NULL != token)
|
||||||
@ -61,7 +61,7 @@ inline void tokenize(gstrarray &array, const TCHAR* str, const TCHAR *delim = NU
|
|||||||
#if defined(_tcstok_s)
|
#if defined(_tcstok_s)
|
||||||
token = _tcstok_s(NULL, delim, &next_token);
|
token = _tcstok_s(NULL, delim, &next_token);
|
||||||
#else
|
#else
|
||||||
token = _tcstok(NULL, delim);
|
token = strtok(NULL, delim);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,7 +573,7 @@ TCHAR *strxcpy(TCHAR *d, const TCHAR *s, size_t n)
|
|||||||
#else
|
#else
|
||||||
if (n)
|
if (n)
|
||||||
{
|
{
|
||||||
_tcsncpy(d, s, n-1);
|
strncpy(d, s, n-1);
|
||||||
d[n-1] = NUL;
|
d[n-1] = NUL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -636,7 +636,11 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
#else
|
#else
|
||||||
buffer[sizeOfBuffer-1] = 0;
|
buffer[sizeOfBuffer-1] = 0;
|
||||||
ret = _vsntprintf(buffer, sizeOfBuffer, format, argptr);
|
#if defined( G_HAS_VSNPRINTF )
|
||||||
|
ret = _vsnprintf(buffer, sizeOfBuffer, format, argptr);
|
||||||
|
#else
|
||||||
|
ret = vsprintf(buffer, format, argptr);
|
||||||
|
#endif
|
||||||
if ((ret < 0) || buffer[sizeOfBuffer-1])
|
if ((ret < 0) || buffer[sizeOfBuffer-1])
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,7 @@ inline void gctime(TCHAR *buffer, size_t sizeInChars, const time32_t *timep)
|
|||||||
_tctime_s(buffer, sizeInChars, &zero);
|
_tctime_s(buffer, sizeInChars, &zero);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
const char *time = _tctime(&temp);
|
const char *time = ctime(&temp);
|
||||||
#if defined(__WIN32__)
|
#if defined(__WIN32__)
|
||||||
if (NULL == time)
|
if (NULL == time)
|
||||||
{
|
{
|
||||||
|
@ -193,7 +193,7 @@ init_syntax_once ()
|
|||||||
for (c = 0; c < 256; c++)
|
for (c = 0; c < 256; c++)
|
||||||
re_syntax_table[c] = isxalnum(c) ? Sword : 0;
|
re_syntax_table[c] = isxalnum(c) ? Sword : 0;
|
||||||
|
|
||||||
re_syntax_table['_'] = Sword;
|
re_syntax_table[int('_')] = Sword;
|
||||||
|
|
||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
@ -157,8 +157,16 @@ struct HudsToIdx {
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
typedef word HudsLast[HUDS_MAXBOARD] __attribute__((packed));
|
typedef word HudsLast[HUDS_MAXBOARD]
|
||||||
typedef word GoldLast[GOLD_MAXBOARD] __attribute__((packed));
|
#ifndef __DJGPP__
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
typedef word GoldLast[GOLD_MAXBOARD]
|
||||||
|
#ifndef __DJGPP__
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
@ -170,7 +178,7 @@ typedef word GoldLast[GOLD_MAXBOARD] __attribute__((packed));
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
struct HudsScan {
|
struct HudsScan {
|
||||||
uint count;
|
uint count;
|
||||||
uint active;
|
uint active;
|
||||||
uint32_t lastread;
|
uint32_t lastread;
|
||||||
@ -286,7 +294,7 @@ protected:
|
|||||||
|
|
||||||
int load_message(int __mode, gmsg* __msg, HudsHdr& __hdr);
|
int load_message(int __mode, gmsg* __msg, HudsHdr& __hdr);
|
||||||
void save_message(int __mode, gmsg* __msg, HudsHdr& __hdr);
|
void save_message(int __mode, gmsg* __msg, HudsHdr& __hdr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
_HudsArea() { wide = NULL; }
|
_HudsArea() { wide = NULL; }
|
||||||
@ -297,7 +305,7 @@ public:
|
|||||||
|
|
||||||
// ----------------------------------------------------------------
|
// ----------------------------------------------------------------
|
||||||
// Messagebase member functions
|
// Messagebase member functions
|
||||||
|
|
||||||
void open();
|
void open();
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -63,20 +63,20 @@ Hunspell::~Hunspell()
|
|||||||
// make a copy of src at destination while removing all leading
|
// make a copy of src at destination while removing all leading
|
||||||
// blanks and removing any trailing periods after recording
|
// blanks and removing any trailing periods after recording
|
||||||
// their presence with the abbreviation flag
|
// their presence with the abbreviation flag
|
||||||
// also since already going through character by character,
|
// also since already going through character by character,
|
||||||
// set the capitalization type
|
// set the capitalization type
|
||||||
// return the length of the "cleaned" (and UTF-8 encoded) word
|
// return the length of the "cleaned" (and UTF-8 encoded) word
|
||||||
|
|
||||||
int Hunspell::cleanword2(char * dest, const char * src,
|
int Hunspell::cleanword2(char * dest, const char * src,
|
||||||
w_char * dest_utf, int * nc, int * pcaptype, int * pabbrev)
|
w_char * dest_utf, int * nc, int * pcaptype, int * pabbrev)
|
||||||
{
|
{
|
||||||
unsigned char * p = (unsigned char *) dest;
|
unsigned char * p = (unsigned char *) dest;
|
||||||
const unsigned char * q = (const unsigned char * ) src;
|
const unsigned char * q = (const unsigned char * ) src;
|
||||||
int firstcap = 0;
|
int firstcap = 0;
|
||||||
|
|
||||||
// first skip over any leading blanks
|
// first skip over any leading blanks
|
||||||
while ((*q != '\0') && (*q == ' ')) q++;
|
while ((*q != '\0') && (*q == ' ')) q++;
|
||||||
|
|
||||||
// now strip off any trailing periods (recording their presence)
|
// now strip off any trailing periods (recording their presence)
|
||||||
*pabbrev = 0;
|
*pabbrev = 0;
|
||||||
int nl = strlen((const char *)q);
|
int nl = strlen((const char *)q);
|
||||||
@ -84,9 +84,9 @@ int Hunspell::cleanword2(char * dest, const char * src,
|
|||||||
nl--;
|
nl--;
|
||||||
(*pabbrev)++;
|
(*pabbrev)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no characters are left it can't be capitalized
|
// if no characters are left it can't be capitalized
|
||||||
if (nl <= 0) {
|
if (nl <= 0) {
|
||||||
*pcaptype = NOCAP;
|
*pcaptype = NOCAP;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
@ -141,18 +141,18 @@ int Hunspell::cleanword2(char * dest, const char * src,
|
|||||||
*pcaptype = HUHCAP;
|
*pcaptype = HUHCAP;
|
||||||
}
|
}
|
||||||
return strlen(dest);
|
return strlen(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Hunspell::cleanword(char * dest, const char * src,
|
int Hunspell::cleanword(char * dest, const char * src,
|
||||||
int * pcaptype, int * pabbrev)
|
int * pcaptype, int * pabbrev)
|
||||||
{
|
{
|
||||||
unsigned char * p = (unsigned char *) dest;
|
unsigned char * p = (unsigned char *) dest;
|
||||||
const unsigned char * q = (const unsigned char * ) src;
|
const unsigned char * q = (const unsigned char * ) src;
|
||||||
int firstcap = 0;
|
int firstcap = 0;
|
||||||
|
|
||||||
// first skip over any leading blanks
|
// first skip over any leading blanks
|
||||||
while ((*q != '\0') && (*q == ' ')) q++;
|
while ((*q != '\0') && (*q == ' ')) q++;
|
||||||
|
|
||||||
// now strip off any trailing periods (recording their presence)
|
// now strip off any trailing periods (recording their presence)
|
||||||
*pabbrev = 0;
|
*pabbrev = 0;
|
||||||
int nl = strlen((const char *)q);
|
int nl = strlen((const char *)q);
|
||||||
@ -160,9 +160,9 @@ int Hunspell::cleanword(char * dest, const char * src,
|
|||||||
nl--;
|
nl--;
|
||||||
(*pabbrev)++;
|
(*pabbrev)++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no characters are left it can't be capitalized
|
// if no characters are left it can't be capitalized
|
||||||
if (nl <= 0) {
|
if (nl <= 0) {
|
||||||
*pcaptype = NOCAP;
|
*pcaptype = NOCAP;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
@ -213,8 +213,8 @@ int Hunspell::cleanword(char * dest, const char * src,
|
|||||||
*pcaptype = HUHCAP;
|
*pcaptype = HUHCAP;
|
||||||
}
|
}
|
||||||
return strlen(dest);
|
return strlen(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Hunspell::mkallcap(char * p)
|
void Hunspell::mkallcap(char * p)
|
||||||
{
|
{
|
||||||
@ -231,7 +231,7 @@ void Hunspell::mkallcap(char * p)
|
|||||||
}
|
}
|
||||||
u16_u8(p, MAXWORDUTF8LEN, u, nc);
|
u16_u8(p, MAXWORDUTF8LEN, u, nc);
|
||||||
} else {
|
} else {
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
*p = csconv[((unsigned char) *p)].cupper;
|
*p = csconv[((unsigned char) *p)].cupper;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -250,9 +250,9 @@ int Hunspell::mkallcap2(char * p, w_char * u, int nc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
u16_u8(p, MAXWORDUTF8LEN, u, nc);
|
u16_u8(p, MAXWORDUTF8LEN, u, nc);
|
||||||
return strlen(p);
|
return strlen(p);
|
||||||
} else {
|
} else {
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
*p = csconv[((unsigned char) *p)].cupper;
|
*p = csconv[((unsigned char) *p)].cupper;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -263,7 +263,7 @@ int Hunspell::mkallcap2(char * p, w_char * u, int nc)
|
|||||||
|
|
||||||
void Hunspell::mkallsmall(char * p)
|
void Hunspell::mkallsmall(char * p)
|
||||||
{
|
{
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
*p = csconv[((unsigned char) *p)].clower;
|
*p = csconv[((unsigned char) *p)].clower;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -283,7 +283,7 @@ int Hunspell::mkallsmall2(char * p, w_char * u, int nc)
|
|||||||
u16_u8(p, MAXWORDUTF8LEN, u, nc);
|
u16_u8(p, MAXWORDUTF8LEN, u, nc);
|
||||||
return strlen(p);
|
return strlen(p);
|
||||||
} else {
|
} else {
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
*p = csconv[((unsigned char) *p)].clower;
|
*p = csconv[((unsigned char) *p)].clower;
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -308,10 +308,10 @@ hentry * Hunspell::spellsharps(char * base, char * pos, int n, int repnum, char
|
|||||||
hentry * h;
|
hentry * h;
|
||||||
*pos = 'Ã';
|
*pos = 'Ã';
|
||||||
*(pos + 1) = 'Ÿ';
|
*(pos + 1) = 'Ÿ';
|
||||||
if (h = spellsharps(base, pos + 2, n + 1, repnum + 1, tmp)) return h;
|
if ((h = spellsharps(base, pos + 2, n + 1, repnum + 1, tmp))) return h;
|
||||||
*pos = 's';
|
*pos = 's';
|
||||||
*(pos + 1) = 's';
|
*(pos + 1) = 's';
|
||||||
if (h = spellsharps(base, pos + 2, n + 1, repnum, tmp)) return h;
|
if ((h = spellsharps(base, pos + 2, n + 1, repnum, tmp))) return h;
|
||||||
} else if (repnum > 0) {
|
} else if (repnum > 0) {
|
||||||
if (utf8) return check(base);
|
if (utf8) return check(base);
|
||||||
return check(sharps_u8_l1(tmp, base));
|
return check(sharps_u8_l1(tmp, base));
|
||||||
@ -347,7 +347,7 @@ int Hunspell::spell(const char * word)
|
|||||||
char wspace[MAXWORDUTF8LEN + 4];
|
char wspace[MAXWORDUTF8LEN + 4];
|
||||||
w_char unicw[MAXWORDLEN + 1];
|
w_char unicw[MAXWORDLEN + 1];
|
||||||
int nc = strlen(word);
|
int nc = strlen(word);
|
||||||
int wl2;
|
int wl2=0;
|
||||||
if (utf8) {
|
if (utf8) {
|
||||||
if (nc >= MAXWORDUTF8LEN) return 0;
|
if (nc >= MAXWORDUTF8LEN) return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -363,11 +363,11 @@ int Hunspell::spell(const char * word)
|
|||||||
enum { NBEGIN, NNUM, NSEP };
|
enum { NBEGIN, NNUM, NSEP };
|
||||||
int nstate = NBEGIN;
|
int nstate = NBEGIN;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; (i < wl) &&
|
for (i = 0; (i < wl) &&
|
||||||
(((cw[i] <= '9') && (cw[i] >= '0') && (nstate = NNUM)) ||
|
(((cw[i] <= '9') && (cw[i] >= '0') && (nstate = NNUM)) ||
|
||||||
((nstate == NNUM) && ((cw[i] == ',') ||
|
((nstate == NNUM) && ((cw[i] == ',') ||
|
||||||
(cw[i] == '.') || (cw[i] == '-')) && (nstate = NSEP))); i++);
|
(cw[i] == '.') || (cw[i] == '-')) && (nstate = NSEP))); i++);
|
||||||
if ((i == wl) && (nstate == NNUM)) return 1;
|
if ((i == wl) && (nstate == NNUM)) return 1;
|
||||||
|
|
||||||
// LANG_hu section: number(s) + (percent or degree) with suffixes
|
// LANG_hu section: number(s) + (percent or degree) with suffixes
|
||||||
@ -377,10 +377,10 @@ int Hunspell::spell(const char * word)
|
|||||||
// END of LANG_hu section
|
// END of LANG_hu section
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case HUHCAP:
|
case HUHCAP:
|
||||||
case HUHINITCAP:
|
case HUHINITCAP:
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
rv = check(cw);
|
rv = check(cw);
|
||||||
if ((abbv) && !(rv)) {
|
if ((abbv) && !(rv)) {
|
||||||
memcpy(wspace,cw,wl);
|
memcpy(wspace,cw,wl);
|
||||||
*(wspace+wl) = '.';
|
*(wspace+wl) = '.';
|
||||||
@ -422,14 +422,14 @@ int Hunspell::spell(const char * word)
|
|||||||
if (rv) break;
|
if (rv) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
wl = mkallsmall2(cw, unicw, nc);
|
wl = mkallsmall2(cw, unicw, nc);
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
rv = check(wspace);
|
rv = check(wspace);
|
||||||
if (!rv || (is_keepcase(rv) && !((captype == INITCAP) &&
|
if (!rv || (is_keepcase(rv) && !((captype == INITCAP) &&
|
||||||
// if CHECKSHARPS: KEEPCASE words with ß are allowed
|
// if CHECKSHARPS: KEEPCASE words with ß are allowed
|
||||||
// in INITCAP form, too.
|
// in INITCAP form, too.
|
||||||
pAMgr->get_checksharps() && ((utf8 && strstr(wspace, "ß")) ||
|
pAMgr->get_checksharps() && ((utf8 && strstr(wspace, "ß")) ||
|
||||||
(!utf8 && strchr(wspace, 'ß')))))) {
|
(!utf8 && strchr(wspace, 'ß')))))) {
|
||||||
wl2 = mkinitcap2(cw, unicw, nc);
|
wl2 = mkinitcap2(cw, unicw, nc);
|
||||||
rv = check(cw);
|
rv = check(cw);
|
||||||
@ -448,9 +448,9 @@ int Hunspell::spell(const char * word)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv) return 1;
|
if (rv) return 1;
|
||||||
|
|
||||||
// recursive breaking at break points (not good for morphological analysis)
|
// recursive breaking at break points (not good for morphological analysis)
|
||||||
@ -458,7 +458,7 @@ int Hunspell::spell(const char * word)
|
|||||||
char * s;
|
char * s;
|
||||||
char r;
|
char r;
|
||||||
for (int i = 0; i < pAMgr->get_numbreak(); i++) {
|
for (int i = 0; i < pAMgr->get_numbreak(); i++) {
|
||||||
if (s=(char *) strstr(cw, wordbreak[i])) {
|
if ((s=(char *) strstr(cw, wordbreak[i]))) {
|
||||||
r = *s;
|
r = *s;
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
// examine 2 sides of the break point
|
// examine 2 sides of the break point
|
||||||
@ -488,7 +488,7 @@ int Hunspell::spell(const char * word)
|
|||||||
*dash = 'â';
|
*dash = 'â';
|
||||||
}
|
}
|
||||||
if ((dash=(char *) strchr(cw,'-'))) {
|
if ((dash=(char *) strchr(cw,'-'))) {
|
||||||
*dash='\0';
|
*dash='\0';
|
||||||
// examine 2 sides of the dash
|
// examine 2 sides of the dash
|
||||||
if (dash[1] == '\0') { // base word ending with dash
|
if (dash[1] == '\0') { // base word ending with dash
|
||||||
if (spell(cw)) return 1;
|
if (spell(cw)) return 1;
|
||||||
@ -581,17 +581,17 @@ struct hentry * Hunspell::check(const char * w)
|
|||||||
}
|
}
|
||||||
prevroot = he->word;
|
prevroot = he->word;
|
||||||
} else if (pAMgr->get_compound()) {
|
} else if (pAMgr->get_compound()) {
|
||||||
he = pAMgr->compound_check(word, len,
|
he = pAMgr->compound_check(word, len,
|
||||||
0,0,100,0,NULL,0,NULL,NULL,0);
|
0,0,100,0,NULL,0,NULL,NULL,0);
|
||||||
// LANG_hu section: `moving rule' with last dash
|
// LANG_hu section: `moving rule' with last dash
|
||||||
if ((!he) && (langnum == LANG_hu) && (word[len-1]=='-')) {
|
if ((!he) && (langnum == LANG_hu) && (word[len-1]=='-')) {
|
||||||
char * dup = mystrdup(word);
|
char * dup = mystrdup(word);
|
||||||
dup[len-1] = '\0';
|
dup[len-1] = '\0';
|
||||||
he = pAMgr->compound_check(dup, len-1,
|
he = pAMgr->compound_check(dup, len-1,
|
||||||
-5,0,100,0,NULL,1,NULL,NULL,0);
|
-5,0,100,0,NULL,1,NULL,NULL,0);
|
||||||
free(dup);
|
free(dup);
|
||||||
}
|
}
|
||||||
// end of LANG speficic region
|
// end of LANG speficic region
|
||||||
if (he) {
|
if (he) {
|
||||||
prevroot = he->word;
|
prevroot = he->word;
|
||||||
prevcompound = 1;
|
prevcompound = 1;
|
||||||
@ -625,12 +625,12 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
int ngramsugs = 0;
|
int ngramsugs = 0;
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
ns = pSMgr->suggest(slst, cw, ns);
|
ns = pSMgr->suggest(slst, cw, ns);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
capwords = 1;
|
capwords = 1;
|
||||||
ns = pSMgr->suggest(slst, cw, ns);
|
ns = pSMgr->suggest(slst, cw, ns);
|
||||||
if (ns == -1) break;
|
if (ns == -1) break;
|
||||||
@ -641,7 +641,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
}
|
}
|
||||||
case HUHINITCAP:
|
case HUHINITCAP:
|
||||||
capwords = 1;
|
capwords = 1;
|
||||||
case HUHCAP: {
|
case HUHCAP: {
|
||||||
ns = pSMgr->suggest(slst, cw, ns);
|
ns = pSMgr->suggest(slst, cw, ns);
|
||||||
if (ns != -1) {
|
if (ns != -1) {
|
||||||
int prevns;
|
int prevns;
|
||||||
@ -664,7 +664,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
// aNew -> "a New" (instead of "a new")
|
// aNew -> "a New" (instead of "a new")
|
||||||
for (int j = prevns; j < ns; j++) {
|
for (int j = prevns; j < ns; j++) {
|
||||||
char * space;
|
char * space;
|
||||||
if (space = strchr((*slst)[j],' ')) {
|
if ( (space = strchr((*slst)[j],' ')) ) {
|
||||||
int slen = strlen(space + 1);
|
int slen = strlen(space + 1);
|
||||||
// different case after space (need capitalisation)
|
// different case after space (need capitalisation)
|
||||||
if ((slen < wl) && strcmp(cw + wl - slen, space + 1)) {
|
if ((slen < wl) && strcmp(cw + wl - slen, space + 1)) {
|
||||||
@ -683,7 +683,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ALLCAP: {
|
case ALLCAP: {
|
||||||
memcpy(wspace, cw, (wl+1));
|
memcpy(wspace, cw, (wl+1));
|
||||||
mkallsmall2(wspace, unicw, nc);
|
mkallsmall2(wspace, unicw, nc);
|
||||||
ns = pSMgr->suggest(slst, wspace, ns);
|
ns = pSMgr->suggest(slst, wspace, ns);
|
||||||
@ -696,12 +696,12 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
if (pAMgr && pAMgr->get_checksharps()) {
|
if (pAMgr && pAMgr->get_checksharps()) {
|
||||||
char * pos;
|
char * pos;
|
||||||
if (utf8) {
|
if (utf8) {
|
||||||
while (pos = strstr((*slst)[j], "ß")) {
|
while ( (pos = strstr((*slst)[j], "ß")) ) {
|
||||||
*pos = 'S';
|
*pos = 'S';
|
||||||
*(pos+1) = 'S';
|
*(pos+1) = 'S';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while (pos = strchr((*slst)[j], 'ß')) {
|
while ( (pos = strchr((*slst)[j], 'ß')) ) {
|
||||||
(*slst)[j] = (char *) realloc((*slst)[j], strlen((*slst)[j]) + 2);
|
(*slst)[j] = (char *) realloc((*slst)[j], strlen((*slst)[j]) + 2);
|
||||||
mystrrep((*slst)[j], "ß", "SS");
|
mystrrep((*slst)[j], "ß", "SS");
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
ns = pSMgr->ngsuggest(*slst, wspace, pHMgr);
|
ns = pSMgr->ngsuggest(*slst, wspace, pHMgr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
capwords = 1;
|
capwords = 1;
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall2(wspace, unicw, nc);
|
mkallsmall2(wspace, unicw, nc);
|
||||||
@ -746,7 +746,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall2(wspace, unicw, nc);
|
mkallsmall2(wspace, unicw, nc);
|
||||||
ns = pSMgr->ngsuggest(*slst, wspace, pHMgr);
|
ns = pSMgr->ngsuggest(*slst, wspace, pHMgr);
|
||||||
for (int j=0; j < ns; j++)
|
for (int j=0; j < ns; j++)
|
||||||
mkallcap((*slst)[j]);
|
mkallcap((*slst)[j]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -790,13 +790,13 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
strcpy(s, (*slst)[j]);
|
strcpy(s, (*slst)[j]);
|
||||||
len = strlen(s);
|
len = strlen(s);
|
||||||
}
|
}
|
||||||
int wl = mkallsmall2(s, w, len);
|
mkallsmall2(s, w, len);
|
||||||
free((*slst)[j]);
|
free((*slst)[j]);
|
||||||
if (spell(s)) {
|
if (spell(s)) {
|
||||||
(*slst)[l] = mystrdup(s);
|
(*slst)[l] = mystrdup(s);
|
||||||
l++;
|
l++;
|
||||||
} else {
|
} else {
|
||||||
int wl = mkinitcap2(s, w, len);
|
mkinitcap2(s, w, len);
|
||||||
if (spell(s)) {
|
if (spell(s)) {
|
||||||
(*slst)[l] = mystrdup(s);
|
(*slst)[l] = mystrdup(s);
|
||||||
l++;
|
l++;
|
||||||
@ -805,7 +805,7 @@ int Hunspell::suggest(char*** slst, const char * word)
|
|||||||
} else {
|
} else {
|
||||||
(*slst)[l] = (*slst)[j];
|
(*slst)[l] = (*slst)[j];
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ns = l;
|
ns = l;
|
||||||
}
|
}
|
||||||
@ -845,15 +845,15 @@ int Hunspell::suggest_auto(char*** slst, const char * word)
|
|||||||
if (wl == 0) return 0;
|
if (wl == 0) return 0;
|
||||||
int ns = 0;
|
int ns = 0;
|
||||||
*slst = NULL; // HU, nsug in pSMgr->suggest
|
*slst = NULL; // HU, nsug in pSMgr->suggest
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
ns = pSMgr->suggest_auto(slst, cw, ns);
|
ns = pSMgr->suggest_auto(slst, cw, ns);
|
||||||
if (ns>0) break;
|
if (ns>0) break;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
ns = pSMgr->suggest_auto(slst, wspace, ns);
|
ns = pSMgr->suggest_auto(slst, wspace, ns);
|
||||||
@ -861,10 +861,10 @@ int Hunspell::suggest_auto(char*** slst, const char * word)
|
|||||||
mkinitcap((*slst)[j]);
|
mkinitcap((*slst)[j]);
|
||||||
ns = pSMgr->suggest_auto(slst, cw, ns);
|
ns = pSMgr->suggest_auto(slst, cw, ns);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case HUHCAP: {
|
case HUHCAP: {
|
||||||
ns = pSMgr->suggest_auto(slst, cw, ns);
|
ns = pSMgr->suggest_auto(slst, cw, ns);
|
||||||
if (ns == 0) {
|
if (ns == 0) {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
@ -874,7 +874,7 @@ int Hunspell::suggest_auto(char*** slst, const char * word)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ALLCAP: {
|
case ALLCAP: {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
ns = pSMgr->suggest_auto(slst, wspace, ns);
|
ns = pSMgr->suggest_auto(slst, wspace, ns);
|
||||||
@ -929,14 +929,14 @@ int Hunspell::stem(char*** slst, const char * word)
|
|||||||
int abbv = 0;
|
int abbv = 0;
|
||||||
wl = cleanword(cw, word, &captype, &abbv);
|
wl = cleanword(cw, word, &captype, &abbv);
|
||||||
if (wl == 0) return 0;
|
if (wl == 0) return 0;
|
||||||
|
|
||||||
int ns = 0;
|
int ns = 0;
|
||||||
|
|
||||||
*slst = NULL; // HU, nsug in pSMgr->suggest
|
*slst = NULL; // HU, nsug in pSMgr->suggest
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case HUHCAP:
|
case HUHCAP:
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
ns = pSMgr->suggest_stems(slst, cw, ns);
|
ns = pSMgr->suggest_stems(slst, cw, ns);
|
||||||
|
|
||||||
if ((abbv) && (ns == 0)) {
|
if ((abbv) && (ns == 0)) {
|
||||||
@ -949,7 +949,7 @@ int Hunspell::stem(char*** slst, const char * word)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
|
|
||||||
ns = pSMgr->suggest_stems(slst, cw, ns);
|
ns = pSMgr->suggest_stems(slst, cw, ns);
|
||||||
|
|
||||||
@ -967,15 +967,15 @@ int Hunspell::stem(char*** slst, const char * word)
|
|||||||
*(wspace+wl+1) = '\0';
|
*(wspace+wl+1) = '\0';
|
||||||
ns = pSMgr->suggest_stems(slst, wspace, ns);
|
ns = pSMgr->suggest_stems(slst, wspace, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ALLCAP: {
|
case ALLCAP: {
|
||||||
ns = pSMgr->suggest_stems(slst, cw, ns);
|
ns = pSMgr->suggest_stems(slst, cw, ns);
|
||||||
if (ns != 0) break;
|
if (ns != 0) break;
|
||||||
|
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
ns = pSMgr->suggest_stems(slst, wspace, ns);
|
ns = pSMgr->suggest_stems(slst, wspace, ns);
|
||||||
@ -997,7 +997,7 @@ int Hunspell::stem(char*** slst, const char * word)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1016,14 +1016,14 @@ int Hunspell::suggest_pos_stems(char*** slst, const char * word)
|
|||||||
int abbv = 0;
|
int abbv = 0;
|
||||||
wl = cleanword(cw, word, &captype, &abbv);
|
wl = cleanword(cw, word, &captype, &abbv);
|
||||||
if (wl == 0) return 0;
|
if (wl == 0) return 0;
|
||||||
|
|
||||||
int ns = 0; // ns=0 = normalized input
|
int ns = 0; // ns=0 = normalized input
|
||||||
|
|
||||||
*slst = NULL; // HU, nsug in pSMgr->suggest
|
*slst = NULL; // HU, nsug in pSMgr->suggest
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case HUHCAP:
|
case HUHCAP:
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
ns = pSMgr->suggest_pos_stems(slst, cw, ns);
|
ns = pSMgr->suggest_pos_stems(slst, cw, ns);
|
||||||
|
|
||||||
if ((abbv) && (ns == 0)) {
|
if ((abbv) && (ns == 0)) {
|
||||||
@ -1036,7 +1036,7 @@ int Hunspell::suggest_pos_stems(char*** slst, const char * word)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
|
|
||||||
ns = pSMgr->suggest_pos_stems(slst, cw, ns);
|
ns = pSMgr->suggest_pos_stems(slst, cw, ns);
|
||||||
|
|
||||||
@ -1045,15 +1045,15 @@ int Hunspell::suggest_pos_stems(char*** slst, const char * word)
|
|||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
ns = pSMgr->suggest_pos_stems(slst, wspace, ns);
|
ns = pSMgr->suggest_pos_stems(slst, wspace, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case ALLCAP: {
|
case ALLCAP: {
|
||||||
ns = pSMgr->suggest_pos_stems(slst, cw, ns);
|
ns = pSMgr->suggest_pos_stems(slst, cw, ns);
|
||||||
if (ns != 0) break;
|
if (ns != 0) break;
|
||||||
|
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
ns = pSMgr->suggest_pos_stems(slst, wspace, ns);
|
ns = pSMgr->suggest_pos_stems(slst, wspace, ns);
|
||||||
@ -1206,7 +1206,7 @@ char * Hunspell::morph(const char * word)
|
|||||||
|
|
||||||
char result[MAXLNLEN];
|
char result[MAXLNLEN];
|
||||||
char * st = NULL;
|
char * st = NULL;
|
||||||
|
|
||||||
*result = '\0';
|
*result = '\0';
|
||||||
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -1216,11 +1216,11 @@ char * Hunspell::morph(const char * word)
|
|||||||
// test numbers
|
// test numbers
|
||||||
// LANG_hu section: set dash information for suggestions
|
// LANG_hu section: set dash information for suggestions
|
||||||
if (langnum == LANG_hu) {
|
if (langnum == LANG_hu) {
|
||||||
while ((n < wl) &&
|
while ((n < wl) &&
|
||||||
(((cw[n] <= '9') && (cw[n] >= '0')) || (((cw[n] == '.') || (cw[n] == ',')) && (n > 0)))) {
|
(((cw[n] <= '9') && (cw[n] >= '0')) || (((cw[n] == '.') || (cw[n] == ',')) && (n > 0)))) {
|
||||||
n++;
|
n++;
|
||||||
if ((cw[n] == '.') || (cw[n] == ',')) {
|
if ((cw[n] == '.') || (cw[n] == ',')) {
|
||||||
if (((n2 == 0) && (n > 3)) ||
|
if (((n2 == 0) && (n > 3)) ||
|
||||||
((n2 > 0) && ((cw[n-1] == '.') || (cw[n-1] == ',')))) break;
|
((n2 > 0) && ((cw[n-1] == '.') || (cw[n-1] == ',')))) break;
|
||||||
n2++;
|
n2++;
|
||||||
n3 = n;
|
n3 = n;
|
||||||
@ -1257,9 +1257,9 @@ char * Hunspell::morph(const char * word)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// END OF LANG_hu section
|
// END OF LANG_hu section
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
st = pSMgr->suggest_morph(cw);
|
st = pSMgr->suggest_morph(cw);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
@ -1278,14 +1278,14 @@ char * Hunspell::morph(const char * word)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
st = pSMgr->suggest_morph(wspace);
|
st = pSMgr->suggest_morph(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
st = pSMgr->suggest_morph(cw);
|
st = pSMgr->suggest_morph(cw);
|
||||||
if (st) {
|
if (st) {
|
||||||
if (*result) strcat(result, "\n");
|
if (*result) strcat(result, "\n");
|
||||||
@ -1313,7 +1313,7 @@ char * Hunspell::morph(const char * word)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HUHCAP: {
|
case HUHCAP: {
|
||||||
st = pSMgr->suggest_morph(cw);
|
st = pSMgr->suggest_morph(cw);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
@ -1331,13 +1331,13 @@ char * Hunspell::morph(const char * word)
|
|||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ALLCAP: {
|
case ALLCAP: {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
st = pSMgr->suggest_morph(wspace);
|
st = pSMgr->suggest_morph(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
st = pSMgr->suggest_morph(wspace);
|
st = pSMgr->suggest_morph(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
@ -1361,7 +1361,7 @@ char * Hunspell::morph(const char * word)
|
|||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
st = pSMgr->suggest_morph(wspace);
|
st = pSMgr->suggest_morph(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
@ -1394,7 +1394,7 @@ char * Hunspell::morph(const char * word)
|
|||||||
int nresult = 0;
|
int nresult = 0;
|
||||||
// LANG_hu section: set dash information for suggestions
|
// LANG_hu section: set dash information for suggestions
|
||||||
if ((langnum == LANG_hu) && (dash=(char *) strchr(cw,'-'))) {
|
if ((langnum == LANG_hu) && (dash=(char *) strchr(cw,'-'))) {
|
||||||
*dash='\0';
|
*dash='\0';
|
||||||
// examine 2 sides of the dash
|
// examine 2 sides of the dash
|
||||||
if (dash[1] == '\0') { // base word ending with dash
|
if (dash[1] == '\0') { // base word ending with dash
|
||||||
if (spell(cw)) return pSMgr->suggest_morph(cw);
|
if (spell(cw)) return pSMgr->suggest_morph(cw);
|
||||||
@ -1438,7 +1438,7 @@ char * Hunspell::morph(const char * word)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// affixed number in correct word
|
// affixed number in correct word
|
||||||
if (nresult && (dash > cw) && (((*(dash-1)<='9') &&
|
if (nresult && (dash > cw) && (((*(dash-1)<='9') &&
|
||||||
(*(dash-1)>='0')) || (*(dash-1)=='.'))) {
|
(*(dash-1)>='0')) || (*(dash-1)=='.'))) {
|
||||||
*dash='-';
|
*dash='-';
|
||||||
n = 1;
|
n = 1;
|
||||||
@ -1487,12 +1487,12 @@ char * Hunspell::morph_with_correction(const char * word)
|
|||||||
|
|
||||||
char result[MAXLNLEN];
|
char result[MAXLNLEN];
|
||||||
char * st = NULL;
|
char * st = NULL;
|
||||||
|
|
||||||
*result = '\0';
|
*result = '\0';
|
||||||
|
|
||||||
|
|
||||||
switch(captype) {
|
switch(captype) {
|
||||||
case NOCAP: {
|
case NOCAP: {
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(cw);
|
st = pSMgr->suggest_morph_for_spelling_error(cw);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
@ -1511,14 +1511,14 @@ char * Hunspell::morph_with_correction(const char * word)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case INITCAP: {
|
case INITCAP: {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(cw);
|
st = pSMgr->suggest_morph_for_spelling_error(cw);
|
||||||
if (st) {
|
if (st) {
|
||||||
if (*result) strcat(result, "\n");
|
if (*result) strcat(result, "\n");
|
||||||
@ -1546,7 +1546,7 @@ char * Hunspell::morph_with_correction(const char * word)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HUHCAP: {
|
case HUHCAP: {
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(cw);
|
st = pSMgr->suggest_morph_for_spelling_error(cw);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
@ -1559,16 +1559,16 @@ char * Hunspell::morph_with_correction(const char * word)
|
|||||||
if (*result) strcat(result, "\n");
|
if (*result) strcat(result, "\n");
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ALLCAP: {
|
case ALLCAP: {
|
||||||
memcpy(wspace,cw,(wl+1));
|
memcpy(wspace,cw,(wl+1));
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
@ -1592,7 +1592,7 @@ char * Hunspell::morph_with_correction(const char * word)
|
|||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
free(st);
|
free(st);
|
||||||
}
|
}
|
||||||
mkallsmall(wspace);
|
mkallsmall(wspace);
|
||||||
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
st = pSMgr->suggest_morph_for_spelling_error(wspace);
|
||||||
if (st) {
|
if (st) {
|
||||||
@ -1617,7 +1617,7 @@ char * Hunspell::morph_with_correction(const char * word)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* analyze word
|
/* analyze word
|
||||||
* return line count
|
* return line count
|
||||||
* XXX need a better data structure for morphological analysis */
|
* XXX need a better data structure for morphological analysis */
|
||||||
int Hunspell::analyze(char ***out, const char *word) {
|
int Hunspell::analyze(char ***out, const char *word) {
|
||||||
int n = 0;
|
int n = 0;
|
||||||
@ -1635,7 +1635,7 @@ int Hunspell::analyze(char ***out, const char *word) {
|
|||||||
strncpy((*out)[n++], m + p, i - p + 1);
|
strncpy((*out)[n++], m + p, i - p + 1);
|
||||||
if (m[i] == '\n') (*out)[n++][i - p] = '\0';
|
if (m[i] == '\n') (*out)[n++][i - p] = '\0';
|
||||||
if(!m[i+1]) break;
|
if(!m[i+1]) break;
|
||||||
p = i + 1;
|
p = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(m);
|
free(m);
|
||||||
|
@ -13,11 +13,11 @@ using namespace std;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
@ -44,9 +44,9 @@ SuggestMgr::SuggestMgr(const char * tryme, int maxn,
|
|||||||
complexprefixes = pAMgr->get_complexprefixes();
|
complexprefixes = pAMgr->get_complexprefixes();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tryme) {
|
if (tryme) {
|
||||||
if (utf8) {
|
if (utf8) {
|
||||||
w_char t[MAXSWL];
|
w_char t[MAXSWL];
|
||||||
ctryl = u8_u16(t, MAXSWL, tryme);
|
ctryl = u8_u16(t, MAXSWL, tryme);
|
||||||
ctry_utf = (w_char *) malloc(ctryl * sizeof(w_char));
|
ctry_utf = (w_char *) malloc(ctryl * sizeof(w_char));
|
||||||
memcpy(ctry_utf, t, ctryl * sizeof(w_char));
|
memcpy(ctry_utf, t, ctryl * sizeof(w_char));
|
||||||
@ -77,9 +77,9 @@ SuggestMgr::~SuggestMgr()
|
|||||||
int SuggestMgr::suggest(char*** slst, const char * w, int nsug)
|
int SuggestMgr::suggest(char*** slst, const char * w, int nsug)
|
||||||
{
|
{
|
||||||
int nocompoundtwowords = 0;
|
int nocompoundtwowords = 0;
|
||||||
char ** wlst;
|
char ** wlst;
|
||||||
w_char word_utf[MAXSWL];
|
w_char word_utf[MAXSWL];
|
||||||
int wl;
|
int wl=0;
|
||||||
|
|
||||||
char w2[MAXWORDUTF8LEN];
|
char w2[MAXWORDUTF8LEN];
|
||||||
const char * word = w;
|
const char * word = w;
|
||||||
@ -90,7 +90,7 @@ int SuggestMgr::suggest(char*** slst, const char * w, int nsug)
|
|||||||
if (utf8) reverseword_utf(w2); else reverseword(w2);
|
if (utf8) reverseword_utf(w2); else reverseword(w2);
|
||||||
word = w2;
|
word = w2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*slst) {
|
if (*slst) {
|
||||||
wlst = *slst;
|
wlst = *slst;
|
||||||
} else {
|
} else {
|
||||||
@ -98,7 +98,7 @@ int SuggestMgr::suggest(char*** slst, const char * w, int nsug)
|
|||||||
if (wlst == NULL) return -1;
|
if (wlst == NULL) return -1;
|
||||||
for (int i = 0; i < maxSug; i++) wlst[i] = NULL;
|
for (int i = 0; i < maxSug; i++) wlst[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utf8) {
|
if (utf8) {
|
||||||
wl = u8_u16(word_utf, MAXSWL, word);
|
wl = u8_u16(word_utf, MAXSWL, word);
|
||||||
}
|
}
|
||||||
@ -201,7 +201,7 @@ int SuggestMgr::suggest_auto(char*** slst, const char * w, int nsug)
|
|||||||
if ((nsug < maxSug) && (nsug > -1) && check_forbidden(word, strlen(word))) {
|
if ((nsug < maxSug) && (nsug > -1) && check_forbidden(word, strlen(word))) {
|
||||||
nsug = twowords(wlst, word, nsug, cpdsuggest);
|
nsug = twowords(wlst, word, nsug, cpdsuggest);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // repeating ``for'' statement compounding support
|
} // repeating ``for'' statement compounding support
|
||||||
|
|
||||||
if (nsug < 0) {
|
if (nsug < 0) {
|
||||||
@ -221,7 +221,7 @@ int SuggestMgr::mapchars(char** wlst, const char * word, int ns, int cpdsuggest)
|
|||||||
{
|
{
|
||||||
time_t timelimit;
|
time_t timelimit;
|
||||||
int timer;
|
int timer;
|
||||||
|
|
||||||
int wl = strlen(word);
|
int wl = strlen(word);
|
||||||
if (wl < 2 || ! pAMgr) return ns;
|
if (wl < 2 || ! pAMgr) return ns;
|
||||||
|
|
||||||
@ -242,13 +242,13 @@ int SuggestMgr::mapchars(char** wlst, const char * word, int ns, int cpdsuggest)
|
|||||||
int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns,
|
int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns,
|
||||||
const mapentry* maptable, int nummap, int * timer, time_t * timelimit)
|
const mapentry* maptable, int nummap, int * timer, time_t * timelimit)
|
||||||
{
|
{
|
||||||
char c = *(word + i);
|
char c = *(word + i);
|
||||||
if (c == 0) {
|
if (c == 0) {
|
||||||
int cwrd = 1;
|
int cwrd = 1;
|
||||||
int wl;
|
int wl;
|
||||||
for (int m=0; m < ns; m++)
|
for (int m=0; m < ns; m++)
|
||||||
if (strcmp(word,wlst[m]) == 0) cwrd = 0;
|
if (strcmp(word,wlst[m]) == 0) cwrd = 0;
|
||||||
if ((cwrd) && (wl = strlen(word)) && (check(word, wl, 0, timer, timelimit) ||
|
if ((cwrd) && (wl = strlen(word)) && (check(word, wl, 0, timer, timelimit) ||
|
||||||
check(word, wl, 1, timer, timelimit))) {
|
check(word, wl, 1, timer, timelimit))) {
|
||||||
if (ns < maxSug) {
|
if (ns < maxSug) {
|
||||||
wlst[ns] = mystrdup(word);
|
wlst[ns] = mystrdup(word);
|
||||||
@ -257,7 +257,7 @@ int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
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) {
|
||||||
@ -279,7 +279,7 @@ int SuggestMgr::map_related(const char * word, int i, char** wlst, int ns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int SuggestMgr::map_related_utf(w_char * word, int len, int i, char** wlst, int ns,
|
int SuggestMgr::map_related_utf(w_char * word, int len, int i, char** wlst, int ns,
|
||||||
const mapentry* maptable, int nummap, int * timer, time_t * timelimit)
|
const mapentry* maptable, int nummap, int * timer, time_t * timelimit)
|
||||||
{
|
{
|
||||||
if (i == len) {
|
if (i == len) {
|
||||||
int cwrd = 1;
|
int cwrd = 1;
|
||||||
@ -288,7 +288,7 @@ int SuggestMgr::map_related_utf(w_char * word, int len, int i, char** wlst, int
|
|||||||
u16_u8(s, MAXSWUTF8L, word, len);
|
u16_u8(s, MAXSWUTF8L, word, len);
|
||||||
for (int m=0; m < ns; m++)
|
for (int m=0; m < ns; m++)
|
||||||
if (strcmp(s,wlst[m]) == 0) cwrd = 0;
|
if (strcmp(s,wlst[m]) == 0) cwrd = 0;
|
||||||
if ((cwrd) && (wl = strlen(s)) && (check(s, wl, 0, timer, timelimit) ||
|
if ((cwrd) && (wl = strlen(s)) && (check(s, wl, 0, timer, timelimit) ||
|
||||||
check(s, wl, 1, timer, timelimit))) {
|
check(s, wl, 1, timer, timelimit))) {
|
||||||
if (ns < maxSug) {
|
if (ns < maxSug) {
|
||||||
wlst[ns] = mystrdup(s);
|
wlst[ns] = mystrdup(s);
|
||||||
@ -297,7 +297,7 @@ int SuggestMgr::map_related_utf(w_char * word, int len, int i, char** wlst, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ns;
|
return ns;
|
||||||
}
|
}
|
||||||
int in_map = 0;
|
int in_map = 0;
|
||||||
unsigned short c = *((unsigned short *) word + i);
|
unsigned short c = *((unsigned short *) word + i);
|
||||||
for (int j = 0; j < nummap; j++) {
|
for (int j = 0; j < nummap; j++) {
|
||||||
@ -449,7 +449,7 @@ int SuggestMgr::badchar_utf(char ** wlst, const w_char * word, int wl, int ns, i
|
|||||||
int cwrd;
|
int cwrd;
|
||||||
time_t timelimit = time(NULL);
|
time_t timelimit = time(NULL);
|
||||||
int timer = MINTIMER;
|
int timer = MINTIMER;
|
||||||
|
|
||||||
memcpy(candidate_utf, word, wl * sizeof(w_char));
|
memcpy(candidate_utf, word, wl * sizeof(w_char));
|
||||||
|
|
||||||
// swap out each char one by one and try all the tryme
|
// swap out each char one by one and try all the tryme
|
||||||
@ -477,7 +477,7 @@ int SuggestMgr::badchar_utf(char ** wlst, const w_char * word, int wl, int ns, i
|
|||||||
return ns;
|
return 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_utf(char** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
|
int SuggestMgr::extrachar_utf(char** wlst, const w_char * word, int wl, int ns, int cpdsuggest)
|
||||||
{
|
{
|
||||||
char candidate[MAXSWUTF8L];
|
char candidate[MAXSWUTF8L];
|
||||||
@ -493,7 +493,7 @@ int SuggestMgr::extrachar_utf(char** wlst, const w_char * word, int wl, int ns,
|
|||||||
memcpy(candidate_utf, word + 1, (wl - 1) * sizeof(w_char));
|
memcpy(candidate_utf, word + 1, (wl - 1) * sizeof(w_char));
|
||||||
for (p = word, r = candidate_utf; p < word + wl; ) {
|
for (p = word, r = candidate_utf; p < word + wl; ) {
|
||||||
cwrd = 1;
|
cwrd = 1;
|
||||||
u16_u8(candidate, MAXSWUTF8L, candidate_utf, wl - 1);
|
u16_u8(candidate, MAXSWUTF8L, candidate_utf, wl - 1);
|
||||||
for (int k=0; k < ns; k++)
|
for (int k=0; k < ns; k++)
|
||||||
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
if (strcmp(candidate,wlst[k]) == 0) cwrd = 0;
|
||||||
if ((cwrd) && check(candidate, strlen(candidate), cpdsuggest, NULL, NULL)) {
|
if ((cwrd) && check(candidate, strlen(candidate), cpdsuggest, NULL, NULL)) {
|
||||||
@ -501,14 +501,14 @@ int SuggestMgr::extrachar_utf(char** wlst, const w_char * word, int wl, 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++;
|
||||||
}
|
}
|
||||||
return ns;
|
return 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 cpdsuggest)
|
int SuggestMgr::extrachar(char** wlst, const char * word, int ns, int cpdsuggest)
|
||||||
{
|
{
|
||||||
char candidate[MAXSWUTF8L];
|
char candidate[MAXSWUTF8L];
|
||||||
@ -530,7 +530,7 @@ int SuggestMgr::extrachar(char** wlst, const char * word, int ns, int cpdsuggest
|
|||||||
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++;
|
||||||
}
|
}
|
||||||
@ -563,7 +563,7 @@ int SuggestMgr::forgotchar(char ** wlst, const char * word, int ns, int cpdsugge
|
|||||||
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;
|
||||||
}
|
}
|
||||||
if (!timelimit) return ns;
|
if (!timelimit) return ns;
|
||||||
}
|
}
|
||||||
@ -612,7 +612,7 @@ int SuggestMgr::forgotchar_utf(char ** wlst, const w_char * word, int wl, 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;
|
||||||
}
|
}
|
||||||
if (!timelimit) return ns;
|
if (!timelimit) return ns;
|
||||||
}
|
}
|
||||||
@ -648,7 +648,7 @@ int SuggestMgr::twowords(char ** wlst, const char * word, int ns, int cpdsuggest
|
|||||||
|
|
||||||
int wl=strlen(word);
|
int wl=strlen(word);
|
||||||
if (wl < 3) return ns;
|
if (wl < 3) return ns;
|
||||||
|
|
||||||
if (pAMgr->get_langnum() == LANG_hu) forbidden = check_forbidden(word, wl);
|
if (pAMgr->get_langnum() == LANG_hu) forbidden = check_forbidden(word, wl);
|
||||||
|
|
||||||
strcpy(candidate + 1, word);
|
strcpy(candidate + 1, word);
|
||||||
@ -797,13 +797,13 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, HashMgr* pHMgr)
|
|||||||
int col = -1;
|
int col = -1;
|
||||||
while ((hp = pHMgr->walk_hashtable(col, hp))) {
|
while ((hp = pHMgr->walk_hashtable(col, hp))) {
|
||||||
// check forbidden words
|
// check forbidden words
|
||||||
if ((hp->astr) && (pAMgr) &&
|
if ((hp->astr) && (pAMgr) &&
|
||||||
(TESTAFF(hp->astr, pAMgr->get_forbiddenword(), hp->alen) ||
|
(TESTAFF(hp->astr, pAMgr->get_forbiddenword(), hp->alen) ||
|
||||||
TESTAFF(hp->astr, pAMgr->get_nosuggest(), hp->alen) ||
|
TESTAFF(hp->astr, pAMgr->get_nosuggest(), hp->alen) ||
|
||||||
TESTAFF(hp->astr, pAMgr->get_onlyincompound(), hp->alen))) continue;
|
TESTAFF(hp->astr, pAMgr->get_onlyincompound(), hp->alen))) continue;
|
||||||
sc = ngram(3, word, hp->word, NGRAM_LONGER_WORSE);
|
sc = ngram(3, word, hp->word, NGRAM_LONGER_WORSE);
|
||||||
if (sc > scores[lp]) {
|
if (sc > scores[lp]) {
|
||||||
scores[lp] = sc;
|
scores[lp] = sc;
|
||||||
roots[lp] = hp;
|
roots[lp] = hp;
|
||||||
int lval = sc;
|
int lval = sc;
|
||||||
for (j=0; j < MAX_ROOTS; j++)
|
for (j=0; j < MAX_ROOTS; j++)
|
||||||
@ -811,7 +811,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, 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
|
||||||
@ -868,7 +868,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, HashMgr* pHMgr)
|
|||||||
lp = j;
|
lp = j;
|
||||||
lval = gscore[j];
|
lval = gscore[j];
|
||||||
}
|
}
|
||||||
} else free (glst[k].word);
|
} else free (glst[k].word);
|
||||||
} else free(glst[k].word);
|
} else free(glst[k].word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,7 +877,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, HashMgr* pHMgr)
|
|||||||
|
|
||||||
// now we are done generating guesses
|
// now we are done generating guesses
|
||||||
// sort in order of decreasing score
|
// sort in order of decreasing score
|
||||||
|
|
||||||
bubblesort(&guess[0], &gscore[0], MAX_GUESS);
|
bubblesort(&guess[0], &gscore[0], MAX_GUESS);
|
||||||
|
|
||||||
// weight suggestions with a similarity index, based on
|
// weight suggestions with a similarity index, based on
|
||||||
@ -907,7 +907,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, HashMgr* pHMgr)
|
|||||||
gscore[i] += 2000;
|
gscore[i] += 2000;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// heuristic weigthing of ngram scores
|
// heuristic weigthing of ngram scores
|
||||||
gscore[i] +=
|
gscore[i] +=
|
||||||
// length of longest common subsequent minus lenght difference
|
// length of longest common subsequent minus lenght difference
|
||||||
@ -935,7 +935,7 @@ int SuggestMgr::ngsuggest(char** wlst, char * w, HashMgr* pHMgr)
|
|||||||
if (gscore[i] > 1000) same = 1;
|
if (gscore[i] > 1000) same = 1;
|
||||||
for (j=0; j < ns; j++)
|
for (j=0; j < ns; j++)
|
||||||
// don't suggest previous suggestions or a previous suggestion with prefixes or affixes
|
// don't suggest previous suggestions or a previous suggestion with prefixes or affixes
|
||||||
if (strstr(guess[i], wlst[j]) ||
|
if (strstr(guess[i], wlst[j]) ||
|
||||||
// check forbidden words
|
// check forbidden words
|
||||||
!check(guess[i], strlen(guess[i]), 0, NULL, NULL)) unique = 0;
|
!check(guess[i], strlen(guess[i]), 0, NULL, NULL)) unique = 0;
|
||||||
if (unique) wlst[ns++] = guess[i]; else free(guess[i]);
|
if (unique) wlst[ns++] = guess[i]; else free(guess[i]);
|
||||||
@ -957,7 +957,7 @@ int SuggestMgr::check(const char * word, int len, int cpdsuggest, int * timer, t
|
|||||||
{
|
{
|
||||||
struct hentry * rv=NULL;
|
struct hentry * rv=NULL;
|
||||||
int nosuffix = 0;
|
int nosuffix = 0;
|
||||||
|
|
||||||
// check time limit
|
// check time limit
|
||||||
if (timer) {
|
if (timer) {
|
||||||
(*timer)--;
|
(*timer)--;
|
||||||
@ -969,8 +969,8 @@ int SuggestMgr::check(const char * word, int len, int cpdsuggest, int * timer, t
|
|||||||
*timer = MAXPLUSTIMER;
|
*timer = MAXPLUSTIMER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pAMgr) {
|
if (pAMgr) {
|
||||||
if (cpdsuggest==1) {
|
if (cpdsuggest==1) {
|
||||||
if (pAMgr->get_compound()) {
|
if (pAMgr->get_compound()) {
|
||||||
rv = pAMgr->compound_check(word,len,0,0,0,0,NULL,0,NULL,NULL,1);
|
rv = pAMgr->compound_check(word,len,0,0,0,0,NULL,0,NULL,NULL,1);
|
||||||
@ -987,7 +987,7 @@ int SuggestMgr::check(const char * word, int len, int cpdsuggest, int * timer, t
|
|||||||
if (rv->astr && (TESTAFF(rv->astr,pAMgr->get_pseudoroot(),rv->alen) ||
|
if (rv->astr && (TESTAFF(rv->astr,pAMgr->get_pseudoroot(),rv->alen) ||
|
||||||
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) rv = NULL;
|
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) rv = NULL;
|
||||||
} else rv = pAMgr->prefix_check(word, len, 0); // only prefix, and prefix + suffix XXX
|
} else rv = pAMgr->prefix_check(word, len, 0); // only prefix, and prefix + suffix XXX
|
||||||
|
|
||||||
if (rv) {
|
if (rv) {
|
||||||
nosuffix=1;
|
nosuffix=1;
|
||||||
} else {
|
} else {
|
||||||
@ -1004,9 +1004,9 @@ int SuggestMgr::check(const char * word, int len, int cpdsuggest, int * timer, t
|
|||||||
|| TESTAFF(rv->astr,pAMgr->get_nosuggest(),rv->alen) ||
|
|| TESTAFF(rv->astr,pAMgr->get_nosuggest(),rv->alen) ||
|
||||||
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) return 0;
|
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) return 0;
|
||||||
|
|
||||||
if (rv) { // XXX obsolote
|
if (rv) { // XXX obsolote
|
||||||
if ((pAMgr->get_compoundflag()) &&
|
if ((pAMgr->get_compoundflag()) &&
|
||||||
TESTAFF(rv->astr, pAMgr->get_compoundflag(), rv->alen)) return 2 + nosuffix;
|
TESTAFF(rv->astr, pAMgr->get_compoundflag(), rv->alen)) return 2 + nosuffix;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1017,7 +1017,7 @@ int SuggestMgr::check_forbidden(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 && rv->astr && (TESTAFF(rv->astr,pAMgr->get_pseudoroot(),rv->alen) ||
|
if (rv && rv->astr && (TESTAFF(rv->astr,pAMgr->get_pseudoroot(),rv->alen) ||
|
||||||
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) rv = NULL;
|
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) rv = NULL;
|
||||||
@ -1033,7 +1033,7 @@ int SuggestMgr::check_forbidden(const char * word, int len)
|
|||||||
int SuggestMgr::suggest_stems(char*** slst, const char * w, int nsug)
|
int SuggestMgr::suggest_stems(char*** slst, const char * w, int nsug)
|
||||||
{
|
{
|
||||||
char buf[MAXSWUTF8L];
|
char buf[MAXSWUTF8L];
|
||||||
char ** wlst;
|
char ** wlst;
|
||||||
int prevnsug = nsug;
|
int prevnsug = nsug;
|
||||||
|
|
||||||
char w2[MAXWORDUTF8LEN];
|
char w2[MAXWORDUTF8LEN];
|
||||||
@ -1054,7 +1054,7 @@ int SuggestMgr::suggest_stems(char*** slst, const char * w, int nsug)
|
|||||||
}
|
}
|
||||||
// perhaps there are a fix stem in the dictionary
|
// perhaps there are a fix stem in the dictionary
|
||||||
if ((nsug < maxSug) && (nsug > -1)) {
|
if ((nsug < maxSug) && (nsug > -1)) {
|
||||||
|
|
||||||
nsug = fixstems(wlst, word, nsug);
|
nsug = fixstems(wlst, word, nsug);
|
||||||
if (nsug == prevnsug) {
|
if (nsug == prevnsug) {
|
||||||
char * s = mystrdup(word);
|
char * s = mystrdup(word);
|
||||||
@ -1080,7 +1080,7 @@ int SuggestMgr::suggest_stems(char*** slst, const char * w, int nsug)
|
|||||||
free(s);
|
free(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsug < 0) {
|
if (nsug < 0) {
|
||||||
for (int i=0;i<maxSug; i++)
|
for (int i=0;i<maxSug; i++)
|
||||||
if (wlst[i] != NULL) free(wlst[i]);
|
if (wlst[i] != NULL) free(wlst[i]);
|
||||||
@ -1110,12 +1110,12 @@ int SuggestMgr::fixstems(char ** wlst, const char * word, int ns)
|
|||||||
int cmpdstemnum;
|
int cmpdstemnum;
|
||||||
int cmpdstem[MAXCOMPOUND];
|
int cmpdstem[MAXCOMPOUND];
|
||||||
|
|
||||||
if (pAMgr) {
|
if (pAMgr) {
|
||||||
rv = pAMgr->lookup(word);
|
rv = pAMgr->lookup(word);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
dicstem = 0;
|
dicstem = 0;
|
||||||
} else {
|
} else {
|
||||||
// try stripping off affixes
|
// try stripping off affixes
|
||||||
rv = pAMgr->affix_check(word, wl);
|
rv = pAMgr->affix_check(word, wl);
|
||||||
|
|
||||||
// else try check compound word
|
// else try check compound word
|
||||||
@ -1139,7 +1139,7 @@ int SuggestMgr::fixstems(char ** wlst, const char * word, int ns)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// XXX obsolote, will be a general solution for stemming
|
// XXX obsolote, will be a general solution for stemming
|
||||||
if ((prefix) && (strncmp(prefix, "leg", 3)==0)) prefix[0] = '\0'; // (HU)
|
if ((prefix) && (strncmp(prefix, "leg", 3)==0)) prefix[0] = '\0'; // (HU)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1147,10 +1147,10 @@ int SuggestMgr::fixstems(char ** wlst, const char * word, int ns)
|
|||||||
|
|
||||||
|
|
||||||
if ((rv) && (ns < maxSug)) {
|
if ((rv) && (ns < maxSug)) {
|
||||||
|
|
||||||
// check fixstem flag and not_valid_stem flag
|
// check fixstem flag and not_valid_stem flag
|
||||||
// first word
|
// first word
|
||||||
if ((ns < maxSug) && (dicstem < 2)) {
|
if ((ns < maxSug) && (dicstem < 2)) {
|
||||||
strcpy(buf, prefix);
|
strcpy(buf, prefix);
|
||||||
if ((dicstem > 0) && pAMgr->get_derived()) {
|
if ((dicstem > 0) && pAMgr->get_derived()) {
|
||||||
// XXX obsolote
|
// XXX obsolote
|
||||||
@ -1162,7 +1162,7 @@ int SuggestMgr::fixstems(char ** wlst, const char * word, int ns)
|
|||||||
} else {
|
} else {
|
||||||
// special stem in affix description
|
// special stem in affix description
|
||||||
const char * wordchars = pAMgr->get_wordchars();
|
const char * wordchars = pAMgr->get_wordchars();
|
||||||
if (rv->description &&
|
if (rv->description &&
|
||||||
(strchr(wordchars, *(rv->description)))) {
|
(strchr(wordchars, *(rv->description)))) {
|
||||||
char * desc = (rv->description) + 1;
|
char * desc = (rv->description) + 1;
|
||||||
while (strchr(wordchars, *desc)) desc++;
|
while (strchr(wordchars, *desc)) desc++;
|
||||||
@ -1190,7 +1190,7 @@ int SuggestMgr::fixstems(char ** wlst, const char * word, int ns)
|
|||||||
} else {
|
} else {
|
||||||
// special stem in affix description
|
// special stem in affix description
|
||||||
const char * wordchars = pAMgr->get_wordchars();
|
const char * wordchars = pAMgr->get_wordchars();
|
||||||
if (rv->description &&
|
if (rv->description &&
|
||||||
(strchr(wordchars, *(rv->description)))) {
|
(strchr(wordchars, *(rv->description)))) {
|
||||||
char * desc = (rv->description) + 1;
|
char * desc = (rv->description) + 1;
|
||||||
while (strchr(wordchars, *desc)) desc++;
|
while (strchr(wordchars, *desc)) desc++;
|
||||||
@ -1243,19 +1243,19 @@ while (rv) {
|
|||||||
|
|
||||||
rv = rv2;
|
rv = rv2;
|
||||||
|
|
||||||
} else return ns;
|
} else return ns;
|
||||||
} else {
|
} else {
|
||||||
strcpy(fix, "__");
|
strcpy(fix, "__");
|
||||||
strcat(fix, rv->word);
|
strcat(fix, rv->word);
|
||||||
rv = NULL;
|
rv = NULL;
|
||||||
rv2 = pAMgr->lookup(fix);
|
rv2 = pAMgr->lookup(fix);
|
||||||
if ((rv2) && (rv2->astr) && (ns < maxSug))
|
if ((rv2) && (rv2->astr) && (ns < maxSug))
|
||||||
if ((rv2) && (rv2->astr) && (ns < maxSug))
|
if ((rv2) && (rv2->astr) && (ns < maxSug))
|
||||||
if (0) {
|
if (0) {
|
||||||
char buf2[MAXSWUTF8L];
|
char buf2[MAXSWUTF8L];
|
||||||
|
|
||||||
strcpy(buf2, prefix);
|
strcpy(buf2, prefix);
|
||||||
|
|
||||||
if (*(rv2->astr) == '-') {
|
if (*(rv2->astr) == '-') {
|
||||||
strcat(buf2, "");
|
strcat(buf2, "");
|
||||||
} else {
|
} else {
|
||||||
@ -1325,7 +1325,7 @@ return ns;
|
|||||||
// suggest possible stems
|
// suggest possible stems
|
||||||
int SuggestMgr::suggest_pos_stems(char*** slst, const char * w, int nsug)
|
int SuggestMgr::suggest_pos_stems(char*** slst, const char * w, int nsug)
|
||||||
{
|
{
|
||||||
char ** wlst;
|
char ** wlst;
|
||||||
|
|
||||||
struct hentry * rv = NULL;
|
struct hentry * rv = NULL;
|
||||||
|
|
||||||
@ -1386,12 +1386,12 @@ char * SuggestMgr::suggest_morph(const char * w)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rv = pAMgr->lookup(word);
|
rv = pAMgr->lookup(word);
|
||||||
|
|
||||||
while (rv) {
|
while (rv) {
|
||||||
if ((!rv->astr) || !(TESTAFF(rv->astr, pAMgr->get_forbiddenword(), rv->alen) ||
|
if ((!rv->astr) || !(TESTAFF(rv->astr, pAMgr->get_forbiddenword(), rv->alen) ||
|
||||||
TESTAFF(rv->astr, pAMgr->get_pseudoroot(), rv->alen) ||
|
TESTAFF(rv->astr, pAMgr->get_pseudoroot(), rv->alen) ||
|
||||||
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) {
|
TESTAFF(rv->astr,pAMgr->get_onlyincompound(),rv->alen))) {
|
||||||
if (rv->description && ((!rv->astr) ||
|
if (rv->description && ((!rv->astr) ||
|
||||||
!TESTAFF(rv->astr, pAMgr->get_lemma_present(), rv->alen)))
|
!TESTAFF(rv->astr, pAMgr->get_lemma_present(), rv->alen)))
|
||||||
strcat(result, word);
|
strcat(result, word);
|
||||||
if (rv->description) strcat(result, rv->description);
|
if (rv->description) strcat(result, rv->description);
|
||||||
@ -1399,7 +1399,7 @@ char * SuggestMgr::suggest_morph(const char * w)
|
|||||||
}
|
}
|
||||||
rv = rv->next_homonym;
|
rv = rv->next_homonym;
|
||||||
}
|
}
|
||||||
|
|
||||||
st = pAMgr->affix_check_morph(word,strlen(word));
|
st = pAMgr->affix_check_morph(word,strlen(word));
|
||||||
if (st) {
|
if (st) {
|
||||||
strcat(result, st);
|
strcat(result, st);
|
||||||
@ -1409,7 +1409,7 @@ char * SuggestMgr::suggest_morph(const char * w)
|
|||||||
if (pAMgr->get_compound() && (*result == '\0'))
|
if (pAMgr->get_compound() && (*result == '\0'))
|
||||||
pAMgr->compound_check_morph(word, strlen(word),
|
pAMgr->compound_check_morph(word, strlen(word),
|
||||||
0, 0, 100, 0,NULL, 0, &r, NULL);
|
0, 0, 100, 0,NULL, 0, &r, NULL);
|
||||||
|
|
||||||
return (*result) ? mystrdup(line_uniq(delete_zeros(result))) : NULL;
|
return (*result) ? mystrdup(line_uniq(delete_zeros(result))) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,7 +1425,7 @@ char * SuggestMgr::suggest_morph_for_spelling_error(const char * word)
|
|||||||
free(wlst[maxSug - 1]);
|
free(wlst[maxSug - 1]);
|
||||||
}
|
}
|
||||||
if (wlst) free(wlst);
|
if (wlst) free(wlst);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1468,7 +1468,7 @@ int SuggestMgr::ngram(int n, char * s1, const char * s2, int uselen)
|
|||||||
nscore = nscore + ns;
|
nscore = nscore + ns;
|
||||||
if (ns < 2) break;
|
if (ns < 2) break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char t[MAXSWUTF8L];
|
char t[MAXSWUTF8L];
|
||||||
l1 = strlen(s1);
|
l1 = strlen(s1);
|
||||||
l2 = strlen(s2);
|
l2 = strlen(s2);
|
||||||
|
@ -72,6 +72,9 @@
|
|||||||
#define SMB_VERSION 0x0121 /* SMB format version */
|
#define SMB_VERSION 0x0121 /* SMB format version */
|
||||||
/* High byte major, low byte minor */
|
/* High byte major, low byte minor */
|
||||||
|
|
||||||
|
#define U_MODE 777 /* permitions for the new files (real: U_MODE XOR UMASK) */
|
||||||
|
/* This is required for sopen(,,,) */
|
||||||
|
|
||||||
#ifndef __gtimall_h
|
#ifndef __gtimall_h
|
||||||
time32_t gtime(time32_t *timep)
|
time32_t gtime(time32_t *timep)
|
||||||
{
|
{
|
||||||
@ -109,7 +112,7 @@ int SMBCALL smb_open(smb_t* smb)
|
|||||||
smb->shd_fp=smb->sdt_fp=smb->sid_fp=NULL;
|
smb->shd_fp=smb->sdt_fp=smb->sid_fp=NULL;
|
||||||
smb->last_error[0]=0;
|
smb->last_error[0]=0;
|
||||||
sprintf(str,"%s.shd",smb->file);
|
sprintf(str,"%s.shd",smb->file);
|
||||||
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO))==-1) {
|
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO,U_MODE))==-1) {
|
||||||
sprintf(smb->last_error,"%d opening %s",errno,str);
|
sprintf(smb->last_error,"%d opening %s",errno,str);
|
||||||
return(2);
|
return(2);
|
||||||
}
|
}
|
||||||
@ -156,7 +159,7 @@ int SMBCALL smb_open(smb_t* smb)
|
|||||||
setvbuf(smb->shd_fp,smb->shd_buf,_IOFBF,SHD_BLOCK_LEN);
|
setvbuf(smb->shd_fp,smb->shd_buf,_IOFBF,SHD_BLOCK_LEN);
|
||||||
|
|
||||||
sprintf(str,"%s.sdt",smb->file);
|
sprintf(str,"%s.sdt",smb->file);
|
||||||
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO))==-1) {
|
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO,U_MODE))==-1) {
|
||||||
sprintf(smb->last_error,"%d opening %s",errno,str);
|
sprintf(smb->last_error,"%d opening %s",errno,str);
|
||||||
smb_close(smb);
|
smb_close(smb);
|
||||||
return(1);
|
return(1);
|
||||||
@ -172,7 +175,7 @@ int SMBCALL smb_open(smb_t* smb)
|
|||||||
setvbuf(smb->sdt_fp,NULL,_IOFBF,2*1024);
|
setvbuf(smb->sdt_fp,NULL,_IOFBF,2*1024);
|
||||||
|
|
||||||
sprintf(str,"%s.sid",smb->file);
|
sprintf(str,"%s.sid",smb->file);
|
||||||
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO))==-1) {
|
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYNO,U_MODE))==-1) {
|
||||||
sprintf(smb->last_error,"%d opening %s",errno,str);
|
sprintf(smb->last_error,"%d opening %s",errno,str);
|
||||||
smb_close(smb);
|
smb_close(smb);
|
||||||
return(3);
|
return(3);
|
||||||
@ -219,7 +222,7 @@ int SMBCALL smb_open_da(smb_t* smb)
|
|||||||
|
|
||||||
sprintf(str,"%s.sda",smb->file);
|
sprintf(str,"%s.sda",smb->file);
|
||||||
while(1) {
|
while(1) {
|
||||||
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW))!=-1)
|
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW,U_MODE))!=-1)
|
||||||
break;
|
break;
|
||||||
if(errno!=EACCES && errno!=EAGAIN) {
|
if(errno!=EACCES && errno!=EAGAIN) {
|
||||||
sprintf(smb->last_error,"%d opening %s",errno,str);
|
sprintf(smb->last_error,"%d opening %s",errno,str);
|
||||||
@ -264,7 +267,7 @@ int SMBCALL smb_open_ha(smb_t* smb)
|
|||||||
|
|
||||||
sprintf(str,"%s.sha",smb->file);
|
sprintf(str,"%s.sha",smb->file);
|
||||||
while(1) {
|
while(1) {
|
||||||
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW))!=-1)
|
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW,U_MODE))!=-1)
|
||||||
break;
|
break;
|
||||||
if(errno!=EACCES && errno!=EAGAIN) {
|
if(errno!=EACCES && errno!=EAGAIN) {
|
||||||
sprintf(smb->last_error,"%d opening %s",errno,str);
|
sprintf(smb->last_error,"%d opening %s",errno,str);
|
||||||
@ -1010,7 +1013,7 @@ int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc)
|
|||||||
|
|
||||||
sprintf(str,"%s.sch",smb->file);
|
sprintf(str,"%s.sch",smb->file);
|
||||||
while(1) {
|
while(1) {
|
||||||
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW))!=-1)
|
if((file=sopen(str,O_RDWR|O_CREAT|O_BINARY,SH_DENYRW,U_MODE))!=-1)
|
||||||
break;
|
break;
|
||||||
if(errno!=EACCES && errno!=EAGAIN) {
|
if(errno!=EACCES && errno!=EAGAIN) {
|
||||||
sprintf(smb->last_error,"%d opening %s", errno, str);
|
sprintf(smb->last_error,"%d opening %s", errno, str);
|
||||||
|
Reference in New Issue
Block a user