Tue Dec 31 19:46:13 2019 UTC ()
bibtex2html: build with current ocaml
(markd)
diff -r1.53 -r1.54 pkgsrc/converters/bibtex2html/Makefile
diff -r1.17 -r1.18 pkgsrc/converters/bibtex2html/distinfo
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-bbl_lexer.mll
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-bib2bib.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-bibfilter.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-bibtex.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-bibtex_parser.mly
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-condition_parser.mly
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-expand.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-latexmacros.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-main.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-readbib.ml
diff -r0 -r1.1 pkgsrc/converters/bibtex2html/patches/patch-translate.ml
diff -r1.1 -r1.2 pkgsrc/converters/bibtex2html/patches/patch-biboutput.ml
diff -r1.1 -r1.2 pkgsrc/converters/bibtex2html/patches/patch-bibtex__lexer.mll
diff -r1.1 -r1.2 pkgsrc/converters/bibtex2html/patches/patch-condition.ml
--- pkgsrc/converters/bibtex2html/Makefile 2019/08/11 13:18:09 1.53
+++ pkgsrc/converters/bibtex2html/Makefile 2019/12/31 19:46:12 1.54
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: Makefile,v 1.53 2019/08/11 13:18:09 wiz Exp $ | | 1 | # $NetBSD: Makefile,v 1.54 2019/12/31 19:46:12 markd Exp $ |
2 | | | 2 | |
3 | DISTNAME= bibtex2html-1.98 | | 3 | DISTNAME= bibtex2html-1.98 |
4 | PKGREVISION= 14 | | 4 | PKGREVISION= 14 |
5 | CATEGORIES= converters | | 5 | CATEGORIES= converters |
6 | MASTER_SITES= http://www.lri.fr/~filliatr/ftp/bibtex2html/ | | 6 | MASTER_SITES= http://www.lri.fr/~filliatr/ftp/bibtex2html/ |
7 | | | 7 | |
8 | MAINTAINER= pkgsrc-users@NetBSD.org | | 8 | MAINTAINER= pkgsrc-users@NetBSD.org |
9 | HOMEPAGE= https://www.lri.fr/~filliatr/bibtex2html/ | | 9 | HOMEPAGE= https://www.lri.fr/~filliatr/bibtex2html/ |
10 | COMMENT= Collection of tools for translating from BibTeX to HTML | | 10 | COMMENT= Collection of tools for translating from BibTeX to HTML |
11 | LICENSE= gnu-gpl-v2 | | 11 | LICENSE= gnu-gpl-v2 |
12 | | | 12 | |
13 | BUILD_DEPENDS+= hevea-[0-9]*:../../textproc/hevea | | 13 | BUILD_DEPENDS+= hevea-[0-9]*:../../textproc/hevea |
14 | BUILD_DEPENDS+= tex-cm-super-[0-9]*:../../fonts/tex-cm-super | | 14 | BUILD_DEPENDS+= tex-cm-super-[0-9]*:../../fonts/tex-cm-super |
| @@ -23,26 +23,28 @@ DEPENDS+= web2c-[0-9]*:../../print/web2c | | | @@ -23,26 +23,28 @@ DEPENDS+= web2c-[0-9]*:../../print/web2c |
23 | | | 23 | |
24 | GNU_CONFIGURE= yes | | 24 | GNU_CONFIGURE= yes |
25 | USE_TOOLS+= perl:run | | 25 | USE_TOOLS+= perl:run |
26 | | | 26 | |
27 | SUBST_CLASSES+= paths | | 27 | SUBST_CLASSES+= paths |
28 | SUBST_MESSAGE.paths= Fixing hardcoded paths. | | 28 | SUBST_MESSAGE.paths= Fixing hardcoded paths. |
29 | SUBST_STAGE.paths= pre-configure | | 29 | SUBST_STAGE.paths= pre-configure |
30 | SUBST_FILES.paths= aux2bib.1 | | 30 | SUBST_FILES.paths= aux2bib.1 |
31 | SUBST_SED.paths= -e 's,/usr/share,${PREFIX}/share,g' | | 31 | SUBST_SED.paths= -e 's,/usr/share,${PREFIX}/share,g' |
32 | | | 32 | |
33 | INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1 | | 33 | INSTALLATION_DIRS+= bin ${PKGMANDIR}/man1 |
34 | INSTALLATION_DIRS+= share/doc/${PKGBASE} | | 34 | INSTALLATION_DIRS+= share/doc/${PKGBASE} |
35 | | | 35 | |
| | | 36 | MAKE_ENV+= ZLIB=-unsafe-string |
| | | 37 | |
36 | .include "../../lang/ocaml/buildlink3.mk" | | 38 | .include "../../lang/ocaml/buildlink3.mk" |
37 | | | 39 | |
38 | post-build: | | 40 | post-build: |
39 | set -e; \ | | 41 | set -e; \ |
40 | cd ${WRKSRC} && ${MAKE} doc | | 42 | cd ${WRKSRC} && ${MAKE} doc |
41 | | | 43 | |
42 | do-install: | | 44 | do-install: |
43 | ${INSTALL_SCRIPT} ${WRKSRC}/aux2bib ${DESTDIR}${PREFIX}/bin | | 45 | ${INSTALL_SCRIPT} ${WRKSRC}/aux2bib ${DESTDIR}${PREFIX}/bin |
44 | ${INSTALL_PROGRAM} ${WRKSRC}/bibtex2html ${DESTDIR}${PREFIX}/bin | | 46 | ${INSTALL_PROGRAM} ${WRKSRC}/bibtex2html ${DESTDIR}${PREFIX}/bin |
45 | ${INSTALL_PROGRAM} ${WRKSRC}/bib2bib ${DESTDIR}${PREFIX}/bin | | 47 | ${INSTALL_PROGRAM} ${WRKSRC}/bib2bib ${DESTDIR}${PREFIX}/bin |
46 | ${INSTALL_MAN} ${WRKSRC}/bibtex2html.1 \ | | 48 | ${INSTALL_MAN} ${WRKSRC}/bibtex2html.1 \ |
47 | ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1 | | 49 | ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1 |
48 | ${INSTALL_MAN} ${WRKSRC}/bibtex2html.1 \ | | 50 | ${INSTALL_MAN} ${WRKSRC}/bibtex2html.1 \ |
--- pkgsrc/converters/bibtex2html/distinfo 2018/03/14 08:28:44 1.17
+++ pkgsrc/converters/bibtex2html/distinfo 2019/12/31 19:46:12 1.18
| @@ -1,9 +1,20 @@ | | | @@ -1,9 +1,20 @@ |
1 | $NetBSD: distinfo,v 1.17 2018/03/14 08:28:44 dholland Exp $ | | 1 | $NetBSD: distinfo,v 1.18 2019/12/31 19:46:12 markd Exp $ |
2 | | | 2 | |
3 | SHA1 (bibtex2html-1.98.tar.gz) = daaa082885a30dae38263614565298d4862b8331 | | 3 | SHA1 (bibtex2html-1.98.tar.gz) = daaa082885a30dae38263614565298d4862b8331 |
4 | RMD160 (bibtex2html-1.98.tar.gz) = f47dda14108c3f53bca64352bfb7455f1b79d964 | | 4 | RMD160 (bibtex2html-1.98.tar.gz) = f47dda14108c3f53bca64352bfb7455f1b79d964 |
5 | SHA512 (bibtex2html-1.98.tar.gz) = 7d8480ed87bef74a1e0c970446fba4d30b103df3e78f127a051efff875032ac7f52d3d6baab0c6a2fc67ca11f3d558d7be4439311934f99067993b5891ff6ad4 | | 5 | SHA512 (bibtex2html-1.98.tar.gz) = 7d8480ed87bef74a1e0c970446fba4d30b103df3e78f127a051efff875032ac7f52d3d6baab0c6a2fc67ca11f3d558d7be4439311934f99067993b5891ff6ad4 |
6 | Size (bibtex2html-1.98.tar.gz) = 92719 bytes | | 6 | Size (bibtex2html-1.98.tar.gz) = 92719 bytes |
7 | SHA1 (patch-biboutput.ml) = 42d07071fd85fd1be47e522a4f957b53693d5b0d | | 7 | SHA1 (patch-bbl_lexer.mll) = e63157f319825aad196f0628f04e1065e5f3cfa8 |
8 | SHA1 (patch-bibtex__lexer.mll) = 207d8442dc87465cfed478d2d97445ba3bd90d9f | | 8 | SHA1 (patch-bib2bib.ml) = 37e8ac8e9f7453f304423dce25bd3b5481909aaf |
9 | SHA1 (patch-condition.ml) = f00078a8a16a6c47416e08b378d51db782f8e7f2 | | 9 | SHA1 (patch-bibfilter.ml) = 52f74806d12bd1d4838ac02ed1cce4a835f6cdc1 |
| | | 10 | SHA1 (patch-biboutput.ml) = 434f695c89aeeb4c6768d9d78502b5995aeb772c |
| | | 11 | SHA1 (patch-bibtex.ml) = 4e68071f920d7d04b0fe8e40c3e5196d6a5742da |
| | | 12 | SHA1 (patch-bibtex__lexer.mll) = 0e5ea0a0d0f3500a73635a9ddebad93175400027 |
| | | 13 | SHA1 (patch-bibtex_parser.mly) = dbd957eb6a47203baea103ef015583073128c1b7 |
| | | 14 | SHA1 (patch-condition.ml) = ff4cb8380df6f324554037ab4ae9d42d7fe28eb9 |
| | | 15 | SHA1 (patch-condition_parser.mly) = 7d44a5606c969fa1eb40ee1bc3f93ab8ae4e1c66 |
| | | 16 | SHA1 (patch-expand.ml) = d83740b76bbedb375519db2d2cd9d8458daa5ba8 |
| | | 17 | SHA1 (patch-latexmacros.ml) = a3beb18495de348246e7a8039838bab3d7c766e7 |
| | | 18 | SHA1 (patch-main.ml) = 3afed48b57d5858962f4b4bc5be15190014db41c |
| | | 19 | SHA1 (patch-readbib.ml) = 888fbca4bad5c0597af1315b834574072ca005fb |
| | | 20 | SHA1 (patch-translate.ml) = 222d3a9a1208e54fd54c1bc52ed784c59bf2a531 |
$NetBSD: patch-bbl_lexer.mll,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- bbl_lexer.mll.orig 2014-07-04 07:51:21.000000000 +0000
+++ bbl_lexer.mll
@@ -39,7 +39,7 @@ rule biblio_header = parse
{ biblio_name lexbuf }
| eof
{ raise End_of_file }
- | _
+ | _
{ biblio_header lexbuf }
and biblio_name = parse
@@ -48,15 +48,15 @@ and biblio_name = parse
let s = String.sub l 1 (String.length l - 2) in
Some s }
| _
- { None }
+ { None }
and bibitem = parse
| "\\end{thebibliography}"
{ raise End_of_biblio }
| '\\' ['a'-'z']* "bibitem"
{ brace_depth := 0;
- begin try bibitem1 lexbuf
- with Failure "lexing: empty token" -> opt_ref := None end;
+ begin try bibitem1 lexbuf
+ with Failure _ -> opt_ref := None end;
bibitem2 lexbuf }
| _ { bibitem lexbuf }
@@ -70,7 +70,7 @@ and bibitem1_body = parse
| eof { raise End_of_file }
and bibitem2 = parse
- | '{' { Buffer.reset buf;
+ | '{' { Buffer.reset buf;
key := bibitem2_body lexbuf;
skip_end_of_line lexbuf;
Buffer.reset buf;
$NetBSD: patch-bib2bib.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- bib2bib.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ bib2bib.ml
@@ -33,10 +33,10 @@ let get_input_file_name f =
let condition = ref Condition.True
-let add_condition c =
+let add_condition c =
try
let c = Parse_condition.condition c in
- condition := if !condition = Condition.True then c
+ condition := if !condition = Condition.True then c
else Condition.And(!condition,c)
with
Condition_lexer.Lex_error msg ->
@@ -77,92 +77,92 @@ let args_spec =
("-d", Arg.Set Options.debug, "debug flag");
("-q", Arg.Set Options.quiet, "quiet flag");
("--quiet", Arg.Set Options.quiet, "quiet flag");
- ("-s", Arg.String
- (fun s -> sort_criteria := (String.lowercase s):: !sort_criteria),
+ ("-s", Arg.String
+ (fun s -> sort_criteria := (String.lowercase_ascii s):: !sort_criteria),
"<c> sort with respect to keys (if c=$key) or a given field <c>");
("-r", Arg.Set reverse_sort,
"reverse the sort order");
- ("--no-comment", Arg.Unit (fun () -> no_comment := true),
+ ("--no-comment", Arg.Unit (fun () -> no_comment := true),
"do not add extra comments at beginning");
- ("--remove", Arg.String
- (fun s -> remove_fields := (String.lowercase s):: !remove_fields),
+ ("--remove", Arg.String
+ (fun s -> remove_fields := (String.lowercase_ascii s):: !remove_fields),
"<f> removes the field <f>");
- ("--rename",
- Arg.Tuple
+ ("--rename",
+ Arg.Tuple
[ Arg.Set_string rename_field ;
- Arg.String (fun s -> rename_fields :=
- (String.lowercase !rename_field,
- String.lowercase s):: !rename_fields)],
+ Arg.String (fun s -> rename_fields :=
+ (String.lowercase_ascii !rename_field,
+ String.lowercase_ascii s):: !rename_fields)],
"<f1> <f2> rename field <f1> into <f2>");
- ("--expand", Arg.Unit (fun () -> expand_abbrevs := true),
+ ("--expand", Arg.Unit (fun () -> expand_abbrevs := true),
"expand the abbreviations");
- ("--expand-xrefs", Arg.Unit (fun () -> expand_xrefs := true),
+ ("--expand-xrefs", Arg.Unit (fun () -> expand_xrefs := true),
"expand the cross-references");
- ("--version", Arg.Unit (fun () -> Copying.banner "bib2bib"; exit 0),
+ ("--version", Arg.Unit (fun () -> Copying.banner "bib2bib"; exit 0),
"print version and exit");
- ("--warranty",
+ ("--warranty",
Arg.Unit (fun () -> Copying.banner "bib2bib"; Copying.copying(); exit 0),
"display software warranty")
]
-let output_cite_file keys =
+let output_cite_file keys =
if !cite_output_file_name = "" then
- prerr_endline "No citation file output (no file name specified)"
- else
+ prerr_endline "No citation file output (no file name specified)"
+ else
try
let ch = open_out !cite_output_file_name in
KeySet.iter (fun k -> output_string ch (k ^ "\n")) keys;
close_out ch
- with
+ with
Sys_error msg ->
prerr_endline ("Cannot write output citations file (" ^ msg ^ ")");
exit 1
-let output_bib_file remove rename biblio keys =
- try
- let ch =
- if !bib_output_file_name = ""
- then stdout
- else open_out !bib_output_file_name
- in
- let cmd =
- List.fold_right
- (fun s t ->
- if String.contains s ' '
- then
- if String.contains s '\''
- then " \"" ^ s ^ "\"" ^ t
- else " '" ^ s ^ "'" ^ t
- else " " ^ s ^ t)
- (Array.to_list Sys.argv)
- ""
- in
+let output_bib_file remove rename biblio keys =
+ try
+ let ch =
+ if !bib_output_file_name = ""
+ then stdout
+ else open_out !bib_output_file_name
+ in
+ let cmd =
+ List.fold_right
+ (fun s t ->
+ if String.contains s ' '
+ then
+ if String.contains s '\''
+ then " \"" ^ s ^ "\"" ^ t
+ else " '" ^ s ^ "'" ^ t
+ else " " ^ s ^ t)
+ (Array.to_list Sys.argv)
+ ""
+ in
let comments =
if !no_comment then empty_biblio else
add_new_entry
(Comment ("Command line:" ^ cmd))
- (add_new_entry
- (Comment
+ (add_new_entry
+ (Comment
("This file has been generated by bib2bib "
^ Version.version))
empty_biblio)
in
let biblio = merge_biblios comments biblio in
- Biboutput.output_bib ~remove ~rename ~html:false ch biblio keys;
+ Biboutput.output_bib ~remove ~rename ~html:false ch biblio keys;
if !bib_output_file_name <> "" then close_out ch
- with Sys_error msg ->
- prerr_endline ("Cannot write output bib file (" ^ msg ^ ")");
- exit 1
+ with Sys_error msg ->
+ prerr_endline ("Cannot write output bib file (" ^ msg ^ ")");
+ exit 1
-let output_php_file remove rename biblio keys =
+let output_php_file remove rename biblio keys =
if !php_output_file_name <> "" then
try
let ch = open_out !php_output_file_name in
output_string ch "<?php
-$parsed_bibfile =
+$parsed_bibfile =
Array
(
";
@@ -175,13 +175,13 @@ Array
with Biboutput.Bad_input_for_php msg ->
eprintf "error while producing PHP output: %s\n" msg;
exit 2
-
+
let rec make_compare_fun db criteria c1 c2 =
match criteria with
- | [] -> 0
+ | [] -> 0
| field :: rem ->
- let comp =
+ let comp =
match field with
| "$key" ->
begin
@@ -198,12 +198,12 @@ let rec make_compare_fun db criteria c1
compare s1 s2
| _ -> 0
end
- | "$date" ->
+ | "$date" ->
begin
match (c1,c2) with
| (Entry(s1,t1,l1),Entry(s2,t2,l2)) ->
- Expand.date_compare db
- (s1,t1,Expand.expand_fields l1)
+ Expand.date_compare db
+ (s1,t1,Expand.expand_fields l1)
(s2,t2,Expand.expand_fields l2)
| _ -> 0
end
@@ -211,8 +211,8 @@ let rec make_compare_fun db criteria c1
begin
match (c1,c2) with
| (Entry(_,_,l1),Entry(_,_,l2)) ->
- let s1 =
- try
+ let s1 =
+ try
match List.assoc field l1 with
| [Bibtex.String(s)] -> s
| [Bibtex.Id(s)] -> s
@@ -220,7 +220,7 @@ let rec make_compare_fun db criteria c1
with
Not_found -> ""
and s2 =
- try
+ try
match List.assoc field l2 with
| [Bibtex.String(s)] -> s
| [Bibtex.Id(s)] -> s
@@ -234,10 +234,10 @@ let rec make_compare_fun db criteria c1
in
if comp = 0
then make_compare_fun db rem c1 c2
- else
+ else
if !reverse_sort then -comp else comp
;;
-
+
let usage = "Usage: bib2bib [options] <input file names>\nOptions are:"
@@ -252,40 +252,40 @@ let main () =
done;
end;
if !input_file_names = [] then input_file_names := [""];
- if !Options.debug then begin
+ if !Options.debug then begin
Condition.print !condition; printf "\n"
end;
let all_entries =
List.fold_right
- (fun file accu ->
+ (fun file accu ->
merge_biblios accu (Readbib.read_entries_from_file file))
!input_file_names
empty_biblio
- in
+ in
let abbrv_expanded = Bibtex.expand_abbrevs all_entries in
let xref_expanded = Bibtex.expand_crossrefs abbrv_expanded in
let matching_keys =
Bibfilter.filter xref_expanded
- (fun e k f -> Condition.evaluate_cond e k f !condition)
+ (fun e k f -> Condition.evaluate_cond e k f !condition)
in
if KeySet.cardinal matching_keys = 0 then
begin
eprintf "Warning: no matching reference found.\n";
if !Options.warn_error then exit 2;
end;
-
- let user_expanded =
- if !expand_abbrevs then
- if !expand_xrefs then xref_expanded else abbrv_expanded
- else
- if !expand_xrefs then Bibtex.expand_crossrefs all_entries
+
+ let user_expanded =
+ if !expand_abbrevs then
+ if !expand_xrefs then xref_expanded else abbrv_expanded
+ else
+ if !expand_xrefs then Bibtex.expand_crossrefs all_entries
else all_entries
in
let needed_keys = Bibfilter.saturate user_expanded matching_keys in
(* this should be to right place to sort the output bibliography *)
let final_bib =
if !sort_criteria = [] then user_expanded
- else
+ else
let comp = make_compare_fun (Expand.expand user_expanded) (List.rev !sort_criteria) in
eprintf "Sorting...";
let b = Bibtex.sort comp user_expanded in
@@ -297,8 +297,5 @@ let main () =
output_php_file !remove_fields !rename_fields final_bib (Some needed_keys)
-let _ =
+let _ =
Printexc.catch main ()
-
-
-
$NetBSD: patch-bibfilter.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- bibfilter.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ bibfilter.ml
@@ -28,7 +28,7 @@ let filter biblio criterion =
Bibtex.fold
(fun entry keys ->
match entry with
- Entry(entry_type,key,fields)
+ Entry(entry_type,key,fields)
when criterion entry_type key fields ->
KeySet.add key keys
| _ -> keys)
@@ -41,9 +41,9 @@ let filter biblio criterion =
let rec needed_keys_for_field biblio field value keys abbrevs =
if field = "crossref"
- then
+ then
match value with
- [String(s)] ->
+ [String(s)] ->
if not (KeySet.mem s keys) then
begin
try
@@ -60,7 +60,7 @@ let rec needed_keys_for_field biblio fie
(keys,abbrevs)
end
else (keys,abbrevs)
- | _ ->
+ | _ ->
if not !Options.quiet then
eprintf "Warning: cross-references must be constant strings\n";
if !Options.warn_error then exit 2;
@@ -69,9 +69,9 @@ let rec needed_keys_for_field biblio fie
List.fold_right
(fun a (keys,abbrevs) ->
match a with
- Id(id) ->
- let id = String.lowercase id in
- if not (KeySet.mem id abbrevs)
+ Id(id) ->
+ let id = String.lowercase_ascii id in
+ if not (KeySet.mem id abbrevs)
then
try
let e = find_abbrev id biblio in
@@ -81,7 +81,7 @@ let rec needed_keys_for_field biblio fie
needed_keys_for_entry biblio keys (KeySet.add id abbrevs) e
with Not_found ->
if abbrev_is_implicit id then (keys,abbrevs)
- else
+ else
begin
if not !Options.quiet then
eprintf "Warning: string \"%s\" not found.\n" id;
@@ -101,7 +101,7 @@ and needed_keys_for_entry biblio keys ab
needed_keys_for_field biblio field value keys abbrevs)
fields
(keys,abbrevs)
- | Abbrev(field,value) ->
+ | Abbrev(field,value) ->
needed_keys_for_field biblio field value keys abbrevs
| _ -> (keys,abbrevs)
$NetBSD: patch-bibtex.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- bibtex.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ bibtex.ml
@@ -17,16 +17,16 @@
(*s Datatype for BibTeX bibliographies. *)
type entry_type = string
-
+
type key = string
module KeySet = Set.Make(struct type t = key let compare = compare end)
-
+
type atom =
| Id of string
| String of string
-type command =
+type command =
| Comment of string
| Preamble of atom list
| Abbrev of string * atom list
@@ -51,9 +51,9 @@ let find_entry key biblio =
match b with
| [] -> raise Not_found
| (Entry (_,s,_) as e) :: b ->
- if String.lowercase s = key then e else find key b
+ if String.lowercase_ascii s = key then e else find key b
| _ :: b -> find key b
- in find (String.lowercase key) biblio
+ in find (String.lowercase_ascii key) biblio
let add_new_entry command biblio = command :: biblio
@@ -75,7 +75,7 @@ let add_entry command biblio =
try
let new_bib = remove_entry key biblio in
command :: new_bib
- with Not_found ->
+ with Not_found ->
command :: biblio
end
| _ -> command::biblio
@@ -96,16 +96,16 @@ let merge_biblios b1 b2 =
b1
KeySet.empty
in
- let new_b1 =
+ let new_b1 =
fold
(fun entry accu -> match entry with
- | Entry (_,key,_) ->
- if KeySet.mem key b2keys then
+ | Entry (_,key,_) ->
+ if KeySet.mem key b2keys then
begin
Format.eprintf "Warning, key '%s' duplicated@." key;
if !Options.warn_error then exit 2;
- accu
- end
+ accu
+ end
else entry :: accu
| _ -> entry :: accu)
b1
@@ -114,13 +114,13 @@ let merge_biblios b1 b2 =
let new_bib =
fold
(fun entry accu -> match entry with
- | Abbrev (key,_) ->
- if KeySet.mem key b1abbrevs then
+ | Abbrev (key,_) ->
+ if KeySet.mem key b1abbrevs then
begin
Format.eprintf "Warning, key '%s' duplicated@." key;
if !Options.warn_error then exit 2;
- accu
- end
+ accu
+ end
else entry :: accu
| _ -> entry :: accu)
b2
@@ -137,7 +137,7 @@ let month_env =
let abbrev_is_implicit key =
try
let _ = int_of_string key in true
- with Failure "int_of_string" ->
+ with Failure _ ->
try
let _ = List.assoc key month_env in true
with Not_found -> false
@@ -153,12 +153,12 @@ i*)
let rec find_abbrev key biblio =
match biblio with
| [] -> raise Not_found
- | (Abbrev (s,_) as e) :: b ->
+ | (Abbrev (s,_) as e) :: b ->
if s = key then e
else find_abbrev key b
| _ :: b -> find_abbrev key b
-let concat_atom_lists a1 a2 =
+let concat_atom_lists a1 a2 =
match (a1,a2) with
| ([String s1], [String s2]) -> [String (s1 ^ s2)]
| _ -> a1 @ a2
@@ -175,10 +175,10 @@ let rec expand_list = function
| [] -> []
| ((Id s) as a) :: rem ->
begin
- try
+ try
let v = find_abbrev_in_table s in
concat_atom_lists v (expand_list rem)
- with Not_found ->
+ with Not_found ->
concat_atom_lists [a] (expand_list rem)
end
| ((String _) as a) :: rem ->
@@ -188,13 +188,13 @@ let rec expand_fields = function
| [] -> []
| (n,l) :: rem -> (n, expand_list l) :: (expand_fields rem)
-let rec expand_abbrevs biblio =
- fold
+let rec expand_abbrevs biblio =
+ fold
(fun command accu ->
match command with
| Abbrev (a,l) ->
let s = expand_list l in
- add_abbrev a s;
+ add_abbrev a s;
accu
| Entry (t,k,f) ->
Entry (t,k,expand_fields f) :: accu
@@ -205,30 +205,31 @@ let rec expand_abbrevs biblio =
let add_crossref_fields =
List.fold_left
- (fun acc ((x,_) as d) ->
+ (fun acc ((x,_) as d) ->
if List.mem_assoc x acc then acc else d::acc)
-let rec expand_crossrefs biblio =
+let rec expand_crossrefs biblio =
let crossref_table = Hashtbl.create 97 in
- let add_crossref a l = Hashtbl.add crossref_table (String.lowercase a) l in
- let find_crossref a = Hashtbl.find crossref_table (String.lowercase a) in
- let replace_crossref a l =
- Hashtbl.replace crossref_table (String.lowercase a) l
- in
+ let add_crossref a l =
+ Hashtbl.add crossref_table (String.lowercase_ascii a) l in
+ let find_crossref a =
+ Hashtbl.find crossref_table (String.lowercase_ascii a) in
+ let replace_crossref a l =
+ Hashtbl.replace crossref_table (String.lowercase_ascii a) l in
(* first phase: record needed crossrefs in table *)
- List.iter
+ List.iter
(fun command ->
match command with
| Entry (t,k,f) ->
begin
try
match List.assoc "crossref" f with
- | [String(s)] ->
+ | [String(s)] ->
add_crossref s []
- | _ ->
+ | _ ->
begin
- Format.eprintf
+ Format.eprintf
"Warning: invalid cross-reference in entry '%s'.@." k;
if !Options.warn_error then exit 2;
end
@@ -237,12 +238,12 @@ let rec expand_crossrefs biblio =
| _ -> ())
biblio;
(* second phase: record crossrefs data in table *)
- List.iter
+ List.iter
(fun command ->
match command with
| Entry (t,k,f) ->
begin
- try
+ try
let _ = find_crossref k in
if !Options.debug then
Format.eprintf "recording cross-reference '%s'.@." k;
@@ -252,21 +253,21 @@ let rec expand_crossrefs biblio =
| _ -> ())
biblio;
(* third phase: expand crossrefs *)
- fold
+ fold
(fun command accu ->
match command with
| Entry (t,k,f) ->
begin
try
match List.assoc "crossref" f with
- | [String(s)] ->
+ | [String(s)] ->
begin
- try
+ try
let f = List.remove_assoc "crossref" f in
let f' = find_crossref s in
if f' = [] then
begin
- Format.eprintf
+ Format.eprintf
"Warning: cross-reference '%s' not found.@." s;
if !Options.warn_error then exit 2;
end;
@@ -284,7 +285,7 @@ let rec expand_crossrefs biblio =
-let sort comp bib =
+let sort comp bib =
let comments,preambles,abbrevs,entries =
List.fold_left
(fun (c,p,a,e) command ->
@@ -307,4 +308,3 @@ let sort comp bib =
let current_key = ref ""
-
$NetBSD: patch-bibtex_parser.mly,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- bibtex_parser.mly.orig 2014-07-04 07:51:21.000000000 +0000
+++ bibtex_parser.mly
@@ -17,15 +17,15 @@
/*
* bibtex2html - A BibTeX to HTML translator
* Copyright (C) 1997 Jean-Christophe FILLIATRE
- *
+ *
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
+ *
* See the GNU General Public License version 2 for more details
* (enclosed in the file GPL).
*/
@@ -40,7 +40,7 @@
%}
-%token <string> Tident Tstring Tcomment
+%token <string> Tident Tstring Tcomment
%token <string * string> Tentry
%token Tabbrev Tpreamble Tlbrace Trbrace Tcomma Tequal EOF Tsharp
@@ -67,19 +67,19 @@ command:
| Tpreamble sharp_string_list Trbrace
{ Preamble $2 }
| Tabbrev Tident Tequal sharp_string_list Trbrace
- { Abbrev (String.lowercase $2,$4) }
+ { Abbrev (String.lowercase_ascii $2,$4) }
| entry Tcomma comma_field_list Trbrace
- { let et,key = $1 in Entry (String.lowercase et, key, $3) }
+ { let et,key = $1 in Entry (String.lowercase_ascii et, key, $3) }
;
-entry:
- | Tentry
+entry:
+ | Tentry
{ let et,key = $1 in Bibtex.current_key := key; (et,key) }
comma_field_list:
field Tcomma comma_field_list
{ $1::$3 }
- | field
+ | field
{ [$1] }
| field Tcomma
{ [$1] }
@@ -91,7 +91,7 @@ field:
{ ($1,[String ""]) }
;
field_name:
- Tident { String.lowercase $1 }
+ Tident { String.lowercase_ascii $1 }
| Tcomment { "comment" }
;
sharp_string_list:
@@ -102,7 +102,7 @@ sharp_string_list:
;
atom:
Tident
- { Id (String.lowercase $1) }
+ { Id (String.lowercase_ascii $1) }
| Tstring
{ String $1 }
;
$NetBSD: patch-condition_parser.mly,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- condition_parser.mly.orig 2014-07-04 07:51:21.000000000 +0000
+++ condition_parser.mly
@@ -17,15 +17,15 @@
/*
* bibtex2html - A BibTeX to HTML translator
* Copyright (C) 1997 Jean-Christophe FILLIATRE
- *
+ *
* This software is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation.
- *
+ *
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
+ *
* See the GNU General Public License version 2 for more details
* (enclosed in the file GPL).
*/
@@ -39,7 +39,7 @@
%}
%token <string> IDENT STRING COMP
-%token <string> INT
+%token <string> INT
%token COLON AND OR NOT LPAR RPAR DOLLAR_KEY DOLLAR_TYPE EXISTS EOF
%start condition_start
@@ -64,19 +64,17 @@ condition:
;
atom:
-| cte COLON STRING
+| cte COLON STRING
{ let s = Latex_accents.normalize true $3 in
(*i
Printf.printf "regexp = %s\n" s;
i*)
Match($1, Str.regexp_case_fold s) }
-| cte COMP cte
+| cte COMP cte
{ Comp($1,$2,$3) }
-| EXISTS IDENT
- { Exists(String.lowercase $2) }
+| EXISTS IDENT
+ { Exists(String.lowercase_ascii $2) }
;
-cte: IDENT { Field(String.lowercase $1) } | INT { Cte($1) } | STRING {
+cte: IDENT { Field(String.lowercase_ascii $1) } | INT { Cte($1) } | STRING {
Cte($1) } | DOLLAR_KEY { Key } | DOLLAR_TYPE { Entrytype } ;
-
-
$NetBSD: patch-expand.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- expand.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ expand.ml
@@ -174,7 +174,7 @@ let date_compare el e1 e2 =
(*s Access to the fields. *)
-let get_field (_,_,f) s = List.assoc (String.lowercase s) f
+let get_field (_,_,f) s = List.assoc (String.lowercase_ascii s) f
let get_lowercase_field (_,_,f) s = List.assoc s f
let get_title e = get_lowercase_field e "title"
$NetBSD: patch-latexmacros.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- latexmacros.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ latexmacros.ml
@@ -113,7 +113,7 @@ def "\\textsi" [Print "<i>" ; Print_arg
(* Basic color support. *)
def "\\textcolor" [ Parameterized (function name ->
- match String.lowercase name with
+ match String.lowercase_ascii name with
(* At the moment, we support only the 16 named colors defined in HTML 4.01. *)
| "black" | "silver" | "gray" | "white" | "maroon" | "red" | "purple" | "fuchsia"
| "green" | "lime" | "olive" | "yellow" | "navy" | "blue" | "teal" | "aqua" ->
$NetBSD: patch-main.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- main.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ main.ml
@@ -89,7 +89,7 @@ let sort_entries entries bibitems =
in
let sl =
if !sort = By_date then
- Sort.list (fun (_,_,e1) (_,_,e2) -> Expand.date_order entries e1 e2) el
+ List.sort (fun (_,_,e1) (_,_,e2) -> Expand.date_compare entries e1 e2) el
else
el
in
$NetBSD: patch-readbib.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- readbib.ml.orig 2014-07-04 07:51:21.000000000 +0000
+++ readbib.ml
@@ -21,10 +21,10 @@ open Printf
let read_entries_from_file f =
if not !Options.quiet then begin
- if f = "" then
+ if f = "" then
eprintf "Reading from standard input...\n"
else
- eprintf "Reading %s..." f;
+ eprintf "Reading %s..." f;
flush stderr
end;
let chan = if f = "" then stdin else open_in f in
@@ -36,9 +36,9 @@ let read_entries_from_file f =
eprintf "ok (%d entries).\n" (Bibtex.size el); flush stderr
end;
el
- with Parsing.Parse_error | Failure "unterminated string" ->
+ with Parsing.Parse_error | Failure _ ->
if f <> "" then close_in chan;
- eprintf "Parse error character %d, in or after entry '%s'.\n"
+ eprintf "Parse error character %d, in or after entry '%s'.\n"
(Lexing.lexeme_start lb) !Bibtex.current_key;
flush stderr;
- exit 1
+ exit 1
$NetBSD: patch-translate.ml,v 1.1 2019/12/31 19:46:12 markd Exp $
fixed compilation with recent versions of OCaml
git commit 8f25afb95a839c9f9522a34013d5c905af14378b
--- translate.ml.orig 2014-07-04 07:51:22.000000000 +0000
+++ translate.ml
@@ -69,23 +69,23 @@ let default_fields =
let (fields : field_info list ref) = ref default_fields
let add_field s =
- let u = String.lowercase s in
+ let u = String.lowercase_ascii s in
Biboutput.add_link_field u;
fields := (u, None) :: (List.remove_assoc u !fields)
let add_named_field s name =
- let u = String.lowercase s in
+ let u = String.lowercase_ascii s in
Biboutput.add_link_field u;
if u = "abstract" then abstract_name := name;
if not !both || u <> "abstract" then
fields := (u, Some name) :: (List.remove_assoc u !fields)
let add_note_field s =
- let u = String.lowercase s in
+ let u = String.lowercase_ascii s in
note_fields := !note_fields @ [u, NKlatex]
let add_note_html_field s =
- let u = String.lowercase s in
+ let u = String.lowercase_ascii s in
note_fields := !note_fields @ [u, NKhtml]
(* first pass to get the crossrefs *)
@@ -186,13 +186,13 @@ let file_suffixes =
".rtf"; ".RTF"; ".txt"; ".TXT"; ".html"; ".HTML" ])
let is_http s =
- String.length s > 3 & String.lowercase (String.sub s 0 4) = "http"
+ String.length s > 3 && String.lowercase_ascii (String.sub s 0 4) = "http"
let is_ftp s =
- String.length s > 2 & String.lowercase (String.sub s 0 3) = "ftp"
+ String.length s > 2 && String.lowercase_ascii (String.sub s 0 3) = "ftp"
let is_www s =
- String.length s > 3 & String.lowercase (String.sub s 0 4) = "www:"
+ String.length s > 3 && String.lowercase_ascii (String.sub s 0 4) = "www:"
let is_url s = is_http s || is_ftp s || is_www s
@@ -203,7 +203,8 @@ let file_type f =
if is_http f then "http" else if is_ftp f then "ftp" else "www:"
let get_url s =
- if (String.length s > 3 & String.lowercase (String.sub s 0 3) = "www") then
+ if String.length s > 3 && String.lowercase_ascii (String.sub s 0 3) = "www"
+ then
String.sub s 4 (String.length s - 4)
else
s
@@ -215,7 +216,7 @@ let link_name (u, name) url s = match na
if !raw_url then
url
else if !use_label_name then
- String.capitalize (String.lowercase u)
+ String.capitalize_ascii (String.lowercase_ascii u)
else
s
@@ -422,16 +423,16 @@ let one_entry_summary ch biblio (_,b,((_
output_string ch "\n\n";
open_row ch;
(* JK changes *)
- if (not !nokeys) or !multiple then output_string ch "[";
+ if (not !nokeys) || !multiple then output_string ch "[";
Html.open_anchor ch k;
- if (not !nokeys) or !multiple then begin
+ if (not !nokeys) || !multiple then begin
if !multiple then Html.open_href ch (k ^ !link_suffix);
latex2html ch (if !use_keys then k else Hashtbl.find cite_tab k);
if !multiple then Html.close_href ch;
end else
if !table <> NoTable then output_string ch " ";
Html.close_anchor ch;
- if (not !nokeys) or !multiple then output_string ch "]";
+ if (not !nokeys) || !multiple then output_string ch "]";
(* end of JK changes *)
output_string ch "\n";
new_column ch;
--- pkgsrc/converters/bibtex2html/patches/patch-biboutput.ml 2018/03/14 08:28:44 1.1
+++ pkgsrc/converters/bibtex2html/patches/patch-biboutput.ml 2019/12/31 19:46:12 1.2
| @@ -1,19 +1,19 @@ | | | @@ -1,19 +1,19 @@ |
1 | $NetBSD: patch-biboutput.ml,v 1.1 2018/03/14 08:28:44 dholland Exp $ | | 1 | $NetBSD: patch-biboutput.ml,v 1.2 2019/12/31 19:46:12 markd Exp $ |
2 | | | 2 | |
3 | Fix build with ocaml 4.06. | | 3 | fixed compilation with recent versions of OCaml |
4 | Silence deprecation warnings. | | 4 | git commit 8f25afb95a839c9f9522a34013d5c905af14378b |
5 | | | 5 | |
6 | --- biboutput.ml~ 2014-07-04 07:51:21.000000000 +0000 | | 6 | --- biboutput.ml.orig 2014-07-04 07:51:21.000000000 +0000 |
7 | +++ biboutput.ml | | 7 | +++ biboutput.ml |
8 | @@ -32,7 +32,7 @@ let is_url s = Str.string_match url_re s | | 8 | @@ -32,7 +32,7 @@ let is_url s = Str.string_match url_re s |
9 | | | 9 | |
10 | let print_atom html ch = function | | 10 | let print_atom html ch = function |
11 | | Id s -> | | 11 | | Id s -> |
12 | - if html & not (abbrev_is_implicit s) then | | 12 | - if html & not (abbrev_is_implicit s) then |
13 | + if html && not (abbrev_is_implicit s) then | | 13 | + if html && not (abbrev_is_implicit s) then |
14 | begin | | 14 | begin |
15 | Html.open_href ch ("#" ^ s); | | 15 | Html.open_href ch ("#" ^ s); |
16 | output_string ch s; | | 16 | output_string ch s; |
17 | @@ -40,7 +40,7 @@ let print_atom html ch = function | | 17 | @@ -40,7 +40,7 @@ let print_atom html ch = function |
18 | end | | 18 | end |
19 | else | | 19 | else |
| @@ -25,35 +25,49 @@ Silence deprecation warnings. | | | @@ -25,35 +25,49 @@ Silence deprecation warnings. |
25 | output_string ch s; | | 25 | output_string ch s; |
26 | @@ -131,9 +131,9 @@ let print_command remove rename html htm | | 26 | @@ -131,9 +131,9 @@ let print_command remove rename html htm |
27 | with Not_found -> field | | 27 | with Not_found -> field |
28 | in | | 28 | in |
29 | output_string ch (",\n " ^ ofield ^ " = "); | | 29 | output_string ch (",\n " ^ ofield ^ " = "); |
30 | - if html & field = "crossref" then | | 30 | - if html & field = "crossref" then |
31 | + if html && field = "crossref" then | | 31 | + if html && field = "crossref" then |
32 | print_crossref html ch l | | 32 | print_crossref html ch l |
33 | - else if html & is_link_field field then | | 33 | - else if html & is_link_field field then |
34 | + else if html && is_link_field field then | | 34 | + else if html && is_link_field field then |
35 | print_link_field ch l | | 35 | print_link_field ch l |
36 | else | | 36 | else |
37 | print_atom_list html ch l | | 37 | print_atom_list html ch l |
38 | @@ -162,17 +162,17 @@ let add_backslashes s = | | 38 | @@ -154,26 +154,16 @@ exception Bad_input_for_php of string |
39 | | _ -> 1) | | 39 | |
| | | 40 | (* inspired from String.escaped *) |
| | | 41 | let add_backslashes s = |
| | | 42 | - let n = ref 0 in |
| | | 43 | - for i = 0 to String.length s - 1 do |
| | | 44 | - n := !n + |
| | | 45 | - (match String.unsafe_get s i with |
| | | 46 | - | '\'' | '\\' -> 2 |
| | | 47 | - | _ -> 1) |
| | | 48 | + let n = String.length s in |
| | | 49 | + let b = Buffer.create (2 * n) in |
| | | 50 | + for i = 0 to n - 1 do |
| | | 51 | + let c = String.unsafe_get s i in |
| | | 52 | + begin match c with |
| | | 53 | + | '\'' | '\\' -> Buffer.add_char b '\\' |
| | | 54 | + | _ -> () end; |
| | | 55 | + Buffer.add_char b c |
40 | done; | | 56 | done; |
41 | if !n = String.length s then s else begin | | 57 | - if !n = String.length s then s else begin |
42 | - let s' = String.create !n in | | 58 | - let s' = String.create !n in |
43 | + let s' = Bytes.create !n in | | 59 | - n := 0; |
44 | n := 0; | | 60 | - for i = 0 to String.length s - 1 do |
45 | for i = 0 to String.length s - 1 do | | 61 | - let c = String.unsafe_get s i in |
46 | let c = String.unsafe_get s i in | | 62 | - begin match c with |
47 | begin match c with | | | |
48 | - | ('\'' | '\\') -> String.unsafe_set s' !n '\\'; incr n | | 63 | - | ('\'' | '\\') -> String.unsafe_set s' !n '\\'; incr n |
49 | + | ('\'' | '\\') -> Bytes.unsafe_set s' !n '\\'; incr n | | 64 | - | _ -> () |
50 | | _ -> () | | 65 | - end; |
51 | end; | | | |
52 | - String.unsafe_set s' !n c; incr n | | 66 | - String.unsafe_set s' !n c; incr n |
53 | + Bytes.unsafe_set s' !n c; incr n | | 67 | - done; |
54 | done; | | | |
55 | - s' | | 68 | - s' |
56 | + Bytes.to_string s' | | 69 | - end |
57 | end | | 70 | + Buffer.contents b |
58 | | | 71 | |
59 | let php_print_atom ch = function | | 72 | let php_print_atom ch = function |
| | | 73 | | Id s -> fprintf ch "\'%s\'" s |
--- pkgsrc/converters/bibtex2html/patches/patch-bibtex__lexer.mll 2018/03/14 08:28:44 1.1
+++ pkgsrc/converters/bibtex2html/patches/patch-bibtex__lexer.mll 2019/12/31 19:46:12 1.2
| @@ -1,15 +1,99 @@ | | | @@ -1,15 +1,99 @@ |
1 | $NetBSD: patch-bibtex__lexer.mll,v 1.1 2018/03/14 08:28:44 dholland Exp $ | | 1 | $NetBSD: patch-bibtex__lexer.mll,v 1.2 2019/12/31 19:46:12 markd Exp $ |
2 | | | 2 | |
3 | Silence deprecation warning. | | 3 | fixed compilation with recent versions of OCaml |
| | | 4 | git commit 8f25afb95a839c9f9522a34013d5c905af14378b |
4 | | | 5 | |
5 | --- bibtex_lexer.mll~ 2014-07-04 07:51:21.000000000 +0000 | | 6 | --- bibtex_lexer.mll.orig 2014-07-04 07:51:21.000000000 +0000 |
6 | +++ bibtex_lexer.mll | | 7 | +++ bibtex_lexer.mll |
7 | @@ -60,7 +60,7 @@ rule token = parse | | 8 | @@ -23,7 +23,7 @@ |
| | | 9 | open Lexing |
| | | 10 | open Bibtex_parser |
| | | 11 | |
| | | 12 | -let serious = ref false (* if we are inside a command or not *) |
| | | 13 | +let serious = ref false (* if we are inside a command or not *) |
| | | 14 | |
| | | 15 | let brace_depth = ref 0 |
| | | 16 | |
| | | 17 | @@ -31,12 +31,12 @@ let brace_depth = ref 0 |
| | | 18 | |
| | | 19 | let buffer = Buffer.create 8192 |
| | | 20 | |
| | | 21 | -let reset_string_buffer () = |
| | | 22 | +let reset_string_buffer () = |
| | | 23 | Buffer.reset buffer |
| | | 24 | |
| | | 25 | -let store_string_char c = |
| | | 26 | +let store_string_char c = |
| | | 27 | Buffer.add_char buffer c |
| | | 28 | - |
| | | 29 | + |
| | | 30 | let get_stored_string () = |
| | | 31 | let s = Buffer.contents buffer in |
| | | 32 | Buffer.reset buffer; |
| | | 33 | @@ -55,23 +55,23 @@ let space = [' ' '\t' '\r' '\n'] |
| | | 34 | rule token = parse |
| | | 35 | | space + |
| | | 36 | { token lexbuf } |
| | | 37 | - | '@' space* |
| | | 38 | - ([^ ' ' '\t' '\n' '\r' '{' '(']+ as entry_type) space* |
| | | 39 | + | '@' space* |
| | | 40 | + ([^ ' ' '\t' '\n' '\r' '{' '(']+ as entry_type) space* |
8 | (('{' | '(') as delim) space* | | 41 | (('{' | '(') as delim) space* |
9 | { serious := true; | | 42 | - { serious := true; |
10 | start_delim := delim; | | 43 | - start_delim := delim; |
11 | - match String.lowercase entry_type with | | 44 | - match String.lowercase entry_type with |
12 | + match String.lowercase_ascii entry_type with | | 45 | - | "string" -> |
13 | | "string" -> | | 46 | + { serious := true; |
| | | 47 | + start_delim := delim; |
| | | 48 | + match String.lowercase_ascii entry_type with |
| | | 49 | + | "string" -> |
14 | Tabbrev | | 50 | Tabbrev |
15 | | "comment" -> | | 51 | - | "comment" -> |
| | | 52 | + | "comment" -> |
| | | 53 | reset_string_buffer (); |
| | | 54 | comment lexbuf; |
| | | 55 | serious := false; |
| | | 56 | Tcomment (get_stored_string ()) |
| | | 57 | - | "preamble" -> |
| | | 58 | + | "preamble" -> |
| | | 59 | Tpreamble |
| | | 60 | - | et -> |
| | | 61 | - Tentry (entry_type, key lexbuf) |
| | | 62 | + | et -> |
| | | 63 | + Tentry (entry_type, key lexbuf) |
| | | 64 | } |
| | | 65 | | '=' { if !serious then Tequal else token lexbuf } |
| | | 66 | | '#' { if !serious then Tsharp else token lexbuf } |
| | | 67 | @@ -110,7 +110,7 @@ and string = parse |
| | | 68 | brace lexbuf; |
| | | 69 | store_string_char '}'; |
| | | 70 | string lexbuf |
| | | 71 | - } |
| | | 72 | + } |
| | | 73 | | '"' |
| | | 74 | { () } |
| | | 75 | | "\\\"" |
| | | 76 | @@ -141,10 +141,10 @@ and brace = parse |
| | | 77 | brace lexbuf } |
| | | 78 | |
| | | 79 | and key = parse |
| | | 80 | - | [^ ' ' '\t' '\n' '\r' ',']+ |
| | | 81 | + | [^ ' ' '\t' '\n' '\r' ',']+ |
| | | 82 | { lexeme lexbuf } |
| | | 83 | - | eof |
| | | 84 | - | _ |
| | | 85 | + | eof |
| | | 86 | + | _ |
| | | 87 | { raise Parsing.Parse_error } |
| | | 88 | |
| | | 89 | and comment = parse |
| | | 90 | @@ -153,7 +153,7 @@ and comment = parse |
| | | 91 | | [^ '}' '@'] as c |
| | | 92 | { store_string_char c; |
| | | 93 | comment lexbuf } |
| | | 94 | - | eof |
| | | 95 | + | eof |
| | | 96 | { () } |
| | | 97 | - | _ |
| | | 98 | + | _ |
| | | 99 | { () } |
--- pkgsrc/converters/bibtex2html/patches/patch-condition.ml 2018/03/14 08:28:44 1.1
+++ pkgsrc/converters/bibtex2html/patches/patch-condition.ml 2019/12/31 19:46:12 1.2
| @@ -1,17 +1,73 @@ | | | @@ -1,17 +1,73 @@ |
1 | $NetBSD: patch-condition.ml,v 1.1 2018/03/14 08:28:44 dholland Exp $ | | 1 | $NetBSD: patch-condition.ml,v 1.2 2019/12/31 19:46:12 markd Exp $ |
2 | | | 2 | |
3 | Silence deprecation warnings. | | 3 | fixed compilation with recent versions of OCaml |
| | | 4 | git commit 8f25afb95a839c9f9522a34013d5c905af14378b |
4 | | | 5 | |
5 | --- condition.ml~ 2014-07-04 07:51:21.000000000 +0000 | | 6 | --- condition.ml.orig 2014-07-04 07:51:21.000000000 +0000 |
6 | +++ condition.ml | | 7 | +++ condition.ml |
7 | @@ -54,8 +54,8 @@ let evaluate_constante entrytype key fie | | 8 | @@ -22,10 +22,10 @@ type constante = |
| | | 9 | | Field of string |
| | | 10 | | Cte of string |
| | | 11 | ;; |
| | | 12 | - |
| | | 13 | + |
| | | 14 | type condition = |
| | | 15 | - | True |
| | | 16 | - | False |
| | | 17 | + | True |
| | | 18 | + | False |
| | | 19 | | And of condition * condition |
| | | 20 | | Or of condition * condition |
| | | 21 | | Not of condition |
| | | 22 | @@ -52,12 +52,12 @@ let evaluate_constante entrytype key fie |
| | | 23 | | Cte(x) -> Latex_accents.normalize false x |
| | | 24 | ;; |
8 | | | 25 | |
9 | let eval_comp v1 op v2 = | | 26 | -let eval_comp v1 op v2 = |
| | | 27 | +let eval_comp v1 op v2 = |
10 | match op with | | 28 | match op with |
11 | - | "=" -> String.lowercase v1 = String.lowercase v2 | | 29 | - | "=" -> String.lowercase v1 = String.lowercase v2 |
12 | - | "<>" -> String.lowercase v1 <> String.lowercase v2 | | 30 | - | "<>" -> String.lowercase v1 <> String.lowercase v2 |
13 | + | "=" -> String.lowercase_ascii v1 = String.lowercase_ascii v2 | | 31 | + | "=" -> String.lowercase_ascii v1 = String.lowercase_ascii v2 |
14 | + | "<>" -> String.lowercase_ascii v1 <> String.lowercase_ascii v2 | | 32 | + | "<>" -> String.lowercase_ascii v1 <> String.lowercase_ascii v2 |
15 | | "==" -> v1 = v2 | | 33 | | "==" -> v1 = v2 |
16 | | "!=" -> v1 <> v2 | | 34 | - | "!=" -> v1 <> v2 |
| | | 35 | + | "!=" -> v1 <> v2 |
17 | | _ -> | | 36 | | _ -> |
| | | 37 | let n1 = int_of_string v1 |
| | | 38 | and n2 = int_of_string v2 in |
| | | 39 | @@ -84,12 +84,12 @@ let rec evaluate_rec entrytype key field |
| | | 40 | | Comp(c1,op,c2) -> |
| | | 41 | begin |
| | | 42 | try |
| | | 43 | - let v1 = evaluate_constante entrytype key fields c1 |
| | | 44 | + let v1 = evaluate_constante entrytype key fields c1 |
| | | 45 | and v2 = evaluate_constante entrytype key fields c2 in |
| | | 46 | try |
| | | 47 | eval_comp v1 op v2 |
| | | 48 | with |
| | | 49 | - Failure "int_of_string" -> |
| | | 50 | + Failure _ -> |
| | | 51 | if not !Options.quiet then begin |
| | | 52 | eprintf "Warning: cannot compare non-numeric values "; |
| | | 53 | eprintf "%s and %s in entry %s\n" v1 v2 key |
| | | 54 | @@ -126,7 +126,7 @@ let evaluate_cond entrytype key fields c |
| | | 55 | with |
| | | 56 | Not_found -> assert false |
| | | 57 | ;; |
| | | 58 | - |
| | | 59 | + |
| | | 60 | let string_of_constante = function |
| | | 61 | Key -> "(key)" |
| | | 62 | | Entrytype -> "(entrytype)" |
| | | 63 | @@ -140,9 +140,8 @@ let rec print = function |
| | | 64 | | And(c1,c2) -> printf "("; print c1; printf " and "; print c2; printf ")" |
| | | 65 | | Or(c1,c2) -> printf "("; print c1; printf " or "; print c2; printf ")" |
| | | 66 | | Not(c) -> printf "(not "; print c; printf ")" |
| | | 67 | - | Comp(c1,op,c2) -> |
| | | 68 | + | Comp(c1,op,c2) -> |
| | | 69 | printf "%s %s %s" (string_of_constante c1) op (string_of_constante c2) |
| | | 70 | | Match(c,s) -> printf "%s : (regexp)" (string_of_constante c) |
| | | 71 | | Exists(f) -> printf "exists %s" f |
| | | 72 | ;; |
| | | 73 | - |