Skip to content

Commit e50d5b4

Browse files
committed
Removed all remaining dependencies on the vfe module from the backend, base and frontend modules.
1 parent f53e52a commit e50d5b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+802
-676
lines changed

vfe/syspovdebug.h renamed to platform/unix/syspovdebug.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//******************************************************************************
22
///
3-
/// @file vfe/syspovdebug.h
3+
/// @file platform/unix/syspovdebug.h
44
///
55
/// This header file is included by povdebug.h, which is in turn included by
66
/// all C++ files in POV-Ray. povdebug.h is the last header file included
@@ -15,7 +15,7 @@
1515
/// @parblock
1616
///
1717
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
18-
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
18+
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
1919
///
2020
/// POV-Ray is free software: you can redistribute it and/or modify
2121
/// it under the terms of the GNU Affero General Public License as
@@ -40,7 +40,7 @@
4040
///
4141
//******************************************************************************
4242

43-
#ifndef __SYSPOVDEBUG_H__
44-
#define __SYSPOVDEBUG_H__
43+
#ifndef POVRAY_UNIX_SYSPOVDEBUG_H
44+
#define POVRAY_UNIX_SYSPOVDEBUG_H
4545

46-
#endif // __SYSPOVDEBUG_H__
46+
#endif // POVRAY_UNIX_SYSPOVDEBUG_H

platform/windows/syspovdebug.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//******************************************************************************
2+
///
3+
/// @file platform/windows/syspovdebug.h
4+
///
5+
/// This header file is included by povdebug.h, which is in turn included by
6+
/// all C++ files in POV-Ray. povdebug.h is the last header file included
7+
/// (with the possible exception of files that do not declare anything that
8+
/// could clash with declarations in povdebug.h or this file).
9+
///
10+
/// As a rule, system header files are not safe to include after this file.
11+
///
12+
/// @author Christopher J. Cason
13+
///
14+
/// @copyright
15+
/// @parblock
16+
///
17+
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
18+
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
19+
///
20+
/// POV-Ray is free software: you can redistribute it and/or modify
21+
/// it under the terms of the GNU Affero General Public License as
22+
/// published by the Free Software Foundation, either version 3 of the
23+
/// License, or (at your option) any later version.
24+
///
25+
/// POV-Ray is distributed in the hope that it will be useful,
26+
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
27+
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+
/// GNU Affero General Public License for more details.
29+
///
30+
/// You should have received a copy of the GNU Affero General Public License
31+
/// along with this program. If not, see <http://www.gnu.org/licenses/>.
32+
///
33+
/// ----------------------------------------------------------------------------
34+
///
35+
/// POV-Ray is based on the popular DKB raytracer version 2.12.
36+
/// DKBTrace was originally written by David K. Buck.
37+
/// DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
38+
///
39+
/// @endparblock
40+
///
41+
//******************************************************************************
42+
43+
#ifndef POVRAY_WINDOWS_SYSPOVDEBUG_H
44+
#define POVRAY_WINDOWS_SYSPOVDEBUG_H
45+
46+
#endif // POVRAY_WINDOWS_SYSPOVDEBUG_H

platform/windows/syspovpath.cpp

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
//******************************************************************************
2+
///
3+
/// @file platform/windows/syspovpath.cpp
4+
///
5+
/// Windows-specific partial implementation of the @ref Path class.
6+
///
7+
/// @copyright
8+
/// @parblock
9+
///
10+
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
11+
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
12+
///
13+
/// POV-Ray is free software: you can redistribute it and/or modify
14+
/// it under the terms of the GNU Affero General Public License as
15+
/// published by the Free Software Foundation, either version 3 of the
16+
/// License, or (at your option) any later version.
17+
///
18+
/// POV-Ray is distributed in the hope that it will be useful,
19+
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
/// GNU Affero General Public License for more details.
22+
///
23+
/// You should have received a copy of the GNU Affero General Public License
24+
/// along with this program. If not, see <http://www.gnu.org/licenses/>.
25+
///
26+
/// ----------------------------------------------------------------------------
27+
///
28+
/// POV-Ray is based on the popular DKB raytracer version 2.12.
29+
/// DKBTrace was originally written by David K. Buck.
30+
/// DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
31+
///
32+
/// @endparblock
33+
///
34+
//******************************************************************************
35+
36+
#include "syspovpath.h"
37+
38+
// this must be the last file included
39+
#include "base/povdebug.h"
40+
41+
namespace pov_base
42+
{
43+
44+
//******************************************************************************
45+
46+
#if !POV_USE_DEFAULT_PATH_PARSER
47+
48+
/// Test for the special directory name denoting the current directory (`.`).
49+
static inline bool IsCurrentDir(const UCS2String& s)
50+
{
51+
return (s.length() == 1) && (s[0] == '.');
52+
}
53+
54+
/// Test for the special directory name denoting the parent directory (`..`).
55+
static inline bool IsParentDir(const UCS2String& s)
56+
{
57+
return (s.length() == 2) && (s[0] == '.') && (s[1] == '.');
58+
}
59+
60+
bool Path::ParsePathString (UCS2String& volume, vector<UCS2String>& dirnames, UCS2String& filename, const UCS2String& path)
61+
{
62+
UCS2String stash;
63+
64+
// Unless noted otherwise, all components are considered empty.
65+
volume.clear();
66+
dirnames.clear();
67+
filename.clear();
68+
69+
// Empty strings are considered valid path names, too.
70+
if (path.empty() == true)
71+
return true;
72+
73+
UCS2String::const_iterator i = path.begin();
74+
75+
// Check for a volume identifier:
76+
// - If the second character is a colon, we presume the first two characters to identify the drive. In that case
77+
// we'll also check whether the following character is a path separator, indicating an absolute path on that
78+
// drive, in which case we'll also include a trailing separator to the drive letter.
79+
// - If the path starts with two identical path separator characters, we presume the string to be a UNC path, in
80+
// which case we set the volume identifier to the network share, including two leading and a trailing separator
81+
// characters.
82+
// - Otherwise, if the first character is a path separator, this indicates an absolute path on the current drive,
83+
// in which case we set the volume identifier to a single path separator character.
84+
// - In any other case, we presume the string to be a relative path, and set the volume identifier to an empty
85+
// string.
86+
87+
if ((*i == POV_PATH_SEPARATOR) || (*i == POV_PATH_SEPARATOR_2))
88+
{
89+
// String starts with a path separator; may be an absolute path on the current drive or a UNC path.
90+
91+
// Stash the separator (use the canonical one, not the one actually used).
92+
stash += POV_PATH_SEPARATOR;
93+
++i;
94+
95+
if ((i != path.end()) && (*i == stash[0]))
96+
{
97+
// The second character is also an (identical) separator character, indicating a UNC path.
98+
99+
// Stash another path separators (use the canonical one, not the one actually used).
100+
stash += POV_PATH_SEPARATOR;
101+
++i;
102+
103+
// Stash everything that follows, up to the next path separator.
104+
for (; (i != path.end()) && (*i != POV_PATH_SEPARATOR) && (*i != POV_PATH_SEPARATOR_2); ++i)
105+
stash += *i;
106+
107+
// Currently, we don't support bare UNC share names without trailing separator character,
108+
// even though allegedly they are technically valid.
109+
if (i == path.end())
110+
return false;
111+
112+
// Stash another path separator (use the canonical one, not the one actually used)
113+
// to indicate an absolute path.
114+
stash += POV_PATH_SEPARATOR;
115+
++i;
116+
}
117+
// If it's not a UNC path, at this point our stash contains a single path separator,
118+
// which is exactly what we intend to emit as the volume identifier in that case.
119+
120+
// Emit whatever string we have stashed as the volume identifier.
121+
volume = stash;
122+
stash.clear();
123+
}
124+
else if (isalpha (*i))
125+
{
126+
// String starts with an ASCII letter; may be a relative path or a drive letter.
127+
128+
// Stash the character, then go on to test what's next.
129+
stash += *i;
130+
++i;
131+
132+
if ((i != path.end()) && (*i == ':'))
133+
{
134+
// Yup, that's a drive letter. Add the colon to the stashed letter.
135+
stash += ':';
136+
++i;
137+
138+
// Currently, we don't support relative paths if a volume is specified.
139+
if ((i == path.end()) || ((*i != POV_PATH_SEPARATOR) && (*i != POV_PATH_SEPARATOR_2)))
140+
return false;
141+
142+
// Stash another path separator (use the canonical one, not the one actually used)
143+
// to indicate an absolute path.
144+
stash += POV_PATH_SEPARATOR;
145+
++i;
146+
147+
// Emit the stashed string as the volume identifier.
148+
volume = stash;
149+
stash.clear();
150+
}
151+
// If it's not a drive letter, at this point we have only stashed the first letter, but
152+
// our index still points to the second one so the following algorithm will take care of it.
153+
}
154+
155+
// Walk through the path string, stashing any non-separator characters. Whenever we hit a separator
156+
// character, emit the stashed characters (if any) as a directory name and clear the stash.
157+
// Also, as we go along, resolve the special directory names `.` and `..` if possible.
158+
159+
// NB since we do not emit "empty" directory names, any sequence of consecutive separator
160+
// characters is effectively treated as a single separator character.
161+
162+
for(; i != path.end(); ++i)
163+
{
164+
if ((*i == POV_PATH_SEPARATOR) || (*i == POV_PATH_SEPARATOR_2))
165+
{
166+
if (!stash.empty() && !IsCurrentDir(stash))
167+
{
168+
if (!dirnames.empty() && IsParentDir(stash))
169+
dirnames.pop_back();
170+
else
171+
dirnames.push_back (stash);
172+
stash.clear();
173+
}
174+
}
175+
else
176+
stash += *i;
177+
}
178+
179+
// Whatever is left in the stash is presumably the actual file name.
180+
181+
// NB as a consequence of the algorithm chosen, any path name ending in a path separator
182+
// character will be emitted as a list of directories only, with the file name left empty.
183+
184+
filename = stash;
185+
186+
return true;
187+
}
188+
189+
#endif // !POV_USE_DEFAULT_PATH_PARSER
190+
191+
//******************************************************************************
192+
193+
}

vfe/syspovprotobackend.h renamed to platform/windows/syspovpath.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//******************************************************************************
22
///
3-
/// @file vfe/syspovprotobackend.h
3+
/// @file platform/windows/syspovpath.h
44
///
5-
/// @todo What's in here?
5+
/// Windows-specific declarations related to the @ref Path class.
66
///
77
/// @copyright
88
/// @parblock
99
///
1010
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.7.
11-
/// Copyright 1991-2015 Persistence of Vision Raytracer Pty. Ltd.
11+
/// Copyright 1991-2016 Persistence of Vision Raytracer Pty. Ltd.
1212
///
1313
/// POV-Ray is free software: you can redistribute it and/or modify
1414
/// it under the terms of the GNU Affero General Public License as
@@ -33,10 +33,18 @@
3333
///
3434
//******************************************************************************
3535

36-
#ifndef __SYSPOVPROTOBACKEND_H__
37-
#define __SYSPOVPROTOBACKEND_H__
36+
#ifndef POVRAY_WINDOWS_SYSPOVPATH_H
37+
#define POVRAY_WINDOWS_SYSPOVPATH_H
3838

39-
#include "syspovconfig.h"
39+
#include "base/configbase.h"
4040

41-
#endif
41+
#include "base/path.h"
4242

43+
namespace pov_base
44+
{
45+
46+
// Currently there are no Windows-specific declarations.
47+
48+
}
49+
50+
#endif // POVRAY_WINDOWS_SYSPOVPATH_H

0 commit comments

Comments
 (0)