source: python/trunk/Include/osdefs.h@ 560

Last change on this file since 560 was 391, checked in by dmik, 11 years ago

python: Merge vendor 2.7.6 to trunk.

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1#ifndef Py_OSDEFS_H
2#define Py_OSDEFS_H
3#ifdef __cplusplus
4extern "C" {
5#endif
6
7
8/* Operating system dependencies */
9
10/* Mod by chrish: QNX has WATCOM, but isn't DOS */
11#if !defined(__QNX__)
12#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2)
13#if defined(PYOS_OS2) && defined(PYCC_GCC)
14#define MAXPATHLEN 260
15#define SEP '/'
16#define ALTSEP '\\'
17#else
18#define SEP '\\'
19#define ALTSEP '/'
20#define MAXPATHLEN 256
21#endif
22#define DRVSEP ':' /* (bird) */
23#define DELIM ';'
24#endif
25#endif
26
27#ifdef RISCOS
28#define SEP '.'
29#define MAXPATHLEN 256
30#define DELIM ','
31#endif
32
33
34/* Filename separator */
35#ifndef SEP
36#define SEP '/'
37#endif
38
39/* Test if `ch' is a filename separator (bird) */
40#ifdef ALTSEP
41#define IS_SEP(ch) ((ch) == SEP || (ch) == ALTSEP)
42#else
43#define IS_SEP(ch) ((ch) == SEP)
44#endif
45
46/* Test if `path' has a drive letter or not. (bird) */
47#ifdef DRVSEP
48#define HAS_DRV(path) (*(path) && (path)[1] == DRVSEP)
49#else
50#define HAS_DRV(path) 0
51#endif
52
53/* Test if `path' is absolute or not. (bird) */
54#ifdef DRVSEP
55#define IS_ABSPATH(path) (IS_SEP((path)[0]) || HAS_DRV(path))
56#else
57#define IS_ABSPATH(path) (IS_SEP((path)[0]))
58#endif
59
60/* Test if `path' contains any of the path separators including drive letter. (bird) */
61#ifdef ALTSEP
62#define HAS_ANYSEP(path) ( strchr((path), SEP) || strchr((path), ALTSEP) || HAS_DRV(path) )
63#else
64#define HAS_ANYSEP(path) ( strchr((path), SEP) || HAS_DRV(path) )
65#endif
66
67/* Max pathname length */
68#ifdef __hpux
69#include <sys/param.h>
70#include <limits.h>
71#ifndef PATH_MAX
72#define PATH_MAX MAXPATHLEN
73#endif
74#endif
75
76#ifndef MAXPATHLEN
77#if defined(PATH_MAX) && PATH_MAX > 1024
78#define MAXPATHLEN PATH_MAX
79#else
80#define MAXPATHLEN 1024
81#endif
82#endif
83
84/* Search path entry delimiter */
85#ifndef DELIM
86#define DELIM ':'
87#endif
88
89#ifdef __cplusplus
90}
91#endif
92#endif /* !Py_OSDEFS_H */
Note: See TracBrowser for help on using the repository browser.