jupyter_kernel_1.0.0_8c987c13/sources/ada/magics-write_file.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--  SPDX-FileCopyrightText: 2020 Max Reznik <reznikmm@gmail.com>
--
--  SPDX-License-Identifier: MIT
----------------------------------------------------------------

with Ada.Wide_Wide_Text_IO;

with Jupyter.Kernels;

procedure Magics.Write_File
  (IO_Pub : not null Jupyter.Kernels.IO_Pub_Access;
   Name   : League.Strings.Universal_String;
   Text   : League.Strings.Universal_String;
   Silent : Boolean)
is
   pragma Unreferenced (Silent, IO_Pub);
   Output : Ada.Wide_Wide_Text_IO.File_Type;
begin
   Ada.Wide_Wide_Text_IO.Create
     (Output, Name => Name.To_UTF_8_String, Form => "WCEM=8");
   Ada.Wide_Wide_Text_IO.Put_Line (Output, Text.To_Wide_Wide_String);
   Ada.Wide_Wide_Text_IO.Close (Output);
end Magics.Write_File;