Mercurial > octave
diff libinterp/parse-tree/parse.h @ 28953:dff830c84726
Add function "dir_encoding" to set a file encoding per directory (bug #49685).
* corefcn/load-path.h (load_path::read_dir_config): Add new function.
* corefcn/load-path.cc (load_path::read_dir_config): Add new function.
(load_path::add): Call read_dir_config on adding a new directory to the load
path.
* corefcn/input.h (input_system::dir_encoding, input_system::set_dir_encoding):
Add new functions. Add private unordered_map "m_dir_encoding".
* corefcn/input.cc (input_system::dir_encoding, input_system::set_dir_encoding):
Add new functions.
(base_reader, file_reader, input_reader): Add new constructors that accept an
encoding (use mfile_encoding by default). Add private property "m_encoding".
(load_path_dir): Static function to get the part of the directory that would
be added to the load path.
(Fdir_encoding): New function.
* corefcn/interpreter.cc (interpreter::chdir): Call load_path::read_dir_config.
* parse-tree/lex.h (lexer): Add new constructor that accepts an encoding.
* parse-tree/parse.h (parser): Add new constructor that accepts an encoding.
* parse-tree/oct-parse.yy (parse_fcn_file): Pass dir_encoding to parser.
* doc/interpreter/func.txi: Add docstring of function "dir_encoding" to manual.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Fri, 18 Sep 2020 17:15:32 +0200 |
parents | 3211325aa1bf |
children | 6aa1440e415a |
line wrap: on
line diff
--- a/libinterp/parse-tree/parse.h Sat Oct 17 02:13:39 2020 -0700 +++ b/libinterp/parse-tree/parse.h Fri Sep 18 17:15:32 2020 +0200 @@ -610,6 +610,10 @@ : base_parser (*(new lexer (file, interp))) { } + parser (FILE *file, interpreter& interp, std::string encoding) + : base_parser (*(new lexer (file, interp, encoding))) + { } + parser (const std::string& eval_string, interpreter& interp) : base_parser (*(new lexer (eval_string, interp))) { }