Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Doxygen-styled comments to parts of the libretro API #15641

Merged
merged 132 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
9a6f5d9
Touch up the documentation for a few environment calls
JesseTG Aug 23, 2023
80d4e53
Touch up more comments
JesseTG Aug 25, 2023
f604628
Update docs for more environment calls
JesseTG Aug 28, 2023
c5ef438
Add doc comments for more environment calls
JesseTG Aug 28, 2023
bf516e5
Change various @returns to indicate that the environment call is avai…
JesseTG Aug 28, 2023
c3f1322
Note some deprecated symbols
JesseTG Aug 29, 2023
324ed96
Touch up the docs for RETRO_ENVIRONMENT_SET_MESSAGE
JesseTG Aug 29, 2023
165e454
Touch up the docs for RETRO_ENVIRONMENT_SET_PIXEL_FORMAT
JesseTG Aug 29, 2023
a1a06e3
Add more doc comments
JesseTG Aug 30, 2023
127179c
(libretro) Add more doxygen documentation for the libretro API
RobLoach Aug 31, 2023
6a89b5a
(libretro) Add doxygen comments for the callbacks
RobLoach Sep 3, 2023
f7845e0
Document retro_init and retro_deinit
JesseTG Sep 4, 2023
a8dbb63
Add comments for retro_log-related symbols
JesseTG Sep 4, 2023
d68b6ca
Add a comment
JesseTG Sep 4, 2023
15d91f4
Clean up some camera-related comments
JesseTG Sep 4, 2023
349039c
Clean up frame time-related callbacks
JesseTG Sep 4, 2023
41bdf2e
Merge remote-tracking branch 'origin/jtg/docs-improvements' into jtg/…
JesseTG Sep 4, 2023
972ca8b
Correct some information about major callbacks
JesseTG Sep 4, 2023
d44be24
Clarify some parameter info
JesseTG Sep 4, 2023
899b78d
Fix incorrect info about retro_set_environment
JesseTG Sep 4, 2023
1c11d36
Update libretro-common/include/libretro.h
JesseTG Sep 5, 2023
9669889
(libretro) Add doxygen docs on RETRO_THROTTLE
RobLoach Sep 5, 2023
55f1bad
Touch up the docs for RETRO_ENVIRONMENT_SET_AUDIO_CALLBACK
JesseTG Sep 6, 2023
e8a82aa
Touch up the docs for some macros
JesseTG Sep 6, 2023
0ec8f43
Touch up the docs for some more environment calls
JesseTG Sep 6, 2023
c195ff1
Update libretro-common/include/libretro.h
JesseTG Sep 7, 2023
f6fc0bc
Update libretro-common/include/libretro.h
JesseTG Sep 7, 2023
e88baf8
Update libretro-common/include/libretro.h
JesseTG Sep 7, 2023
e57b6df
Update libretro-common/include/libretro.h
JesseTG Sep 7, 2023
fee528a
Tidy up the doc comments for clamping.h
JesseTG Sep 7, 2023
ac4728f
Define some sections for constants
JesseTG Sep 7, 2023
67aa098
Fix a duplicate @see
JesseTG Sep 7, 2023
65f4eb8
Polish up the docs for the rumble interface
JesseTG Sep 7, 2023
1de7a1d
Polish up the docs for RETRO_ENVIRONMENT_GET_INPUT_DEVICE_CAPABILITIES
JesseTG Sep 7, 2023
a40bad7
Update libretro-common/include/libretro.h
JesseTG Sep 9, 2023
92f91e0
Document INLINE
JesseTG Sep 9, 2023
66e937f
Clean up some tags
JesseTG Sep 9, 2023
1728445
Touch up the docs for the sensor interface
JesseTG Sep 9, 2023
a42640e
Add docs for RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK
JesseTG Sep 9, 2023
6221252
Update docs for RETRO_ENVIRONMENT_GET_INPUT_BITMASKS and accompanying…
JesseTG Sep 9, 2023
5951d40
Update some group definitions
JesseTG Sep 9, 2023
8b2d8de
Spiff up the docs for retro_dirent.h
JesseTG Sep 12, 2023
5b0ab44
Document dylib.h
JesseTG Sep 12, 2023
5b1019f
Document base64.h
JesseTG Sep 12, 2023
a7a9b7d
Document crc32.h
JesseTG Sep 12, 2023
e88c60e
Touch up the docs for audio conversion functions
JesseTG Sep 12, 2023
2ccacfb
Clean up some Doxygen tags
JesseTG Sep 12, 2023
fdc084d
Refine the docs for RETRO_ENVIRONMENT_GET_PERF_INTERFACE
JesseTG Sep 13, 2023
324cb66
Fix incorrect infor in dylib.h
JesseTG Sep 13, 2023
b5f8540
Touch up the docs for RETRO_ENVIRONMENT_GET_CAMERA_INTERFACE
JesseTG Sep 14, 2023
b5fa9e5
Revise the docs for RETRO_ENVIRONMENT_SET_GEOMETRY
JesseTG Sep 14, 2023
b0e6008
Revise the docs for RETRO_ENVIRONMENT_GET_LOCATION_INTERFACE
JesseTG Sep 15, 2023
9d27589
Revise a function's doc
JesseTG Sep 15, 2023
8481efb
Touch up most of the rthreads docs
JesseTG Sep 18, 2023
96c8527
Touch up the retro_timers.h docs
JesseTG Sep 18, 2023
4ccf335
Revise the subsystem docs
JesseTG Sep 19, 2023
e419485
Fix some incorrect @see's
JesseTG Sep 19, 2023
71e2658
Touch up the docs for RETRO_ENVIRONMENT_GET_LED_INTERFACE
JesseTG Sep 22, 2023
1c6bb96
Give the RETRO_ENVIRONMENT_GET_SAVESTATE_CONTEXT docs a makeover
JesseTG Sep 22, 2023
1023aba
Slight cleanup to the microphone docs
JesseTG Sep 22, 2023
041f1af
Slight cleanup to the device power docs
JesseTG Sep 22, 2023
f73ef1e
Touch up serialization quirk docs
JesseTG Sep 22, 2023
b4f80fa
Give the MIDI docs a haircut
JesseTG Sep 22, 2023
efcf911
Update libretro-common/include/libretro.h
JesseTG Sep 23, 2023
027d5b6
Freshen up rtime's docs
JesseTG Sep 23, 2023
2c1bfe6
Improve the docs and accompanying definitions for RETRO_ENVIRONMENT_G…
JesseTG Sep 23, 2023
e8e298d
Shine the shoes of RETRO_ENVIRONMENT_GET_INPUT_MAX_USERS's docs
JesseTG Sep 23, 2023
122a37c
Freshen up the docs for fifo_queue.h
JesseTG Sep 23, 2023
796416c
Document most of task_queue.h
JesseTG Sep 25, 2023
24b9753
Put retro_dirent's symbols in a group
JesseTG Sep 26, 2023
02c3169
Finish documenting task_queue.h
JesseTG Sep 26, 2023
4c744f7
Document some compatibility headers
JesseTG Sep 26, 2023
41d21d3
Document read_stdin
JesseTG Sep 27, 2023
5bfcb55
Document file_stream_transforms.h
JesseTG Sep 27, 2023
5e6508d
Document the VFS API
JesseTG Oct 2, 2023
fb42832
(Docs) Add doxygen notes about RETRO_DEVICE_*
RobLoach Oct 3, 2023
a455188
Fix some line breaks
JesseTG Oct 3, 2023
4e14add
Revise RETRO_DEVICE docs
JesseTG Oct 3, 2023
deec422
Document strl.h
JesseTG Oct 10, 2023
87ea39a
Update the features_cpu.h docs
JesseTG Oct 10, 2023
931f589
Rewrite the docs for file_stream.h
JesseTG Oct 16, 2023
f697306
Update the docs for retro_endianness.h
JesseTG Oct 17, 2023
c7e98d8
Update the docs for retro_miscellaneous.h
JesseTG Oct 17, 2023
da11c66
Document the RETRO_VFS_SEEK_POSITION constants
JesseTG Oct 17, 2023
892c368
Finish documenting rthreads.h
JesseTG Oct 18, 2023
443c1aa
Document network_stream.h
JesseTG Oct 18, 2023
073fe8c
Put the RETRO_MEMORY defines in a defgroup
JesseTG Oct 20, 2023
fdd5085
Move a doc comment in retro_common.h to file scope
JesseTG Oct 20, 2023
f7cab18
Revise the docs for RETRO_ENVIRONMENT_SET_CONTROLLER_INFO, and accomp…
JesseTG Oct 22, 2023
df99457
Fix the @param/in/out order in libretro.h's @param declarations
JesseTG Oct 22, 2023
8a49b92
Tidy up the docs for RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION
JesseTG Oct 23, 2023
c921852
Spiff up the docs for RETRO_ENVIRONMENT_GET_CURRENT_SOFTWARE_FRAMEBUFFER
JesseTG Oct 23, 2023
48d2c5b
Fix some tags
JesseTG Oct 23, 2023
389a5d2
Polish up RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE's docs
JesseTG Oct 24, 2023
802b2a8
libretro: Add header doxygen
RobLoach Nov 2, 2023
2aea63a
Update libretro-common/include/libretro.h
JesseTG Nov 2, 2023
065af45
Update libretro-common/include/libretro.h
JesseTG Nov 2, 2023
e9271f9
Merge pull request #1 from RobLoach/readme-header
JesseTG Nov 2, 2023
f651349
Clean up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY
JesseTG Oct 24, 2023
d0e2683
Clean up the docs for RETRO_ENVIRONMENT_SET_HW_RENDER_CONTEXT_NEGOTIA…
JesseTG Oct 24, 2023
7729c46
Touch up some comment syntax for RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE
JesseTG Oct 30, 2023
a5f0b5b
Fix some inaccuracies
JesseTG Oct 30, 2023
2d85766
Re-add the license statement for libretro.h
JesseTG Nov 3, 2023
4b3011e
Touch up the docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2
JesseTG Nov 6, 2023
2a81579
Touch up docs for RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY
JesseTG Nov 6, 2023
bcb12bb
Touch up docs for some options-related symbols
JesseTG Nov 6, 2023
517ece6
Fix some syntax that was preventing most doc files from being generated
JesseTG Nov 6, 2023
8103c50
Express retro_core_option_definition docs in terms of retro_core_opti…
JesseTG Nov 15, 2023
a7ff413
Finalize some core option-related docs
JesseTG Nov 15, 2023
4f485dc
Fix some incorrect info about achievements
JesseTG Nov 16, 2023
1273fda
Polish up the docs for RETRO_ENVIRONMENT_SET_MEMORY_MAPS
JesseTG Nov 16, 2023
00c7ea6
Polish up the docs for RETRO_ENVIRONMENT_GET_DISK_CONTROL_INTERFACE_V…
JesseTG Nov 16, 2023
e010211
Add a notice for `RETRO_ENVIRONMENT_GET_LOG_INTERFACE`
JesseTG Nov 28, 2023
04719ef
Update the disk control interface docs
JesseTG Nov 28, 2023
726540c
Add a sentence to a doc comment
JesseTG Dec 4, 2023
51b235d
Update a comment
JesseTG Dec 4, 2023
e6fca0e
Remove an irrelevant @todo
JesseTG Dec 4, 2023
eb130df
Touch up the docs for `retro_message_target`
JesseTG Dec 4, 2023
0716a57
Touch up the docs for `retro_message_type`
JesseTG Dec 4, 2023
8c2f9b5
Touch up the docs for `RETRO_ENVIRONMENT_SET_MESSAGE_EXT`
JesseTG Dec 4, 2023
1cae9b3
Touch up the docs for `RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALL…
JesseTG Dec 4, 2023
611dee1
Touch up the docs for `RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCY`
JesseTG Dec 4, 2023
699e5f2
Merge branch 'master' into jtg/docs-improvements
JesseTG Dec 19, 2023
e492fbd
Revise a comment
JesseTG Dec 27, 2023
5433da6
Revise the docs for `RETRO_ENVIRONMENT_SET_VARIABLE`
JesseTG Dec 27, 2023
cbc554e
Add a `@see`
JesseTG Dec 27, 2023
0fa502e
Clean up the `RETRO_ENVIRONMENT_SET_FASTFORWARDING_OVERRIDE` docs
JesseTG Dec 27, 2023
c8b88cc
Update the Doxyfile
JesseTG Jan 3, 2024
c97efb5
Merge branch 'master' into jtg/docs-improvements
JesseTG Jan 24, 2024
551110f
libretro: Add three more environment callback doxygen docs
RobLoach Jan 29, 2024
7cfc955
Merge pull request #2 from RobLoach/doxygen-env
JesseTG Jan 29, 2024
dbce707
doxygen: Remove @example reference
RobLoach Jan 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions libretro-common/include/audio/conversion/float_to_s16.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,28 @@ RETRO_BEGIN_DECLS
#include <stddef.h>

/**
* convert_float_to_s16:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* Converts an array of floating-point audio samples
* to signed integer 16-bit audio samples,
* possibly using SIMD intrinsics.
*
* Converts floating point
* to signed integer 16-bit.
* @param out The buffer that will be used to store the converted samples.
* @param in The buffer containing the samples to convert.
* Any number of channels is supported.
* @param samples The length of \c in in samples, \em not bytes or frames.
* \c out must be as large as <tt>sizeof(int16_t) * samples</tt>.
* @see convert_s16_to_float
**/
void convert_float_to_s16(int16_t *out,
const float *in, size_t samples);

/**
* convert_float_to_s16_init_simd:
* Initializes any prerequisites for
* using SIMD implementations of \c convert_float_to_s16.
*
* Sets up function pointers for conversion
* functions based on CPU features.
* If SIMD intrinsics are not available or no initialization is required,
* this function does nothing.
*
* @see convert_float_to_s16
**/
void convert_float_to_s16_init_simd(void);

Expand Down
27 changes: 17 additions & 10 deletions libretro-common/include/audio/conversion/s16_to_float.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,30 @@
RETRO_BEGIN_DECLS

/**
* convert_s16_to_float:
* @out : output buffer
* @in : input buffer
* @samples : size of samples to be converted
* @gain : gain applied (.e.g. audio volume)
* Converts an array of signed integer 16-bit audio samples
* to floating-point format,
* possibly using SIMD intrinsics.
*
* Converts from signed integer 16-bit
* to floating point.
* @param out The buffer that will be used to store the converted samples.
* @param in The buffer containing the samples to convert.
* Any number of channels is supported.
* @param samples The length of \c in in samples, \em not bytes or frames.
* \c out must be as large as <tt>sizeof(float) * samples</tt>.
* @param gain The gain (audio volume) to apply to the samples.
* Pass a value of 1.0 to not apply any gain.
* @see convert_float_to_s16
**/
void convert_s16_to_float(float *out,
const int16_t *in, size_t samples, float gain);

/**
* convert_s16_to_float_init_simd:
* Initializes any prerequisites for
* using SIMD implementations of \c convert_s16_to_float.
*
* Sets up function pointers for conversion
* functions based on CPU features.
* If SIMD intrinsics are not available or no initialization is required,
* this function does nothing.
*
* @see convert_s16_to_float
**/
void convert_s16_to_float_init_simd(void);

Expand Down
19 changes: 8 additions & 11 deletions libretro-common/include/clamping.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,13 @@
#include <retro_inline.h>

/**
* clamp_float:
* @val : initial value
* @lower : lower limit that value should be clamped against
* @upper : upper limit that value should be clamped against
* Clamps a floating-point value to the specified range.
*
* Clamps a floating point value.
* @param val The value to clamp.
* @param lower The minimum possible value.
* @param upper The maximum possible value.
*
* Returns: a clamped value of initial float value @val.
* @returns \c val clamped to between \c lower and \c upper (inclusive).
*/
static INLINE float clamp_float(float val, float lower, float upper)
{
Expand All @@ -46,12 +45,10 @@ static INLINE float clamp_float(float val, float lower, float upper)
}

/**
* clamp_8bit:
* @val : initial value
* Clamps an integer to fit in 8 bits.
*
* Clamps an unsigned 8-bit value.
*
* Returns: a clamped value of initial unsigned 8-bit value @val.
* @param val The value to clamp.
* @return \c val clamped to between 0 and 255 (inclusive).
*/
static INLINE uint8_t clamp_8bit(int val)
{
Expand Down
5 changes: 5 additions & 0 deletions libretro-common/include/compat/fnmatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@

#define FNM_NOMATCH 1

/**
* Portable implementation of \c fnmatch(3),
* except \c flags is not implemented.
* @see https://man7.org/linux/man-pages/man3/fnmatch.3.html
*/
int rl_fnmatch(const char *pattern, const char *string, int flags);

#endif
14 changes: 11 additions & 3 deletions libretro-common/include/compat/getopt.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@
#include "../../../config.h"
#endif

/* Custom implementation of the GNU getopt_long for portability.
* Not designed to be fully compatible, but compatible with
* the features RetroArch uses. */
/**
* @file getopt.h
*
* Portable reimplementation of a subset of libc's \c getopt_long.
* Not designed to be fully compatible,
* but it's enough for RetroArch's purposes.
*
* If \c getopt_long is available (as determined by \c HAVE_GETOPT_LONG), it will be used instead.
*
* @see https://man7.org/linux/man-pages/man3/getopt.3.html
*/

#ifdef HAVE_GETOPT_LONG
#include <getopt.h>
Expand Down
13 changes: 13 additions & 0 deletions libretro-common/include/compat/ifaddrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,20 @@ struct ifaddrs

#include <sys/cdefs.h>

/**
* Portable reimplementation of \c getifaddrs().
* The original function will be used if it's available.
*
* @see https://man7.org/linux/man-pages/man3/getifaddrs.3.html
*/
extern int getifaddrs(struct ifaddrs **ifap);

/**
* Portable reimplementation of \c freeifaddrs().
* The original function will be used if it's available.
*
* @see https://man7.org/linux/man-pages/man3/getifaddrs.3.html
*/
extern void freeifaddrs(struct ifaddrs *ifa);

#endif
16 changes: 14 additions & 2 deletions libretro-common/include/compat/intrinsics.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@

RETRO_BEGIN_DECLS

/* Count Leading Zero, unsigned 16bit input value */
/**
* Counts the leading zero bits in a \c uint16_t.
* Uses compiler intrinsics if available, or a standard C implementation if not.
*
* @param val Value to count leading zeroes in.
* @return Number of leading zeroes in \c val.
*/
static INLINE unsigned compat_clz_u16(uint16_t val)
{
#if defined(__GNUC__)
Expand All @@ -56,7 +62,13 @@ static INLINE unsigned compat_clz_u16(uint16_t val)
#endif
}

/* Count Trailing Zero */
/**
* Counts the trailing zero bits in a \c uint16_t.
* Uses compiler intrinsics if available, or a standard C implementation if not.
*
* @param val Value to count trailing zeroes in.
* @return Number of trailing zeroes in \c val.
*/
static INLINE int compat_ctz(unsigned x)
{
#if defined(__GNUC__) && !defined(RARCH_CONSOLE)
Expand Down
37 changes: 35 additions & 2 deletions libretro-common/include/compat/posix_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,64 @@

#include <retro_common_api.h>

/**
* @file posix_string.h
*
* Portable reimplementations of various string functions
* that are normally provided by libc or POSIX.
*/

#ifdef _MSC_VER
#include <compat/msvc.h>
#endif

RETRO_BEGIN_DECLS

#ifdef _WIN32
#if defined(_WIN32) || defined(DOXYGEN)
#undef strtok_r
#define strtok_r(str, delim, saveptr) retro_strtok_r__(str, delim, saveptr)

/**
* Portable reimplementation of \c strtok_r().
* The original function will be used if it's available.
*
* @see https://man7.org/linux/man-pages/man3/strtok.3.html
*/
char *strtok_r(char *str, const char *delim, char **saveptr);
#endif

#ifdef _MSC_VER
#if defined(_MSC_VER) || defined(DOXYGEN)
#undef strcasecmp
#undef strdup

#define strcasecmp(a, b) retro_strcasecmp__(a, b)
#define strdup(orig) retro_strdup__(orig)
/**
* Portable reimplementation of \c strcasecmp().
* The original function will be used if it's available.
*
* @see https://man7.org/linux/man-pages/man3/strcasecmp.3.html
*/
int strcasecmp(const char *a, const char *b);

/**
* Portable reimplementation of \c strdup().
* The original function will be used if it's available.
*
* @see https://man7.org/linux/man-pages/man3/strdup.3.html
*/
char *strdup(const char *orig);

/* isblank is available since MSVC 2013 */
#if _MSC_VER < 1800
#undef isblank
#define isblank(c) retro_isblank__(c)
/**
* Portable reimplementation of \c isblank().
* The original function will be used if it's available.
*
* @see https://en.cppreference.com/w/c/string/byte/isblank
*/
int isblank(int c);
#endif

Expand Down
8 changes: 8 additions & 0 deletions libretro-common/include/compat/strcasestr.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ RETRO_BEGIN_DECLS
* since we prefer to use the actual name. */
#define strcasestr(haystack, needle) strcasestr_retro__(haystack, needle)

/**
* Portable reimplementation of \c strcasestr(3).
* If the original function is available
* (as determined by the presence of \c HAVE_STRCASESTR),
* it will be used instead.
*
* @see https://man7.org/linux/man-pages/man3/strstr.3.html
*/
char *strcasestr(const char *haystack, const char *needle);

RETRO_END_DECLS
Expand Down
63 changes: 56 additions & 7 deletions libretro-common/include/dynamic/dylib.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,79 @@

RETRO_BEGIN_DECLS

/**
* Opaque handle to a dynamic library.
* @see dylib_load
*/
typedef void *dylib_t;

/**
* Opaque handle to a function exposed by a dynamic library.
*
* Should be cast to a known function pointer type before being used.
* @see dylib_proc
*/
typedef void (*function_t)(void);

#ifdef NEED_DYNAMIC
/**
* dylib_load:
* @path : Path to libretro core library.
* Loads a dynamic library in a platform-independent manner.
*
* Platform independent dylib loading.
* @param path Path to the library to load.
* May be either a complete path or a filename without an extension.
* If not a complete path, the operating system will search for a library by this name;
* details will depend on the platform.
* @note The returned library must be freed with \c dylib_close
* before the core or frontend exits.
*
* @return Library handle on success, otherwise NULL.
* @return Handle to the loaded library, or \c NULL on failure.
* Upon failure, \c dylib_error may be used
* to retrieve a string describing the error.
* @see dylib_close
* @see dylib_error
* @see dylib_proc
**/
dylib_t dylib_load(const char *path);

/**
* dylib_close:
* @lib : Library handle.
* Frees the resources associated with a dynamic library.
*
* Any function pointers obtained from the library may become invalid,
* depending on whether the operating system manages reference counts to dynamic libraries.
*
* Frees library handle.
* If there was an error closing the library,
* it will be reported by \c dylib_error.
*
* @param lib Handle to the library to close.
* Behavior is undefined if \c NULL.
**/
void dylib_close(dylib_t lib);

/**
* Returns a string describing the most recent error that occurred
* within the other \c dylib functions.
*
* @return Pointer to the most recent error string,
* \c or NULL if there was no error.
* @warning The returned string is only valid
* until the next call to a \c dylib function.
* Additionally, the string is managed by the library
* and should not be modified or freed by the caller.
*/
char *dylib_error(void);

/**
* Returns a pointer to a function exposed by a dynamic library.
*
* @param lib The library to get a function pointer from.
* @param proc The name of the function to get a pointer to.
* @return Pointer to the requested function,
* or \c NULL if there was an error.
* This must be cast to the correct function pointer type before being used.
* @warning The returned pointer is only valid for the lifetime of \c lib.
* Once \c lib is closed, all function pointers returned from it will be invalidated;
* using them is undefined behavior.
*/
function_t dylib_proc(dylib_t lib, const char *proc);
#endif

Expand Down
22 changes: 22 additions & 0 deletions libretro-common/include/encodings/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,29 @@

RETRO_BEGIN_DECLS

/**
* Encodes binary data into a \c NULL-terminated base64 string.
*
* @param binaryData The data to encode.
* Behavior is undefined if \c NULL.
* @param len The length of the data to encode.
* @param flen Pointer to the length of the returned string.
* @return Pointer to the base64-encoded string, or \c NULL on failure.
* The returned string is owned by the caller and must be released with \c free().
* @see unbase64
*/
char* base64(const void* binaryData, int len, int *flen);

/**
* Decodes a base64-encoded string into binary data.
*
* @param ascii The base64 string to decode, in ASCII format.
* @param len Length of the string to decode.
* @param flen Pointer to the length of the returned data.
* @return The decoded binary data, or \c NULL on failure.
* The returned buffer is owned by the caller and must be released with \c free().
* @see base64
*/
unsigned char* unbase64(const char* ascii, int len, int *flen);

RETRO_END_DECLS
Expand Down
Loading