Mercurial > hg > octave-lyh
annotate liboctave/oct-env.h @ 14348:95c43fc8dbe1 stable rc-3-6-1-0
3.6.1 release candidate 0
* configure.ac (AC_INIT): Version is now 3.6.1-rc0.
(OCTAVE_RELEASE_DATE): Now 2012-02-07.
* liboctave/Makefile.am: Bump liboctave revision version.
* src/Makefile.am: Bump liboctave revision version.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 09 Feb 2012 11:25:04 -0500 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
2926 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
13983
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2926 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2926 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
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 |
19 <http://www.gnu.org/licenses/>. | |
2926 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_env_h) | |
24 #define octave_env_h 1 | |
25 | |
26 #include <string> | |
27 | |
28 class | |
6108 | 29 OCTAVE_API |
2926 | 30 octave_env |
31 { | |
32 protected: | |
33 | |
34 octave_env (void); | |
35 | |
36 public: | |
37 | |
3504 | 38 static std::string polite_directory_format (const std::string& name); |
2926 | 39 |
3504 | 40 static bool absolute_pathname (const std::string& s); |
2926 | 41 |
6838 | 42 static bool rooted_relative_pathname (const std::string& s); |
43 | |
3504 | 44 static std::string base_pathname (const std::string& s); |
2926 | 45 |
10250 | 46 static std::string |
47 make_absolute (const std::string& s, | |
48 const std::string& dot_path = get_current_directory ()); | |
2926 | 49 |
10250 | 50 static std::string get_current_directory (void); |
2926 | 51 |
3504 | 52 static std::string get_home_directory (void); |
2926 | 53 |
3504 | 54 static std::string get_program_name (void); |
2926 | 55 |
3504 | 56 static std::string get_program_invocation_name (void); |
2926 | 57 |
3504 | 58 static std::string get_user_name (void); |
2926 | 59 |
3504 | 60 static std::string get_host_name (void); |
2926 | 61 |
3504 | 62 static std::string getenv (const std::string& name); |
2926 | 63 |
3504 | 64 static void putenv (const std::string& name, const std::string& value); |
2926 | 65 |
5489 | 66 static bool have_x11_display (void); |
67 | |
3504 | 68 static bool chdir (const std::string& newdir); |
2926 | 69 |
3504 | 70 static void set_program_name (const std::string& s); |
2926 | 71 |
72 private: | |
73 | |
74 static bool instance_ok (void); | |
75 | |
3504 | 76 std::string do_polite_directory_format (const std::string& name) const; |
2926 | 77 |
3504 | 78 bool do_absolute_pathname (const std::string& s) const; |
2926 | 79 |
6838 | 80 bool do_rooted_relative_pathname (const std::string& s) const; |
81 | |
3504 | 82 std::string do_base_pathname (const std::string& s) const; |
2926 | 83 |
4097 | 84 std::string do_make_absolute (const std::string& s, |
10312
cbc402e64d83
untabify liboctave header files
John W. Eaton <jwe@octave.org>
parents:
10278
diff
changeset
|
85 const std::string& dot_path) const; |
2926 | 86 |
4097 | 87 std::string do_getcwd (void) const; |
2926 | 88 |
3504 | 89 std::string do_get_home_directory (void) const; |
2926 | 90 |
3504 | 91 std::string do_get_user_name (void) const; |
2926 | 92 |
3504 | 93 std::string do_get_host_name (void) const; |
2926 | 94 |
3504 | 95 std::string do_getenv (const std::string& name) const; |
2926 | 96 |
3504 | 97 void do_putenv (const std::string& name, const std::string& value) const; |
2926 | 98 |
3504 | 99 bool do_chdir (const std::string& newdir); |
2926 | 100 |
3504 | 101 void do_set_program_name (const std::string& s) const; |
2926 | 102 |
3504 | 103 void pathname_backup (std::string& path, int n) const; |
2926 | 104 |
105 void error (int) const; | |
106 | |
3504 | 107 void error (const std::string&) const; |
2926 | 108 |
109 // No copying! | |
110 | |
111 octave_env (const octave_env&); | |
112 | |
113 octave_env& operator = (const octave_env&); | |
114 | |
115 // The real thing. | |
116 static octave_env *instance; | |
117 | |
13983
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
118 |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
119 static void cleanup_instance (void) { delete instance; instance = 0; } |
7dd7cccf0757
clean up memory allocated for singletons before exit
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
120 |
2926 | 121 // TRUE means follow symbolic links that point to directories just |
122 // as if they are real directories. | |
123 bool follow_symbolic_links; | |
124 | |
125 // TRUE means that pwd always give verbatim directory, regardless | |
126 // of symbolic link following. | |
127 bool verbatim_pwd; | |
128 | |
129 // Where are we? | |
4097 | 130 mutable std::string current_directory; |
2926 | 131 |
132 // Etc. | |
10278
4a278982c0fe
use gnulib progname module
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
133 mutable std::string prog_name; |
2926 | 134 |
10278
4a278982c0fe
use gnulib progname module
John W. Eaton <jwe@octave.org>
parents:
10250
diff
changeset
|
135 mutable std::string prog_invocation_name; |
2926 | 136 |
3504 | 137 mutable std::string user_name; |
2926 | 138 |
3504 | 139 mutable std::string host_name; |
2926 | 140 }; |
141 | |
142 #endif |