-
Notifications
You must be signed in to change notification settings - Fork 0
/
aspell-1-fixes.patch
670 lines (561 loc) · 17.2 KB
/
aspell-1-fixes.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 21:13:24 +1100
Subject: [PATCH 01/10] add pthreads option
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,9 @@ AC_ARG_ENABLE(wide-curses,
AC_ARG_ENABLE(regex,
[ --disable-regex])
+AC_ARG_ENABLE(pthreads,
+ [ --disable-pthreads])
+
AC_ARG_ENABLE(compile-in-filters,
[ --enable-compile-in-filters])
@@ -254,6 +257,8 @@ AM_LANGINFO_CODESET
# #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+if test "$enable_pthreads" != "no"
+then
AC_SUBST(PTHREAD_LIB)
AC_MSG_CHECKING(if posix mutexes are supported)
@@ -293,6 +298,7 @@ else
AC_MSG_WARN([Unable to find locking mechanism, Aspell will not be thread safe.])
fi
+fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:10:22 +1100
Subject: [PATCH 02/10] use namespace mingw
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0001-use-namespace.mingw.patch?h=mingw-w64-aspell
diff --git a/common/file_util.cpp b/common/file_util.cpp
index 1111111..2222222 100644
--- a/common/file_util.cpp
+++ b/common/file_util.cpp
@@ -30,6 +30,7 @@
# define ACCESS _access
# include <windows.h>
# include <winbase.h>
+# include "asc_ctype.hpp"
#else
@@ -38,6 +39,7 @@
#endif
+using namespace acommon;
namespace acommon {
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:14:27 +1100
Subject: [PATCH 03/10] printf mingw
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0002-printf.mingw.patch?h=mingw-w64-aspell
diff --git a/common/config.cpp b/common/config.cpp
index 1111111..2222222 100644
--- a/common/config.cpp
+++ b/common/config.cpp
@@ -39,6 +39,9 @@
#include "vararray.hpp"
#include "string_list.hpp"
+#define printf printf
+#include "libintl.h"
+#undef printf
#include "gettext.h"
#include "iostream.hpp"
diff --git a/modules/speller/default/language.cpp b/modules/speller/default/language.cpp
index 1111111..2222222 100644
--- a/modules/speller/default/language.cpp
+++ b/modules/speller/default/language.cpp
@@ -24,6 +24,9 @@
# include <langinfo.h>
#endif
+#define printf printf
+#include "libintl.h"
+#undef printf
#include "gettext.h"
namespace aspeller {
diff --git a/prog/aspell.cpp b/prog/aspell.cpp
index 1111111..2222222 100644
--- a/prog/aspell.cpp
+++ b/prog/aspell.cpp
@@ -59,6 +59,9 @@
#include "hash-t.hpp"
#include "hash_fun.hpp"
+#define printf printf
+#include "libintl.h"
+#undef printf
#include "gettext.h"
using namespace acommon;
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:15:48 +1100
Subject: [PATCH 04/10] no-undefined mingw
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0003-no-undefined-on.mingw.patch?h=mingw-w64-aspell
diff --git a/Makefile.am b/Makefile.am
index 1111111..2222222 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -194,7 +194,7 @@ libaspell_la_SOURCES +=\
else # not COMPILE_IN_FILTERS
dynamic_optfiles += ${optfiles}
-filter_ldflags = -module -avoid-version
+filter_ldflags = -module -avoid-version -no-undefined
### Add name of filter library containing your filter. Name always
### must look like lib<filtername>-filter.la see development manual
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:16:41 +1100
Subject: [PATCH 05/10] reloc mingw
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0004-reloc.mingw.patch?h=mingw-w64-aspell
diff --git a/common/config.cpp b/common/config.cpp
index 1111111..2222222 100644
--- a/common/config.cpp
+++ b/common/config.cpp
@@ -22,6 +22,8 @@
# include <langinfo.h>
#endif
+#include "info.hpp"
+#include <windows.h>
#include "cache.hpp"
#include "asc_ctype.hpp"
#include "config.hpp"
@@ -310,6 +312,14 @@ namespace acommon {
const Entry * res = 0;
const Entry * cur = first_;
+#ifdef ENABLE_W32_PREFIX
+ if (key == "prefix")
+ {
+ Entry *e = new Config::Entry();
+ e->value = get_w32_prefix ();
+ return e;
+ }
+#endif
while (cur) {
if (cur->key == key && cur->action != NoOp) res = cur;
cur = cur->next;
diff --git a/common/info.cpp b/common/info.cpp
index 1111111..2222222 100644
--- a/common/info.cpp
+++ b/common/info.cpp
@@ -39,6 +39,19 @@
#include "gettext.h"
+#ifdef ENABLE_W32_PREFIX
+extern "C" {
+static HINSTANCE dll_hinstance;
+
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+{
+ if (fdwReason == DLL_PROCESS_ATTACH)
+ dll_hinstance = hinstDLL;
+ return TRUE;
+}
+}
+#endif
+
namespace acommon {
class Dir {
@@ -778,4 +791,60 @@ namespace acommon {
return data;
}
+#ifdef ENABLE_W32_PREFIX
+
+const char *
+get_w32_prefix ()
+{
+
+ static char *wprefix = NULL;
+
+/*
+ Entry * next;
+ String key;
+ String value;
+ String file;
+*/
+ if (wprefix == NULL)
+ {
+ DWORD bsize = MAX_PATH;
+ DWORD l = bsize;
+ char *bslash, *slash;
+ char *buf = (char *) malloc (bsize);
+ while (l == bsize)
+ {
+ l = GetModuleFileNameA (dll_hinstance, buf, bsize);
+ if (l == 0)
+ {
+ DebugBreak ();
+ abort ();
+ }
+ if (l == bsize)
+ {
+ buf = (char *) realloc ((void *) buf, bsize * 2);
+ bsize *= 2;
+ l = bsize;
+ }
+ }
+ bslash = strrchr (buf, '\\');
+ slash = strrchr (buf, '/');
+ if (bslash > slash)
+ slash = bslash;
+ slash[0] = '\0';
+ l = strlen (buf);
+ if (l > 3 && strcmp (&buf[l - 3], "bin") == 0)
+ {
+ bslash = strrchr (buf, '\\');
+ slash = strrchr (buf, '/');
+ if (bslash > slash)
+ slash = bslash;
+ slash[0] = '\0';
+ }
+ wprefix = buf;
+
+ }
+ return wprefix;
+}
+#endif
+
}
diff --git a/common/info.hpp b/common/info.hpp
index 1111111..2222222 100644
--- a/common/info.hpp
+++ b/common/info.hpp
@@ -140,8 +140,7 @@ namespace acommon {
};
-
-
+ const char * get_w32_prefix ();
}
#endif /* ASPELL_INFO__HPP */
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:17:30 +1100
Subject: [PATCH 06/10] w32 home
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0005-w32-home.all.patch?h=mingw-w64-aspell
diff --git a/common/config.cpp b/common/config.cpp
index 1111111..2222222 100644
--- a/common/config.cpp
+++ b/common/config.cpp
@@ -664,6 +664,21 @@ namespace acommon {
} else { // sep == '|'
assert(replace[0] == '$');
const char * env = getenv(replace.c_str()+1);
+ if (NULL == env && strcmp (replace.c_str() + 1, "HOME") == 0)
+ {
+ const char *hd, *hp;
+ hd = getenv("HOMEDRIVE");
+ hp = getenv("HOMEPATH");
+ if (hd && hp)
+ {
+ char tmpbuf[strlen ("HOME=") + strlen (hd) + strlen (hp) + 1];
+ strcpy (tmpbuf, "HOME=");
+ strcpy (&tmpbuf[strlen ("HOME=")], hd);
+ strcpy (&tmpbuf[strlen ("HOME=") + strlen (hd)], hp);
+ putenv (tmpbuf);
+ env = getenv(replace.c_str()+1);
+ }
+ }
final_str += env ? env : second;
}
replace = "";
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:18:24 +1100
Subject: [PATCH 07/10] abort mingw
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0006-abort.mingw.patch?h=mingw-w64-aspell
diff --git a/common/config.cpp b/common/config.cpp
index 1111111..2222222 100644
--- a/common/config.cpp
+++ b/common/config.cpp
@@ -623,7 +623,7 @@ namespace acommon {
} else {
- abort(); // this should not happen
+ DebugBreak(); // this should not happen
}
@@ -857,7 +857,7 @@ namespace acommon {
case ListClear:
return make_err(no_value_clear, entry->key);
default:
- abort(); // this shouldn't happen
+ DebugBreak(); // this shouldn't happen
}
} else {
entry->place_holder = -1;
diff --git a/common/itemize.cpp b/common/itemize.cpp
index 1111111..2222222 100644
--- a/common/itemize.cpp
+++ b/common/itemize.cpp
@@ -12,6 +12,7 @@
#include "mutable_container.hpp"
#include <stdio.h>
#include <cstdio>
+#include <debugapi.h>
//FIXME: it should be possible to escape ',' '+' '-' '!' so that they can
// appear in values
@@ -97,7 +98,7 @@ namespace acommon {
RET_ON_ERR(d.clear());
break;
default:
- abort();
+ DebugBreak();
}
}
return no_err;
diff --git a/common/posib_err.cpp b/common/posib_err.cpp
index 1111111..2222222 100644
--- a/common/posib_err.cpp
+++ b/common/posib_err.cpp
@@ -13,7 +13,7 @@
#include "posib_err.hpp"
#include "gettext.h"
-
+#include <debugapi.h>
namespace acommon {
@@ -100,7 +100,7 @@ namespace acommon {
fputs(_("Unhandled Error: "), stderr);
fputs(err_->err->mesg, stderr);
fputs("\n", stderr);
- abort();
+ DebugBreak();
}
#endif
diff --git a/common/string_list.hpp b/common/string_list.hpp
index 1111111..2222222 100644
--- a/common/string_list.hpp
+++ b/common/string_list.hpp
@@ -12,6 +12,7 @@
#include "posib_err.hpp"
#include <stdio.h>
#include <cstdio>
+#include <debugapi.h>
namespace acommon {
@@ -90,7 +91,7 @@ namespace acommon {
}
bool empty() const { return first == 0; }
- unsigned int size() const { abort(); return 0; }
+ unsigned int size() const { DebugBreak(); return 0; }
};
diff --git a/lib/find_speller.cpp b/lib/find_speller.cpp
index 1111111..2222222 100644
--- a/lib/find_speller.cpp
+++ b/lib/find_speller.cpp
@@ -384,7 +384,7 @@ namespace acommon {
b_size.req_type = '+';
}
if (!asc_isdigit(p[0]) || !asc_isdigit(p[1]) || p[2] != '\0')
- abort(); //FIXME: create an error condition here
+ DebugBreak(); //FIXME: create an error condition here
b_size.requested = atoi(p);
b_size.init();
diff --git a/modules/filter/tex.cpp b/modules/filter/tex.cpp
index 1111111..2222222 100644
--- a/modules/filter/tex.cpp
+++ b/modules/filter/tex.cpp
@@ -24,6 +24,7 @@
#include "string_enumeration.hpp"
#include "gettext.h"
+#include <debugapi.h>
namespace {
diff --git a/modules/speller/default/data.cpp b/modules/speller/default/data.cpp
index 1111111..2222222 100644
--- a/modules/speller/default/data.cpp
+++ b/modules/speller/default/data.cpp
@@ -17,6 +17,7 @@
#include "vararray.hpp"
#include "gettext.h"
+#include <debugapi.h>
namespace aspeller {
@@ -439,7 +440,7 @@ namespace aspeller {
w = new_default_replacement_dict();
break;
default:
- abort();
+ DebugBreak();
}
RET_ON_ERR(w->load(true_file_name, config, new_dicts, speller));
diff --git a/modules/speller/default/phonetic.cpp b/modules/speller/default/phonetic.cpp
index 1111111..2222222 100644
--- a/modules/speller/default/phonetic.cpp
+++ b/modules/speller/default/phonetic.cpp
@@ -7,6 +7,7 @@
#include "file_util.hpp"
#include "file_data_util.hpp"
#include "clone_ptr-t.hpp"
+#include <debugapi.h>
namespace aspeller {
@@ -194,7 +195,7 @@ namespace aspeller {
} else if (name == lang->name()) {
sl = new PhonetSoundslike(lang);
} else {
- abort(); // FIXME
+ DebugBreak(); // FIXME
}
PosibErrBase pe = sl->setup(iconv);
if (pe.has_err()) {
diff --git a/modules/speller/default/readonly_ws.cpp b/modules/speller/default/readonly_ws.cpp
index 1111111..2222222 100644
--- a/modules/speller/default/readonly_ws.cpp
+++ b/modules/speller/default/readonly_ws.cpp
@@ -55,6 +55,7 @@ using std::pair;
#include "iostream.hpp"
#include "gettext.h"
+#include <debugapi.h>
typedef unsigned int u32int;
static const u32int u32int_max = (u32int)-1;
@@ -102,7 +103,7 @@ static inline char * mmap_open(unsigned int,
static inline void mmap_free(char *, unsigned int)
{
- abort();
+ DebugBreak();
}
#endif
@@ -204,7 +205,7 @@ namespace {
InsensitiveHash hash;
InsensitiveEqual equal;
bool is_nonexistent(Value v) const {return v == u32int_max;}
- void make_nonexistent(const Value & v) const {abort();}
+ void make_nonexistent(const Value & v) const {DebugBreak();}
};
typedef VectorHashTable<WordLookupParms> WordLookup;
diff --git a/modules/speller/default/speller_impl.cpp b/modules/speller/default/speller_impl.cpp
index 1111111..2222222 100644
--- a/modules/speller/default/speller_impl.cpp
+++ b/modules/speller/default/speller_impl.cpp
@@ -380,7 +380,7 @@ namespace aspeller {
static PosibErr<void> save_repl(SpellerImpl * m, bool value) {
// FIXME
// m->save_on_saveall(DataSet::Id(&m->personal_repl()), value);
- abort(); return no_err;
+ DebugBreak(); return no_err;
}
static PosibErr<void> sug_mode(SpellerImpl * m, const char * mode) {
RET_ON_ERR(m->suggest_->set_mode(mode));
@@ -683,7 +683,7 @@ namespace aspeller {
case Dict::multi_dict:
break;
default:
- abort();
+ DebugBreak();
}
save_on_saveall = false;
}
@@ -709,7 +709,7 @@ namespace aspeller {
} else {
- abort();
+ DebugBreak();
}
break;
diff --git a/prog/aspell.cpp b/prog/aspell.cpp
index 1111111..2222222 100644
--- a/prog/aspell.cpp
+++ b/prog/aspell.cpp
@@ -448,7 +448,7 @@ int main (int argc, const char *argv[])
else if (action_str == "merge")
action = do_merge;
else
- abort(); // this should not happen
+ DebugBreak(); // this should not happen
if (action != do_other) {
if (args.empty()) {
@@ -1498,7 +1498,7 @@ void dump (aspeller::Dict * lws, Convert * conv)
}
break;
default:
- abort();
+ DebugBreak();
}
}
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Sun, 31 Jan 2016 20:19:16 +1100
Subject: [PATCH 08/10] fix including langinfo
taken from:
https://aur.archlinux.org/cgit/aur.git/plain/0007-fix-including-langinfo.patch?h=mingw-w64-aspell
diff --git a/modules/speller/default/language.cpp b/modules/speller/default/language.cpp
index 1111111..2222222 100644
--- a/modules/speller/default/language.cpp
+++ b/modules/speller/default/language.cpp
@@ -20,7 +20,7 @@
#include "getdata.hpp"
#include "file_util.hpp"
-#ifdef ENABLE_NLS
+#ifdef HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tony Theodore <[email protected]>
Date: Tue, 2 Feb 2016 15:46:07 +1100
Subject: [PATCH 09/10] add dlopen option
diff --git a/configure.ac b/configure.ac
index 1111111..2222222 100644
--- a/configure.ac
+++ b/configure.ac
@@ -58,6 +58,9 @@ AC_ARG_ENABLE(curses,
AC_ARG_ENABLE(curses-include,
[ --enable-curses-include=DIR])
+AC_ARG_ENABLE(dlopen,
+ [ --enable-dlopen])
+
AC_ARG_ENABLE(wide-curses,
AS_HELP_STRING([--disable-wide-curses],[disable wide char utf8 cursor control]))
@@ -95,14 +98,17 @@ AC_LANG([C++])
AM_PROG_CC_C_O
AC_DISABLE_STATIC
-AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
+if test "$enable_dlopen" = "yes"
+then
dnl DL stuff
+AC_LIBTOOL_DLOPEN
AC_CHECK_HEADERS(dlfcn.h,,[enable_compile_in_filters=yes])
AC_CHECK_FUNC(dlopen,,
AC_CHECK_LIB(dl, dlopen,,[enable_compile_in_filters=yes]))
+fi
dnl
@@ -165,9 +171,12 @@ then
AC_DEFINE(ENABLE_WIN32_RELOCATABLE, 1, [Defined if win32 relocation should be used])
fi
+if test "$enable_dlopen" = "yes"
+then
# DL stuff
AC_CHECK_HEADERS(dlfcn.h)
AC_CHECK_LIB(dl, dlopen)
+fi
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# #
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Kevin Atkinson <[email protected]>
Date: Thu, 29 Dec 2016 00:50:31 -0500
Subject: [PATCH 10/10] Compile Fixes for GCC 7.
Closes #519.
(cherry picked from commit 8089fa02122fed0a6394eba14bbedcb1d18e2384)
diff --git a/modules/filter/tex.cpp b/modules/filter/tex.cpp
index 1111111..2222222 100644
--- a/modules/filter/tex.cpp
+++ b/modules/filter/tex.cpp
@@ -175,7 +175,7 @@ namespace {
if (c == '{') {
- if (top.in_what == Parm || top.in_what == Opt || top.do_check == '\0')
+ if (top.in_what == Parm || top.in_what == Opt || *top.do_check == '\0')
push_command(Parm);
top.in_what = Parm;
diff --git a/prog/check_funs.cpp b/prog/check_funs.cpp
index 1111111..2222222 100644
--- a/prog/check_funs.cpp
+++ b/prog/check_funs.cpp
@@ -647,7 +647,7 @@ static void print_truncate(FILE * out, const char * word, int width) {
}
}
if (i == width-1) {
- if (word == '\0')
+ if (*word == '\0')
put(out,' ');
else if (word[len] == '\0')
put(out, word, len);