diff --git a/src/haiku.cpp b/src/haiku.cpp index e55b0b13..6ede53d9 100644 --- a/src/haiku.cpp +++ b/src/haiku.cpp @@ -17,8 +17,12 @@ You should have received a copy of the GNU General Public License along with Grafx2; if not, see */ -#include "struct.h" - +/** @file haiku.cpp + * Definition of Haiku specific functions. + * + * Haiku API is C++, so this is C++ code exporting as C symbols + * to be called by GrafX2 C code. + */ #ifdef __HAIKU__ #include #include @@ -26,8 +30,7 @@ #include -extern "C" qword haiku_get_free_space(char* path); -extern "C" char* haiku_get_clipboard(); +#include "haiku.h" qword haiku_get_free_space(char* path) { @@ -38,6 +41,9 @@ qword haiku_get_free_space(char* path) return (qword) disk.Capacity(); } +/** + * @return NULL or a string that should be free()'d by the caller + */ char* haiku_get_clipboard() { if (be_clipboard->Lock()) diff --git a/src/haiku.h b/src/haiku.h index 781e2b86..c23fb940 100644 --- a/src/haiku.h +++ b/src/haiku.h @@ -1,15 +1,21 @@ -#include "struct.h" - -/* +/** @file haiku.h + * Declarations of HAIKU specific functions. + * * Haiku specific code was moved here, because the API is C++. * It can't be compiled in the usual C files. - * So we provide a C wrapper to the functons we need. + * So we provide a C wrapper to the functions we need. */ - #ifndef __HAIKU_H #define __HAIKU_H +#include "struct.h" +#ifdef __cplusplus +extern "C" { +#endif qword haiku_get_free_space(char* path); char* haiku_get_clipboard(); +#ifdef __cplusplus +} +#endif #endif diff --git a/tools/Doxyfile b/tools/Doxyfile index e0b39c66..1d2ea574 100644 --- a/tools/Doxyfile +++ b/tools/Doxyfile @@ -1974,7 +1974,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = __attribute__(x)= +PREDEFINED = __attribute__(x)= __HAIKU__ # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The