This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Add support for the encoding form parameter


Manually tested on Windows
Tested on i686-linux, committed on trunk

These changes are only for the Win32 runtime. In the previous implementation of
the unicode support it was not possible to create file with filenames
containing a character whose code was > 127. This is because in many cases such
character was interpreted as an unicode prefix by the runtime. With the
encoding form parameter it is now possible to specify the filename encoding to
avoid such problem. Note that the default encoding is UTF8 which is then
compatible with the previous implementation.
--
The following program must create a file named: file_[CAPITAL LETTER A ACUTE]
--
with Text_IO; use Text_IO;
procedure C is
   F : File_Type;
begin
   Create (F, Name => "file_["C1"]", Form => "encoding=8bits");
   Put_Line (F, "hello");
   Close (F);
end;

Add also a new function to GNAT.OS_Lib returning the current
time as an OS_Time value.

2007-04-06  Pascal Obry  <obry@adacore.com>
	    Thomas Quinot  <quinot@adacore.com>

	* adaint.c: Replace all occurences of S2WS to S2WSU (Unicode) when
	dealing with filename.
	(__gnat_fopen): Call the proper macro (8bits or UTF8) to convert the
	filename from a standard string to a wide-string depending on the
	encoding value.
	(__gnat_freopen): Idem.
	(__gnat_current_time): New function (wrapper for time(3) standard C
	function).

	* g-os_lib.ads (Current_Time): New function. Returns the current
	system time as an OS_Time value.

	* s-osprim.ads (Clock): Add more precise definition of UNIX epoch.
	(Monotonic_Clock): Same.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]