@@ -95423,10 +95423,9 @@ let ffi_obj_create obj_params =
95423
95423
let ffi_obj_as_prims obj_params =
95424
95424
["";to_string (Ffi_obj_create obj_params)]
95425
95425
end
95426
- module Ext_cmj_magic
95427
- = struct
95428
- #1 "ext_cmj_magic.ml"
95429
- (* Copyright (C) 2020 Authors of BuckleScript
95426
+ module Ext_digest : sig
95427
+ #1 "ext_digest.mli"
95428
+ (* Copyright (C) 2019- Authors of BuckleScript
95430
95429
*
95431
95430
* This program is free software: you can redistribute it and/or modify
95432
95431
* it under the terms of the GNU Lesser General Public License as published by
@@ -95451,16 +95450,39 @@ module Ext_cmj_magic
95451
95450
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
95452
95451
95453
95452
95454
- let cmj_magic_number = "BUCKLE20200209"
95455
- let cmj_magic_number_length =
95456
- String.length cmj_magic_number
95457
-
95453
+ val length : int
95458
95454
95455
+ val hex_length : int
95456
+ end = struct
95457
+ #1 "ext_digest.ml"
95458
+ (* Copyright (C) 2019- Authors of BuckleScript
95459
+ *
95460
+ * This program is free software: you can redistribute it and/or modify
95461
+ * it under the terms of the GNU Lesser General Public License as published by
95462
+ * the Free Software Foundation, either version 3 of the License, or
95463
+ * (at your option) any later version.
95464
+ *
95465
+ * In addition to the permissions granted to you by the LGPL, you may combine
95466
+ * or link a "work that uses the Library" with a publicly distributed version
95467
+ * of this file to produce a combined library or application, then distribute
95468
+ * that combined work under the terms of your choosing, with no requirement
95469
+ * to comply with the obligations normally placed on you by section 4 of the
95470
+ * LGPL version 3 (or the corresponding section of a later version of the LGPL
95471
+ * should you choose to use a later version).
95472
+ *
95473
+ * This program is distributed in the hope that it will be useful,
95474
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
95475
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95476
+ * GNU Lesser General Public License for more details.
95477
+ *
95478
+ * You should have received a copy of the GNU Lesser General Public License
95479
+ * along with this program; if not, write to the Free Software
95480
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
95459
95481
95460
- let digest_length = 16 (*16 chars *)
95461
95482
95462
- let header_length = cmj_magic_number_length + digest_length
95483
+ let length = 16
95463
95484
95485
+ let hex_length = 32
95464
95486
end
95465
95487
module Lam_primitive : sig
95466
95488
#1 "lam_primitive.mli"
@@ -97388,47 +97410,33 @@ let make
97388
97410
}
97389
97411
97390
97412
97391
- let verify_magic_in_beg ic =
97392
- let buffer = really_input_string ic Ext_cmj_magic.cmj_magic_number_length in
97393
- if buffer <> Ext_cmj_magic.cmj_magic_number then
97394
- Ext_fmt.failwithf ~loc:__LOC__
97395
- "cmj files have incompatible versions, please rebuilt using the new compiler : %s"
97396
- __LOC__
97397
97413
97398
97414
97399
97415
(* Serialization .. *)
97400
97416
let from_file name : t =
97401
97417
let ic = open_in_bin name in
97402
- verify_magic_in_beg ic ;
97403
97418
let _digest = Digest.input ic in
97404
97419
let v : t = input_value ic in
97405
97420
close_in ic ;
97406
97421
v
97407
97422
97408
97423
let from_file_with_digest name : t * Digest.t =
97409
97424
let ic = open_in_bin name in
97410
- verify_magic_in_beg ic ;
97411
97425
let digest = Digest.input ic in
97412
97426
let v : t = input_value ic in
97413
97427
close_in ic ;
97414
97428
v,digest
97415
97429
97416
97430
97417
97431
let from_string s : t =
97418
- let magic_number = String.sub s 0 Ext_cmj_magic.cmj_magic_number_length in
97419
- if magic_number = Ext_cmj_magic.cmj_magic_number then
97420
- Marshal.from_string s Ext_cmj_magic.header_length
97421
- else
97422
- Ext_fmt.failwithf ~loc:__LOC__
97423
- "cmj files have incompatible versions, please rebuilt using the new compiler : %s"
97424
- __LOC__
97432
+ Marshal.from_string s Ext_digest.length
97425
97433
97426
97434
97427
97435
let for_sure_not_changed (name : string) (header : string) =
97428
97436
if Sys.file_exists name then
97429
97437
let ic = open_in_bin name in
97430
97438
let holder =
97431
- really_input_string ic Ext_cmj_magic.header_length in
97439
+ really_input_string ic Ext_digest.length in
97432
97440
close_in ic;
97433
97441
holder = header
97434
97442
else false
@@ -97439,7 +97447,7 @@ let for_sure_not_changed (name : string) (header : string) =
97439
97447
let to_file name ~check_exists (v : t) =
97440
97448
let s = Marshal.to_string v [] in
97441
97449
let cur_digest = Digest.string s in
97442
- let header = Ext_cmj_magic.cmj_magic_number ^ cur_digest in
97450
+ let header = cur_digest in
97443
97451
if not (check_exists && for_sure_not_changed name header) then
97444
97452
let oc = open_out_bin name in
97445
97453
output_string oc header;
0 commit comments