Mercurial > octave
annotate liboctave/system/lo-sysdep.h @ 25916:3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
* lo-sysdep.[cc/h] (octave::sys::getenv_wrapper, octave::sys::putenv_wrapper):
Add new functions to call Unicode versions of CRT functions on Windows.
* oct-env.cc (putenv, do_getenv), sysdep.cc (Funsetenv): Use these new
functions.
* lo-utils.[cc/h] (octave_putenv): Remove function moved to lo-sysdep.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Thu, 04 Oct 2018 19:08:42 +0200 |
parents | 7dad5fa7e88e |
children | 00f796120a6d |
rev | line source |
---|---|
2926 | 1 /* |
2 | |
25054
6652d3823428
maint: Update copyright dates in all source files.
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
3 Copyright (C) 1996-2018 John W. Eaton |
2926 | 4 |
5 This file is part of Octave. | |
6 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
10 (at your option) any later version. |
2926 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
15 GNU General Public License for more details. |
2926 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
2926 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
23 #if ! defined (octave_lo_sysdep_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17769
diff
changeset
|
24 #define octave_lo_sysdep_h 1 |
2926 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
20791
diff
changeset
|
27 |
2926 | 28 #include <string> |
29 | |
21949
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21828
diff
changeset
|
30 #include <sys/types.h> |
baeffde5c87d
fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents:
21828
diff
changeset
|
31 |
2926 | 32 #include "lo-ieee.h" |
21738
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
33 |
6321 | 34 class string_vector; |
2926 | 35 |
21738
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
36 namespace octave |
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
37 { |
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 namespace sys |
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
39 { |
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 extern std::string getcwd (void); |
2926 | 41 |
21738
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
42 extern int chdir (const std::string&); |
25514
c63f67d87b4a
Add C++ functions to convert between UTF-8 string and wstring (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25147
diff
changeset
|
43 |
25516
8945a6a6c0eb
Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25514
diff
changeset
|
44 extern bool get_dirlist (const std::string& dirname, string_vector& dirlist, |
8945a6a6c0eb
Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25514
diff
changeset
|
45 std::string& msg); |
8945a6a6c0eb
Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25514
diff
changeset
|
46 |
25517
7fbc39a46be8
Add wrapper to fopen for files with non-ASCII chars in path on Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25516
diff
changeset
|
47 extern std::FILE * fopen (const std::string& name, const std::string& mode); |
7fbc39a46be8
Add wrapper to fopen for files with non-ASCII chars in path on Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25516
diff
changeset
|
48 |
25916
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
49 extern void putenv_wrapper (const std::string& name, |
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
50 const std::string& value); |
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
51 |
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
52 extern std::string getenv_wrapper (const std::string&); |
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
53 |
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
54 extern int unsetenv_wrapper (const std::string&); |
3f2282954600
Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25532
diff
changeset
|
55 |
25514
c63f67d87b4a
Add C++ functions to convert between UTF-8 string and wstring (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25147
diff
changeset
|
56 extern std::wstring u8_to_wstring (const std::string&); |
c63f67d87b4a
Add C++ functions to convert between UTF-8 string and wstring (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25147
diff
changeset
|
57 |
c63f67d87b4a
Add C++ functions to convert between UTF-8 string and wstring (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25147
diff
changeset
|
58 extern std::string u8_from_wstring (const std::wstring&); |
25532
7dad5fa7e88e
Add function for ASCII only file names (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25517
diff
changeset
|
59 |
7dad5fa7e88e
Add function for ASCII only file names (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents:
25517
diff
changeset
|
60 extern std::string get_ASCII_filename (const std::string& long_file_name); |
21738
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
61 } |
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
62 } |
a99c2407f930
use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
63 |
6321 | 64 #endif |