diff options
Diffstat (limited to 'gcc/fortran/gfortran.h')
-rw-r--r-- | gcc/fortran/gfortran.h | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index f6a7c54123b..5fa3bc1f2c7 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -556,7 +556,7 @@ init_local_integer; /* Used for keeping things in balanced binary trees. */ #define BBT_HEADER(self) int priority; struct self *left, *right -#define NAMED_INTCST(a,b,c) a, +#define NAMED_INTCST(a,b,c,d) a, typedef enum { ISOFORTRANENV_INVALID = -1, @@ -566,7 +566,7 @@ typedef enum iso_fortran_env_symbol; #undef NAMED_INTCST -#define NAMED_INTCST(a,b,c) a, +#define NAMED_INTCST(a,b,c,d) a, #define NAMED_REALCST(a,b,c) a, #define NAMED_CMPXCST(a,b,c) a, #define NAMED_LOGCST(a,b,c) a, @@ -700,6 +700,21 @@ typedef struct symbol_attribute; +/* We need to store source lines as sequences of multibyte source + characters. We define here a type wide enough to hold any multibyte + source character, just like libcpp does. A 32-bit type is enough. */ + +#if HOST_BITS_PER_INT >= 32 +typedef unsigned int gfc_char_t; +#elif HOST_BITS_PER_LONG >= 32 +typedef unsigned long gfc_char_t; +#elif defined(HAVE_LONG_LONG) && (HOST_BITS_PER_LONGLONG >= 32) +typedef unsigned long long gfc_char_t; +#else +# error "Cannot find an integer type with at least 32 bits" +#endif + + /* The following three structures are used to identify a location in the sources. @@ -729,7 +744,7 @@ typedef struct gfc_linebuf int truncated; bool dbg_emitted; - char line[1]; + gfc_char_t line[1]; } gfc_linebuf; #define gfc_linebuf_header_size (offsetof (gfc_linebuf, line)) @@ -738,7 +753,7 @@ typedef struct gfc_linebuf typedef struct { - char *nextc; + gfc_char_t *nextc; gfc_linebuf *lb; } locus; @@ -769,6 +784,7 @@ typedef struct gfc_charlen { struct gfc_expr *length; struct gfc_charlen *next; + bool length_from_typespec; /* Length from explicit array ctor typespec? */ tree backend_decl; int resolved; @@ -1482,7 +1498,7 @@ typedef struct gfc_expr struct { int length; - char *string; + gfc_char_t *string; } character; @@ -1552,6 +1568,15 @@ gfc_real_info; extern gfc_real_info gfc_real_kinds[]; +typedef struct +{ + int kind, bit_size; + const char *name; +} +gfc_character_info; + +extern gfc_character_info gfc_character_kinds[]; + /* Equivalence structures. Equivalent lvalues are linked along the *eq pointer, equivalence sets are strung along the *next node. */ @@ -1940,10 +1965,25 @@ void gfc_advance_line (void); int gfc_check_include (void); int gfc_define_undef_line (void); +int gfc_wide_is_printable (gfc_char_t); +int gfc_wide_is_digit (gfc_char_t); +int gfc_wide_fits_in_byte (gfc_char_t); +gfc_char_t gfc_wide_tolower (gfc_char_t); +gfc_char_t gfc_wide_toupper (gfc_char_t); +size_t gfc_wide_strlen (const gfc_char_t *); +int gfc_wide_strncasecmp (const gfc_char_t *, const char *, size_t); +gfc_char_t *gfc_wide_memset (gfc_char_t *, gfc_char_t, size_t); +char *gfc_widechar_to_char (const gfc_char_t *, int); +gfc_char_t *gfc_char_to_widechar (const char *); + +#define gfc_get_wide_string(n) gfc_getmem((n) * sizeof(gfc_char_t)) + void gfc_skip_comments (void); -int gfc_next_char_literal (int); -int gfc_next_char (void); -int gfc_peek_char (void); +gfc_char_t gfc_next_char_literal (int); +gfc_char_t gfc_next_char (void); +char gfc_next_ascii_char (void); +gfc_char_t gfc_peek_char (void); +char gfc_peek_ascii_char (void); void gfc_error_recovery (void); void gfc_gobble_whitespace (void); try gfc_new_file (void); @@ -1996,6 +2036,8 @@ typedef struct gfc_error_buf void gfc_error_init_1 (void); void gfc_buffer_error (int); +const char *gfc_print_wide_char (gfc_char_t); + void gfc_warning (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_warning_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_clear_warning (void); @@ -2354,6 +2396,7 @@ bool gfc_check_access (gfc_access, gfc_access); symbol_attribute gfc_variable_attr (gfc_expr *, gfc_typespec *); symbol_attribute gfc_expr_attr (gfc_expr *); match gfc_match_rvalue (gfc_expr **); +int gfc_check_digit (char, int); /* trans.c */ void gfc_generate_code (gfc_namespace *); |