fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

filename.H
Go to the documentation of this file.
1 /*
2  * "$Id$"
3  *
4  * Filename header file for the Fast Light Tool Kit (FLTK).
5  *
6  * Copyright 1998-2010 by Bill Spitzak and others.
7  *
8  * This library is free software. Distribution and use rights are outlined in
9  * the file "COPYING" which should have been included with this file. If this
10  * file is missing or damaged, see the license at:
11  *
12  * http://www.fltk.org/COPYING.php
13  *
14  * Please report all bugs and problems on the following page:
15  *
16  * http://www.fltk.org/str.php
17  */
22 /* Xcode on OS X includes files by recursing down into directories.
23  * This code catches the cycle and directly includes the required file.
24  */
25 #ifdef fl_dirent_h_cyclic_include
26 # include "/usr/include/dirent.h"
27 #endif
28 
29 #ifndef FL_FILENAME_H
30 # define FL_FILENAME_H
31 
32 # include "Fl_Export.H"
33 
38 # define FL_PATH_MAX 2048
54 FL_EXPORT const char *fl_filename_name(const char * filename);
55 FL_EXPORT const char *fl_filename_ext(const char *buf);
56 FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
57 FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
58 FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
59 FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
60 FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
61 FL_EXPORT int fl_filename_isdir(const char *name);
62 
63 # if defined(__cplusplus) && !defined(FL_DOXYGEN)
64 /*
65  * Under WIN32, we include filename.H from numericsort.c; this should probably change...
66  */
67 
68 inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); }
69 inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); }
70 inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); }
71 FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from, const char *cwd);
72 inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); }
73 # endif /* __cplusplus */
74 
75 
76 # if defined(WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__WATCOMC__)
77 
78 struct dirent {char d_name[1];};
79 
80 # elif defined(__WATCOMC__)
81 # include <sys/types.h>
82 # include <direct.h>
83 
84 # else
85 /*
86  * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist.
87  * The correct information is in one of these files:
88  *
89  * #include <sys/ndir.h>
90  * #include <sys/dir.h>
91  * #include <ndir.h>
92  *
93  * plus you must do the following #define:
94  *
95  * #define dirent direct
96  *
97  * It would be best to create a <dirent.h> file that does this...
98  */
99 # include <sys/types.h>
100 # define fl_dirent_h_cyclic_include
101 # include <dirent.h>
102 # undef fl_dirent_h_cyclic_include
103 # endif
104 
105 # if defined (__cplusplus)
106 extern "C" {
107 # endif /* __cplusplus */
108 
109 # if !defined(FL_DOXYGEN)
110 FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
111 FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
112 FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
113 FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
114 # endif
115 
116  typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **);
118 # if defined(__cplusplus)
119 }
120 
121 /*
122  * Portable "scandir" function. Ugly but necessary...
123  */
124 
125 FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
127 FL_EXPORT void fl_filename_free_list(struct dirent ***l, int n);
128 
129 /*
130  * Generic function to open a Uniform Resource Identifier (URI) using a
131  * system-defined program (added in FLTK 1.1.8)
132  */
133 
134 FL_EXPORT int fl_open_uri(const char *uri, char *msg = (char *)0,
135  int msglen = 0);
136 
137 FL_EXPORT void fl_decode_uri(char *uri);
138 
139 # ifndef FL_DOXYGEN
140 /*
141  * _fl_filename_isdir_quick() is a private function that checks for a
142  * trailing slash and assumes that the passed name is a directory if
143  * it finds one. This function is used by Fl_File_Browser and
144  * Fl_File_Chooser to avoid extra stat() calls, but is not supported
145  * outside of FLTK...
146  */
147 int _fl_filename_isdir_quick(const char *name);
148 # endif
149 
150 # endif /* __cplusplus */
151 
152 /*
153  * FLTK 1.0.x compatibility definitions...
154  */
155 
156 # ifdef FLTK_1_0_COMPAT
157 # define filename_absolute fl_filename_absolute
158 # define filename_expand fl_filename_expand
159 # define filename_ext fl_filename_ext
160 # define filename_isdir fl_filename_isdir
161 # define filename_list fl_filename_list
162 # define filename_match fl_filename_match
163 # define filename_name fl_filename_name
164 # define filename_relative fl_filename_relative
165 # define filename_setext fl_filename_setext
166 # define numericsort fl_numericsort
167 # endif /* FLTK_1_0_COMPAT */
168 
169 
170 #endif /* FL_FILENAME_H */
171 
174 /*
175  * End of "$Id$".
176  */
fl_filename_relative
int fl_filename_relative(char *to, int tolen, const char *from)
Definition: filename_absolute.cxx:128
fl_casealphasort
int fl_casealphasort(struct dirent **, struct dirent **)
Definition: filename_list.cxx:41
buf
static char * buf
Definition: fl_encoding_mac_roman.cxx:76
fl_casenumericsort
int fl_casenumericsort(struct dirent **, struct dirent **)
fl_filename_isdir
int fl_filename_isdir(const char *name)
Definition: filename_isdir.cxx:52
FL_EXPORT
#define FL_EXPORT
Definition: Fl_Export.H:35
fl_filename_free_list
void fl_filename_free_list(struct dirent ***list, int n)
Free the list of filenames that is generated by fl_filename_list().
Definition: filename_list.cxx:189
dirent.h
fl_numericsort
int fl_numericsort(struct dirent **, struct dirent **)
FL_PATH_MAX
#define FL_PATH_MAX
Definition: filename.H:38
fl_filename_match
int fl_filename_match(const char *name, const char *pattern)
Definition: filename_match.cxx:44
fl_filename_list
int fl_filename_list(const char *d, dirent ***list, Fl_File_Sort_F *sort)
Definition: filename_list.cxx:75
fl_filename_absolute
int fl_filename_absolute(char *to, int tolen, const char *from)
Definition: filename_absolute.cxx:56
_fl_filename_isdir_quick
int _fl_filename_isdir_quick(const char *n)
Definition: filename_isdir.cxx:35
fl_alphasort
int fl_alphasort(struct dirent **, struct dirent **)
Definition: filename_list.cxx:37
Fl_File_Sort_F
int() Fl_File_Sort_F(struct dirent **, struct dirent **)
Definition: filename.H:116
Fl_Export.H
fl_filename_setext
char * fl_filename_setext(char *to, int tolen, const char *ext)
Definition: filename_setext.cxx:40
fl_filename_expand
int fl_filename_expand(char *to, int tolen, const char *from)
Definition: filename_expand.cxx:63
name
static const char * name
Definition: Fl_arg.cxx:53
fl_decode_uri
void fl_decode_uri(char *uri)
Definition: fl_open_uri.cxx:253
fl_filename_ext
const char * fl_filename_ext(const char *buf)
Definition: filename_ext.cxx:34
dirent
#define dirent
Definition: numericsort.c:31
fl_open_uri
int fl_open_uri(const char *uri, char *msg, int msglen)
Definition: fl_open_uri.cxx:98