ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/paths.h
(Generate patch)

Comparing ray/src/common/paths.h (file contents):
Revision 2.14 by schorsch, Thu Jun 26 00:58:09 2003 UTC vs.
Revision 2.22 by schorsch, Mon Sep 19 11:30:10 2005 UTC

# Line 4 | Line 4
4   */
5   #ifndef _RAD_PATHS_H_
6   #define _RAD_PATHS_H_
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
7  
8 < #include "copyright.h"
12 <
8 > #include <stdio.h>
9   #include <stdlib.h>
10   #include <string.h>
11 + #include <fcntl.h>
12 + #include <sys/types.h>
13 + #include <sys/stat.h>
14 +
15   #ifdef _WIN32
16    #include <io.h>
17 < #else /* _WIN32 */
18 <  #include <unistd.h>
19 <  #include <sys/param.h>
20 < #endif /* _WIN32 */
17 >  #include <direct.h> /* getcwd(), chdir(), _mkdir(), etc. */
18  
22 #ifdef _WIN32
23
19    #define access _access
20 +  #define mkdir(dirname,perms) _mkdir(dirname)
21    #define PATH_MAX _MAX_PATH
22 +  #define NULL_DEVICE   "NUL"
23    #define DIRSEP                '/'
24    #define ISDIRSEP(c)   ((c)=='/' || (c)=='\\')
25    #define ISABS(s)      ((s)!=NULL \
# Line 34 | Line 31 | extern "C" {
31    #define CASEDIRSEP    case '/': case '\\'
32    #define PATHSEP               ';'
33    #define CURDIR                '.'
37  #define MAXPATH               512 /* XXX obsoleted by posix PATH_MAX */
34    #define DEFAULT_TEMPDIRS {"C:/TMP", "C:/TEMP", ".", NULL}
35    #define TEMPLATE      "rtXXXXXX"
36    #define TEMPLEN               8
# Line 49 | Line 45 | extern "C" {
45      #define  W_OK 02
46      #define  R_OK 04
47    #endif
48 < extern char  *fixargv0();
48 >  /* to make the permissions user specific we'd need to use CreateFile() */
49 >  #ifndef S_IRUSR
50 >    #define S_IRUSR _S_IREAD
51 >    #define S_IWUSR _S_IWRITE
52 >  #endif
53  
54 < #else
55 <  #ifndef PATH_MAX /* doesn't implement posix? */
56 <    #define PATH_MAX 512 /* quite conservative (I think...) */
54 >  #ifdef __cplusplus
55 >    extern "C" {
56    #endif
57 +  extern char  *fixargv0();
58 +  #ifdef __cplusplus
59 +    }
60 +  #endif
61  
62 + #else /* everything but Windows */
63 +  #include <unistd.h>
64 +  #include <sys/param.h>
65 +
66 +  #define RMAX_PATH_MAX 4096 /* our own maximum */
67 +  #ifndef PATH_MAX
68 +    #define PATH_MAX 512
69 +  #elif PATH_MAX > RMAX_PATH_MAX /* the OS is exaggerating */
70 +    #undef PATH_MAX
71 +    #define PATH_MAX RMAX_PATH_MAX
72 +  #endif
73 +
74    #ifdef AMIGA
75  
76 +        #define NULL_DEVICE     "NIL:"
77      #define DIRSEP              '/'
78      #define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0])))
79      #define PATHSEP             ';'
80          #define CURDIR          '.'
65    #define MAXPATH             128
81      #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL}
82      #define TEMPLATE    "/tmp/rtXXXXXX"
83      #define TEMPLEN             13
# Line 74 | Line 89 | extern char  *fixargv0();
89  
90    #else
91  
92 +    /* posix */
93 +
94 +        /* this is defined as _PATH_DEVNULL in /usr/include/paths.h on Linux */
95 +        #define NULL_DEVICE     "/dev/null"
96      #define DIRSEP              '/'
97      #define ISABS(s) ((s)!=NULL && (ISDIRSEP(s[0])))
98      #define PATHSEP             ':'
99          #define CURDIR          '.'
81    #define MAXPATH             256
100      #define DEFAULT_TEMPDIRS {"/var/tmp", "/usr/tmp", "/tmp", ".", NULL}
101 <    #define TEMPLATE    "/usr/tmp/rtXXXXXX"
101 >    #define TEMPLATE    "/tmp/rtXXXXXX"
102      #define TEMPLEN             17
103      #define ULIBVAR             "RAYPATH"
104      #ifndef DEFPATH
# Line 98 | Line 116 | extern char  *fixargv0();
116    #define CASEDIRSEP    case DIRSEP
117   #endif
118  
119 < extern char  *mktemp(), *getenv();
120 <
103 < #ifdef BSD
104 < extern char  *getwd();
105 < #else
106 < extern char  *getcwd();
107 < #define  getwd(p)       getcwd(p, sizeof(p))
119 > #ifdef __cplusplus
120 > extern "C" {
121   #endif
122  
110
123   /* Find a writeable directory for temporary files */
124   /* If s is NULL, we return a static string */
125   extern char *temp_directory(char *s, size_t len);
# Line 122 | Line 134 | extern char *temp_filename(char *s, size_t len, char *
134   /* Same as above, but also open the file and return the descriptor */
135   /* This one is supposed to protect against race conditions on unix */
136   /* WARNING: On Windows, there's no protection against race conditions */
137 < extern int temp_file(char *s, size_t len, char *templ);
137 > extern int temp_fd(char *s, size_t len, char *templ);
138 >
139 > /* Same as above, but return a file pointer instead of a descriptor */
140 > extern FILE *temp_fp(char *s, size_t len, char *templ);
141  
142   /* Concatenate two strings, leaving exactly one DIRSEP in between */
143   extern char *append_filepath(char *s1, char *s2, size_t len);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines