diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-12 22:23:59 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-09-12 22:23:59 +0000 |
commit | f1afe16096674811b2dd3a962b0e26cc7137433e (patch) | |
tree | 21cc6935b87686835780712e1d9a7d64eae418d0 /gcc/java/lang.c | |
parent | 53cabf65946c0fb82530f2079d5979382d1f597c (diff) | |
download | gcc-f1afe16096674811b2dd3a962b0e26cc7137433e.tar.gz |
Fix for PR gcj/33:
* jv-scan.c (help): Document --encoding.
(options): Added `encoding' entry.
(OPT_ENCODING): New define.
(main): Handle --encoding.
Include <langinfo.h> if nl_langinfo exists.
* lang-options.h: Document --classpath, --CLASSPATH, --main, and
--encoding.
* jcf-parse.c Include <langinfo.h> if we have nl_langinfo.
(parse_source_file): Correctly call java_init_lex. Added `finput'
argument. Use nl_langinfo to determine default encoding.
* java-tree.h (current_encoding): Declare.
* parse.y (java_parser_context_restore_global): Don't restore
`finput'.
(java_parser_context_save_global): Don't set `finput' field.
(java_pop_parser_context): Don't restore `finput'. Free old lexer
if required.
* lang.c (current_encoding): New global.
(lang_decode_option): Recognize `-fencoding='.
(finish_parse): Don't close finput.
* parse.h (struct parser_ctxt): Removed `finput' and
`unget_utf8_value' fields. Added `lexer' field.
(java_init_lex): Fixed declaration.
* lex.c (java_new_lexer): New function.
(java_destroy_lexer): Likewise.
(java_read_char): Added `lex' argument. Handle iconv case.
(java_read_unicode): Added `lex' argument. Count backslashes in
lexer structure.
(java_init_lex): Added `finput' and `encoding' arguments. Set
`lexer' field in ctxp.
(BAD_UTF8_VALUE): Removed.
(java_lex): Handle seeing UEOF in the middle of a string literal.
* lex.h: Include <iconv.h> if HAVE_ICONV defined.
(java_lexer): New structure.
(UNGETC): Removed.
(GETC): Removed.
(DEFAULT_ENCODING): New define.
(java_destroy_lexer): Declare.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36377 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java/lang.c')
-rw-r--r-- | gcc/java/lang.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 5f95f2d9c57..2dc33f22b09 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -121,6 +121,9 @@ int flag_hash_synchronization; JNI, not CNI. */ int flag_jni = 0; +/* The encoding of the source file. */ +char *current_encoding = NULL; + /* When non zero, report the now deprecated empty statements. */ int flag_extraneous_semicolon; @@ -222,6 +225,13 @@ lang_decode_option (argc, argv) return 1; } #undef ARG +#define ARG "-fencoding=" + if (strncmp (p, ARG, sizeof (ARG) - 1) == 0) + { + current_encoding = p + sizeof (ARG) - 1; + return 1; + } +#undef ARG if (p[0] == '-' && p[1] == 'f') { @@ -309,7 +319,9 @@ lang_decode_option (argc, argv) return 0; } +/* Global open file. */ FILE *finput; + const char * init_parse (filename) const char *filename; @@ -362,6 +374,7 @@ init_parse (filename) } } } + init_lex (); return filename; @@ -370,7 +383,6 @@ init_parse (filename) void finish_parse () { - fclose (finput); jcf_dependency_write (); } |