2007-08-31 22:01:34 +08:00
|
|
|
/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
|
2004-05-13 14:41:07 +08:00
|
|
|
Contributed by Andy Vaught
|
|
|
|
|
2005-01-13 05:27:33 +08:00
|
|
|
This file is part of the GNU Fortran 95 runtime library (libgfortran).
|
2004-05-13 14:41:07 +08:00
|
|
|
|
2005-01-13 05:27:33 +08:00
|
|
|
Libgfortran is free software; you can redistribute it and/or modify
|
2004-05-13 14:41:07 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
2005-01-13 05:27:33 +08:00
|
|
|
In addition to the permissions in the GNU General Public License, the
|
|
|
|
Free Software Foundation gives you unlimited permission to link the
|
|
|
|
compiled version of this file into combinations with other programs,
|
|
|
|
and to distribute those combinations without any restriction coming
|
|
|
|
from the use of this file. (The General Public License restrictions
|
|
|
|
do apply in other respects; for example, they cover modification of
|
|
|
|
the file, and distribution when not linked into a combine
|
|
|
|
executable.)
|
|
|
|
|
|
|
|
Libgfortran is distributed in the hope that it will be useful,
|
2004-05-13 14:41:07 +08:00
|
|
|
but WITHOUT 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
|
2005-01-13 05:27:33 +08:00
|
|
|
along with libgfortran; see the file COPYING. If not, write to
|
2005-08-17 10:49:08 +08:00
|
|
|
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110-1301, USA. */
|
2004-05-13 14:41:07 +08:00
|
|
|
|
2007-08-31 22:01:34 +08:00
|
|
|
#include "libgfortran.h"
|
|
|
|
|
2004-05-13 14:41:07 +08:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* Environment scanner. Examine the environment for controlling minor
|
|
|
|
* aspects of the program's execution. Our philosophy here that the
|
|
|
|
* environment should not prevent the program from running, so an
|
|
|
|
* environment variable with a messed-up value will be interpreted in
|
|
|
|
* the default way.
|
|
|
|
*
|
|
|
|
* Most of the environment is checked early in the startup sequence,
|
|
|
|
* but other variables are checked during execution of the user's
|
|
|
|
* program. */
|
|
|
|
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
options_t options;
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct variable
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int value, *var;
|
|
|
|
void (*init) (struct variable *);
|
|
|
|
void (*show) (struct variable *);
|
|
|
|
const char *desc;
|
|
|
|
int bad;
|
|
|
|
}
|
|
|
|
variable;
|
|
|
|
|
2006-02-07 04:12:44 +08:00
|
|
|
static void init_unformatted (variable *);
|
2004-05-13 14:41:07 +08:00
|
|
|
|
2006-02-07 04:12:44 +08:00
|
|
|
/* print_spaces()-- Print a particular number of spaces. */
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
print_spaces (int n)
|
|
|
|
{
|
|
|
|
char buffer[80];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (n <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
buffer[i] = ' ';
|
|
|
|
|
|
|
|
buffer[i] = '\0';
|
|
|
|
|
|
|
|
st_printf (buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* var_source()-- Return a string that describes where the value of a
|
|
|
|
* variable comes from */
|
|
|
|
|
|
|
|
static const char *
|
|
|
|
var_source (variable * v)
|
|
|
|
{
|
|
|
|
if (getenv (v->name) == NULL)
|
|
|
|
return "Default";
|
|
|
|
|
|
|
|
if (v->bad)
|
|
|
|
return "Bad ";
|
|
|
|
|
|
|
|
return "Set ";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-10 18:37:59 +08:00
|
|
|
/* init_integer()-- Initialize an integer environment variable. */
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
static void
|
|
|
|
init_integer (variable * v)
|
|
|
|
{
|
|
|
|
char *p, *q;
|
|
|
|
|
2005-04-10 18:37:59 +08:00
|
|
|
p = getenv (v->name);
|
|
|
|
if (p == NULL)
|
|
|
|
goto set_default;
|
|
|
|
|
|
|
|
for (q = p; *q; q++)
|
|
|
|
if (!isdigit (*q) && (p != q || *q != '-'))
|
|
|
|
{
|
|
|
|
v->bad = 1;
|
|
|
|
goto set_default;
|
|
|
|
}
|
|
|
|
|
|
|
|
*v->var = atoi (p);
|
|
|
|
return;
|
|
|
|
|
|
|
|
set_default:
|
|
|
|
*v->var = v->value;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* init_unsigned_integer()-- Initialize an integer environment variable
|
|
|
|
which has to be positive. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_unsigned_integer (variable * v)
|
|
|
|
{
|
|
|
|
char *p, *q;
|
|
|
|
|
2004-05-13 14:41:07 +08:00
|
|
|
p = getenv (v->name);
|
|
|
|
if (p == NULL)
|
|
|
|
goto set_default;
|
|
|
|
|
|
|
|
for (q = p; *q; q++)
|
|
|
|
if (!isdigit (*q))
|
|
|
|
{
|
|
|
|
v->bad = 1;
|
|
|
|
goto set_default;
|
|
|
|
}
|
|
|
|
|
|
|
|
*v->var = atoi (p);
|
|
|
|
return;
|
|
|
|
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
set_default:
|
2004-05-13 14:41:07 +08:00
|
|
|
*v->var = v->value;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* show_integer()-- Show an integer environment variable */
|
|
|
|
|
|
|
|
static void
|
|
|
|
show_integer (variable * v)
|
|
|
|
{
|
|
|
|
st_printf ("%s %d\n", var_source (v), *v->var);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* init_boolean()-- Initialize a boolean environment variable. We
|
|
|
|
* only look at the first letter of the variable. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_boolean (variable * v)
|
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = getenv (v->name);
|
|
|
|
if (p == NULL)
|
|
|
|
goto set_default;
|
|
|
|
|
|
|
|
if (*p == '1' || *p == 'Y' || *p == 'y')
|
|
|
|
{
|
|
|
|
*v->var = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*p == '0' || *p == 'N' || *p == 'n')
|
|
|
|
{
|
|
|
|
*v->var = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
v->bad = 1;
|
|
|
|
|
|
|
|
set_default:
|
|
|
|
*v->var = v->value;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* show_boolean()-- Show a boolean environment variable */
|
|
|
|
|
|
|
|
static void
|
|
|
|
show_boolean (variable * v)
|
|
|
|
{
|
|
|
|
st_printf ("%s %s\n", var_source (v), *v->var ? "Yes" : "No");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_sep (variable * v)
|
|
|
|
{
|
|
|
|
int seen_comma;
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = getenv (v->name);
|
|
|
|
if (p == NULL)
|
|
|
|
goto set_default;
|
|
|
|
|
|
|
|
v->bad = 1;
|
|
|
|
options.separator = p;
|
|
|
|
options.separator_len = strlen (p);
|
|
|
|
|
|
|
|
/* Make sure the separator is valid */
|
|
|
|
|
|
|
|
if (options.separator_len == 0)
|
|
|
|
goto set_default;
|
|
|
|
seen_comma = 0;
|
|
|
|
|
|
|
|
while (*p)
|
|
|
|
{
|
|
|
|
if (*p == ',')
|
|
|
|
{
|
|
|
|
if (seen_comma)
|
|
|
|
goto set_default;
|
|
|
|
seen_comma = 1;
|
|
|
|
p++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*p++ != ' ')
|
|
|
|
goto set_default;
|
|
|
|
}
|
|
|
|
|
|
|
|
v->bad = 0;
|
|
|
|
return;
|
|
|
|
|
|
|
|
set_default:
|
|
|
|
options.separator = " ";
|
|
|
|
options.separator_len = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
show_sep (variable * v)
|
|
|
|
{
|
|
|
|
st_printf ("%s \"%s\"\n", var_source (v), options.separator);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
init_string (variable * v __attribute__ ((unused)))
|
2004-05-13 14:41:07 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
show_string (variable * v)
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
|
|
|
|
p = getenv (v->name);
|
|
|
|
if (p == NULL)
|
|
|
|
p = "";
|
|
|
|
|
|
|
|
st_printf ("%s \"%s\"\n", var_source (v), p);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Structure for associating names and values. */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
int value;
|
|
|
|
}
|
|
|
|
choice;
|
|
|
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
{ FP_ROUND_NEAREST, FP_ROUND_UP, FP_ROUND_DOWN, FP_ROUND_ZERO };
|
|
|
|
|
string.c (find_option): Change 3rd argument to const st_option *.
* runtime/string.c (find_option): Change 3rd argument to
const st_option *.
* libgfortran.h (find_option): Likewise.
* runtime/environ.c (rounding, precision, signal_choices): Constify.
(init_choice, show_choice): Change 2nd argument to const choice *.
* io/open.c (access_opt, action_opt, blank_opt, delim_opt, form_opt,
position_opt, status_opt, pad_opt): Constify.
* io/transfer.c (advance_opt): Likewise.
* io/inquire.c (undefined): Likewise.
* io/close.c (status_opt): Likewise.
* io/format.c (posint_required, period_required, nonneg_required,
unexpected_element, unexpected_end, bad_string, bad_hollerith,
reversion_error): Likewise.
* io/unix.c (yes, no, unknown): Change from const char *
into const char [].
From-SVN: r104773
2005-09-29 21:53:59 +08:00
|
|
|
static const choice rounding[] = {
|
2004-05-13 14:41:07 +08:00
|
|
|
{"NEAREST", FP_ROUND_NEAREST},
|
|
|
|
{"UP", FP_ROUND_UP},
|
|
|
|
{"DOWN", FP_ROUND_DOWN},
|
|
|
|
{"ZERO", FP_ROUND_ZERO},
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
{NULL, 0}
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
};
|
|
|
|
|
string.c (find_option): Change 3rd argument to const st_option *.
* runtime/string.c (find_option): Change 3rd argument to
const st_option *.
* libgfortran.h (find_option): Likewise.
* runtime/environ.c (rounding, precision, signal_choices): Constify.
(init_choice, show_choice): Change 2nd argument to const choice *.
* io/open.c (access_opt, action_opt, blank_opt, delim_opt, form_opt,
position_opt, status_opt, pad_opt): Constify.
* io/transfer.c (advance_opt): Likewise.
* io/inquire.c (undefined): Likewise.
* io/close.c (status_opt): Likewise.
* io/format.c (posint_required, period_required, nonneg_required,
unexpected_element, unexpected_end, bad_string, bad_hollerith,
reversion_error): Likewise.
* io/unix.c (yes, no, unknown): Change from const char *
into const char [].
From-SVN: r104773
2005-09-29 21:53:59 +08:00
|
|
|
static const choice precision[] =
|
2004-05-13 14:41:07 +08:00
|
|
|
{
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
{ "24", 1},
|
|
|
|
{ "53", 2},
|
|
|
|
{ "64", 0},
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
{ NULL, 0}
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
};
|
2004-05-13 14:41:07 +08:00
|
|
|
|
string.c (find_option): Change 3rd argument to const st_option *.
* runtime/string.c (find_option): Change 3rd argument to
const st_option *.
* libgfortran.h (find_option): Likewise.
* runtime/environ.c (rounding, precision, signal_choices): Constify.
(init_choice, show_choice): Change 2nd argument to const choice *.
* io/open.c (access_opt, action_opt, blank_opt, delim_opt, form_opt,
position_opt, status_opt, pad_opt): Constify.
* io/transfer.c (advance_opt): Likewise.
* io/inquire.c (undefined): Likewise.
* io/close.c (status_opt): Likewise.
* io/format.c (posint_required, period_required, nonneg_required,
unexpected_element, unexpected_end, bad_string, bad_hollerith,
reversion_error): Likewise.
* io/unix.c (yes, no, unknown): Change from const char *
into const char [].
From-SVN: r104773
2005-09-29 21:53:59 +08:00
|
|
|
static const choice signal_choices[] =
|
2004-05-13 14:41:07 +08:00
|
|
|
{
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
{ "IGNORE", 1},
|
|
|
|
{ "ABORT", 0},
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
{ NULL, 0}
|
2004-05-13 14:41:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
string.c (find_option): Change 3rd argument to const st_option *.
* runtime/string.c (find_option): Change 3rd argument to
const st_option *.
* libgfortran.h (find_option): Likewise.
* runtime/environ.c (rounding, precision, signal_choices): Constify.
(init_choice, show_choice): Change 2nd argument to const choice *.
* io/open.c (access_opt, action_opt, blank_opt, delim_opt, form_opt,
position_opt, status_opt, pad_opt): Constify.
* io/transfer.c (advance_opt): Likewise.
* io/inquire.c (undefined): Likewise.
* io/close.c (status_opt): Likewise.
* io/format.c (posint_required, period_required, nonneg_required,
unexpected_element, unexpected_end, bad_string, bad_hollerith,
reversion_error): Likewise.
* io/unix.c (yes, no, unknown): Change from const char *
into const char [].
From-SVN: r104773
2005-09-29 21:53:59 +08:00
|
|
|
init_choice (variable * v, const choice * c)
|
2004-05-13 14:41:07 +08:00
|
|
|
{
|
|
|
|
char *p;
|
|
|
|
|
|
|
|
p = getenv (v->name);
|
|
|
|
if (p == NULL)
|
|
|
|
goto set_default;
|
|
|
|
|
|
|
|
for (; c->name; c++)
|
|
|
|
if (strcasecmp (c->name, p) == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (c->name == NULL)
|
|
|
|
{
|
|
|
|
v->bad = 1;
|
|
|
|
goto set_default;
|
|
|
|
}
|
|
|
|
|
|
|
|
*v->var = c->value;
|
|
|
|
return;
|
|
|
|
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
set_default:
|
2004-05-13 14:41:07 +08:00
|
|
|
*v->var = v->value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
string.c (find_option): Change 3rd argument to const st_option *.
* runtime/string.c (find_option): Change 3rd argument to
const st_option *.
* libgfortran.h (find_option): Likewise.
* runtime/environ.c (rounding, precision, signal_choices): Constify.
(init_choice, show_choice): Change 2nd argument to const choice *.
* io/open.c (access_opt, action_opt, blank_opt, delim_opt, form_opt,
position_opt, status_opt, pad_opt): Constify.
* io/transfer.c (advance_opt): Likewise.
* io/inquire.c (undefined): Likewise.
* io/close.c (status_opt): Likewise.
* io/format.c (posint_required, period_required, nonneg_required,
unexpected_element, unexpected_end, bad_string, bad_hollerith,
reversion_error): Likewise.
* io/unix.c (yes, no, unknown): Change from const char *
into const char [].
From-SVN: r104773
2005-09-29 21:53:59 +08:00
|
|
|
show_choice (variable * v, const choice * c)
|
2004-05-13 14:41:07 +08:00
|
|
|
{
|
|
|
|
st_printf ("%s ", var_source (v));
|
|
|
|
|
|
|
|
for (; c->name; c++)
|
|
|
|
if (c->value == *v->var)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (c->name)
|
|
|
|
st_printf ("%s\n", c->name);
|
|
|
|
else
|
|
|
|
st_printf ("(Unknown)\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static variable variable_table[] = {
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
{"GFORTRAN_STDIN_UNIT", GFC_STDIN_UNIT_NUMBER, &options.stdin_unit,
|
|
|
|
init_integer, show_integer,
|
2004-05-13 14:41:07 +08:00
|
|
|
"Unit number that will be preconnected to standard input\n"
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"(No preconnection if negative)", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
{"GFORTRAN_STDOUT_UNIT", GFC_STDOUT_UNIT_NUMBER, &options.stdout_unit,
|
|
|
|
init_integer, show_integer,
|
2004-05-13 14:41:07 +08:00
|
|
|
"Unit number that will be preconnected to standard output\n"
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"(No preconnection if negative)", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
{"GFORTRAN_STDERR_UNIT", GFC_STDERR_UNIT_NUMBER, &options.stderr_unit,
|
|
|
|
init_integer, show_integer,
|
2005-01-23 08:14:31 +08:00
|
|
|
"Unit number that will be preconnected to standard error\n"
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"(No preconnection if negative)", 0},
|
2005-01-23 08:14:31 +08:00
|
|
|
|
2004-05-13 14:41:07 +08:00
|
|
|
{"GFORTRAN_USE_STDERR", 1, &options.use_stderr, init_boolean,
|
|
|
|
show_boolean,
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"Sends library output to standard error instead of standard output.", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
{"GFORTRAN_TMPDIR", 0, NULL, init_string, show_string,
|
|
|
|
"Directory for scratch files. Overrides the TMP environment variable\n"
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"If TMP is not set " DEFAULT_TEMPDIR " is used.", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
{"GFORTRAN_UNBUFFERED_ALL", 0, &options.all_unbuffered, init_boolean,
|
|
|
|
show_boolean,
|
|
|
|
"If TRUE, all output is unbuffered. This will slow down large writes "
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"but can be\nuseful for forcing data to be displayed immediately.", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
{"GFORTRAN_SHOW_LOCUS", 1, &options.locus, init_boolean, show_boolean,
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"If TRUE, print filename and line number where runtime errors happen.", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
{"GFORTRAN_OPTIONAL_PLUS", 0, &options.optional_plus, init_boolean, show_boolean,
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"Print optional plus signs in numbers where permitted. Default FALSE.", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
{"GFORTRAN_DEFAULT_RECL", DEFAULT_RECL, &options.default_recl,
|
2005-04-10 21:08:12 +08:00
|
|
|
init_unsigned_integer, show_integer,
|
2004-05-13 14:41:07 +08:00
|
|
|
"Default maximum record length for sequential files. Most useful for\n"
|
|
|
|
"adjusting line length of preconnected units. Default "
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
stringize (DEFAULT_RECL), 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
{"GFORTRAN_LIST_SEPARATOR", 0, NULL, init_sep, show_sep,
|
2006-10-19 01:17:49 +08:00
|
|
|
"Separator to use when writing list output. May contain any number of "
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
"spaces\nand at most one comma. Default is a single space.", 0},
|
2004-05-13 14:41:07 +08:00
|
|
|
|
2006-02-07 04:12:44 +08:00
|
|
|
/* GFORTRAN_CONVERT_UNIT - Set the default data conversion for
|
|
|
|
unformatted I/O. */
|
|
|
|
{"GFORTRAN_CONVERT_UNIT", 0, 0, init_unformatted, show_string,
|
|
|
|
"Set format for unformatted files", 0},
|
|
|
|
|
2007-01-18 20:54:11 +08:00
|
|
|
/* Behaviour when encoutering a runtime error. */
|
|
|
|
{"GFORTRAN_ERROR_DUMPCORE", -1, &options.dump_core,
|
|
|
|
init_boolean, show_boolean,
|
|
|
|
"Dump a core file (if possible) on runtime error", -1},
|
|
|
|
|
gfortran.h (gfc_option_t): Add flag_backtrace field.
* gfortran.h (gfc_option_t): Add flag_backtrace field.
* lang.opt: Add -fbacktrace option.
* invoke.texi: Document the new option.
* trans-decl.c (gfc_build_builtin_function_decls): Add new
option to the call to set_std.
* options.c (gfc_init_options, gfc_handle_option): Handle the
new option.
* runtime/backtrace.c: New file.
* runtime/environ.c (variable_table): New GFORTRAN_ERROR_BACKTRACE
environment variable.
* runtime/compile_options.c (set_std): Add new argument.
* runtime/main.c (store_exe_path, full_exe_path): New functions.
* runtime/error.c (sys_exit): Add call to show_backtrace.
* libgfortran.h (options_t): New backtrace field.
(store_exe_path, full_exe_path, show_backtrace): New prototypes.
* configure.ac: Add checks for execinfo.h, execvp, pipe, dup2,
close, fdopen, strcasestr, getrlimit, backtrace, backtrace_symbols
and getppid.
* Makefile.am: Add runtime/backtrace.c.
* fmain.c (main): Add call to store_exe_path.
* Makefile.in: Renegerate.
* config.h.in: Renegerate.
* configure: Regenerate.
From-SVN: r122954
2007-03-15 20:39:47 +08:00
|
|
|
{"GFORTRAN_ERROR_BACKTRACE", -1, &options.backtrace,
|
|
|
|
init_boolean, show_boolean,
|
|
|
|
"Print out a backtrace (if possible) on runtime error", -1},
|
|
|
|
|
normalize.c (almostone_r4, [...]): Fix parameter list.
* runtime/normalize.c (almostone_r4, almostone_r8): Fix parameter
list.
* intrinsics/random.c (KISS_DEFAULT_SEED): Remove extra semicolon.
* io/transfer.c: Do not use empty initializers for global objects.
Add missing initializers.
* io/lock.c: Do not use empty initializers for global objects.
* io/close.c: Add missing initializers.
* runtime/environ.c: Add missing initializers. Do not use empty
initializers for global object.
(init_string): Mark argument as unused.
* runtime/main.c (cleanup): Fix parameter list.
* io/io.h: Fix parameter lists.
* m4/transpose.m4, m4/matmul.m4: Fix pointer cast to avoid
warning.
* generated/transpose_c4.c, generated/transpose_c8.c,
generated/transpose_i4.c, generated/transpose_i8.c,
generated/matmul_c4.c, generated/matmul_c8.c,
generated/matmul_i4.c, generated/matmul_i8.c,
generated/matmul_r4.c, generated/matmul_r8.c: Regenerated.
* io/write.c (nml_write_obj): Fix 64-bit problem.
* io/list_read.c (nml_get_obj_data): Add missing braces around
initializer to avoid warnings.
* intrinsics/etime.c (etime_sub): Remove unused variable.
From-SVN: r99719
2005-05-15 20:44:42 +08:00
|
|
|
{NULL, 0, NULL, NULL, NULL, NULL, 0}
|
2004-05-13 14:41:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* init_variables()-- Initialize most runtime variables from
|
|
|
|
* environment variables. */
|
|
|
|
|
|
|
|
void
|
|
|
|
init_variables (void)
|
|
|
|
{
|
|
|
|
variable *v;
|
|
|
|
|
|
|
|
for (v = variable_table; v->name; v++)
|
|
|
|
v->init (v);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check_buffered()-- Given an unit number n, determine if an override
|
|
|
|
* for the stream exists. Returns zero for unbuffered, one for
|
|
|
|
* buffered or two for not set. */
|
|
|
|
|
|
|
|
int
|
|
|
|
check_buffered (int n)
|
|
|
|
{
|
libgfortran.h (GFC_ITOA_BUF_SIZE, [...]): Define.
* libgfortran.h (GFC_ITOA_BUF_SIZE, GFC_XTOA_BUF_SIZE,
GFC_OTOA_BUF_SIZE, GFC_BTOA_BUF_SIZE): Define.
(gfc_itoa, xtoa): Add 2 extra arguments.
* runtime/environ.c: Include stdio.h.
(check_buffered): Use sprintf.
* runtime/error.c: Include assert.h.
(gfc_itoa, xtoa): Add 2 extra arguments, avoid using static
buffers.
(st_printf, st_sprintf): Adjust callers.
* io/write.c (otoa, btoa): Add 2 extra arguments, avoid using
static buffers.
(write_int, write_decimal): Add 2 extra arguments to conv
function pointer, adjust caller.
(write_integer): Adjust gfc_itoa caller.
* io/unit.c (get_array_unit_len): Return 0 rather than NULL.
* io/read.c (read_f): Remove spurious pointer dereference.
From-SVN: r104855
2005-10-01 19:50:10 +08:00
|
|
|
char name[22 + sizeof (n) * 3];
|
2004-05-13 14:41:07 +08:00
|
|
|
variable v;
|
|
|
|
int rv;
|
|
|
|
|
|
|
|
if (options.all_unbuffered)
|
|
|
|
return 0;
|
|
|
|
|
libgfortran.h (GFC_ITOA_BUF_SIZE, [...]): Define.
* libgfortran.h (GFC_ITOA_BUF_SIZE, GFC_XTOA_BUF_SIZE,
GFC_OTOA_BUF_SIZE, GFC_BTOA_BUF_SIZE): Define.
(gfc_itoa, xtoa): Add 2 extra arguments.
* runtime/environ.c: Include stdio.h.
(check_buffered): Use sprintf.
* runtime/error.c: Include assert.h.
(gfc_itoa, xtoa): Add 2 extra arguments, avoid using static
buffers.
(st_printf, st_sprintf): Adjust callers.
* io/write.c (otoa, btoa): Add 2 extra arguments, avoid using
static buffers.
(write_int, write_decimal): Add 2 extra arguments to conv
function pointer, adjust caller.
(write_integer): Adjust gfc_itoa caller.
* io/unit.c (get_array_unit_len): Return 0 rather than NULL.
* io/read.c (read_f): Remove spurious pointer dereference.
From-SVN: r104855
2005-10-01 19:50:10 +08:00
|
|
|
sprintf (name, "GFORTRAN_UNBUFFERED_%d", n);
|
2004-05-13 14:41:07 +08:00
|
|
|
|
|
|
|
v.name = name;
|
|
|
|
v.value = 2;
|
|
|
|
v.var = &rv;
|
|
|
|
|
|
|
|
init_boolean (&v);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
show_variables (void)
|
|
|
|
{
|
|
|
|
variable *v;
|
|
|
|
int n;
|
c99_functions.c, [...]: Whitespace fixes.
* intrinsics/c99_functions.c, intrinsics/eoshift0.c,
intrinsics/eoshift2.c, intrinsics/exit.c, intrinsics/flush.c,
intrinsics/ishftc.c, intrinsics/mvbits.c, intrinsics/pack_generic.c,
intrinsics/random.c, intrinsics/reshape_generic.c, intrinsics/size.c,
intrinsics/spread_generic.c, intrinsics/stat.c,
intrinsics/string_intrinsics.c, intrinsics/system_clock.c,
intrinsics/transpose_generic.c, intrinsics/unlink.c,
intrinsics/unpack_generic.c, io/backspace.c, io/format.c,
io/list_read.c, io/lock.c, io/open.c, io/transfer.c, io/unix.c,
io/write.c, runtime/environ.c, runtime/error.c,
runtime/in_pack_generic.c, runtime/in_unpack_generic.c, runtime/main.c,
runtime/memory.c, runtime/pause.c, runtime/stop.c,
runtime/string.c: Whitespace fixes.
From-SVN: r91794
2004-12-07 08:01:01 +08:00
|
|
|
|
|
|
|
/* TODO: print version number. */
|
2004-05-13 14:41:07 +08:00
|
|
|
st_printf ("GNU Fortran 95 runtime library version "
|
|
|
|
"UNKNOWN" "\n\n");
|
|
|
|
|
|
|
|
st_printf ("Environment variables:\n");
|
|
|
|
st_printf ("----------------------\n");
|
|
|
|
|
|
|
|
for (v = variable_table; v->name; v++)
|
|
|
|
{
|
|
|
|
n = st_printf ("%s", v->name);
|
|
|
|
print_spaces (25 - n);
|
|
|
|
|
|
|
|
if (v->show == show_integer)
|
|
|
|
st_printf ("Integer ");
|
|
|
|
else if (v->show == show_boolean)
|
|
|
|
st_printf ("Boolean ");
|
|
|
|
else
|
|
|
|
st_printf ("String ");
|
|
|
|
|
|
|
|
v->show (v);
|
|
|
|
st_printf ("%s\n\n", v->desc);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* System error codes */
|
|
|
|
|
|
|
|
st_printf ("\nRuntime error codes:");
|
|
|
|
st_printf ("\n--------------------\n");
|
|
|
|
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
for (n = LIBERROR_FIRST + 1; n < LIBERROR_LAST; n++)
|
2004-05-13 14:41:07 +08:00
|
|
|
if (n < 0 || n > 9)
|
|
|
|
st_printf ("%d %s\n", n, translate_error (n));
|
|
|
|
else
|
|
|
|
st_printf (" %d %s\n", n, translate_error (n));
|
|
|
|
|
|
|
|
st_printf ("\nCommand line arguments:\n");
|
|
|
|
st_printf (" --help Print this list\n");
|
|
|
|
|
|
|
|
/* st_printf(" --resume <dropfile> Resume program execution from dropfile\n"); */
|
|
|
|
|
|
|
|
sys_exit (0);
|
|
|
|
}
|
2006-02-07 04:12:44 +08:00
|
|
|
|
|
|
|
/* This is the handling of the GFORTRAN_CONVERT_UNITS environment variable.
|
|
|
|
It is called from environ.c to parse this variable, and from
|
|
|
|
open.c to determine if the user specified a default for an
|
|
|
|
unformatted file.
|
|
|
|
The syntax of the environment variable is, in bison grammar:
|
|
|
|
|
|
|
|
GFORTRAN_CONVERT_UNITS: mode | mode ';' exception ;
|
|
|
|
mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
|
|
|
|
exception: mode ':' unit_list | unit_list ;
|
|
|
|
unit_list: unit_spec | unit_list unit_spec ;
|
|
|
|
unit_spec: INTEGER | INTEGER '-' INTEGER ;
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Defines for the tokens. Other valid tokens are ',', ':', '-'. */
|
|
|
|
|
|
|
|
|
|
|
|
#define NATIVE 257
|
|
|
|
#define SWAP 258
|
|
|
|
#define BIG 259
|
|
|
|
#define LITTLE 260
|
|
|
|
/* Some space for additional tokens later. */
|
|
|
|
#define INTEGER 273
|
|
|
|
#define END (-1)
|
|
|
|
#define ILLEGAL (-2)
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int unit;
|
|
|
|
unit_convert conv;
|
|
|
|
} exception_t;
|
|
|
|
|
|
|
|
|
|
|
|
static char *p; /* Main character pointer for parsing. */
|
|
|
|
static char *lastpos; /* Auxiliary pointer, for backing up. */
|
|
|
|
static int unit_num; /* The last unit number read. */
|
|
|
|
static int unit_count; /* The number of units found. */
|
|
|
|
static int do_count; /* Parsing is done twice - first to count the number
|
|
|
|
of units, then to fill in the table. This
|
|
|
|
variable controls what to do. */
|
|
|
|
static exception_t *elist; /* The list of exceptions to the default. This is
|
|
|
|
sorted according to unit number. */
|
|
|
|
static int n_elist; /* Number of exceptions to the default. */
|
|
|
|
|
|
|
|
static unit_convert endian; /* Current endianness. */
|
|
|
|
|
|
|
|
static unit_convert def; /* Default as specified (if any). */
|
|
|
|
|
|
|
|
/* Search for a unit number, using a binary search. The
|
|
|
|
first argument is the unit number to search for. The second argument
|
|
|
|
is a pointer to an index.
|
|
|
|
If the unit number is found, the function returns 1, and the index
|
|
|
|
is that of the element.
|
|
|
|
If the unit number is not found, the function returns 0, and the
|
|
|
|
index is the one where the element would be inserted. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
search_unit (int unit, int *ip)
|
|
|
|
{
|
|
|
|
int low, high, mid;
|
|
|
|
|
|
|
|
low = -1;
|
|
|
|
high = n_elist;
|
|
|
|
while (high - low > 1)
|
|
|
|
{
|
|
|
|
mid = (low + high) / 2;
|
|
|
|
if (unit <= elist[mid].unit)
|
|
|
|
high = mid;
|
|
|
|
else
|
|
|
|
low = mid;
|
|
|
|
}
|
|
|
|
*ip = high;
|
|
|
|
if (elist[high].unit == unit)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This matches a keyword. If it is found, return the token supplied,
|
|
|
|
otherwise return ILLEGAL. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
match_word (const char *word, int tok)
|
|
|
|
{
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (strncasecmp (p, word, strlen (word)) == 0)
|
|
|
|
{
|
|
|
|
p += strlen (word);
|
|
|
|
res = tok;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
res = ILLEGAL;
|
|
|
|
return res;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Match an integer and store its value in unit_num. This only works
|
|
|
|
if p actually points to the start of an integer. The caller has
|
|
|
|
to ensure this. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
match_integer (void)
|
|
|
|
{
|
|
|
|
unit_num = 0;
|
|
|
|
while (isdigit (*p))
|
|
|
|
unit_num = unit_num * 10 + (*p++ - '0');
|
|
|
|
return INTEGER;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This reads the next token from the GFORTRAN_CONVERT_UNITS variable.
|
|
|
|
Returned values are the different tokens. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
next_token (void)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
|
|
|
lastpos = p;
|
|
|
|
switch (*p)
|
|
|
|
{
|
|
|
|
case '\0':
|
|
|
|
result = END;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ':':
|
|
|
|
case ',':
|
|
|
|
case '-':
|
|
|
|
case ';':
|
|
|
|
result = *p;
|
|
|
|
p++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
case 'B':
|
|
|
|
result = match_word ("big_endian", BIG);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'l':
|
|
|
|
case 'L':
|
|
|
|
result = match_word ("little_endian", LITTLE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'n':
|
|
|
|
case 'N':
|
|
|
|
result = match_word ("native", NATIVE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 's':
|
|
|
|
case 'S':
|
|
|
|
result = match_word ("swap", SWAP);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '1': case '2': case '3': case '4': case '5':
|
|
|
|
case '6': case '7': case '8': case '9':
|
|
|
|
result = match_integer ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
result = ILLEGAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Back up the last token by setting back the character pointer. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
push_token (void)
|
|
|
|
{
|
|
|
|
p = lastpos;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called when a unit is identified. If do_count is nonzero,
|
|
|
|
increment the number of units by one. If do_count is zero,
|
|
|
|
put the unit into the table. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_single (int unit)
|
|
|
|
{
|
|
|
|
int i,j;
|
|
|
|
|
|
|
|
if (do_count)
|
|
|
|
{
|
|
|
|
unit_count++;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (search_unit (unit, &i))
|
|
|
|
{
|
|
|
|
elist[unit].conv = endian;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (j=n_elist; j>=i; j--)
|
|
|
|
elist[j+1] = elist[j];
|
|
|
|
|
|
|
|
n_elist += 1;
|
|
|
|
elist[i].unit = unit;
|
|
|
|
elist[i].conv = endian;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is called when a unit range is identified. If do_count is
|
|
|
|
nonzero, increase the number of units. If do_count is zero,
|
|
|
|
put the unit into the table. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
mark_range (int unit1, int unit2)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
if (do_count)
|
|
|
|
unit_count += abs (unit2 - unit1) + 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (unit2 < unit1)
|
|
|
|
for (i=unit2; i<=unit1; i++)
|
|
|
|
mark_single (i);
|
|
|
|
else
|
|
|
|
for (i=unit1; i<=unit2; i++)
|
|
|
|
mark_single (i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Parse the GFORTRAN_CONVERT_UNITS variable. This is called
|
|
|
|
twice, once to count the units and once to actually mark them in
|
2006-10-19 01:17:49 +08:00
|
|
|
the table. When counting, we don't check for double occurrences
|
2006-02-07 04:12:44 +08:00
|
|
|
of units. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
do_parse (void)
|
|
|
|
{
|
2007-05-17 16:39:32 +08:00
|
|
|
int tok;
|
2006-02-07 04:12:44 +08:00
|
|
|
int unit1;
|
|
|
|
int continue_ulist;
|
|
|
|
char *start;
|
|
|
|
|
|
|
|
unit_count = 0;
|
|
|
|
|
|
|
|
start = p;
|
|
|
|
|
|
|
|
/* Parse the string. First, let's look for a default. */
|
|
|
|
tok = next_token ();
|
|
|
|
switch (tok)
|
|
|
|
{
|
|
|
|
case NATIVE:
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_NATIVE;
|
2006-02-07 04:12:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SWAP:
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_SWAP;
|
2006-02-07 04:12:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BIG:
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_BIG;
|
2006-02-07 04:12:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LITTLE:
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_LITTLE;
|
2006-02-07 04:12:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTEGER:
|
|
|
|
/* A leading digit means that we are looking at an exception.
|
|
|
|
Reset the position to the beginning, and continue processing
|
|
|
|
at the exception list. */
|
|
|
|
p = start;
|
|
|
|
goto exceptions;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case END:
|
|
|
|
goto end;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
goto error;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
tok = next_token ();
|
|
|
|
switch (tok)
|
|
|
|
{
|
|
|
|
case ';':
|
|
|
|
def = endian;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ':':
|
|
|
|
/* This isn't a default after all. Reset the position to the
|
|
|
|
beginning, and continue processing at the exception list. */
|
|
|
|
p = start;
|
|
|
|
goto exceptions;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case END:
|
2007-05-17 16:39:32 +08:00
|
|
|
def = endian;
|
2006-02-07 04:12:44 +08:00
|
|
|
goto end;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
goto error;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
exceptions:
|
|
|
|
|
|
|
|
/* Loop over all exceptions. */
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
tok = next_token ();
|
|
|
|
switch (tok)
|
|
|
|
{
|
2007-05-17 16:39:32 +08:00
|
|
|
case NATIVE:
|
|
|
|
if (next_token () != ':')
|
|
|
|
goto error;
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_NATIVE;
|
2007-05-17 16:39:32 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SWAP:
|
|
|
|
if (next_token () != ':')
|
|
|
|
goto error;
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_SWAP;
|
2007-05-17 16:39:32 +08:00
|
|
|
break;
|
|
|
|
|
2006-02-07 04:12:44 +08:00
|
|
|
case LITTLE:
|
|
|
|
if (next_token () != ':')
|
|
|
|
goto error;
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_LITTLE;
|
2006-02-07 04:12:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case BIG:
|
|
|
|
if (next_token () != ':')
|
|
|
|
goto error;
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
endian = GFC_CONVERT_BIG;
|
2006-02-07 04:12:44 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case INTEGER:
|
|
|
|
push_token ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case END:
|
|
|
|
goto end;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
goto error;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* We arrive here when we want to parse a list of
|
|
|
|
numbers. */
|
|
|
|
continue_ulist = 1;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
tok = next_token ();
|
|
|
|
if (tok != INTEGER)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
unit1 = unit_num;
|
|
|
|
tok = next_token ();
|
|
|
|
/* The number can be followed by a - and another number,
|
|
|
|
which means that this is a unit range, a comma
|
|
|
|
or a semicolon. */
|
|
|
|
if (tok == '-')
|
|
|
|
{
|
|
|
|
if (next_token () != INTEGER)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
mark_range (unit1, unit_num);
|
|
|
|
tok = next_token ();
|
|
|
|
if (tok == END)
|
|
|
|
goto end;
|
|
|
|
else if (tok == ';')
|
|
|
|
continue_ulist = 0;
|
|
|
|
else if (tok != ',')
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mark_single (unit1);
|
|
|
|
switch (tok)
|
|
|
|
{
|
|
|
|
case ';':
|
|
|
|
continue_ulist = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ',':
|
|
|
|
break;
|
|
|
|
|
|
|
|
case END:
|
|
|
|
goto end;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} while (continue_ulist);
|
|
|
|
}
|
|
|
|
end:
|
|
|
|
return 0;
|
|
|
|
error:
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
def = GFC_CONVERT_NONE;
|
2006-02-07 04:12:44 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void init_unformatted (variable * v)
|
|
|
|
{
|
|
|
|
char *val;
|
|
|
|
val = getenv (v->name);
|
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675
* libgfortran.h: New file.
* iso-fortran-env.def: Use macros in the new header instead of
hardcoded integer constants.
* Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
fortran/libgfortran.h.
* gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
ioerror_codes): Remove.
* trans.c (ERROR_ALLOCATION): Remove.
(gfc_call_malloc, gfc_allocate_with_status,
gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
* trans-types.h (GFC_DTYPE_*): Remove.
* trans-decl.c (gfc_generate_function_code): Use
GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
* trans-io.c (set_parameter_value, set_parameter_ref): Use
LIBERROR_* macros instead of IOERROR_ macros.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Use
LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
* options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
CONVERT_NATIVE.
(gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
* libgfortran.h: Include gcc/fortran/libgfortran.h.
Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS,
error_codes, GFC_STD_*, GFC_FPE_* and unit_convert.
* runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead
of hardcoded constants.
(do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of
CONVERT_*.
* runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead
of ERROR_BAD_OPTION.
* runtime/error.c (translate_error, generate_error): Use
LIBERROR_* macros instead of ERROR_*.
* io/file_pos.c (formatted_backspace, unformatted_backspace,
st_backspace, st_rewind, st_flush): Rename macros.
* io/open.c (convert_opt, edit_modes, new_unit, already_open,
st_open): Likewise.
* io/close.c (st_close): Likewise.
* io/list_read.c (next_char, convert_integer, parse_repeat,
read_logical, read_integer, read_character, parse_real,
check_type, list_formatted_read_scalar, namelist_read,
nml_err_ret): Likewise.
* io/read.c (convert_real, read_l, read_decimal, read_radix,
read_f): Likewise.
* io/inquire.c (inquire_via_unit): Likewise.
* io/unit.c (get_internal_unit): Likewise.
* io/transfer.c (read_sf, read_block, read_block_direct,
write_block, write_buf, unformatted_read, unformatted_write,
formatted_transfer_scalar, us_read, us_write, data_transfer_init,
skip_record, next_record_r, write_us_marker, next_record_w_unf,
next_record_w, finalize_transfer, st_read, st_write_done):
Likewise.
* io/format.c (format_error): Likewise.
From-SVN: r128050
2007-09-04 00:44:15 +08:00
|
|
|
def = GFC_CONVERT_NONE;
|
2006-02-07 04:12:44 +08:00
|
|
|
n_elist = 0;
|
|
|
|
|
|
|
|
if (val == NULL)
|
|
|
|
return;
|
|
|
|
do_count = 1;
|
|
|
|
p = val;
|
|
|
|
do_parse ();
|
|
|
|
if (do_count <= 0)
|
|
|
|
{
|
|
|
|
n_elist = 0;
|
|
|
|
elist = NULL;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
elist = get_mem (unit_count * sizeof (exception_t));
|
|
|
|
do_count = 0;
|
|
|
|
p = val;
|
|
|
|
do_parse ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the default conversion for for an unformatted unit. */
|
|
|
|
|
|
|
|
unit_convert
|
|
|
|
get_unformatted_convert (int unit)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (elist == NULL)
|
|
|
|
return def;
|
|
|
|
else if (search_unit (unit, &i))
|
|
|
|
return elist[i].conv;
|
|
|
|
else
|
|
|
|
return def;
|
|
|
|
}
|