* sysdep.c: Problem discovered during IA64 VMS port. [VMS] #include <unixio.h> to get proper prototypes. * adaint.c: Issues discovered/problems fixed during IA64 VMS port. [VMS] #define _POSIX_EXIT for proper semantics. [VMS] #include <unixio.h> for proper prototypes. [VMS] (fork): #define IA64 version. (__gnat_os_exit): Remove unnecessary VMS specific code. * 3vtrasym.adb: Minor reformatting Use terminology encoded/decoded name, rather than C++ specific notion of mangling (this is the terminology used throughout GNAT). * einfo.h: Regenerated * einfo.ads, einfo.adb: Add new flag Is_Thread_Body * exp_ch6.adb: (Expand_N_Subprogram_Body): Handle expansion of thread body procedure * par-prag.adb: Add dummy entry for Thread_Body pragma * rtsfind.ads: Add entries for System.Threads entities for thread body processing * sem_attr.adb: (Analyze_Pragma, Access attributes): Check these are not applied to a thread body, since this is not permitted * sem_prag.adb: Add processing for Thread_Body pragma. Minor comment fix. * sem_res.adb: (Resolve_Call): Check for incorrect attempt to call a thread body procedure with a direct call. * snames.ads, snames.adb: Add entry for Thread_Body pragma Add names associated with thread body expansion * snames.h: Add entry for Thread_Body pragma * s-thread.adb: Add entries for thread body processing These are dummy bodies so far * s-thread.ads: Add documentation on thread body handling. Add entries for thread body processing. * sem_ch10.adb: (Build_Limited_Views): Return after posting an error in case of limited with_clause on subprograms, generics, instances or generic renamings (Install_Limited_Withed_Unit): Do nothing in case of limited with_clause on subprograms, generics, instances or generic renamings * raise.c (setup_to_install): Correct mistake in last revision; two arguments out of order. * trans.c, cuintp.c, argv.c, aux-io.c, cal.c, errno.c, exit.c, gnatbl.c, init.c, stringt.h, utils.c, utils2.c: Update copyright notice, missed in previous change. Remove trailing blanks and other style errors introduced in previous change. * decl.c (gnat_to_gnu_field): Adjust the conditions under which we get rid of the wrapper for a LJM type, ensuring we don't do that if the field is addressable. This avoids potential low level type view mismatches later on, for instance in a by-reference argument passing process. * decl.c (gnat_to_gnu_field): No longer check for BLKmode being aligned at byte boundary. * decl.c (components_to_record): Do not delete the empty variants from the end of the union type. * exp_ch4.adb (Expand_N_Op_Eq): Use base type when locating primitive operation for a derived type, an explicit declaration may use a local subtype of Boolean. * make.adb (Gnatmake): Allow main sources on the command line with a library project when it is only for compilation (no binding or linking). Part of PR ada/12806: * ada-tree.h (TYPE_DIGITS_VALUE, SET_TYPE_DIGITS_VALUE): Save count as tree, not integer. * decl.c: (gnat_to_gnu_entity, case E_Floating_Point_Type): Save count as tree, not integer. * targtyps.c, decl.c, misc.c, gigi.h (fp_prec_to_size, fp_size_to_prec): Temporary routines to work around change in FP sizing semantics in GCC. * utils.c: (build_vms_descriptor): TYPE_DIGITS_VALUE is tree, not integer. * gigi.h: (enumerate_modes): New function. * Make-lang.in: (ada/misc.o): Add real.h. * misc.c: (enumerate_modes): New function. From-SVN: r73250
112 lines
4.3 KiB
C
112 lines
4.3 KiB
C
/****************************************************************************
|
|
* *
|
|
* GNAT COMPILER COMPONENTS *
|
|
* *
|
|
* A R G V *
|
|
* *
|
|
* C Implementation File *
|
|
* *
|
|
* Copyright (C) 1992-2003 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- *
|
|
* ware Foundation; either version 2, or (at your option) any later ver- *
|
|
* sion. GNAT is distributed in the hope that it will be useful, but WITH- *
|
|
* OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License *
|
|
* for more details. You should have received a copy of the GNU General *
|
|
* Public License distributed with GNAT; see file COPYING. If not, write *
|
|
* to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, *
|
|
* MA 02111-1307, USA. *
|
|
* *
|
|
* As a special exception, if you link this file with other files to *
|
|
* produce an executable, this file does not by itself cause the resulting *
|
|
* executable to be covered by the GNU General Public License. This except- *
|
|
* ion does not however invalidate any other reasons why the executable *
|
|
* file might be covered by the GNU Public License. *
|
|
* *
|
|
* GNAT was originally developed by the GNAT team at New York University. *
|
|
* Extensive contributions were provided by Ada Core Technologies Inc. *
|
|
* *
|
|
****************************************************************************/
|
|
|
|
/* Routines for accessing command line arguments from both the runtime
|
|
library and from the compiler itself. In the former case, gnat_argc
|
|
and gnat_argv are the original argc and argv values as stored by the
|
|
binder generated main program, and these routines are accessed from
|
|
the Ada.Command_Line package. In the compiler case, gnat_argc and
|
|
gnat_argv are the values as modified by toplev, and these routines
|
|
are accessed from the Osint package. */
|
|
|
|
/* Also routines for accessing the environment from the runtime library.
|
|
Gnat_envp is the original envp value as stored by the binder generated
|
|
main program, and these routines are accessed from the
|
|
Ada.Command_Line.Environment package. */
|
|
|
|
#ifdef IN_RTS
|
|
#include "tconfig.h"
|
|
#include "tsystem.h"
|
|
#include <sys/stat.h>
|
|
#else
|
|
#include "config.h"
|
|
#include "system.h"
|
|
#endif
|
|
|
|
#include "adaint.h"
|
|
|
|
/* argc and argv of the main program are saved under gnat_argc and gnat_argv,
|
|
envp of the main program is saved under gnat_envp. */
|
|
|
|
int gnat_argc = 0;
|
|
const char **gnat_argv = (const char **) 0;
|
|
const char **gnat_envp = (const char **) 0;
|
|
|
|
#ifdef _WIN32
|
|
/* Note that on Windows environment the environ point to a buffer that could
|
|
be reallocated if needed. It means that gnat_envp needs to be updated
|
|
before using gnat_envp to point to the right environment space */
|
|
#include <stdlib.h>
|
|
/* for the environ variable definition */
|
|
#define gnat_envp (environ)
|
|
#endif
|
|
|
|
int
|
|
__gnat_arg_count (void)
|
|
{
|
|
return gnat_argc;
|
|
}
|
|
|
|
int
|
|
__gnat_len_arg (int arg_num)
|
|
{
|
|
return strlen (gnat_argv[arg_num]);
|
|
}
|
|
|
|
void
|
|
__gnat_fill_arg (char *a, int i)
|
|
{
|
|
strncpy (a, gnat_argv[i], strlen(gnat_argv[i]));
|
|
}
|
|
|
|
int
|
|
__gnat_env_count (void)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; gnat_envp[i]; i++)
|
|
;
|
|
return i;
|
|
}
|
|
|
|
int
|
|
__gnat_len_env (int env_num)
|
|
{
|
|
return strlen (gnat_envp[env_num]);
|
|
}
|
|
|
|
void
|
|
__gnat_fill_env (char *a, int i)
|
|
{
|
|
strncpy (a, gnat_envp[i], strlen (gnat_envp[i]));
|
|
}
|