From 2debda2f0f2d1a9b4fc0fd59bcac49fea0fae823 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sun, 6 Feb 2000 23:16:24 +0000 Subject: [PATCH] doumented gimpenv --Sven --- ChangeLog | 5 +- devel-docs/ChangeLog | 11 ++-- devel-docs/libgimp/libgimp-decl.txt | 10 +-- devel-docs/libgimp/tmpl/gimpenv.sgml | 5 +- libgimp/gimpenv.c | 91 ++++++++++++++++++++++------ libgimp/gimpenv.h | 53 ++-------------- libgimpbase/gimpenv.c | 91 ++++++++++++++++++++++------ libgimpbase/gimpenv.h | 53 ++-------------- 8 files changed, 174 insertions(+), 145 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35e14556d5..e2bc31a5eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ -Sun Feb 6 23:45:09 CET 2000 Sven Neumann +Sun Feb 7 00:14:26 CET 2000 Sven Neumann + * libgimp/gimpenv.[ch]: use g* types and moved the documentation + into the C file where it is parseable by the documentation system + * libgimp/gimpmatrix.[ch]: use g* types and name the parameters in the header. diff --git a/devel-docs/ChangeLog b/devel-docs/ChangeLog index b3fdbd8a18..de6f693898 100644 --- a/devel-docs/ChangeLog +++ b/devel-docs/ChangeLog @@ -1,10 +1,11 @@ -Sun Feb 6 23:44:17 CET 2000 Sven Neumann +Sun Feb 7 00:14:26 CET 2000 Sven Neumann - * devel-docs/libgimp/libgimp-decl.txt - * devel-docs/libgimp/tmpl/gimpmatrix.sgml: documented gimpmatrix + * libgimp/libgimp-decl.txt + * libgimp/tmpl/gimpenv.sgml: documented gimpenv + * libgimp/tmpl/gimpmatrix.sgml: documented gimpmatrix - * devel-docs/libgimp/tmpl/gimpcolorspace.sgml - * devel-docs/libgimp/tmpl/gimpmenu.sgml: cleanup + * libgimp/tmpl/gimpcolorspace.sgml + * libgimp/tmpl/gimpmenu.sgml: cleanup Sun Feb 6 22:15:20 CET 2000 Sven Neumann diff --git a/devel-docs/libgimp/libgimp-decl.txt b/devel-docs/libgimp/libgimp-decl.txt index 78bf5801e1..642d1dca10 100644 --- a/devel-docs/libgimp/libgimp-decl.txt +++ b/devel-docs/libgimp/libgimp-decl.txt @@ -3262,22 +3262,22 @@ GimpChainButton *gcb gimp_directory -char * +gchar * void gimp_personal_rc_file -char * -char *basename +gchar * +gchar *basename gimp_data_directory -char * +gchar * void gimp_gtkrc -char * +gchar * void diff --git a/devel-docs/libgimp/tmpl/gimpenv.sgml b/devel-docs/libgimp/tmpl/gimpenv.sgml index 57adf184c4..8531de028d 100644 --- a/devel-docs/libgimp/tmpl/gimpenv.sgml +++ b/devel-docs/libgimp/tmpl/gimpenv.sgml @@ -2,11 +2,12 @@ gimpenv - +Functions to access the GIMP environment. - +A set of functions to find the locations of GIMP's data directories and +configuration files. diff --git a/libgimp/gimpenv.c b/libgimp/gimpenv.c index 7bc8fe0669..3d8f05e40f 100644 --- a/libgimp/gimpenv.c +++ b/libgimp/gimpenv.c @@ -33,12 +33,34 @@ extern const char *__XOS2RedirRoot(const char *); #endif -char * -gimp_directory () +/** + * gimp_directory: + * + * Returns the user-specific GIMP settings directory. If the environment + * variable GIMP_DIRECTORY exists, it is used. If it is an absolute path, + * it is used as is. If it is a relative path, it is taken to be a + * subdirectory of the home directory. If it is relative path, and no home + * directory can be determined, it is taken to be a subdirectory of + * gimp_data_directory(). + * + * The usual case is that no GIMP_DIRECTORY environment variable exists, + * and then we use the GIMPDIR subdirectory of the home directory. If no + * home directory exists, we use a per-user subdirectory of + * gimp_data_directory(). + * In any case, we always return some non-empty string, whether it + * corresponds to an existing directory or not. + * + * The returned string is allocated just once, and should *NOT* be + * freed with g_free(). + * + * Returns: The user-specific GIMP settings directory. + */ +gchar* +gimp_directory (void) { - static char *gimp_dir = NULL; - char *env_gimp_dir; - char *home_dir; + static gchar *gimp_dir = NULL; + gchar *env_gimp_dir; + gchar *home_dir; if (gimp_dir != NULL) return gimp_dir; @@ -96,8 +118,19 @@ gimp_directory () return gimp_dir; } -char * -gimp_personal_rc_file (char *basename) +/** + * gimp_personal_rc_file: + * @basename: The basename of a rc_file. + * + * Returns the name of a file in the user-specific GIMP settings directory. + * + * The returned string is allocated dynamically and *SHOULD* be freed + * with g_free() after use. + * + * Returns: The name of a file in the user-specific GIMP settings directory. + */ +gchar* +gimp_personal_rc_file (gchar *basename) { return g_strconcat (gimp_directory (), G_DIR_SEPARATOR_S, @@ -105,11 +138,25 @@ gimp_personal_rc_file (char *basename) NULL); } -char * -gimp_data_directory () +/** + * gimp_data_directory: + * + * Returns the top directory for GIMP data. If the environment variable + * GIMP_DATADIR exists, that is used. It should be an absolute pathname. + * Otherwise, on Unix the compile-time defined directory is used. On + * Win32, the installation directory as deduced from the executable's + * name is used. + * + * The returned string is allocated just once, and should *NOT* be + * freed with g_free(). + * + * Returns: The top directory for GIMP data. + */ +gchar* +gimp_data_directory (void) { - static char *gimp_data_dir = NULL; - char *env_gimp_data_dir = NULL; + static gchar *gimp_data_dir = NULL; + gchar *env_gimp_data_dir = NULL; if (gimp_data_dir != NULL) return gimp_data_dir; @@ -136,8 +183,8 @@ gimp_data_directory () #endif #else /* Figure it out from the executable name */ - char filename[MAX_PATH]; - char *sep1, *sep2; + gchar filename[MAX_PATH]; + gchar *sep1, *sep2; if (GetModuleFileName (NULL, filename, sizeof (filename)) == 0) g_error ("GetModuleFilename failed\n"); @@ -167,16 +214,20 @@ gimp_data_directory () return gimp_data_dir; } -/* gimp_gtkrc returns the name of the GIMP's application-specific - * gtkrc file. +/** + * gimp_gtkrc: + * + * Returns the name of the GIMP's application-specific gtkrc file. * * The returned string is allocated just once, and should *NOT* be * freed with g_free(). + * + * Returns: The name of the GIMP's application-specific gtkrc file. */ -char* -gimp_gtkrc () +gchar* +gimp_gtkrc (void) { - static char *gimp_gtkrc_filename = NULL; + static gchar *gimp_gtkrc_filename = NULL; if (gimp_gtkrc_filename != NULL) return gimp_gtkrc_filename; @@ -188,3 +239,7 @@ gimp_gtkrc () NULL); return gimp_gtkrc_filename; } + + + + diff --git a/libgimp/gimpenv.h b/libgimp/gimpenv.h index 5137193575..3fe88e83b4 100644 --- a/libgimp/gimpenv.h +++ b/libgimp/gimpenv.h @@ -25,55 +25,12 @@ extern "C" { #endif /* __cplusplus */ -/* gimp_directory() returns the user-specific GIMP settings - * directory. If the environment variable GIMP_DIRECTORY exists, that - * is used. If it is an absolute path, it is used as is. If it is a - * relative path, it is taken to be a subdirectory of the home - * directory. If it is relative, and no home directory can be - * determined, it is taken to be a subdirectory of - * gimp_data_directory(). - * - * The usual case is that no GIMP_DIRECTORY envvar exists, and then we - * use the GIMPDIR subdirectory of the home directory. If no home - * directory exists, we use a per-user subdirectory of - * gimp_data_directory(). - * - * In any case, we always return some non-empty string, whether it - * corresponds to an existing directory or not. - * - * The returned string is allocated just once, and should *NOT* be - * freed with g_free(). - */ -char *gimp_directory (void); +/* For information look into the C source or the html documentation */ -/* gimp_personal_rc_file() returns the name of a file in the - * user-specific GIMP settings directory. - * - * The returned string is allocated dynamically and *SHOULD* be freed - * with g_free() after use. - */ -char *gimp_personal_rc_file (char *basename); - -/* gimp_data_directory returns the top directory for GIMP data. If - * the environment variable GIMP_DATADIR exists, that is used. It - * should be an absolute pathname. - * - * Otherwise, on Unix the compile-time defined directory is used. On - * Win32, the installation directory as deduced from the executable's - * name is used. - * - * The returned string is allocated just once, and should *NOT* be - * freed with g_free(). - */ -char *gimp_data_directory (void); - -/* gimp_gtkrc returns the name of the GIMP's application-specific - * gtkrc file. - * - * The returned string is allocated just once, and should *NOT* be - * freed with g_free(). - */ -char *gimp_gtkrc (void); +gchar* gimp_directory (void); +gchar* gimp_personal_rc_file (gchar *basename); +gchar* gimp_data_directory (void); +gchar* gimp_gtkrc (void); #ifdef __cplusplus } diff --git a/libgimpbase/gimpenv.c b/libgimpbase/gimpenv.c index 7bc8fe0669..3d8f05e40f 100644 --- a/libgimpbase/gimpenv.c +++ b/libgimpbase/gimpenv.c @@ -33,12 +33,34 @@ extern const char *__XOS2RedirRoot(const char *); #endif -char * -gimp_directory () +/** + * gimp_directory: + * + * Returns the user-specific GIMP settings directory. If the environment + * variable GIMP_DIRECTORY exists, it is used. If it is an absolute path, + * it is used as is. If it is a relative path, it is taken to be a + * subdirectory of the home directory. If it is relative path, and no home + * directory can be determined, it is taken to be a subdirectory of + * gimp_data_directory(). + * + * The usual case is that no GIMP_DIRECTORY environment variable exists, + * and then we use the GIMPDIR subdirectory of the home directory. If no + * home directory exists, we use a per-user subdirectory of + * gimp_data_directory(). + * In any case, we always return some non-empty string, whether it + * corresponds to an existing directory or not. + * + * The returned string is allocated just once, and should *NOT* be + * freed with g_free(). + * + * Returns: The user-specific GIMP settings directory. + */ +gchar* +gimp_directory (void) { - static char *gimp_dir = NULL; - char *env_gimp_dir; - char *home_dir; + static gchar *gimp_dir = NULL; + gchar *env_gimp_dir; + gchar *home_dir; if (gimp_dir != NULL) return gimp_dir; @@ -96,8 +118,19 @@ gimp_directory () return gimp_dir; } -char * -gimp_personal_rc_file (char *basename) +/** + * gimp_personal_rc_file: + * @basename: The basename of a rc_file. + * + * Returns the name of a file in the user-specific GIMP settings directory. + * + * The returned string is allocated dynamically and *SHOULD* be freed + * with g_free() after use. + * + * Returns: The name of a file in the user-specific GIMP settings directory. + */ +gchar* +gimp_personal_rc_file (gchar *basename) { return g_strconcat (gimp_directory (), G_DIR_SEPARATOR_S, @@ -105,11 +138,25 @@ gimp_personal_rc_file (char *basename) NULL); } -char * -gimp_data_directory () +/** + * gimp_data_directory: + * + * Returns the top directory for GIMP data. If the environment variable + * GIMP_DATADIR exists, that is used. It should be an absolute pathname. + * Otherwise, on Unix the compile-time defined directory is used. On + * Win32, the installation directory as deduced from the executable's + * name is used. + * + * The returned string is allocated just once, and should *NOT* be + * freed with g_free(). + * + * Returns: The top directory for GIMP data. + */ +gchar* +gimp_data_directory (void) { - static char *gimp_data_dir = NULL; - char *env_gimp_data_dir = NULL; + static gchar *gimp_data_dir = NULL; + gchar *env_gimp_data_dir = NULL; if (gimp_data_dir != NULL) return gimp_data_dir; @@ -136,8 +183,8 @@ gimp_data_directory () #endif #else /* Figure it out from the executable name */ - char filename[MAX_PATH]; - char *sep1, *sep2; + gchar filename[MAX_PATH]; + gchar *sep1, *sep2; if (GetModuleFileName (NULL, filename, sizeof (filename)) == 0) g_error ("GetModuleFilename failed\n"); @@ -167,16 +214,20 @@ gimp_data_directory () return gimp_data_dir; } -/* gimp_gtkrc returns the name of the GIMP's application-specific - * gtkrc file. +/** + * gimp_gtkrc: + * + * Returns the name of the GIMP's application-specific gtkrc file. * * The returned string is allocated just once, and should *NOT* be * freed with g_free(). + * + * Returns: The name of the GIMP's application-specific gtkrc file. */ -char* -gimp_gtkrc () +gchar* +gimp_gtkrc (void) { - static char *gimp_gtkrc_filename = NULL; + static gchar *gimp_gtkrc_filename = NULL; if (gimp_gtkrc_filename != NULL) return gimp_gtkrc_filename; @@ -188,3 +239,7 @@ gimp_gtkrc () NULL); return gimp_gtkrc_filename; } + + + + diff --git a/libgimpbase/gimpenv.h b/libgimpbase/gimpenv.h index 5137193575..3fe88e83b4 100644 --- a/libgimpbase/gimpenv.h +++ b/libgimpbase/gimpenv.h @@ -25,55 +25,12 @@ extern "C" { #endif /* __cplusplus */ -/* gimp_directory() returns the user-specific GIMP settings - * directory. If the environment variable GIMP_DIRECTORY exists, that - * is used. If it is an absolute path, it is used as is. If it is a - * relative path, it is taken to be a subdirectory of the home - * directory. If it is relative, and no home directory can be - * determined, it is taken to be a subdirectory of - * gimp_data_directory(). - * - * The usual case is that no GIMP_DIRECTORY envvar exists, and then we - * use the GIMPDIR subdirectory of the home directory. If no home - * directory exists, we use a per-user subdirectory of - * gimp_data_directory(). - * - * In any case, we always return some non-empty string, whether it - * corresponds to an existing directory or not. - * - * The returned string is allocated just once, and should *NOT* be - * freed with g_free(). - */ -char *gimp_directory (void); +/* For information look into the C source or the html documentation */ -/* gimp_personal_rc_file() returns the name of a file in the - * user-specific GIMP settings directory. - * - * The returned string is allocated dynamically and *SHOULD* be freed - * with g_free() after use. - */ -char *gimp_personal_rc_file (char *basename); - -/* gimp_data_directory returns the top directory for GIMP data. If - * the environment variable GIMP_DATADIR exists, that is used. It - * should be an absolute pathname. - * - * Otherwise, on Unix the compile-time defined directory is used. On - * Win32, the installation directory as deduced from the executable's - * name is used. - * - * The returned string is allocated just once, and should *NOT* be - * freed with g_free(). - */ -char *gimp_data_directory (void); - -/* gimp_gtkrc returns the name of the GIMP's application-specific - * gtkrc file. - * - * The returned string is allocated just once, and should *NOT* be - * freed with g_free(). - */ -char *gimp_gtkrc (void); +gchar* gimp_directory (void); +gchar* gimp_personal_rc_file (gchar *basename); +gchar* gimp_data_directory (void); +gchar* gimp_gtkrc (void); #ifdef __cplusplus }