Remove OCaml 4.06-isms from the code.

This commit is contained in:
Richard W.M. Jones 2018-04-17 12:33:03 +01:00
parent 653b082bf4
commit ba46bc4c60
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,52 @@
diff -ur labltk-8.06.4.old/builtin/rawimg.ml labltk-8.06.4/builtin/rawimg.ml
--- labltk-8.06.4.old/builtin/rawimg.ml 2017-10-30 09:19:07.000000000 +0000
+++ labltk-8.06.4/builtin/rawimg.ml 2018-04-17 12:30:40.687146757 +0100
@@ -10,8 +10,6 @@
pixmap_data: bytes
}
-let (.![]<-) = Bytes.set
-
type pixel = string (* 3 chars *)
(* pixmap will be an abstract type *)
@@ -74,9 +72,9 @@
(* Char.chr does range checking *)
let pixel r g b =
let s = Bytes.create 3 in
- s.![0] <- Char.chr r;
- s.![1] <- Char.chr g;
- s.![2] <- Char.chr b;
+ Bytes.set s 0 (Char.chr r);
+ Bytes.set s 1 (Char.chr g);
+ Bytes.set s 2 (Char.chr b);
Bytes.unsafe_to_string s
##ifdef CAMLTK
diff -ur labltk-8.06.4.old/compiler/printer.ml labltk-8.06.4/compiler/printer.ml
--- labltk-8.06.4.old/compiler/printer.ml 2017-10-30 09:19:07.000000000 +0000
+++ labltk-8.06.4/compiler/printer.ml 2018-04-17 12:28:51.853254250 +0100
@@ -18,8 +18,6 @@
open Format;;
-let (.![]<-) = Bytes.set ;;
-
let escape_string s =
let more = ref 0 in
for i = 0 to String.length s - 1 do
@@ -33,8 +31,12 @@
for i = 0 to String.length s - 1 do
let c = s.[i] in
match c with
- | '\\' | '\"' |'\'' -> res.![!j] <- '\\'; incr j; res.![!j] <- c; incr j
- | _ -> res.![!j] <- c; incr j
+ | '\\' | '\"' |'\'' ->
+ Bytes.set res !j '\\';
+ incr j;
+ Bytes.set res !j c;
+ incr j
+ | _ -> Bytes.set res !j c; incr j
done;
Bytes.to_string res
;;

View File

@ -19,6 +19,9 @@ Source0: https://forge.ocamlcore.org/frs/download.php/1727/labltk-8.06.4.t
Patch1: labltk-8.06.0-enable-debugging.patch
Patch2: labltk-8.06.4-enable-more-debugging.patch
# Remove some OCaml 4.06-isms.
Patch3: labltk-8.06.4-remove-ocaml-406-isms.patch
BuildRequires: ocaml
BuildRequires: tcl-devel, tk-devel
@ -46,6 +49,7 @@ This package contains the development files.
%patch1 -p1
%patch2 -p1
%patch3 -p1
# Remove version control files which might get copied into documentation.
find -name .gitignore -delete