diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-12 14:58:01 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2013-04-12 14:58:01 +0200 |
commit | 7f18b29a17b0905afb33ab3c0617fc587b766f97 (patch) | |
tree | 6db6862ab6efa3907d870a62cf3e6efc4c96409e /gcc/ada/adaint.c | |
parent | 0c68c6135fcd6bf0b97fc801b1d0ddc606275651 (diff) | |
download | gcc-7f18b29a17b0905afb33ab3c0617fc587b766f97.zip gcc-7f18b29a17b0905afb33ab3c0617fc587b766f97.tar.gz gcc-7f18b29a17b0905afb33ab3c0617fc587b766f97.tar.bz2 |
[multiple changes]
2013-04-12 Robert Dewar <dewar@adacore.com>
* opt.ads (Style_Check_Main): New switch.
* sem.adb (Semantics): Set Style_Check flag properly for new
unit to be analyzed.
* sem_ch10.adb (Analyze_With_Clause): Don't reset Style_Check,
the proper setting of this flag is now part of the Semantics
procedure.
* switch-c.adb (Scan_Front_End_Switches): Set Style_Check_Main
for -gnatg and -gnaty
2013-04-12 Doug Rupp <rupp@adacore.com>
* s-crtl.ads (fopen, freopen): Add vms_form parameter
* i-cstrea.ads (fopen, freopen): Likewise.
* adaint.h (__gnat_fopen, __gnat_freopen): Likewise.
* adaint.c (__gnat_fopen, __gnat_freopen): Likewise.
[VMS]: Split out RMS keys and call CRTL function appropriately.
* s-fileio.adb (Form_VMS_RMS_Keys, Form_RMS_Context_Key): New
subprograms.
(Open, Reset): Call Form_VMS_RMS_Keys. Call fopen,freopen with
vms_form
* gnat_rm.texi: Document implemented RMS keys.
From-SVN: r197902
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r-- | gcc/ada/adaint.c | 75 |
1 files changed, 70 insertions, 5 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index dc94d63..c4bb754 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2012, Free Software Foundation, Inc. * + * Copyright (C) 1992-2013, 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- * @@ -213,6 +213,8 @@ struct vstring #define SYI$_ACTIVECPU_CNT 0x111e extern int LIB$GETSYI (int *, unsigned int *); +extern unsigned int LIB$CALLG_64 + ( unsigned long long argument_list [], int (*user_procedure)(void)); #else #include <utime.h> @@ -820,7 +822,8 @@ __gnat_rmdir (char *path) } FILE * -__gnat_fopen (char *path, char *mode, int encoding ATTRIBUTE_UNUSED) +__gnat_fopen (char *path, char *mode, int encoding ATTRIBUTE_UNUSED, + char *vms_form ATTRIBUTE_UNUSED) { #if defined (_WIN32) && ! defined (__vxworks) && ! defined (IS_CROSS) TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -837,7 +840,37 @@ __gnat_fopen (char *path, char *mode, int encoding ATTRIBUTE_UNUSED) return _tfopen (wpath, wmode); #elif defined (VMS) - return decc$fopen (path, mode); + if (vms_form == 0) + return decc$fopen (path, mode); + else + { + char *local_form = (char *) alloca (strlen (vms_form) + 1); + /* Allocate an argument list of guaranteed ample length. */ + unsigned long long *arg_list = + (unsigned long long *) alloca (strlen (vms_form) + 3); + char *ptrb, *ptre; + int i; + + arg_list [1] = (unsigned long long) path; + arg_list [2] = (unsigned long long) mode; + strcpy (local_form, vms_form); + + /* Given a string such as "\"rfm=udf\",\"rat=cr\"" + Split it into an argument list as "rfm=udf","rat=cr". */ + ptrb = local_form; + for (i = 0; *ptrb; i++) + { + ptrb = strchr (ptrb, '"'); + ptre = strchr (ptrb + 1, '"'); + *ptre = 0; + arg_list [i + 3] = (unsigned long long) (ptrb + 1); + ptrb = ptre + 1; + } + arg_list [0] = i + 2; + /* CALLG_64 returns int , fortunately (FILE *) on VMS is a + always a 32bit pointer. */ + return LIB$CALLG_64 (arg_list, &decc$fopen); + } #else return GNAT_FOPEN (path, mode); #endif @@ -847,7 +880,8 @@ FILE * __gnat_freopen (char *path, char *mode, FILE *stream, - int encoding ATTRIBUTE_UNUSED) + int encoding ATTRIBUTE_UNUSED, + char *vms_form ATTRIBUTE_UNUSED) { #if defined (_WIN32) && ! defined (__vxworks) && ! defined (IS_CROSS) TCHAR wpath[GNAT_MAX_PATH_LEN]; @@ -864,7 +898,38 @@ __gnat_freopen (char *path, return _tfreopen (wpath, wmode, stream); #elif defined (VMS) - return decc$freopen (path, mode, stream); + if (vms_form == 0) + return decc$freopen (path, mode, stream); + else + { + char *local_form = (char *) alloca (strlen (vms_form) + 1); + /* Allocate an argument list of guaranteed ample length. */ + unsigned long long *arg_list = + (unsigned long long *) alloca (strlen (vms_form) + 4); + char *ptrb, *ptre; + int i; + + arg_list [1] = (unsigned long long) path; + arg_list [2] = (unsigned long long) mode; + arg_list [3] = (unsigned long long) stream; + strcpy (local_form, vms_form); + + /* Given a string such as "\"rfm=udf\",\"rat=cr\"" + Split it into an argument list as "rfm=udf","rat=cr". */ + ptrb = local_form; + for (i = 0; *ptrb; i++) + { + ptrb = strchr (ptrb, '"'); + ptre = strchr (ptrb + 1, '"'); + *ptre = 0; + arg_list [i + 4] = (unsigned long long) (ptrb + 1); + ptrb = ptre + 1; + } + arg_list [0] = i + 3; + /* CALLG_64 returns int , fortunately (FILE *) on VMS is a + always a 32bit pointer. */ + return LIB$CALLG_64 (arg_list, &decc$freopen); + } #else return freopen (path, mode, stream); #endif |