OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgfortran/] [io/] [format.h] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 733 jeremybenn
/* Copyright (C) 2009, 2010
2
   Free Software Foundation, Inc.
3
   Contributed by Janne Blomqvist
4
 
5
This file is part of the GNU Fortran runtime library (libgfortran).
6
 
7
Libgfortran is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation; either version 3, or (at your option)
10
any later version.
11
 
12
Libgfortran is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
Under Section 7 of GPL version 3, you are granted additional
18
permissions described in the GCC Runtime Library Exception, version
19
3.1, as published by the Free Software Foundation.
20
 
21
You should have received a copy of the GNU General Public License and
22
a copy of the GCC Runtime Library Exception along with this program;
23
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24
<http://www.gnu.org/licenses/>.  */
25
 
26
#ifndef GFOR_FORMAT_H
27
#define GFOR_FORMAT_H
28
 
29
#include "io.h"
30
 
31
 
32
/* Format tokens.  Only about half of these can be stored in the
33
   format nodes.  */
34
 
35
typedef enum
36
{
37
  FMT_NONE = 0, FMT_UNKNOWN, FMT_SIGNED_INT, FMT_ZERO, FMT_POSINT, FMT_PERIOD,
38
  FMT_COMMA, FMT_COLON, FMT_SLASH, FMT_DOLLAR, FMT_T, FMT_TR, FMT_TL,
39
  FMT_LPAREN, FMT_RPAREN, FMT_X, FMT_S, FMT_SS, FMT_SP, FMT_STRING,
40
  FMT_BADSTRING, FMT_P, FMT_I, FMT_B, FMT_BN, FMT_BZ, FMT_O, FMT_Z, FMT_F,
41
  FMT_E, FMT_EN, FMT_ES, FMT_G, FMT_L, FMT_A, FMT_D, FMT_H, FMT_END, FMT_DC,
42
  FMT_DP, FMT_STAR, FMT_RC, FMT_RD, FMT_RN, FMT_RP, FMT_RU, FMT_RZ
43
}
44
format_token;
45
 
46
 
47
/* Format nodes.  A format string is converted into a tree of these
48
   structures, which is traversed as part of a data transfer statement.  */
49
 
50
struct fnode
51
{
52
  format_token format;
53
  int repeat;
54
  struct fnode *next;
55
  char *source;
56
 
57
  union
58
  {
59
    struct
60
    {
61
      int w, d, e;
62
    }
63
    real;
64
 
65
    struct
66
    {
67
      int length;
68
      char *p;
69
    }
70
    string;
71
 
72
    struct
73
    {
74
      int w, m;
75
    }
76
    integer;
77
 
78
    int w;
79
    int k;
80
    int r;
81
    int n;
82
 
83
    struct fnode *child;
84
  }
85
  u;
86
 
87
  /* Members for traversing the tree during data transfer.  */
88
 
89
  int count;
90
  struct fnode *current;
91
 
92
};
93
 
94
 
95
/* A storage structures for format node data.  */
96
 
97
#define FARRAY_SIZE 64
98
 
99
typedef struct fnode_array
100
{
101
  struct fnode_array *next;
102
  fnode array[FARRAY_SIZE];
103
}
104
fnode_array;
105
 
106
 
107
typedef struct format_data
108
{
109
  char *format_string, *string;
110
  const char *error;
111
  char error_element;
112
  format_token saved_token;
113
  int value, format_string_len, reversion_ok;
114
  fnode *avail;
115
  const fnode *saved_format;
116
  fnode_array *last;
117
  fnode_array array;
118
}
119
format_data;
120
 
121
extern void parse_format (st_parameter_dt *);
122
internal_proto(parse_format);
123
 
124
extern const fnode *next_format (st_parameter_dt *);
125
internal_proto(next_format);
126
 
127
extern void unget_format (st_parameter_dt *, const fnode *);
128
internal_proto(unget_format);
129
 
130
extern void format_error (st_parameter_dt *, const fnode *, const char *);
131
internal_proto(format_error);
132
 
133
extern void free_format_data (struct format_data *);
134
internal_proto(free_format_data);
135
 
136
extern void free_format_hash_table (gfc_unit *);
137
internal_proto(free_format_hash_table);
138
 
139
extern void init_format_hash (st_parameter_dt *);
140
internal_proto(init_format_hash);
141
 
142
extern void free_format_hash (st_parameter_dt *);
143
internal_proto(free_format_hash);
144
 
145
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.