aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/initialize.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/initialize.c')
-rw-r--r--gcc/ada/initialize.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ada/initialize.c b/gcc/ada/initialize.c
index 00c4d04..1aba5fd 100644
--- a/gcc/ada/initialize.c
+++ b/gcc/ada/initialize.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2012, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2014, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -52,6 +52,7 @@
#endif
#include "raise.h"
+#include <fcntl.h>
#ifdef __cplusplus
extern "C" {
@@ -151,6 +152,39 @@ __gnat_initialize (void *eh ATTRIBUTE_UNUSED)
}
}
+ /* Set current encoding for the IO. */
+ {
+ char *ccsencoding = getenv ("GNAT_CCS_ENCODING");
+
+ /* Default CCS Encoding. */
+ CurrentCCSEncoding = _O_TEXT;
+ __gnat_wide_text_translation_required = 0;
+
+ if (ccsencoding != NULL)
+ {
+ if (strcmp (ccsencoding, "U16TEXT") == 0)
+ {
+ CurrentCCSEncoding = _O_U16TEXT;
+ __gnat_wide_text_translation_required = 1;
+ }
+ else if (strcmp (ccsencoding, "TEXT") == 0)
+ {
+ CurrentCCSEncoding = _O_TEXT;
+ __gnat_wide_text_translation_required = 0;
+ }
+ else if (strcmp (ccsencoding, "WTEXT") == 0)
+ {
+ CurrentCCSEncoding = _O_WTEXT;
+ __gnat_wide_text_translation_required = 1;
+ }
+ else if (strcmp (ccsencoding, "U8TEXT") == 0)
+ {
+ CurrentCCSEncoding = _O_U8TEXT;
+ __gnat_wide_text_translation_required = 1;
+ }
+ }
+ }
+
/* Adjust gnat_argv to support Unicode characters. */
{
LPWSTR *wargv;