diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/filename_absolute.cxx | 16 | ||||
| -rw-r--r-- | src/filename_expand.cxx | 7 | ||||
| -rw-r--r-- | src/filename_ext.cxx | 5 | ||||
| -rw-r--r-- | src/filename_isdir.cxx | 5 | ||||
| -rw-r--r-- | src/filename_list.cxx | 23 | ||||
| -rw-r--r-- | src/filename_match.cxx | 15 | ||||
| -rw-r--r-- | src/filename_setext.cxx | 4 | ||||
| -rw-r--r-- | src/fl_color.cxx | 6 | ||||
| -rw-r--r-- | src/fl_open_uri.cxx | 6 |
9 files changed, 79 insertions, 8 deletions
diff --git a/src/filename_absolute.cxx b/src/filename_absolute.cxx index db12e5dba..0b40c9310 100644 --- a/src/filename_absolute.cxx +++ b/src/filename_absolute.cxx @@ -54,6 +54,13 @@ inline int isdirsep(char c) {return c=='/' || c=='\\';} #define isdirsep(c) ((c)=='/') #endif +/** + * Makes a filename absolute from a relative filename. + * \param[out] to resulting absolute filename + * \param[in] tolen size of the absolute filename buffer + * \param[in] from relative filename + * \return 0 if no change, non zero otherwise + */ int fl_filename_absolute(char *to, int tolen, const char *from) { if (isdirsep(*from) || *from == '|' #if defined(WIN32) || defined(__EMX__) && !defined(__CYGWIN__) @@ -107,10 +114,13 @@ int fl_filename_absolute(char *to, int tolen, const char *from) { return 1; } -/* - * 'fl_filename_relative()' - Make a filename relative to the current working directory. +/** + * Makes a filename relative to the current working directory. + * \param[out] to resulting relative filename + * \param[in] tolen size of the relative filename buffer + * \param[in] from absolute filename + * \return 0 if no change, non zero otherwise */ - int // O - 0 if no change, 1 if changed fl_filename_relative(char *to, // O - Relative filename int tolen, // I - Size of "to" buffer diff --git a/src/filename_expand.cxx b/src/filename_expand.cxx index 307f1e1af..2925c342e 100644 --- a/src/filename_expand.cxx +++ b/src/filename_expand.cxx @@ -47,6 +47,13 @@ static inline int isdirsep(char c) {return c=='/' || c=='\\';} #define isdirsep(c) ((c)=='/') #endif +/** + * Expands a filename coontaining shell variables. + * \param[out] to resulting expanded filename + * \param[in] tolen size of the expanded filename buffer + * \param[in] from filename containing shell variables + * \return 0 if no change, non zero otherwise + */ int fl_filename_expand(char *to,int tolen, const char *from) { char *temp = new char[tolen]; diff --git a/src/filename_ext.cxx b/src/filename_ext.cxx index 4be691e58..9389bf2e6 100644 --- a/src/filename_ext.cxx +++ b/src/filename_ext.cxx @@ -29,6 +29,11 @@ #include <FL/filename.H> +/** + Gets the extensions of a filename + \param[in] buf the filename to be parsed + \return a pointer to the extension (including '.') if any or NULL otherwise + */ const char *fl_filename_ext(const char *buf) { const char *q = 0; const char *p = buf; diff --git a/src/filename_isdir.cxx b/src/filename_isdir.cxx index be920f68d..2e4582266 100644 --- a/src/filename_isdir.cxx +++ b/src/filename_isdir.cxx @@ -47,6 +47,11 @@ int _fl_filename_isdir_quick(const char* n) { return fl_filename_isdir(n); } +/** + Determines if a file exists and is a directory from its filename + \param[in] n the filename to parse + \return non zero if file exists and is a directory, zero otherwise +*/ int fl_filename_isdir(const char* n) { struct stat s; char fn[1024]; diff --git a/src/filename_list.cxx b/src/filename_list.cxx index 1f5f91fcc..75076a122 100644 --- a/src/filename_list.cxx +++ b/src/filename_list.cxx @@ -50,6 +50,29 @@ int fl_casealphasort(struct dirent **a, struct dirent **b) { } +/** + Portable and const-correct wrapper for the scandir() function. + For each file in that directory a "dirent" structure is created. + The only portable thing about a dirent is that dirent.d_name is the nul-terminated file name. + An pointers array to these dirent's is created and a pointer to the array is returned in *list. + The number of entries is given as a return value. + If there is an error reading the directory a number less than zero is returned, + and errno has the reason; errno does not work under WIN32. + \param[in] d the name of the directory to list. It does not matter if it has a trailing slash. + \param[out] list table containing the resulting directory listing + \param[in] sort sorting functor: + - fl_alphasort: The files are sorted in ascending alphabetical order; + upper and lowercase letters are compared according to their ASCII ordering uppercase before lowercase. + - fl_casealphasort: The files are sorted in ascending alphabetical order; + upper and lowercase letters are compared equally case is not significant. + - fl_casenumericsort: The files are sorted in ascending "alphanumeric" order, where an attempt is made + to put unpadded numbers in consecutive order; upper and lowercase letters + are compared equally case is not significant. + - fl_numericsort: The files are sorted in ascending "alphanumeric" order, where an attempt is made + to put unpadded numbers in consecutive order; upper and lowercase letters are compared + according to their ASCII ordering - uppercase before lowercase. + \return the number of entries if no error, a negative value otherwise. +*/ int fl_filename_list(const char *d, dirent ***list, Fl_File_Sort_F *sort) { #ifndef HAVE_SCANDIR diff --git a/src/filename_match.cxx b/src/filename_match.cxx index c9cad54c8..14cc4d46f 100644 --- a/src/filename_match.cxx +++ b/src/filename_match.cxx @@ -29,6 +29,21 @@ #include <FL/filename.H> #include <ctype.h> +/** + Checks if a string \a s matches a pattern \a p. + The following syntax is used for the pattern: + - * matches any sequence of 0 or more characters. + - ? matches any single character. + - [set] matches any character in the set. Set can contain any single characters, or a-z to represent a range. + To match ] or - they must be the first characters. To match ^ or ! they must not be the first characters. + - [^set] or [!set] matches any character not in the set. + - {X|Y|Z} or {X,Y,Z} matches any one of the subexpressions literally. + - \\x quotes the character x so it has no special meaning. + - x all other characters must be matched exactly. + \param[in] s the string to check for a match + \param[in] p the string pattern + \return non zero if the string matches the pattern +*/ int fl_filename_match(const char *s, const char *p) { int matched; diff --git a/src/filename_setext.cxx b/src/filename_setext.cxx index ac93765c3..28c3ddc22 100644 --- a/src/filename_setext.cxx +++ b/src/filename_setext.cxx @@ -32,6 +32,10 @@ #include <FL/filename.H> #include "flstring.h" +/** + Replaces the extension in \a buf of max. size \a buflen with the extension in \a ext. + \return buf itself for calling convenience. +*/ char *fl_filename_setext(char *buf, int buflen, const char *ext) { char *q = (char *)fl_filename_ext(buf); if (ext) { diff --git a/src/fl_color.cxx b/src/fl_color.cxx index b64f1f5c9..98a715282 100644 --- a/src/fl_color.cxx +++ b/src/fl_color.cxx @@ -124,6 +124,8 @@ Fl_XColor fl_xmap[1][256]; # define fl_overlay 0 # endif +/** \addtogroup fl_attributes + @{ */ //////////////////////////////////////////////////////////////// // Get an rgb color. This is easy for a truecolor visual. For // colormapped it picks the closest color out of the cube in the @@ -472,7 +474,9 @@ Fl_Color fl_contrast(Fl_Color fg, Fl_Color bg) { else if (l2 > 127) return FL_BLACK; else return FL_WHITE; } - +/** + @} +*/ // // End of "$Id$". // diff --git a/src/fl_open_uri.cxx b/src/fl_open_uri.cxx index c0aede758..38da38af4 100644 --- a/src/fl_open_uri.cxx +++ b/src/fl_open_uri.cxx @@ -59,10 +59,8 @@ static int run_program(const char *program, char **argv, char *msg, int msglen); /** - * Open the specified URI. - * - * fl_open_uri() opens the specified Uniform Resource Identifier (URI) - * using an operating-system dependent program or interface. For URIs + * Opens the specified Uniform Resource Identifier (URI). + * Uses an operating-system dependent program or interface. For URIs * using the "ftp", "http", or "https" schemes, the system default web * browser is used to open the URI, while "mailto" and "news" URIs are * typically opened using the system default mail reader and "file" URIs |
