forked from PolMine/RcppCWB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatchEngine.R
More file actions
1763 lines (1480 loc) · 79.8 KB
/
Copy pathPatchEngine.R
File metadata and controls
1763 lines (1480 loc) · 79.8 KB
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
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#' Workflow to patch CWB
#'
#' Flag -fcommon removed from config and config/platform/linux again
#' @examples
#' source("~/Lab/github/RcppCWB/patch/PatchEngine.R")
#'
#' P <- PatchEngine$new(
#' cwb_dir_svn = "~/Lab/tmp/cwb/trunk",
#' repodir = "~/Lab/github/RcppCWB",
#' makeheaders = "~/Lab/github_foreign/makeheaders/src/makeheaders",
#' revision = 1069
#' )
#' P$patch_all()
PatchEngine <- R6Class(
classname = "PatchEngine",
public = list(
#' @field global_replacements Generated `$initialize()` by calling
#' `$configure_global_replacements`
revision = NULL,
cwb_dir_svn = NULL,
repodir = NULL,
repository = NULL,
branch_of_departure = NULL,
last_commit = NULL,
patch_commit = NULL,
patchbranch = NULL,
global_replacements = NULL,
file_patches = NULL,
verbose = TRUE,
diff_global_replacements = NULL,
diff_file_patches = NULL,
makeheaders = NULL,
initialize = function(cwb_dir_svn, revision, repodir, makeheaders, verbose = TRUE){
self$verbose <- verbose
self$repodir <- path.expand(repodir)
if (self$verbose) message("RcppCWB repository path: ", self$repodir)
self$cwb_dir_svn <- path.expand(cwb_dir_svn)
if (self$verbose) message("SVN directory with CWB code: ", self$cwb_dir_svn)
self$revision <- as.integer(revision)
if (self$revision) message("SVN revision to use: ", self$revision)
self$branch_of_departure <- self$get_branch_of_departure()
if (self$verbose) message("The branch of departure is: ", self$branch_of_departure)
self$repository <- repository(self$repodir)
self$last_commit <- last_commit(repo = self$repodir)
self$global_replacements <- self$configure_global_replacements(revision)
self$file_patches <- self$patches(revision)
message("flex version: ", system("flex --version", intern = TRUE))
message("bison version: ", system("bison --version", intern = TRUE)[1])
message("makeheaders utility is available: ", identical(system(makeheaders, intern = TRUE), character()))
self$makeheaders <- makeheaders
invisible(self)
},
get_branch_of_departure = function(){
branches(self$repodir)[sapply(branches(self$repodir), is_head)][[1]][["name"]]
},
svn_get_revision = function(){
old_wd <- setwd(self$cwb_dir_svn)
rev <- as.integer(system("svn info --show-item revision", intern = TRUE))
setwd(old_wd)
rev
},
#' @return An `integer` value with the active SVN revision number.
svn_set_revision = function(){
old_wd <- setwd(self$cwb_dir_svn)
rev <- self$svn_get_revision()
if (self$verbose) message("Active revision of CWB SVN repository: ", rev)
if (rev != as.integer(self$revision)){
system(
sprintf("svn up -r %d", self$revision),
intern = TRUE
)
rev <- self$svn_get_revision()
if (self$verbose) message("Updated revision of CWB SVN repository: ", rev)
}
setwd(old_wd)
rev
},
cwb_fresh_copy = function(){
if (self$verbose) message("* copy unaltered CWB code into RcppCWB repository ... ", appendLF = FALSE)
self$patchbranch <- sprintf("r%d", self$svn_get_revision()) # name of new branch
git2r::checkout(self$repodir, branch = self$branch_of_departure)
if (self$patchbranch %in% names(branches(self$repodir))){
git2r::branch_delete(branch = branches(self$repodir)[[self$patchbranch]])
}
git2r::branch_create(commit = last_commit(repo = self$repodir), name = self$patchbranch)
git2r::checkout(self$repodir, branch = self$patchbranch) # switch to new branch
# copy CWB files
repo_cwb_dir <- path(self$repodir, "src", "cwb")
cwb_files <- list.files(self$cwb_dir_svn, recursive = TRUE, full.names = TRUE)
file.copy(
from = cwb_files,
to = gsub(paste("^", self$cwb_dir_svn, sep = ""), repo_cwb_dir, cwb_files),
overwrite = TRUE
)
if (self$verbose) message(sprintf("%d files copied", length(cwb_files)))
# Remove files that have been added (and that need to be added explicitly)
# To restore the state of RcppCWB development, these files need to be re-added or generated later on
cwb_files_svn_truncated <- gsub(self$cwb_dir_svn, "", cwb_files)
cwb_files_repo <- list.files(repo_cwb_dir, recursive = TRUE, full.names = TRUE)
cwb_files_repo_truncated <- gsub(repo_cwb_dir, "", cwb_files_repo)
# config dir copy of platform-file 'solaris': 'solaris_x86', with modification 'CFLAGS = -Wall -O3 -fPIC'
added_files <- cwb_files_repo_truncated[!cwb_files_repo_truncated %in% cwb_files_svn_truncated]
added_files_full_path <- fs::path(repo_cwb_dir, added_files)
added_files_existing <- added_files_full_path[file.exists(added_files_full_path)]
git2r::rm_file(repo = self$repodir, path = added_files_existing)
# add & commit
git2r::add(repo = self$repodir, path = unname(unlist(git2r::status(repo = self$repodir))))
git2r::commit(self$repodir, message = "CWB restored")
},
#' @description
#' The flex and bison parsers may be missing on CRAN build machines. To
#' avoid errors, parsed files files are generated (registry.tab.c,
#' registry.tab.h, registry.y)
run_bison_flex = function(){
if (self$verbose) message("* run bison and flex parsers")
cwb_pkg_dir <- file.path(self$repodir, "src", "cwb")
old_wd <- setwd(path(cwb_pkg_dir, "cl"))
system("bison -d -t -p creg registry.y")
system("flex -8 -Pcreg registry.l")
setwd(path(cwb_pkg_dir, "cqp"))
system("bison -d -t parser.y")
system("flex -8 parser.l")
setwd(old_wd)
invisible(self)
},
rename_files = function(){
if (self$verbose) message("* rename files cl/endian.h (to endian2.h) and instutils/Makefile (to _Makefile)")
cwb_pkg_dir <- file.path(self$repodir, "src", "cwb")
file.rename(
from = path(cwb_pkg_dir, "cl", "endian.h"),
to = path(cwb_pkg_dir, "cl", "endian2.h")
)
file.rename(
from = path(cwb_pkg_dir, "instutils", "Makefile"),
to = path(cwb_pkg_dir, "instutils", "_Makefile")
)
invisible(self)
},
copy_files = function(){
if (self$verbose) message("* add newly created files to CWB code (overwriting existing files)")
new_files <- list.files(path = file.path(self$repodir, "patch", "cwb"), full.names = TRUE, recursive = TRUE)
for (fname in new_files){
if (self$verbose) message("... copy file: ", fname)
file.copy(from = fname, to = gsub("/patch/", "/src/", fname), overwrite = TRUE)
}
invisible(self)
},
create_copy = function(){
if (self$verbose) message ("* create utils/globals.h as a copy of cwb-encode.c")
file.copy(
from = file.path(self$repodir, "src", "cwb", "utils", "cwb-encode.c"),
to = file.path(self$repodir, "src", "cwb", "utils", "globals.h"),
overwrite = TRUE
)
file.copy(
from = file.path(self$repodir, "src", "cwb", "cl", "cl.h"),
to = file.path(self$repodir, "src", "_cl.h"),
overwrite = TRUE
)
file.copy(
from = file.path(self$repodir, "src", "cwb", "cqp", "eval.h"),
to = file.path(self$repodir, "src", "_eval.h"),
overwrite = TRUE
)
},
create_globalvars_file = function(){
if (self$verbose) message("* create _globalvars.h ... ", appendLF = FALSE)
externed <- c(
"enum _which_app { undef, cqp, cqpcl, cqpserver} which_app;",
unique(unname(unlist(lapply(self$file_patches, `[[`, "extern"))))
)
externed <- externed[!externed %in% c("EvalEnvironment Environment[MAXENVIRONMENT];", "EEP CurEnv, evalenv;", "int eep;")]
writeLines(text = externed, con = file.path(self$repodir, "src", "_globalvars.h"))
message("OK")
},
create_dummy_depend_files = function(){
if (self$verbose) message("* create dummy depend.mk files ...")
cat("\n", file = file.path(self$repodir, "src", "cwb", "cl", "depend.mk"))
cat("\n", file = file.path(self$repodir, "src", "cwb", "cqp", "depend.mk"))
invisible(self)
},
replace_globally = function(){
if (self$verbose) message("* perform global replacements ...")
cwb_pkg_dir <- file.path(self$repodir, "src", "cwb")
files <- c(
unlist(lapply(
c("cl", "cqp", "CQi"),
function(subdir) list.files(file.path(cwb_pkg_dir, subdir), full.names = TRUE)
)),
path.expand(
file.path(cwb_pkg_dir, "utils", c("cwb-encode.c", "cwb-makeall.c", "cwb-huffcode.c", "cwb-compress-rdx.c"))
)
)
for (f in files){
code <- readLines(f)
for (i in 1L:length(self$global_replacements)){
if (length(self$global_replacements[[i]]) > 2L){
if (endsWith(f, self$global_replacements[[i]][[3]])) next
}
code <- gsub(self$global_replacements[[i]][1], self$global_replacements[[i]][2], code)
}
writeLines(text = code, con = f)
}
},
delete_line_before = function(code, action, file){
which_position <- if (length(action) > 1L) action[[2]] else 1L
times <- if (length(action) == 3L) action[[3]] else 1L
position <- grep(pattern = action[[1]], code)[which_position]
if (is.na(times)) times <- position - 1L
if (!is.na(position)){
code <- code[-(position - 1L:times)]
} else {
message(
sprintf("Trying to patch file '%s' - no match for action 'delete_line_before' (regex: %s | match: %d | lines: %d) ", file, action[[1]], which_position, times)
)
}
code
},
delete_line_beginning_with = function(code, action, file){
which_position <- if (length(action) > 1L) action[[2]] else 1L
times <- if (length(action) == 3L) action[[3]] else 1L
position <- grep(pattern = action[[1]], code)[which_position]
if (is.na(times)) times <- length(code) - position
if (!is.na(position)){
code <- code[-(position + 0L:times)]
} else {
message(
sprintf("Trying to patch file '%s' - no match for action 'delete_line_after' (regex: %s | match: %d | lines: %d) ", file, action[[1]], which_position, times)
)
}
code
},
insert_before = function(code, action, file){
which_position <- if (length(action) > 2L) action[[3]] else 1
position <- grep(pattern = action[[1]], code)[which_position]
if (!is.na(position)){
code <- c(
code[1L:(position - 1L)],
action[[2]],
code[position:length(code)]
)
} else {
message(
sprintf(
"Trying to patch file '%s' - no match for action 'insert_before' (regex: %s | match: %d | insertion: %s)",
file, action[[1]], which_position, paste(action[[2]], collapse = "///")
)
)
}
code
},
insert_after = function(code, action, file){
which_position <- if (length(action) > 2L) action[[3]] else 1L
position <- grep(pattern = action[[1]], code)[which_position]
if (!is.na(position)){
code <- c(
code[1L:position],
action[[2]],
code[(position + 1L):length(code)]
)
} else {
message(
sprintf(
"Trying to patch file '%s' - no match for action 'insert_after' (regex: %s | match: %d | insertion: %s)",
file, action[[1]], which_position, paste(action[[2]], collapse = "///")
)
)
}
code
},
replace = function(code, action, file){
position <- grep(pattern = action[[1]], code)
if (length(position) == 0L){
message(
sprintf("Trying to patch file '%s' - no match for action 'replace' (regex: %s | match: %d | replacement: %s)",
file, action[[1]], action[[3]], paste(action[[2]], collapse = "///")),
appendLF = FALSE
)
return(code)
}
if (!is.na(action[[3]])) position <- position[ action[[3]] ]
for (p in position){
code[position] <- gsub(action[1], action[2], code[position])
}
code
},
remove_lines = function(code, action, file){
position <- grep(pattern = action[[1]], code)[ action[[2]] ]
if (!is.na(position)){
code <- code[-position]
} else {
message(
sprintf("Trying to patch file '%s' - no match for action 'remove_lines' (regex: %s | match: %d)", file, action[[1]], action[[2]]),
appendLF = FALSE
)
}
code
},
extern = function(code, action, file){
if (length(action) == 0L) return(code)
for (ext in action){
matches <- which(startsWith(code, ext))
if (length(matches) > 0L){
for (position in matches){
code[position] <- paste("extern", code[position], sep = " ")
}
} else {
message(sprintf("Trying to patch file '%s' - no match for action 'extern' (var to extern: %s | n_matches: %d", file, ext, length(matches)))
}
}
code
},
configure_global_replacements = function(revision){
list(
# In revision 1690, there are further targets dst->stream, outfh, tmp, fh
if (revision == 1069){
c("(vf|f|v)printf\\s*\\(\\s*(stderr|stream|stdout|outfd|File|rd->stream|redir->stream|debug_output|protocol),\\s*", "Rprintf(")
} else if (revision >= 1690){
c("(vf|f|v)printf\\s*\\(\\s*(stderr|stream|stdout|outfd|fd|File|rd->stream|redir->stream|dst->stream|outfh|tmp|fh|dest),\\s*", "Rprintf(")
},
if (revision == 1069) c("(vf|f|v)printf\\s*\\(\\s*fd,\\s*", "Rprintf(", "cwb-encode.c"),
c("YY(F|D)PRINTF\\s*(\\({1,2})\\s*(stderr|yyoutput),\\s*" , "YY\\1PRINTF \\2"),
c("fprintf\\s*\\(", "Rprintf("),
c("(\\s+)printf\\(", "\\1Rprintf("),
c("#(\\s*)define\\sYYFPRINTF\\sfprintf", "#\\1define YYFPRINTF Rprintf"),
# The CWB file 'endian.h' causes issues with the endian.h system file. The
# best solution I could come up with is to rename endian.h into endian2.h.
# In addition - turn 'endian.h' into 'endian2.h' in the Makefile - change
# include statements to 'include "endian2.h"'
c('^\\s*#include\\s+"endian\\.h"\\s*$', '#include "endian2.h"') # only files in cl, maybe limit this,
# c("^(\\s*)exit\\(1\\);", "\\1return 1;")
)
},
# Order to maintain:
# - delete_line_before
# - insert_before
# - insert_after
# - replace
# - remove_lines
patches = function(revision){
list(
"src/cwb/cl/lex.creg.c" = c(
list(),
# These changes are highly specific and are unlikely to work out of the box for r1690
if (revision == 1069) list(
delete_line_before = list("^\\s*if\\s\\(\\s\\(yy_c_buf_p\\)", 4L, 4L),
delete_line_before = list("^\\s*cregrestart\\(cregin\\s*\\);", 2L, 11L),
delete_line_before = list("/\\*\\*\\sImmediately\\sswitch\\sto\\sa\\sdifferent\\sinput\\sstream\\.", 1L, 1L),
insert_before = list("/\\*\\send\\sstandard\\sC\\sheaders\\.\\s\\*/", c("void Rprintf(const char *, ...);", ""), 1),
insert_before = list("#ifndef\\sYY_NO_INPUT", "/*", 1L),
insert_before = list("^\\s*static\\svoid\\syyunput\\s\\(int\\sc,\\sregister\\schar\\s\\*\\syy_bp\\s\\)", "/*", 1L),
insert_before = list("^#ifndef\\sYY_NO_INPUT", "/*", 2L),
insert_before = list("/\\*\\*\\sImmediately\\sswitch\\sto\\sa\\sdifferent\\sinput\\sstream\\.", c("*/", ""), 1L),
insert_after = list("#endif", "*/", 28L),
insert_after = list("^\\}$", "*/", 5L),
# Funktion 'static void yyunput (int c, register char * yy_bp )'
# auskommentiert, zur Vermeidung Nachricht: lex.creg.c:1410:17:
# warning: unused function 'yyunput' [-Wunused-function]
replace = list("^(\\s*)(static\\svoid\\syyunput\\s\\(int\\sc,char\\s\\*buf_ptr\\s+\\);).*?$", "\\1/* \\2 */", 1),
replace = list("^\\s*static\\svoid\\syyunput\\s\\(int\\sc,\\sregister\\schar\\s\\*\\syy_bp\\s\\)", "static void yyunput (int c, register char * yy_bp )", 1L),
replace = list("^(\\s*)\\{(\\s*)/\\*\\sneed\\smore\\sinput\\s\\*/", "\\1{\\2", 1L),
replace = list("/\\*\\scast\\sfor\\s8-bit\\schar's\\s\\*/", "", 1L),
replace = list("\\s*/\\*\\spreserve\\scregtext\\s\\*/", "", 1L),
replace = list("/\\*\\sifndef YY_NO_INPUT\\s\\*/", "", 1L),
remove_lines = list("^\\s/\\*\\sundo\\seffects\\sof\\ssetting\\sup\\scregtext\\s\\*/", 1L),
remove_lines = list("/\\*\\sneed\\sto\\sshift\\sthings\\sup\\sto\\smake\\sroom\\s\\*/", 1L),
remove_lines = list("/\\*\\s\\+2\\sfor\\sEOB\\schars\\.\\s\\*/", 1L),
remove_lines = list("^\\s*/\\*\\sThis\\swas\\sreally\\sa\\sNUL\\.\\s\\*/", 1L),
remove_lines = list("^\\s*/\\*FALLTHROUGH\\*/\\s*$", 1L)
)
),
"src/cwb/cl/endian2.h" = c(
list(
insert_before = list("#include\\s<windows\\.h>" , "#include <winsock2.h> /* AB reversed order, in original CWB code windows.h is included first */", 1L)
),
# Ensure that order of inclusion is 'winsock2.h' and then 'windows.h'.
# The windows.h/winsock2.h order has persisted, but the comment after
# has changed.
if (revision == 1069) list(
delete_line_before = list("/* for consistency:", 1L, 1L)
),
if (revision >= 1690) list(
delete_line_before = list("/\\*\\snote,\\sin\\sorder\\sfor\\sall\\sthis\\sto\\swork,", 1L, 1L)
)
),
"src/cwb/cl/Makefile" = list(
delete_line_before = list("^libcl.a: \\$\\(OBJS\\)", 1L, if (revision >= 1400) 9L else 6L),
delete_line_before = list("##\\scl\\.h\\sheader\\s", 1L, 11L),
delete_line_before = list("^depend:$", 1L, if (revision >= 1400) 14L else 22L),
replace = list("^TOP\\s=\\s\\$\\(shell\\spwd\\)/\\.\\.", "TOP = $(R_PACKAGE_SOURCE)", 1L),
replace = list("^(\\s+)endian.h", "\\1endian2.h", 1L),
replace = list("^(\\s+)\\$\\(AR\\)\\s", "\\1$(AR) cq ", 1L),
remove_lines = list("^\\s+\\$\\(RANLIB\\)", 1L)
),
"src/cwb/cl/attributes.c" = c(
list(
# This will work for r1690 too
insert_before = list("^#include\\s<ctype\\.h>", c("void Rprintf(const char *, ...);", ""))
),
# Cannot find the dollar variabl in r1690 - seems to be gone
if (revision == 1069) list(
# attributes.c:755:19: warning: variable ‘dollar’ set but not used [-Wunused-but-set-variable]
# int ppos, bpos, dollar, rpos;
replace = list("(\\s+)int\\sppos,\\sbpos,\\sdollar,\\srpos;", "\\1int ppos, bpos, rpos;", 1),
replace = list("^(\\s+)dollar = 0;", "\\1/* dollar = 0; */", 1),
replace = list("^(\\s+)dollar = ppos;\\s", "\\1/* dollar = ppos; */", 1),
# The STREQ macro is replaced by a cl_str_is() function in r1690
# attributes.c: In function ‘component_full_name’:
# macros.h:59:22: warning: the address of ‘rname’ will always evaluate as ‘true’ [-Waddress]
# ((a) && (b) && (strcmp((a), (b)) == 0)))
# attributes.c:807:11: note: in expansion of macro ‘STREQ’
# if (STREQ(rname, "HOME"))
replace = list('^(\\s+)if\\s\\(STREQ\\(rname,\\s"HOME"\\)\\)', '\\1if (strcmp(rname, "HOME") == 0)', 1),
# attributes.c:809:16: note: in expansion of macro ‘STREQ’
# else if (STREQ(rname, "APATH"))
replace = list('^(\\s+)else\\sif\\s\\(STREQ\\(rname,\\s"APATH"\\)\\)', '\\1else if (strcmp(rname, "APATH") == 0)', 1),
# attributes.c:812:16: note: in expansion of macro ‘STREQ’
# STREQ macro dissolved to avoid warnings in attributes.c
# else if (STREQ(rname, "ANAME"))
replace = list('^(\\s+)else\\sif\\s\\(STREQ\\(rname,\\s"ANAME"\\)\\)', '\\1else if (strcmp(rname, "ANAME") == 0)', 1)
)
),
"src/cwb/cl/bitio.c" = list(
# Unchanged, will work as in 1069
insert_before = list("^#include\\s<sys/types\\.h>", "void Rprintf(const char *, ...);")
),
"src/cwb/cl/class-mapping.c" = c(
list(),
# This file does not exist in r1960
if (revision == 1069) list(
insert_before = list('#include\\s"globals\\.h"', "void Rprintf(const char *, ...);"),
# argumet names class renamed to obj
replace = list("(\\s*)\\*\\s@param\\sclass\\s+The\\sclass\\s+to\\scheck\\.", "\\1* @param obj The class to check.", 2),
replace = list("(\\s*)\\*\\s@param\\sclass\\s+The\\sclass\\s+to\\scheck\\.", "\\1* @param obj The class to check.", 1),
replace = list("^(\\s+)return\\smember_of_class_i\\(map,\\sclass,\\sid\\);", "\\1return member_of_class_i(map, obj, id);", 1),
replace = list("^(\\s+)SingleMapping\\sclass,", "\\1SingleMapping obj,", 2),
replace = list("^(\\s+)SingleMapping\\sclass,", "\\1SingleMapping obj,", 1),
replace = list("^(\\s+)class->tokens,", "\\1obj->tokens,", 1),
replace = list("^(\\s+)class->nr_tokens,", "\\1obj->nr_tokens,", 1)
)
),
"src/cwb/cl/corpus.c" = c(
list(
# Should work in r1690 too
insert_before = list('#include\\s<ctype\\.h>', "void Rprintf(const char *, ...);")
),
# Usage of stderr on a separate line - 3 times in r1069, but only once in r1690
if (revision == 1069) list(
remove_lines = list("(\\s+)stderr,", 3),
remove_lines = list("(\\s+)stderr,", 2)
),
list(
remove_lines = list("(\\s+)stderr,", 1)
)
),
"src/cwb/cl/fileutils.c" = list(
# All if this should work in r1690 too (though patches for Solares may be obsolete)
insert_before = list('^#include\\s<sys/stat\\.h>', "void Rprintf(const char *, ...);"),
# to satisfy solaris
# #include <signal.h> /* added by Andreas Blaette */
# #include <sys/socket.h> /* added by Andreas Blaette */
insert_before = list('^#include\\s"globals\\.h"', c("#include <signal.h> /* added by Andreas Blaette */", "#include <sys/socket.h> /* added by Andreas Blaette */", ""))
),
"src/cwb/cl/globals.h" = list(
# Note the change from _globals_h_ to _cl_globals_h_
insert_before = list(
if (revision == 1069) '^#ifndef\\s_globals_h_' else '^#ifndef\\s_cl_globals_h_',
"void Rprintf(const char *, ...);")
),
"src/cwb/cl/lexhash.c" = list(
insert_before = list('#include\\s"globals\\.h"', "void Rprintf(const char *, ...);"),
# Do not recall why this include is necessary, but the lexhash.h include (and file)
# are absent in r1690 - so use another anchor.
insert_after = list(
if (revision == 1069) '^#include\\s"lexhash\\.h"' else '#include\\s"globals\\.h"',
"#include <unistd.h>"
)
),
"src/cwb/cl/macros.c" = list(
# Unchanged in r1690
insert_before = list('#include\\s"globals\\.h"', "void Rprintf(const char *, ...);")
),
"src/cwb/cl/makecomps.c" = c(
list(
# Unchanged in r1690
insert_before = list('#include\\s<ctype\\.h>', c("void Rprintf(const char *, ...);", ""))
),
if (revision == 1069) list(
# commented out: char errmsg[CL_MAX_LINE_LENGTH] because also defined elsewhere
replace = list("^(\\s*)char\\serrmsg\\[CL_MAX_LINE_LENGTH\\];", "/* char errmsg[CL_MAX_LINE_LENGTH]; */", 1)
)
),
"src/cwb/cl/registry.y" = list(
# Stable r1069-1690
insert_before = list('#include\\s<ctype\\.h>', "void Rprintf(const char *, ...);")
),
"src/cwb/cl/special-chars.c" = list(
# Stable r1069-1690
insert_before = list('#include\\s<ctype\\.h>', "void Rprintf(const char *, ...);")
),
"src/cwb/cl/storage.c" = list(
# All of this is stable r1069-1690
insert_before = list('^#include\\s<sys/types\\.h>', "void Rprintf(const char *, ...);"),
# storage.c: In function ‘mmapfile’:
# storage.c:335:12: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
# write(fd, &fd, sizeof(int));
insert_before = list("^(\\s*)lseek\\(fd,\\s0,\\sSEEK_SET\\);", ' if (success < 0) Rprintf("Operation not successful");'),
replace = list("^(\\s+)write\\(fd,\\s&fd,\\ssizeof\\(int\\)\\);", "\\1ssize_t success = write(fd, &fd, sizeof(int));", 1)
),
"src/cwb/cl/windows-mmap.c" = list(
# stable r1069 and r1690
insert_before = list('^#include\\s"windows-mmap\\.h"', "void Rprintf(const char *, ...);")
),
# This file is not present in r1690
"src/cwb/cl/registry.tab.c" = list(
insert_before = list("#define\\sYYBISON\\s1", "void Rprintf(const char *, ...);", 1L)
),
"src/cwb/cl/bitfields.c" = list(
# stable r1069-r1690
insert_after = list("^static\\sint\\sBaseTypeBits", "void Rprintf(const char *, ...);")
),
"src/cwb/cl/cdaccess.c" = c(
list(
# The include of 'cdaccess.h' is gone with r1690 so we use another anchor
insert_after = list(
if (revision == 1069) '^#include\\s"cdaccess\\.h"' else '^#include\\s+"compression\\.h"',
"void Rprintf(const char *, ...);"
),
# This code is unchanged with r1690
# cdaccess.c:2697:12: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
# fgets(call, CL_MAX_LINE_LENGTH, pipe);
replace = list("^(\\s*)fgets\\(call,\\sCL_MAX_LINE_LENGTH,\\spipe\\);", '\\1if (fgets(call, CL_MAX_LINE_LENGTH, pipe) == NULL) Rprintf("fgets failure");', 1)
),
# These are unused variable patches gone with r1690 (vars commented out, for instance)
if (revision == 1069) list(
# unchanged in r1690? But does not match
replace = list("^(\\s*)off_end\\s=\\sntohl\\(lexidx_data\\[idx\\s\\+\\s1\\]\\)\\s-\\s1;", "\\1/* off_end = ntohl(lexidx_data[idx + 1]) - 1; */", 1),
replace = list("^(\\s*)int\\sregex_result,\\sidx,\\si,\\slen,\\slexsize;", "\\1int idx, i, lexsize;", 1),
replace = list("^(\\s*)int\\soptimised,\\sgrain_match;", "\\1int optimised;", 1),
replace = list("^(\\s*)char\\s\\*word,\\s\\*preprocessed_string;", "\\1char *word;", 1),
# cdaccess.c: In function ‘cl_regex2id’:
# cdaccess.c:1392:20: warning: variable ‘off_end’ set but not used [-Wunused-but-set-variable]
# int off_start, off_end; /* start and end offset of current lexicon entry */
replace = list("^(\\s*)int\\soff_start,\\soff_end;", "\\1int off_start;", 1),
replace = list("^(\\s*)char\\s\\*p;", "\\1/* char *p; */", 1),
replace = list("^(\\s*)int\\si;", "\\1/* int i; */", 3),
# cdaccess.c: In function ‘cl_dynamic_call’:
# cdaccess.c:2533:17: warning: variable ‘arg’ set but not used [-Wunused-but-set-variable]
# DynCallResult arg;
replace = list("^(\\s*)DynCallResult\\sarg;", "\\1/* DynCallResult arg; */", 1),
replace = list("^(\\s*)arg\\s=\\sargs\\[argnum\\];", "\\1/* arg = args[argnum]; */", 1)
)
),
"src/cwb/cl/globals.c" = list(
# stable r10690 - r1690
insert_after = list(
'^#include\\s"globals\\.h"',
c(
"void Rprintf(const char *, ...);",
"",
"char* cl_get_version(){",
" #ifdef VERSION",
" char* version = VERSION;",
" #else",
' char* version = "";',
" #endif",
" return version;",
"}"
)
)
),
"src/cwb/cl/ngram-hash.c" = c(
list(
insert_after = list("^#include\\s<math\\.h>", "void Rprintf(const char *, ...);")
),
# The variable 'temp' is unused only in r1069?!
if (revision == 1069) list(
# ngram-hash.c: In function ‘cl_delete_ngram_hash’:
# ngram-hash.c:146:30: warning: variable ‘temp’ set but not used [-Wunused-but-set-variable]
# cl_ngram_hash_entry entry, temp;
replace = list("^(\\s*)cl_ngram_hash_entry\\sentry,\\stemp;", "\\1cl_ngram_hash_entry entry;", 1),
replace = list("^(\\s*)temp\\s=\\sentry;", "\\1/* temp = entry; */", 1)
)
),
"src/cwb/cl/regopt.c" = c(
list(
insert_after = list(
if (revision == 1069) '^#include\\s"regopt\\.h"' else '^#include\\s"globals\\.h"',
"void Rprintf(const char *, ...);"
)
),
# The issue may still be present but the syntax has changed - so we do not apply this for now
if (revision == 1069) list(
# regopt.c: In function ‘make_jump_table’:
# regopt.c:1148:18: warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]
# if (ch >= 32 & ch < 127)
replace = list("^(\\s*)if\\s\\(ch\\s>=\\s32\\s&\\sch\\s<\\s127\\)", "\\1if ((ch >= 32) & (ch < 127))", 1)
)
),
"src/cwb/cl/class-mapping.h" = c(
list(),
# The file is not there in r1690
if (revision == 1069) list(
replace = list("^(\\s+)SingleMapping\\sclass,", "\\1SingleMapping obj,", 2),
replace = list("^(\\s+)SingleMapping\\sclass,", "\\1SingleMapping obj,", 1)
)
),
"src/cwb/cl/ui-helpers.c" = c(
list(),
if (revision >= 1690) list(
insert_before = list('^#include\\s"cl\\.h"', c("void Rprintf(const char *, ...);", ""), 1L)
)
),
"src/cwb/cl/cwb-globals.h" = c(
list(),
if (revision >= 1690) list(
delete_line_beginning_with = list("#if\\s__STDC_VERSION__\\s>=\\s199901L", 1L, 22L)
)
),
"src/cwb/cqp/groups.c" = c(
list(),
# The file is gone with r1690
if (revision == 1069) list(
# Comment out open_temporary_file(char *tmp_name_buffer) in
# cqp/output.c, in cqp/output.h and in usage in functions calling
# this function: ComputeGroupExternally (cqp/groups.c) and
# SortExternally (cqp/ranges.c)
delete_line_before = list("^Group\\s\\*", 3L),
delete_line_before = list("^Group\\s\\*compute_grouping\\(CorpusList\\s\\*cl,", 1L),
delete_line_before = list("^Group\\s\\*compute_grouping\\(CorpusList\\s\\*cl,", 1L),
delete_line_before = list("^\\s*if\\s\\(\\(fd\\s=\\sopen_temporary_file\\(temporary_name\\)\\)\\s==\\sNULL\\)\\s\\{", 1L),
delete_line_before = list("^\\s*if\\s\\(\\(fd\\s=\\sopen_temporary_file\\(temporary_name\\)\\)\\s==\\sNULL\\)\\s\\{", 1L),
delete_line_before = list("^(\\s*)sprintf\\(sort_call,\\sExternalGroupingCommand,\\stemporary_name\\);", 1L),
delete_line_before = list("^\\s*return\\sComputeGroupExternally\\(group\\);", 1L),
insert_before = list("^Group\\s\\*", "/*", 3), # begin of commenting out ComputeGroupExternally(Group *group),
insert_before = list("^Group\\s\\*compute_grouping\\(CorpusList\\s\\*cl,", c("*/", "")), # end of commenting out ComputeGroupExternally(Group *group)
insert_after = list("return\\sComputeGroupInternally\\(group\\);", c(" */", " return group;")),
replace = list("^(.*?)\\s*/\\*\\s\\(source\\sID,\\starget\\sID)\\s*\\*/", "\\1", 1),
replace = list("^(.*?)\\s*/\\*\\smodifies\\sGroup\\sobject\\sin\\splace\\sand\\sreturns\\spointer\\s\\*/", "\\1", 1),
replace = list("^(\\s*)(if\\s\\(UseExternalGrouping\\s&&\\s\\!insecure\\s&&\\s\\!\\(source_is_struc\\s\\|\\|\\starget_is_struc\\s\\|\\|\\sis_grouped\\)\\))", "\\1/* \\2", 1)
)
),
"src/cwb/cqp/output.c" = c(
list(),
if (revision < 1400) list(
# Comment out open_temporary_file(char *tmp_name_buffer) in
# cqp/output.c, in cqp/output.h and in usage in functions calling
# this function: ComputeGroupExternally (cqp/groups.c) and
# SortExternally (cqp/ranges.c)
delete_line_before = list('^\\s*sprintf\\(prefix,\\s"cqpt\\.%d",\\s\\(unsigned\\sint\\)getpid\\(\\)\\);', 1L, 8L),
insert_before = list("^FILE\\s\\*\\s*", "/*", 1),
insert_after = list("^\\}\\s*$", "*/", 3),
replace = list('^(.*?)\\s*/\\*\\sholds\\s"cqpt\\.\\$\\$",\\sso\\s64\\schars\\sis\\splenty\\sof\\sheadroom\\s\\*/', "\\1", 1),
replace = list('^(.*?)(\\s*)/\\*\\s"cqpt\\.\\$\\$"\\s\\*/', "\\1", 1),
replace = list("^(.*?)\\s/\\*\\sstring\\sis\\sallocated\\sby\\stempnam\\(\\),\\sneeds\\sto\\sbe\\sfree'd\\sbelow\\s\\*/", "\\1", 1)
)
),
"src/cwb/cqp/parser.y" = c(
list(),
# Want to see issues with r1690 before adapting / checking these patches
if (revision == 1069) list(
delete_line_before = list("^\\s*if\\s\\(\\$2\\s&&\\sgenerate_code\\)\\s\\{", 3L),
replace = list("^(\\s*)int\\sok;", "\\1int ok __attribute__((unused));", 3),
replace = list("^(\\s*)int\\sok;", "\\1int ok __attribute__((unused));", 2),
replace = list("^(\\s*)ok\\s=\\sSortSubcorpus\\(\\$2,\\s\\$3,\\s\\(\\$4\\s>=\\s1\\)\\s\\?\\s\\$4\\s:\\s1,\\s&\\(\\$5\\)\\);", "\\1SortSubcorpus($2, $3, ($4 >= 1) ? $4 : 1, &($5));", 1)
)
),
"src/cwb/cqp/ranges.c" = c(
list(),
# This is highly specific - want to see what happens before adapting things to r1690
if (revision == 1069) list(
delete_line_before = list("^\\s*for\\s\\(i\\s=\\s0;\\si\\s<\\sp;\\si\\+\\+\\)", 2L, 5L),
delete_line_before = list("^\\s*for\\s\\(i\\s=\\s0;\\si\\s<\\sp;\\si\\+\\+\\)", 1L, 5L),
delete_line_before = list("^\\s*value\\s=\\scl_string_canonical\\(value,\\ssrt_cl->corpus->charset,\\ssrt_flags,\\sCL_STRING_CANONICAL_STRDUP\\);", 1L, 7L),
insert_before = list("^int", "/*", 9),
insert_after = list("^\\}\\s*$", "*/", 11),
replace = list("^(\\s*)line\\s=\\s-1;(\\s*)\\s/\\*\\swill\\sindicate\\ssort\\sfailure\\sbelow\\sif\\stext_size\\s==\\s0\\s\\*/", "\\1line = -1;\\2", 1),
replace = list("^(\\s*)\\}(\\s)/\\*\\send\\sfor\\seach\\stoken\\s\\*/", "\\1}\\2", 1),
replace = list("^(\\s*)line\\s=\\s-1;(\\s*)/\\*\\swill\\sindicate\\sfailure\\sof\\sexternal\\ssort\\scommand\\s*\\*/", "\\1line = -1;\\2", 1),
replace = list("^(\\s*)break;\\s*/\\*\\sabort\\s\\*/", "\\1break;", 1),
replace = list("^(\\s*)ok\\s=\\sSortExternally\\(\\);", "\\1/* ok = SortExternally(); */", 1),
remove_lines = list("^\\s*/\\*\\suses\\ssettings\\sfrom\\sstatic\\ssrt_\\*\\svariables\\s\\*/", 1),
remove_lines = list("^\\s*/\\*\\sdetermine\\sstart\\sand\\send\\sposition\\sof\\ssort\\sinterval\\sfor\\sthis\\smatch\\s\\*/", 1),
remove_lines = list("/\\*\\sadjust\\ssort\\sboundaries.*?\\*/", 1),
remove_lines = list("/*\\sswap\\sstart\\sand\\send\\sof\\sinterval.*?\\*/", 1),
remove_lines = list("/\\*\\sdetermine\\ssort\\sdirection\\s\\*/", 1),
remove_lines = list("/\\*\\show\\smany\\stokens\\sto\\sprint\\s\\*/", 1),
remove_lines = list("/\\*\\swhen\\susing\\sflags,\\sprint\\snormalised\\stoken\\ssequence.*?\\*/", 1),
remove_lines = list("/\\*\\sprint\\ssequence\\sof\\stokens\\sin\\ssort\\sinterval\\s\\*/", 1),
remove_lines = list("/\\*\\snow,\\sexecute\\sthe\\sexternal\\ssort\\scommand.*?\\*/", 1),
remove_lines = list("/\\*\\srun\\ssort\\scmd\\sand\\sread\\sfrom\\spipe\\s\\*/", 1),
remove_lines = list("/\\*\\snow\\swe\\sshould\\shave\\sread\\sexactly.*?\\*/", 1)
)
),
"src/cwb/cqp/lex.yy.c" = c(
list(),
# See what happens before taking pains to fit this on r1690
if (revision == 1069) list(
# Funktion yyunput auskommentiert, zur Vermeidung von FEhler:
# lex.yy.c:2459:17: warning: unused function 'yyunput' [-Wunused-function]
# auskommentiert: static int input (void)
# um zu vermeiden:
# lex.yy.c:2500:16: warning: function 'input' is not needed and will not be emitted [-Wunneeded-internal-declaration]
delete_line_before = list("/\\*\\*\\sImmediately\\sswitch\\sto\\sa\\sdifferent\\sinput\\sstream\\.", 1L, 111L),
insert_before = list("#ifdef __cplusplus", "/*", 3L),
insert_before = list("/\\*\\*\\sImmediately\\sswitch\\sto\\sa\\sdifferent\\sinput\\sstream\\.", "", 1L),
insert_after = list("#endif", "*/", 27L),
replace = list("^\\s+static\\svoid\\syyunput\\s\\(int\\sc,char\\s\\*buf_ptr\\s+\\);", " /* static void yyunput (int c,char *buf_ptr ); */", 1L)
)
),
"src/cwb/cqp/Makefile" = list(
# Define target 'all' as follows:
# all: libcqp.a
#
# new target added - to generate libcqp.a
# libcqp.a: $(OBJS) $(CQI_OBJS)
# $(RM) $@
# $(AR) $@ $^
# $(RANLIB) $@
delete_line_before = list("^clean:$", 1L, 7L),
delete_line_before = list("^cqp\\$\\(EXEC_SUFFIX\\):", 1L, 8L),
insert_before = list("^cqp\\$\\(EXEC_SUFFIX\\):.*", "libcqp.a: $(OBJS) $(CQI_OBJS)\n\t$(RM) $@\n\t$(AR) cq $@ $^\n", 1L),
replace = list("all:\\s\\$\\(PROGRAMS\\)", "all: libcqp.a", 1L),
replace = list("^TOP\\s=\\s\\$\\(shell\\spwd\\)/\\.\\.", "TOP = $(R_PACKAGE_SOURCE)", 1L),
remove_lines = list("\\s+-\\$\\(RM\\)\\slex\\.yy\\.c\\sparser\\.tab\\.c\\sparser\\.tab\\.h", 1L)
),
"src/cwb/cqp/hash.c" = c(
# File not there any more at revision 1690
list(),
if (revision == 1069) list(
# The symbols/functions 'hash_string', 'is_prime' and 'find_prime' are
# defined exactly the same way in cl/lexhash.c and cqp/hash.c. To
# avoid linker errors, the functions are commented out in cqp/hash.c
insert_before = list("^\\s*int\\s*$", "/*", 1),
insert_before = list("^\\s*int\\s*$", "/*", 2),
insert_before = list("^unsigned\\sint\\s*$", "/*", 1),
insert_after = list("^\\s*\\}\\s*$", "*/", 1),
insert_after = list("^\\s*\\}\\s*$", "*/", 2),
insert_after = list("^\\s*\\}\\s*$", "*/", 3),
replace = list("^(.*?)\\s*/\\*\\swill\\sexit\\son\\sint\\soverflow\\s\\*/", "\\1", 1)
)
),
"src/cwb/cqp/macro.c" = c(
# The include of hash.h is gone in revision 1690 and there is a macro.h
list(),
if (revision == 1069) list(
insert_before = list('#include\\s"hash\\.h"', '#include "../cl/lexhash.h" /* newly added by AB */', 1)
)
),
"src/cwb/cqp/eval.c" = c(
list(),
# The corpus_size variable is used in revision 1690. This is commented out to see whether problems persist.
if (revision == 1069) list(
replace = list("^(\\s*)if\\s\\(ctptr->pa_ref\\.delete\\)\\s\\{", "\\1if (ctptr->pa_ref.del) {", 2),
replace = list("^(\\s*)if\\s\\(ctptr->pa_ref\\.delete\\)\\s\\{", "\\1if (ctptr->pa_ref.del) {", 1),
replace = list("^(\\s*)if\\s\\(ctptr->sa_ref\\.delete\\)\\s\\{", "\\1if (ctptr->sa_ref.del) {", 1),
replace = list("^(\\s*)if\\s\\(ctptr->idlist\\.delete\\)\\s\\{", "\\1if (ctptr->idlist.del) {", 1),
# eval.c: In function ‘cqp_run_tab_query’:
# eval.c:2911:21: warning: variable ‘corpus_size’ set but not used [-Wunused-but-set-variable]
# int smallest_col, corpus_size;
replace = list("^(\\s*)int\\ssmallest_col,\\scorpus_size;", "\\1int smallest_col;", 1),
replace = list("^(\\s*)corpus_size\\s=\\sevalenv->query_corpus->mother_size;", "\\1/* corpus_size = evalenv->query_corpus->mother_size; */", 1),
# The line 'assert(col->type = tabular)' (line 2891) is turned into
# 'assert((col->type = tabular));' to avoid -Wparentheses error (on
# Debian CRAN machine)
replace = list("^(\\s*)assert\\(col->type\\s=\\stabular\\);", "\\1assert((col->type = tabular));", 1)
),
if (revision >= 1690) list(
# eval.c:190:23: error: unknown type name 'bool'
# bool keep_old_ranges)
# eval.c:2815:27: error: use of undeclared identifier 'false'
# false);
# eval.c:3249:64: error: use of undeclared identifier 'false'
# set_corpus_matchlists(evalenv->query_corpus, &result, 1, false); /* return empty result set */
# eval.c:3397:60: error: use of undeclared identifier 'false'
# set_corpus_matchlists(evalenv->query_corpus, &result, 1, false);
replace = list("bool\\skeep_old_ranges)\\s*$", "int keep_old_ranges)", 1),
replace = list("^(\\s*)false);", "\\10);", 1),
replace = list("^(\\s*set_corpus_matchlists\\(evalenv->query_corpus,\\s&result,\\s1,\\s)false);", "\\10);", 1),
replace = list("^(\\s*set_corpus_matchlists\\(evalenv->query_corpus,\\s&result,\\s1,\\s)false);", "\\10);", 1)
)
),
"src/cwb/cqp/eval.h" = c(
list(),
# No matches for 'int delete' in revision 1690
if (revision == 1069) list(
replace = list("^(\\s*)int(\\s+)delete;", "\\1int\\2del;", 3),
replace = list("^(\\s*)int(\\s+)delete;", "\\1int\\2del;", 2),
replace = list("^(\\s*)int(\\s+)delete;", "\\1int\\2del;", 1),
# global variables prepended by "extern"
extern = list(
"int eep;", # no match in r1690
"EvalEnvironment Environment[MAXENVIRONMENT];", # extern'ed in r1690
"EEP CurEnv, evalenv;" # extern'ed in r1690
)
)
),
"src/_eval.h" = c(
list(
delete_line_before = list("^/\\*\\*\\sNumber\\sof\\sAVStructures", 1L, NA),
insert_before = list(
"^/\\*\\*\\sNumber\\sof\\sAVStructures",
c(
'#include "corpmanag.h"',
'',
'typedef struct _label_entry {',
' int flags;',
' char *name;',
' int ref; /**< array index the label refers to */',
' struct _label_entry *next;',
'} *LabelEntry;',
'',
'typedef struct _symbol_table {',
' LabelEntry user; /**< user namespace */',
' LabelEntry rdat; /**< namespace for LAB_RDAT labels */',
' int next_index; /**< next free reference table index */',
'} *SymbolTable;',
'',
'typedef struct dfa {',
' int Max_States; /**< max number of states of the current dfa;',
' state no. 0 is the initial state. */',
' int Max_Input; /**< max number of input chars of the current dfa. */',
' int **TransTable; /**< state transition table of the current dfa. */',
' Boolean *Final; /**< set of final states. */',
' int E_State; /**< Error State -- it is introduced in order to',
' * make the dfa complete, so the state transition',
' * is a total mapping. The value of this variable',
' * is Max_States.',
' */',
'} DFA;'
),
1L
),
replace = list("^\\s*Boolean\\seval_bool\\(Constrainttree\\sctptr,\\sRefTab\\srt,\\sint\\scorppos\\);", "", 1L),
replace = list("^#endif.*$", "", 1L)
),
if (revision == 1069) list(
replace = list("^(\\s*)int(\\s+)delete;", "\\1int\\2del;", 3),
replace = list("^(\\s*)int(\\s+)delete;", "\\1int\\2del;", 2),
replace = list("^(\\s*)int(\\s+)delete;", "\\1int\\2del;", 1)
)
),
"src/cwb/cqp/hash.h" = c(
list(),