|
a/src/aspell/rclaspell.cpp |
|
b/src/aspell/rclaspell.cpp |
|
... |
|
... |
19 |
#include "autoconfig.h"
|
19 |
#include "autoconfig.h"
|
20 |
#endif
|
20 |
#endif
|
21 |
|
21 |
|
22 |
#ifdef RCL_USE_ASPELL
|
22 |
#ifdef RCL_USE_ASPELL
|
23 |
|
23 |
|
|
|
24 |
#include <mutex>
|
|
|
25 |
|
24 |
#include <unistd.h>
|
26 |
#include <unistd.h>
|
25 |
#include <dlfcn.h>
|
27 |
#include <dlfcn.h>
|
26 |
#include <stdlib.h>
|
28 |
#include <stdlib.h>
|
27 |
|
29 |
|
28 |
#include ASPELL_INCLUDE
|
30 |
#include ASPELL_INCLUDE
|
|
... |
|
... |
30 |
#include "pathut.h"
|
32 |
#include "pathut.h"
|
31 |
#include "execmd.h"
|
33 |
#include "execmd.h"
|
32 |
#include "rclaspell.h"
|
34 |
#include "rclaspell.h"
|
33 |
#include "log.h"
|
35 |
#include "log.h"
|
34 |
#include "unacpp.h"
|
36 |
#include "unacpp.h"
|
35 |
#include "ptmutex.h"
|
|
|
36 |
|
37 |
|
37 |
using namespace std;
|
38 |
using namespace std;
|
38 |
|
39 |
|
39 |
// Just a place where we keep the Aspell library entry points together
|
40 |
// Just a place where we keep the Aspell library entry points together
|
40 |
class AspellApi {
|
41 |
class AspellApi {
|
|
... |
|
... |
61 |
const char *(*aspell_speller_error_message)(const struct AspellSpeller *);
|
62 |
const char *(*aspell_speller_error_message)(const struct AspellSpeller *);
|
62 |
void (*delete_aspell_speller)(struct AspellSpeller *);
|
63 |
void (*delete_aspell_speller)(struct AspellSpeller *);
|
63 |
|
64 |
|
64 |
};
|
65 |
};
|
65 |
static AspellApi aapi;
|
66 |
static AspellApi aapi;
|
66 |
static PTMutexInit o_aapi_mutex;
|
67 |
static std::mutex o_aapi_mutex;
|
67 |
|
68 |
|
68 |
#define NMTOPTR(NM, TP) \
|
69 |
#define NMTOPTR(NM, TP) \
|
69 |
if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) { \
|
70 |
if ((aapi.NM = TP dlsym(m_data->m_handle, #NM)) == 0) { \
|
70 |
badnames += #NM + string(" "); \
|
71 |
badnames += #NM + string(" "); \
|
71 |
}
|
72 |
}
|
|
... |
|
... |
112 |
deleteZ(m_data);
|
113 |
deleteZ(m_data);
|
113 |
}
|
114 |
}
|
114 |
|
115 |
|
115 |
bool Aspell::init(string &reason)
|
116 |
bool Aspell::init(string &reason)
|
116 |
{
|
117 |
{
|
117 |
PTMutexLocker locker(o_aapi_mutex);
|
118 |
std::unique_lock<std::mutex> locker(o_aapi_mutex);
|
118 |
deleteZ(m_data);
|
119 |
deleteZ(m_data);
|
119 |
|
120 |
|
120 |
// Language: we get this from the configuration, else from the NLS
|
121 |
// Language: we get this from the configuration, else from the NLS
|
121 |
// environment. The aspell language names used for selecting language
|
122 |
// environment. The aspell language names used for selecting language
|
122 |
// definition files (used to create dictionaries) are like en, fr
|
123 |
// definition files (used to create dictionaries) are like en, fr
|