+2004-08-31 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * trans-decl.c, trans-expr.c, trans-io.c, trans-types.c: Replace
+ all occurences of 'gfc_strlen_type_node' by
+ 'gfc_charlen_type_node'.
+ * trans-types.h: Same. Also update comment accordingly.
+
2004-08-31 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* primary.c: Update copyright boilerplate to say GCC.
{
case EXPR_CONSTANT:
if (!(*len && INTEGER_CST_P (*len)))
- *len = build_int_cstu (gfc_strlen_type_node,
+ *len = build_int_cstu (gfc_charlen_type_node,
c->expr->value.character.length);
break;
len = build_int_cst (NULL_TREE, length);
TREE_TYPE (str) =
build_array_type (gfc_character1_type_node,
- build_range_type (gfc_strlen_type_node,
+ build_range_type (gfc_charlen_type_node,
integer_one_node, len));
return str;
}
strcpy (&name[1], sym->name);
name[0] = '.';
length = build_decl (VAR_DECL, get_identifier (name),
- gfc_strlen_type_node);
+ gfc_charlen_type_node);
DECL_ARTIFICIAL (length) = 1;
TREE_USED (length) = 1;
gfc_defer_symbol_init (sym);
{
gfc_allocate_lang_decl (decl);
GFC_DECL_ASSIGN (decl) = 1;
- length = gfc_create_var (gfc_strlen_type_node, sym->name);
+ length = gfc_create_var (gfc_charlen_type_node, sym->name);
GFC_DECL_STRING_LEN (decl) = length;
GFC_DECL_ASSIGN_ADDR (decl) = gfc_create_var (pvoid_type_node, sym->name);
/* TODO: Need to check we don't change TREE_STATIC (decl) later. */
/* Length of character result. */
type = TREE_VALUE (typelist);
- assert (type == gfc_strlen_type_node);
+ assert (type == gfc_charlen_type_node);
length = build_decl (PARM_DECL,
get_identifier (".__result"),
parm = f->sym->backend_decl;
type = TREE_VALUE (typelist);
- assert (type == gfc_strlen_type_node);
+ assert (type == gfc_charlen_type_node);
strcpy (&name[1], f->sym->name);
name[0] = '_';
args = tree_cons (NULL_TREE, null_pointer_node, args);
if (formal->sym->ts.type == BT_CHARACTER)
{
- tmp = convert (gfc_strlen_type_node, integer_zero_node);
+ tmp = convert (gfc_charlen_type_node, integer_zero_node);
string_args = tree_cons (NULL_TREE, tmp, string_args);
}
}
gfc_build_library_function_decl (get_identifier (PREFIX("copy_string")),
void_type_node,
4,
- gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node);
+ gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node);
gfor_fndecl_compare_string =
gfc_build_library_function_decl (get_identifier (PREFIX("compare_string")),
gfc_int4_type_node,
4,
- gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node);
+ gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node);
gfor_fndecl_concat_string =
gfc_build_library_function_decl (get_identifier (PREFIX("concat_string")),
void_type_node,
6,
- gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node);
+ gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node);
gfor_fndecl_string_len_trim =
gfc_build_library_function_decl (get_identifier (PREFIX("string_len_trim")),
gfc_int4_type_node,
- 2, gfc_strlen_type_node,
+ 2, gfc_charlen_type_node,
pchar_type_node);
gfor_fndecl_string_index =
gfc_build_library_function_decl (get_identifier (PREFIX("string_index")),
gfc_int4_type_node,
- 5, gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node,
+ 5, gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node,
gfc_logical4_type_node);
gfor_fndecl_string_scan =
gfc_build_library_function_decl (get_identifier (PREFIX("string_scan")),
gfc_int4_type_node,
- 5, gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node,
+ 5, gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node,
gfc_logical4_type_node);
gfor_fndecl_string_verify =
gfc_build_library_function_decl (get_identifier (PREFIX("string_verify")),
gfc_int4_type_node,
- 5, gfc_strlen_type_node, pchar_type_node,
- gfc_strlen_type_node, pchar_type_node,
+ 5, gfc_charlen_type_node, pchar_type_node,
+ gfc_charlen_type_node, pchar_type_node,
gfc_logical4_type_node);
gfor_fndecl_string_trim =
gfc_build_library_function_decl (get_identifier (PREFIX("string_trim")),
void_type_node,
4,
- build_pointer_type (gfc_strlen_type_node),
+ build_pointer_type (gfc_charlen_type_node),
ppvoid_type_node,
- gfc_strlen_type_node,
+ gfc_charlen_type_node,
pchar_type_node);
gfor_fndecl_string_repeat =
void_type_node,
4,
pchar_type_node,
- gfc_strlen_type_node,
+ gfc_charlen_type_node,
pchar_type_node,
gfc_int4_type_node);
void_type_node,
3,
pchar_type_node,
- gfc_strlen_type_node, pchar_type_node);
+ gfc_charlen_type_node, pchar_type_node);
gfor_fndecl_adjustr =
gfc_build_library_function_decl (get_identifier (PREFIX("adjustr")),
void_type_node,
3,
pchar_type_node,
- gfc_strlen_type_node, pchar_type_node);
+ gfc_charlen_type_node, pchar_type_node);
gfor_fndecl_si_kind =
gfc_build_library_function_decl (get_identifier ("selected_int_kind"),
tree tmp;
gfc_init_se (&se, NULL);
- gfc_conv_expr_type (&se, cl->length, gfc_strlen_type_node);
+ gfc_conv_expr_type (&se, cl->length, gfc_charlen_type_node);
gfc_add_block_to_block (pblock, &se.pre);
tmp = cl->backend_decl;
var = NULL_TREE;
gfc_init_se (&start, se);
- gfc_conv_expr_type (&start, ref->u.ss.start, gfc_strlen_type_node);
+ gfc_conv_expr_type (&start, ref->u.ss.start, gfc_charlen_type_node);
gfc_add_block_to_block (&se->pre, &start.pre);
if (integer_onep (start.expr))
end.expr = se->string_length;
else
{
- gfc_conv_expr_type (&end, ref->u.ss.end, gfc_strlen_type_node);
+ gfc_conv_expr_type (&end, ref->u.ss.end, gfc_charlen_type_node);
gfc_add_block_to_block (&se->pre, &end.pre);
}
tmp =
- build2 (MINUS_EXPR, gfc_strlen_type_node,
- fold_convert (gfc_strlen_type_node, integer_one_node),
+ build2 (MINUS_EXPR, gfc_charlen_type_node,
+ fold_convert (gfc_charlen_type_node, integer_one_node),
start.expr);
- tmp = build2 (PLUS_EXPR, gfc_strlen_type_node, end.expr, tmp);
+ tmp = build2 (PLUS_EXPR, gfc_charlen_type_node, end.expr, tmp);
se->string_length = fold (tmp);
}
tree tmp;
tree args;
- if (TREE_TYPE (len) != gfc_strlen_type_node)
+ if (TREE_TYPE (len) != gfc_charlen_type_node)
abort ();
if (gfc_can_put_var_on_stack (len))
{
/* Create a temporary variable to hold the result. */
- tmp = fold (build2 (MINUS_EXPR, gfc_strlen_type_node, len,
- convert (gfc_strlen_type_node,
+ tmp = fold (build2 (MINUS_EXPR, gfc_charlen_type_node, len,
+ convert (gfc_charlen_type_node,
integer_one_node)));
tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node, tmp);
tmp = build_array_type (gfc_character1_type_node, tmp);
var = gfc_conv_string_tmp (se, type, len);
arglist = gfc_chainon_list (arglist, var);
- arglist = gfc_chainon_list (arglist, convert (gfc_strlen_type_node,
- len));
+ arglist = gfc_chainon_list (arglist,
+ convert (gfc_charlen_type_node, len));
}
else /* TODO: derived type function return values. */
abort ();
{
stringargs =
gfc_chainon_list (stringargs,
- convert (gfc_strlen_type_node,
+ convert (gfc_charlen_type_node,
integer_zero_node));
}
}
void_type_node, 5,
pvoid_type_node, pvoid_type_node,
gfc_int4_type_node, gfc_int4_type_node,
- gfc_strlen_type_node);
+ gfc_charlen_type_node);
iocall_set_nml_val_complex =
gfc_build_library_function_decl (get_identifier (PREFIX("st_set_nml_var_complex")),
void_type_node, 4,
tree ppvoid_type_node;
tree pchar_type_node;
tree gfc_character1_type_node;
-tree gfc_strlen_type_node;
+tree gfc_charlen_type_node;
static GTY(()) tree gfc_desc_dim_type;
static GTY(()) tree gfc_max_array_element_size;
boolean_false_node = build_int_cst (boolean_type_node, 0);
/* ??? Shouldn't this be based on gfc_index_integer_kind or so? */
- gfc_strlen_type_node = gfc_get_int_type (4);
+ gfc_charlen_type_node = gfc_get_int_type (4);
}
/* Get the type node for the given type and kind. */
typelist = gfc_chainon_list (typelist, type);
if (arg->ts.type == BT_CHARACTER)
- typelist = gfc_chainon_list (typelist, gfc_strlen_type_node);
+ typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);
}
/* Build the argument types for the function. */
/* Add hidden string length parameters. */
while (nstr--)
- typelist = gfc_chainon_list (typelist, gfc_strlen_type_node);
+ typelist = gfc_chainon_list (typelist, gfc_charlen_type_node);
typelist = gfc_chainon_list (typelist, void_type_node);
extern GTY(()) tree ppvoid_type_node;
extern GTY(()) tree pvoid_type_node;
extern GTY(()) tree pchar_type_node;
-/* This is the type used to hold string lengths. It has nothing to do with
- the C strlen(3) function. It must be the same as the corresponding
- definition in gfortran.h. */
+/* This is the type used to hold the lengths of character variables.
+ It must be the same as the corresponding definition in gfortran.h. */
/* TODO: This is still hardcoded as kind=4 in some bits of the compiler
and runtime library. */
-extern GTY(()) tree gfc_strlen_type_node;
+extern GTY(()) tree gfc_charlen_type_node;
/* be-function.c */
void gfc_convert_function_code (gfc_namespace *);
+2004-08-31 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
+
+ * libgfortran.h: Replace 'gfc_strlen_type' by
+ 'gfc_charlen_type'. Update comment accordingly.
+ * intrinsics/args.c, intrinsics/env.c, io/io.h, io/transfer.c:
+ Replace all occurences of 'gfc_strlen_type' by 'gfc_charlen_type'.
+
2004-08-31 Paul Brook <paul@codesourcery.com>
* libgfortran.h: Add comments.
/* Get a commandline argument. */
void
-prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_strlen_type val_len)
+prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_charlen_type val_len)
{
int argc;
int arglen;
/* INTEGER*8 wrapper of getarg. */
void
-prefix(getarg_i8) (GFC_INTEGER_8 *pos, char *val, gfc_strlen_type val_len)
+prefix(getarg_i8) (GFC_INTEGER_8 *pos, char *val, gfc_charlen_type val_len)
{
GFC_INTEGER_4 pos4;
char *value,
GFC_INTEGER_4 *length,
GFC_INTEGER_4 *status,
- gfc_strlen_type value_len)
+ gfc_charlen_type value_len)
{
int argc, arglen = 0, stat_flag = GFC_GC_SUCCESS;
char **argv;
char *value,
GFC_INTEGER_8 *length,
GFC_INTEGER_8 *status,
- gfc_strlen_type value_len)
+ gfc_charlen_type value_len)
{
GFC_INTEGER_4 number4;
GFC_INTEGER_4 length4;
prefix(get_command_i4) (char *command,
GFC_INTEGER_4 *length,
GFC_INTEGER_4 *status,
- gfc_strlen_type command_len)
+ gfc_charlen_type command_len)
{
int i, argc, arglen, thisarg;
int stat_flag = GFC_GC_SUCCESS;
prefix(get_command_i8) (char *command,
GFC_INTEGER_8 *length,
GFC_INTEGER_8 *status,
- gfc_strlen_type command_len)
+ gfc_charlen_type command_len)
{
GFC_INTEGER_4 length4;
GFC_INTEGER_4 status4;
void
prefix(getenv) (char * name,
char * value,
- gfc_strlen_type name_len,
- gfc_strlen_type value_len)
+ gfc_charlen_type name_len,
+ gfc_charlen_type value_len)
{
/* Make a null-terminated copy of the name string so that c library
GFC_INTEGER_4 *length,
GFC_INTEGER_4 *status,
GFC_LOGICAL_4 *trim_name,
- gfc_strlen_type name_len,
- gfc_strlen_type value_len)
+ gfc_charlen_type name_len,
+ gfc_charlen_type value_len)
{
int stat = GFC_SUCCESS, res_len = 0;
char name_nt[name_len+1], *res;
GFC_INTEGER_8 *length,
GFC_INTEGER_8 *status,
GFC_LOGICAL_8 *trim_name,
- gfc_strlen_type name_len,
- gfc_strlen_type value_len)
+ gfc_charlen_type name_len,
+ gfc_charlen_type value_len)
{
GFC_INTEGER_4 length4, status4;
GFC_LOGICAL_4 trim_name4;
void st_set_nml_var_float (void * , char * , int , int );
#define st_set_nml_var_char prefix(st_set_nml_var_char)
-void st_set_nml_var_char (void * , char * , int , int, gfc_strlen_type);
+void st_set_nml_var_char (void * , char * , int , int, gfc_charlen_type);
#define st_set_nml_var_complex prefix(st_set_nml_var_complex)
void st_set_nml_var_complex (void * , char * , int , int );
void
st_set_nml_var_char (void * var_addr, char * var_name, int var_name_len,
- int kind, gfc_strlen_type string_length)
+ int kind, gfc_charlen_type string_length)
{
st_set_nml_var (var_addr, var_name, var_name_len, kind, BT_CHARACTER,
by the compiler. */
/* The type used of array indices, amongst other things. */
typedef size_t index_type;
-/* The type used for string lengths. Nothing to do with strlen(3). */
-typedef GFC_INTEGER_4 gfc_strlen_type;
+/* The type used for the lengths of character variables. */
+typedef GFC_INTEGER_4 gfc_charlen_type;
/* This will be 0 on little-endian machines and one on big-endian machines. */
#define l8_to_l4_offset prefix(l8_to_l4_offset)