Move the sources to trunk
[opencv] / otherlibs / _fltk / include / FL / filename.H
1 /*
2  * "$Id: filename.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $"
3  *
4  * Filename header file for the Fast Light Tool Kit (FLTK).
5  *
6  * Copyright 1998-2002 by Bill Spitzak and others.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21  * USA.
22  *
23  * Please report all bugs and problems to "fltk-bugs@fltk.org".
24  */
25
26 #ifndef FL_FILENAME_H
27 #  define FL_FILENAME_H
28
29 #  include "Fl_Export.H"
30
31 #  define FL_PATH_MAX 256 /* all buffers are this length */
32
33 FL_EXPORT const char *fl_filename_name(const char *);
34 FL_EXPORT const char *fl_filename_ext(const char *);
35 FL_EXPORT char *fl_filename_setext(char *to, int tolen, const char *ext);
36 FL_EXPORT int fl_filename_expand(char *to, int tolen, const char *from);
37 FL_EXPORT int fl_filename_absolute(char *to, int tolen, const char *from);
38 FL_EXPORT int fl_filename_relative(char *to, int tolen, const char *from);
39 FL_EXPORT int fl_filename_match(const char *name, const char *pattern);
40 FL_EXPORT int fl_filename_isdir(const char *name);
41
42 #  ifdef __cplusplus
43 /*
44  * Under WIN32, we include filename.H from numericsort.c; this should probably change...
45  */
46
47 inline char *fl_filename_setext(char *to, const char *ext) { return fl_filename_setext(to, FL_PATH_MAX, ext); }
48 inline int fl_filename_expand(char *to, const char *from) { return fl_filename_expand(to, FL_PATH_MAX, from); }
49 inline int fl_filename_absolute(char *to, const char *from) { return fl_filename_absolute(to, FL_PATH_MAX, from); }
50 inline int fl_filename_relative(char *to, const char *from) { return fl_filename_relative(to, FL_PATH_MAX, from); }
51 #  endif /* __cplusplus */
52
53
54 #  if defined(WIN32) && !defined(__CYGWIN__)
55
56 struct dirent {char d_name[1];};
57
58 #  else
59 /*
60  * WARNING: on some systems (very few nowadays?) <dirent.h> may not exist.
61  * The correct information is in one of these files:
62  *
63  *     #include <sys/ndir.h>
64  *     #include <sys/dir.h>
65  *     #include <ndir.h>
66  *
67  * plus you must do the following #define:
68  *
69  *     #define dirent direct
70  *
71  * It would be best to create a <dirent.h> file that does this...
72  */
73 #    include <sys/types.h>
74 #    include <dirent.h>
75 #  endif
76
77 #  ifdef __cplusplus
78 extern "C" {
79 #  endif /* __cplusplus */
80
81 FL_EXPORT int fl_alphasort(struct dirent **, struct dirent **);
82 FL_EXPORT int fl_casealphasort(struct dirent **, struct dirent **);
83 FL_EXPORT int fl_casenumericsort(struct dirent **, struct dirent **);
84 FL_EXPORT int fl_numericsort(struct dirent **, struct dirent **);
85
86 typedef int (Fl_File_Sort_F)(struct dirent **, struct dirent **);
87
88 #  ifdef __cplusplus
89 }
90
91 /*
92  * Portable "scandir" function.  Ugly but necessary...
93  */
94
95 FL_EXPORT int fl_filename_list(const char *d, struct dirent ***l,
96                                Fl_File_Sort_F *s = fl_numericsort);
97 #  endif /* __cplusplus */
98
99 /*
100  * FLTK 1.0.x compatibility definitions...
101  */
102
103 #  ifdef FLTK_1_0_COMPAT
104 #    define filename_absolute   fl_filename_absolute
105 #    define filename_expand     fl_filename_expand
106 #    define filename_ext        fl_filename_ext
107 #    define filename_isdir      fl_filename_isdir
108 #    define filename_list       fl_filename_list
109 #    define filename_match      fl_filename_match
110 #    define filename_name       fl_filename_name
111 #    define filename_relative   fl_filename_relative
112 #    define numericsort         fl_numericsort
113 #  endif /* FLTK_1_0_COMPAT */
114
115
116 #endif /* FL_FILENAME_H */
117
118 /*
119  * End of "$Id: filename.H,v 1.2 2002/12/01 15:38:37 neurosurg Exp $".
120  */