annotate tools/bsd_license.ml @ 574:1dc1d41620b6

Builds with Coq 8.15.2
author Adam Chlipala <adam@chlipala.net>
date Sun, 31 Jul 2022 14:48:22 -0400
parents 3fc43e261f67
children
rev   line source
adam@571 1 let read_line () =
amp@546 2 try
amp@546 3 Some (read_line ())
amp@546 4 with End_of_file -> None
amp@546 5
amp@546 6 let print_bsd_licence () = begin
amp@546 7 print_endline " * Three-clause BSD Licence";
amp@546 8 print_endline " *";
amp@546 9 print_endline " * All rights reserved.";
amp@546 10 print_endline " *";
amp@546 11 print_endline " * Redistribution and use in source and binary forms, with or without";
amp@546 12 print_endline " * modification, are permitted provided that the following conditions are met:";
amp@546 13 print_endline " *";
amp@546 14 print_endline " * - Redistributions of source code must retain the above copyright notice,";
amp@546 15 print_endline " * this list of conditions and the following disclaimer.";
amp@546 16 print_endline " * - Redistributions in binary form must reproduce the above copyright notice,";
amp@546 17 print_endline " * this list of conditions and the following disclaimer in the documentation";
amp@546 18 print_endline " * and/or other materials provided with the distribution.";
amp@546 19 print_endline " * - The names of contributors may not be used to endorse or promote products";
amp@546 20 print_endline " * derived from this software without specific prior written permission.";
amp@546 21 print_endline " *";
amp@546 22 print_endline " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"";
amp@546 23 print_endline " * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE";
amp@546 24 print_endline " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE";
amp@546 25 print_endline " * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE";
amp@546 26 print_endline " * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ";
amp@546 27 print_endline " * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF";
amp@546 28 print_endline " * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS";
amp@546 29 print_endline " * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN";
amp@546 30 print_endline " * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)";
amp@546 31 print_endline " * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE";
amp@546 32 print_endline " * POSSIBILITY OF SUCH DAMAGE."
amp@546 33 end
adam@571 34
amp@546 35 let rec initial () =
amp@546 36 match read_line () with
amp@546 37 | None -> ()
amp@546 38 | Some line ->
adam@571 39 let trimmed = String.trim line in
adam@571 40 if String.length trimmed >= 12 && String.sub trimmed 0 12 = "(* Copyright" then begin
adam@571 41 print_endline line;
adam@571 42 copyright_block ()
adam@571 43 end else
adam@571 44 print_endline line;
adam@571 45 initial ()
amp@546 46
amp@546 47 and copyright_block () =
amp@546 48 match read_line () with
amp@546 49 | None -> ()
amp@546 50 | Some line ->
adam@571 51 let trimmed = String.trim line in
adam@571 52 if String.length trimmed >= 2 && String.sub trimmed 0 2 = "*)" then begin
adam@571 53 print_endline line;
adam@571 54 initial ()
adam@571 55 end else if String.length trimmed >= 31 && String.sub trimmed 0 31 = "* This work is licensed under a" then begin
adam@571 56 print_endline line;
adam@571 57 print_bsd_licence ();
adam@571 58 drop_to_end_comment ()
adam@571 59 end else
adam@571 60 print_endline line;
adam@571 61 copyright_block ()
amp@546 62
amp@546 63 and drop_to_end_comment () =
amp@546 64 match read_line () with
amp@546 65 | None -> ()
amp@546 66 | Some line ->
adam@571 67 let trimmed = String.trim line in
adam@571 68 if String.length trimmed >= 2 && String.sub trimmed 0 2 = "*)" then begin
adam@571 69 print_endline line;
adam@571 70 initial ()
adam@571 71 end else
adam@571 72 drop_to_end_comment ()
amp@546 73
amp@546 74 let () = initial ()