Mercurial > dwindows
annotate platform/dirent.h @ 1137:e24e5a13ff2c
Added code to test the new print functions in dwtest.
GTK3 code mostly works except the for the text.
Added stub print functions to all platforms besides GTK3.
Need to decide what to do about GTK2; the GTK3 code will work
in GTK 2.10 and later, but will require switching to cairo.
Mac/Win/OS2 code coming soon. :)
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 09 Sep 2011 09:17:09 +0000 |
parents | 2ff26b697877 |
children | 56f311dc23f6 |
rev | line source |
---|---|
179
6803aba19dae
Don't include this file on unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
1 #ifdef __UNIX__ |
6803aba19dae
Don't include this file on unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
2 #include <dirent.h> |
6803aba19dae
Don't include this file on unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
3 #else |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
4 #ifndef __DIRENT_H__ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
5 #define __DIRENT_H__ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
6 |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
7 #include "compat.h" |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
8 #include <stdio.h> |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
9 #ifdef MAXPATHLEN |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
10 #undef MAXPATHLEN |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
11 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
12 #define MAXPATHLEN (FILENAME_MAX*4) |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
13 #define MAXNAMLEN FILENAME_MAX |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
14 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
15 #ifdef __cplusplus |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
16 extern "C" { |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
17 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
18 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
19 /* attribute stuff */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
20 #ifndef A_RONLY |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
21 # define A_RONLY 0x01 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
22 # define A_HIDDEN 0x02 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
23 # define A_SYSTEM 0x04 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
24 # define A_LABEL 0x08 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
25 # define A_DIR 0x10 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
26 # define A_ARCHIVE 0x20 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
27 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
28 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
29 struct dirent { |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
30 int d_ino; /* Dummy */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
31 int d_reclen; /* Dummy, same as d_namlen */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
32 int d_namlen; /* length of name */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
33 char d_name[MAXNAMLEN + 1]; |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
34 unsigned long d_size; |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
35 unsigned short d_attribute; /* attributes (see above) */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
36 unsigned short d_time; /* modification time */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
37 unsigned short d_date; /* modification date */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
38 }; |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
39 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
40 typedef struct _dirdescr DIR; |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
41 /* the structs do not have to be defined here */ |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
42 |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
43 extern DIR * API _opendir(const char *); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
44 #define opendir(a) _opendir(a) |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
45 extern DIR *API _openxdir(const char *, unsigned); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
46 #define openxdir(a, b) _openxdir(a, b) |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
47 extern struct dirent * API _readdir(DIR *); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
48 #define readdir(a) _readdir(a) |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
49 extern void API _seekdir(DIR *, long); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
50 #define seekdir(a, b) _seekdir(a, b) |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
51 extern long API _telldir(DIR *); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
52 #define telldir(a) _telldir(a) |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
53 extern void API _closedir(DIR *); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
54 #define closedir(a) _closedir(a) |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
55 |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
56 #define rewinddir(dirp) _seekdir(dirp, 0L) |
525
2ff26b697877
Fixes for building with Innotek GCC. Will have to check for regressions
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
179
diff
changeset
|
57 extern char * API _abs_path(const char *name, char *buffer, int len); |
174
75bf3051235f
Fixes so you can mix compilers.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
24
diff
changeset
|
58 #define abs_path(a, b, c) _abs_path(a, b, c) |
24
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
59 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
60 #ifndef S_IFMT |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
61 #define S_IFMT ( S_IFDIR | S_IFREG ) |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
62 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
63 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
64 #ifndef S_ISDIR |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
65 #define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR) |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
66 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
67 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
68 #ifndef S_ISREG |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
69 #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
70 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
71 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
72 #ifdef __cplusplus |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
73 } |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
74 #endif |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
75 |
d9e87e8bcf1d
Updated dynamic windows to build with EMX.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
diff
changeset
|
76 #endif |
179
6803aba19dae
Don't include this file on unix.
bsmith@81767d24-ef19-dc11-ae90-00e081727c95
parents:
177
diff
changeset
|
77 #endif |