----------------------------------------------------------------------------- -- -- Copyright 2004 Björn Persson. -- -- This library 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. -- -- As a special exception, if other files instantiate generics from this -- unit, or you link this unit with other files to produce an executable, -- this unit does not by itself cause the resulting executable to be covered -- by the General Public License. This exception does not however invalidate -- any other reasons why the executable file might be covered by the General -- Public License. -- ---------------------------------------------------------------------------- pragma License (Modified_Gpl); pragma Ada_2022; with Interfaces.C.Strings; -- with AdaCL.EAstrings; pragma Elaborate_All (Interfaces.C.Strings); -- pragma Elaborate_All (AdaCL.EAstrings); package body AdaCL.EAstrings.OS is procedure Init_Locale; pragma Import (C, Init_Locale, "Init_Locale"); function System_Encoding return Interfaces.C.Strings.chars_ptr; pragma Import (C, System_Encoding, "System_Encoding"); Encoding : Character_Encoding := Null_String_Encoding; -- The real initialization is done below, but without an initialization -- here I get a bug box in Gnat 3.4.0. function OS_Encoding return Character_Encoding is begin return Encoding; end OS_Encoding; begin Init_Locale; Encoding := Encoding_By_Name (Interfaces.C.Strings.Value (System_Encoding)); end AdaCL.EAstrings.OS;