annotate liboctave/system/lo-sysdep.h @ 32086:3c608abd55f5

Move "same_file" from liboctinterp to liboctave (bug #63803). * libinterp/corefcn/utils.cc, utils.h (same_file): Deprecate function. * libinterp/corefcn/sysdep.cc, sysdep.h (same_file_internal): Remove function. * liboctave/system/lo-sysdep.cc, lo-sysdep.h (same_file): Move function from liboctinterp to liboctave. * libgui/src/m-editor/file-editor.cc (file_editor::find_tab_widget), libinterp/corefcn/fcn-info.cc (file_editor::find_tab_widget), libinterp/corefcn/interpreter.cc (interpreter::execute_startup_files), libinterp/corefcn/load-path.cc (load_path::append): Use function in updated namespace.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 06 May 2023 17:48:27 +0200
parents ed3a18fe328a
children 85255746fc21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ////////////////////////////////////////////////////////////////////////
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 //
31706
597f3ee61a48 update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 31607
diff changeset
3 // Copyright (C) 1996-2023 The Octave Project Developers
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
4 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 // See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 // distribution or <https://octave.org/copyright/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
7 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
8 // This file is part of Octave.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
9 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
10 // Octave is free software: you can redistribute it and/or modify it
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
11 // under the terms of the GNU General Public License as published by
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
12 // the Free Software Foundation, either version 3 of the License, or
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
13 // (at your option) any later version.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
14 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
15 // Octave is distributed in the hope that it will be useful, but
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
18 // GNU General Public License for more details.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
19 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
20 // You should have received a copy of the GNU General Public License
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
21 // along with Octave; see the file COPYING. If not, see
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
22 // <https://www.gnu.org/licenses/>.
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 //
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ////////////////////////////////////////////////////////////////////////
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
25
20791
f7084eae3318 maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents: 19697
diff changeset
26 #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
27 #define octave_lo_sysdep_h 1
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
28
21244
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
29 #include "octave-config.h"
1473547f50f5 include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents: 20791
diff changeset
30
28467
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
31 #include <fstream>
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
32 #include <string>
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
33
21949
baeffde5c87d fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents: 21828
diff changeset
34 #include <sys/types.h>
baeffde5c87d fix build for Windows systems
John W. Eaton <jwe@octave.org>
parents: 21828
diff changeset
35
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
36 #include "lo-ieee.h"
21738
a99c2407f930 use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
37
6321
363a2f8c9e97 [project @ 2007-02-16 20:26:23 by dbateman]
dbateman
parents: 6123
diff changeset
38 class string_vector;
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
39
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
40 OCTAVE_BEGIN_NAMESPACE(octave)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
41
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
42 OCTAVE_BEGIN_NAMESPACE(sys)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
43
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
44 extern OCTAVE_API int system (const std::string& cmd_str);
2926
66ef74ee5d9f [project @ 1997-05-05 03:20:52 by jwe]
jwe
parents:
diff changeset
45
31771
21f9b34eb893 maint: Eliminate "(void)" in C++ function prototypes/declarations.
Rik <rik@octave.org>
parents: 31706
diff changeset
46 extern OCTAVE_API std::string getcwd ();
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
47
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
48 extern OCTAVE_API int chdir (const std::string&);
25516
8945a6a6c0eb Add Unicode support for getting directory listing in Windows (bug #49118).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25514
diff changeset
49
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
50 extern OCTAVE_API bool
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
51 get_dirlist (const std::string& dirname, string_vector& dirlist,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
52 std::string& msg);
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
53
32077
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
54 extern OCTAVE_API bool
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
55 file_exists (const std::string& filename, bool is_dir = true);
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
56
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
57 extern OCTAVE_API bool
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
58 file_exists (const std::string& filename, bool is_dir, std::string& msg);
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
59
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
60 extern OCTAVE_API bool dir_exists (const std::string& dirname);
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
61
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
62 extern OCTAVE_API bool
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
63 dir_exists (const std::string& dirname, std::string& msg);
ed3a18fe328a Add more efficient functions to check for files or directories on Windows (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents: 31771
diff changeset
64
32086
3c608abd55f5 Move "same_file" from liboctinterp to liboctave (bug #63803).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32077
diff changeset
65 extern OCTAVE_API bool
3c608abd55f5 Move "same_file" from liboctinterp to liboctave (bug #63803).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32077
diff changeset
66 same_file (const std::string& f, const std::string& g);
3c608abd55f5 Move "same_file" from liboctinterp to liboctave (bug #63803).
Markus Mützel <markus.muetzel@gmx.de>
parents: 32077
diff changeset
67
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
68 extern OCTAVE_API std::FILE *
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
69 fopen (const std::string& name, const std::string& mode);
28467
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
70
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
71 extern OCTAVE_API std::FILE *
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
72 fopen_tmp (const std::string& name, const std::string& mode);
30881
1921d9d0e62b Unify detection of temporary directory (bug #62215).
Markus Mützel <markus.muetzel@gmx.de>
parents: 30564
diff changeset
73
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
74 extern OCTAVE_API std::fstream
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
75 fstream (const std::string& name,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
76 const std::ios::openmode mode = std::ios::in | std::ios::out);
28467
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
77
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
78 extern OCTAVE_API std::ifstream
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
79 ifstream (const std::string& name,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
80 const std::ios::openmode mode = std::ios::in);
28467
159b6a1eb408 Use wide character overload to open file streams on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents: 27923
diff changeset
81
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
82 extern OCTAVE_API std::ofstream
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
83 ofstream (const std::string& name,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
84 const std::ios::openmode mode = std::ios::out);
25916
3f2282954600 Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25532
diff changeset
85
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
86 extern OCTAVE_API void
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
87 putenv_wrapper (const std::string& name, const std::string& value);
25916
3f2282954600 Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25532
diff changeset
88
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
89 extern OCTAVE_API std::string getenv_wrapper (const std::string&);
25916
3f2282954600 Support non-ASCII characters in environment variables on Windows (bug #53922).
Markus Mützel <markus.muetzel@gmx.de>
parents: 25532
diff changeset
90
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
91 extern OCTAVE_API int unsetenv_wrapper (const std::string&);
29229
ed5eacd5c3ed Set API tags in files in liboctave/system (patch #8919).
Markus Mützel <markus.muetzel@gmx.de>
parents: 29141
diff changeset
92
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
93 extern OCTAVE_API std::wstring u8_to_wstring (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
94
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
95 extern OCTAVE_API 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
96
31607
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
97 extern OCTAVE_API std::string
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
98 get_ASCII_filename (const std::string& long_file_name,
aac27ad79be6 maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents: 31605
diff changeset
99 const bool allow_locale = false);
31605
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
100
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
101 OCTAVE_END_NAMESPACE(sys)
e88a07dec498 maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents: 30881
diff changeset
102 OCTAVE_END_NAMESPACE(octave)
21738
a99c2407f930 use namespace for lo-sysdep.h functions
John W. Eaton <jwe@octave.org>
parents: 21244
diff changeset
103
6321
363a2f8c9e97 [project @ 2007-02-16 20:26:23 by dbateman]
dbateman
parents: 6123
diff changeset
104 #endif