+2014-07-18 Robert Dewar <dewar@adacore.com>
+
+ * a-witeio.adb: Minor code reorganization.
+ * i-cstrea.ads: Add comment.
+
+2014-07-18 Thomas Quinot <quinot@adacore.com>
+
+ * s-oscons-tmplt.c (NAME_MAX): Minor cleaup and comment
+ clarifications.
+
2014-07-18 Robert Dewar <dewar@adacore.com>
* g-memdum.adb, g-memdum.ads, exp_strm.adb: Minor reformatting.
FIO.Check_Write_Status (AP (File));
for K in 1 .. Spacing loop
+
+ -- We use Put here (rather than Putc) so that we get the proper
+ -- behavior on windows for output of Wide_String to the console.
+
Put (File, Wide_Character'Val (LM));
+
File.Line := File.Line + 1;
- if File.Page_Length /= 0
- and then File.Line > File.Page_Length
- then
+ if File.Page_Length /= 0 and then File.Line > File.Page_Length then
+
+ -- Same situation as above, use Put instead of Putc
+
Put (File, Wide_Character'Val (PM));
+
File.Line := 1;
File.Page := File.Page + 1;
end if;
Putc (Character'Pos (C), File);
end Out_Char;
- R : int;
- pragma Unreferenced (R);
+ Discard : int;
-- Start of processing for Put
if text_translation_required then
set_wide_text_mode (fileno (File.Stream));
- R := fputwc (Wide_Character'Pos (Item), File.Stream);
+ Discard := fputwc (Wide_Character'Pos (Item), File.Stream);
else
WC_Out (Item, File.WC_Method);
end if;
-- Control of Text/Binary Mode --
---------------------------------
+ -- Is the above section title good enough, given the new addition???
+
-- If text_translation_required is true, then the following functions may
-- be used to dynamically switch a file from binary to text mode or vice
-- versa. These functions have no effect if text_translation_required is
-- false (i.e. in normal unix mode). Use fileno to get a stream handle.
- procedure set_binary_mode (handle : int);
- procedure set_text_mode (handle : int);
+ procedure set_binary_mode (handle : int);
+ procedure set_text_mode (handle : int);
+
+ -- The following needs documentation ???
+
procedure set_wide_text_mode (handle : int);
----------------------------
/* Feature macro definitions */
-/* Define _POSIX_SOURCE to get NAME_MAX, PATH_MAX */
-#define _POSIX_SOURCE
+/**
+ ** Note: we deliberately do not define _POSIX_SOURCE / _POSIX_C_SOURCE
+ ** unconditionally, as on many platforms these macros actually disable
+ ** a number of non-POSIX but useful/required features.
+ **/
#if defined (__linux__) && !defined (_XOPEN_SOURCE)
/* For Linux, define _XOPEN_SOURCE to get IOV_MAX */
/* NAME_MAX is used to compute the allocation size for a struct dirent
* passed to readdir() / readdir_r(). However on some systems it is not
* defined, as it is technically a filesystem dependent property that
- * we should retrieve through pathconf().
+ * we should retrieve through pathconf(). In any case, we do not need a
+ * precise value but only an upper limit.
*/
#ifndef NAME_MAX
# ifdef MAXNAMELEN
/* Solaris has no NAME_MAX but defines MAXNAMELEN */
# define NAME_MAX MAXNAMELEN
-# else
- /* PATH_MAX (maximum length of a full path name) is a safe last
- * chance fall back.
- */
+# elif defined(PATH_MAX)
+ /* PATH_MAX (maximum length of a full path name) is a safe fall back */
# define NAME_MAX PATH_MAX
+# elif defined(FILENAME_MAX)
+ /* Similarly FILENAME_MAX can provide a safe fall back */
+# define NAME_MAX FILENAME_MAX
+# else
+ /* Hardcode a reasonably large value as a last chance fallback */
+# define NAME_MAX 1024
# endif
#endif
CND(NAME_MAX, "Maximum file name length")