(libretro-common) Updates

This commit is contained in:
twinaphex 2016-04-23 10:40:46 +02:00
parent 3902a6715a
commit 08b7ac500b
36 changed files with 235 additions and 196 deletions

1
libretro-common/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.o

Binary file not shown.

View File

@ -38,9 +38,9 @@
* prefer to use the actual name. */
#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_retro(argc, argv, optstring, longopts, longindex)
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
struct option
{
@ -57,9 +57,8 @@ int getopt_long(int argc, char *argv[],
const char *optstring, const struct option *longopts, int *longindex);
extern char *optarg;
extern int optind, opterr, optopt;
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
/* If these are variously #defined, then we have bigger problems */
#ifndef no_argument

View File

@ -23,13 +23,13 @@
#ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H
#define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H
#include <retro_common_api.h>
#ifdef _MSC_VER
#include <compat/msvc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
#ifdef _WIN32
#undef strtok_r
@ -56,8 +56,6 @@ int isblank(int c);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -30,9 +30,9 @@
#ifndef HAVE_STRCASESTR
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/* Avoid possible naming collisions during link
* since we prefer to use the actual name. */
@ -40,9 +40,8 @@ extern "C" {
char *strcasestr(const char *haystack, const char *needle);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif
#endif

View File

@ -30,9 +30,9 @@
#include "../../../config.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#ifdef __MACH__
#ifndef HAVE_STRL
@ -52,9 +52,7 @@ size_t strlcat(char *dest, const char *source, size_t size);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -29,15 +29,15 @@
#include "config.h"
#endif
#include <retro_common_api.h>
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
#define NEED_DYNAMIC
#else
#undef NEED_DYNAMIC
#endif
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef void *dylib_t;
typedef void (*function_t)(void);
@ -66,9 +66,6 @@ char *dylib_error(void);
function_t dylib_proc(dylib_t lib, const char *proc);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -24,9 +24,9 @@
#ifndef __LIBRETRO_SDK_CONFIG_FILE_H
#define __LIBRETRO_SDK_CONFIG_FILE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <stdio.h>
#include <stdint.h>
@ -158,9 +158,7 @@ bool config_file_write(config_file_t *conf, const char *path);
* Does not close the file. */
void config_file_dump(config_file_t *conf, FILE *file);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -28,12 +28,12 @@
#include <stddef.h>
#include <sys/types.h>
#include <retro_common_api.h>
#include <boolean.h>
#include <retro_inline.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
/* Order in this enum is equivalent to negative sort order in filelist
* (i.e. DIRECTORY is on top of PLAIN_FILE) */
@ -402,8 +402,6 @@ void fill_pathname_application_path(char *buf, size_t size);
**/
bool path_mkdir(const char *dir);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -18,11 +18,12 @@
#define __RARCH_IMAGE_CONTEXT_H
#include <stdint.h>
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
enum image_process_code
{
@ -49,8 +50,6 @@ bool video_texture_image_color_convert(unsigned r_shift,
bool video_texture_image_load(struct texture_image *img, const char *path);
void video_texture_image_free(struct texture_image *img);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,11 +23,11 @@
#ifndef __LIBRETRO_SDK_FORMAT_RBMP_H__
#define __LIBRETRO_SDK_FORMAT_RBMP_H__
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
enum rbmp_source_type
{
@ -46,8 +46,6 @@ bool rbmp_save_image(
unsigned pitch,
enum rbmp_source_type type);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -26,12 +26,12 @@
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
#include <boolean.h>
#include <file/archive_file.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef struct rpng rpng_t;
@ -62,9 +62,7 @@ bool rpng_save_image_bgr24(const char *path, const uint8_t *data,
unsigned width, unsigned height, unsigned pitch);
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -22,9 +22,9 @@
#ifndef __LIBRETRO_SDK_FORMAT_RXML_H__
#define __LIBRETRO_SDK_FORMAT_RXML_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/* Total NIH. Very trivial "XML" implementation for use in RetroArch.
* Error checking is minimal. Invalid documents may lead to very
@ -89,9 +89,7 @@ typedef rxml_document_t *xmlDocPtr;
#define xmlFreeParserCtxt(ctx) ((void)0)
#endif
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -26,24 +26,22 @@
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
#include <boolean.h>
RETRO_BEGIN_DECLS
bool rtga_image_load_shift(uint8_t *buf,
void *data,
unsigned a_shift, unsigned r_shift,
unsigned g_shift, unsigned b_shift);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,18 +23,16 @@
#ifndef __LIBRETRO_SDK_SCALER_FILTER_H__
#define __LIBRETRO_SDK_SCALER_FILTER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <boolean.h>
#include <gfx/scaler/scaler.h>
bool scaler_gen_filter(struct scaler_ctx *ctx);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,15 +23,15 @@
#ifndef __LIBRETRO_SDK_SCALER_H__
#define __LIBRETRO_SDK_SCALER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
#include <stdint.h>
#include <stddef.h>
#include <boolean.h>
#include <clamping.h>
RETRO_BEGIN_DECLS
#define FILTER_UNITY (1 << 14)
enum scaler_pix_fmt
@ -145,9 +145,7 @@ void *scaler_alloc(size_t elem_size, size_t size);
**/
void scaler_free(void *ptr);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,13 +23,13 @@
#ifndef LIBRETRO_SDK_GLSM_H
#define LIBRETRO_SDK_GLSM_H
#include <retro_common_api.h>
#include <boolean.h>
#include <libretro.h>
#include <glsym/rglgen_headers.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
#ifdef HAVE_OPENGLES2
typedef GLfloat GLdouble;
@ -147,8 +147,6 @@ typedef struct glsm_ctx_params
bool glsm_ctl(enum glsm_state_ctl state, void *data);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -25,9 +25,9 @@
#include <glsm/glsm.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
/* deprecated old FF-style GL symbols */
#define glTexCoord2f rglTexCoord2f
@ -231,8 +231,6 @@ GLint rglGetAttribLocation(GLuint program, const GLchar *name);
void rglDrawBuffers(GLsizei n, const GLenum *bufs);
void rglBindVertexArray(GLuint array);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -27,11 +27,11 @@
#include "config.h"
#endif
#include <retro_common_api.h>
#include "rglgen_headers.h"
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
struct rglgen_sym_map;
@ -41,9 +41,7 @@ void rglgen_resolve_symbols(rglgen_proc_address_t proc);
void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc,
const struct rglgen_sym_map *map);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,6 +23,8 @@
#ifndef LIBCO_H
#define LIBCO_H
#include <retro_common_api.h>
#ifdef LIBCO_C
#ifdef LIBCO_MP
#define thread_local __thread
@ -31,9 +33,7 @@
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef void* cothread_t;
@ -73,9 +73,7 @@ void co_delete(cothread_t cothread);
*/
void co_switch(cothread_t cothread);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
/* ifndef LIBCO_H */
#endif

View File

@ -23,11 +23,11 @@
#ifndef __LIBRETRO_SDK_DIR_LIST_H
#define __LIBRETRO_SDK_DIR_LIST_H
#include <retro_common_api.h>
#include <lists/string_list.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
/**
* dir_list_new:
@ -63,8 +63,6 @@ void dir_list_sort(struct string_list *list, bool dir_first);
**/
void dir_list_free(struct string_list *list);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,9 +23,9 @@
#ifndef __LIBRETRO_SDK_FILE_LIST_H__
#define __LIBRETRO_SDK_FILE_LIST_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
#include <stddef.h>
#include <stdlib.h>
@ -117,8 +117,6 @@ void file_list_sort_on_type(file_list_t *list);
bool file_list_search(const file_list_t *list, const char *needle,
size_t *index);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,13 +23,13 @@
#ifndef __LIBRETRO_SDK_STRING_LIST_H
#define __LIBRETRO_SDK_STRING_LIST_H
#include <retro_common_api.h>
#include <boolean.h>
#include <stdlib.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
union string_list_elem_attr
{
@ -141,8 +141,6 @@ void string_list_join_concat(char *buffer, size_t size,
void string_list_set(struct string_list *list, unsigned idx,
const char *str);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -25,16 +25,14 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
void *memalign_alloc(size_t boundary, size_t size);
void memalign_free(void *ptr);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -27,9 +27,9 @@
#include <boolean.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
struct http_t;
struct http_connection_t;
@ -68,8 +68,6 @@ uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_error);
/* Cleans up all memory. */
void net_http_delete(struct http_t *state);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -26,9 +26,9 @@
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct fifo_buffer fifo_buffer_t;
@ -46,9 +46,7 @@ size_t fifo_read_avail(fifo_buffer_t *buffer);
size_t fifo_write_avail(fifo_buffer_t *buffer);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -25,9 +25,9 @@
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct msg_queue msg_queue_t;
@ -83,8 +83,6 @@ void msg_queue_clear(msg_queue_t *queue);
**/
void msg_queue_free(msg_queue_t *queue);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -26,9 +26,9 @@
#include <stdint.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
enum task_queue_ctl_state
{
@ -148,8 +148,6 @@ void task_queue_push_progress(retro_task_t *task);
bool task_queue_ctl(enum task_queue_ctl_state state, void *data);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -0,0 +1,92 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_common_api.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _LIBRETRO_COMMON_RETRO_COMMON_API_H
#define _LIBRETRO_COMMON_RETRO_COMMON_API_H
/*
This file is designed to normalize the libretro-common compiling environment
for public API headers. This should be leaner than a normal compiling environment,
since it gets #included into other project's sources.
*/
/* ------------------------------------ */
/*
Ordinarily we want to put #ifdef __cplusplus extern "C" in C library
headers to enable them to get used by c++ sources.
However, we want to support building this library as C++ as well, so a
special technique is called for.
*/
#define RETRO_BEGIN_DECLS
#define RETRO_END_DECLS
#ifdef __cplusplus
#ifdef CXX_BUILD
/* build wants everything to be built as c++, so no extern "C" */
#else
#undef RETRO_BEGIN_DECLS
#undef RETRO_END_DECLS
#define RETRO_BEGIN_DECLS extern "C" {
#define RETRO_END_DECLS }
#endif
#else
/* header is included by a C source file, so no extern "C" */
#endif
/*
IMO, this non-standard ssize_t should not be used.
However, it's a good example of how to handle something like this.
*/
#ifdef _MSC_VER
#ifndef HAVE_SSIZE_T
#define HAVE_SSIZE_T
#if defined(_WIN64)
typedef __int64 ssize_t;
#elif defined(_WIN32)
typedef int ssize_t;
#endif
#endif
#endif
/*
I would like to see retro_inline.h moved in here; possibly boolean too.
rationale: these are used in public APIs, and it is easier to find problems
and write code that works the first time portably when theyre included uniformly
than to do the analysis from scratch each time you think you need it, for each feature.
Moreover it helps force you to make hard decisions: if you EVER bring in boolean.h,
then you should pay the price everywhere, so you can see how much grief it will cause.
Of course, another school of thought is that you should do as little damage as possible
in as few places as possible...
*/
/* _LIBRETRO_COMMON_RETRO_COMMON_API_H */
#endif

View File

@ -23,11 +23,11 @@
#ifndef __RETRO_DIRENT_H
#define __RETRO_DIRENT_H
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
struct RDIR;
@ -53,8 +53,6 @@ bool retro_dirent_is_dir(struct RDIR *rdir);
void retro_closedir(struct RDIR *rdir);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,6 +23,14 @@
#ifndef __LIBRETRO_SDK_ENVIRONMENT_H
#define __LIBRETRO_SDK_ENVIRONMENT_H
/*
This file is designed to create a normalized environment for compiling
libretro-common's private implementations, or any other sources which might
enjoy use of it's environment (RetroArch for instance).
This should be an elaborately crafted environment so that sources don't
need to be full of platform-specific workarounds.
*/
#if defined (__cplusplus)
#if 0
printf("This is C++, version %d.\n", __cplusplus);
@ -65,4 +73,6 @@ printf("This is C++, version %d.\n", __cplusplus);
/* This is not standard C. __STDC__ is not defined. */
#endif
#endif

View File

@ -26,11 +26,11 @@
#include <stdint.h>
#include <stddef.h>
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
/**
* path_is_directory:
@ -58,8 +58,6 @@ int32_t path_get_size(const char *path);
**/
bool mkdir_norecurse(const char *dir);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -23,9 +23,9 @@
#ifndef __LIBRETRO_SDK_SEMAPHORE_H
#define __LIBRETRO_SDK_SEMAPHORE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
typedef struct ssem ssem_t;
@ -47,8 +47,6 @@ void ssem_wait(ssem_t *semaphore);
void ssem_signal(ssem_t *semaphore);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif /* __LIBRETRO_SDK_SEMAPHORE_H */

View File

@ -23,14 +23,14 @@
#ifndef __LIBRETRO_SDK_RTHREADS_H__
#define __LIBRETRO_SDK_RTHREADS_H__
#include <retro_common_api.h>
#include <boolean.h>
#include <stdint.h>
#include <retro_inline.h>
#include <retro_miscellaneous.h>
#if defined(__cplusplus)
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef struct sthread sthread_t;
typedef struct slock slock_t;
@ -183,8 +183,6 @@ int scond_broadcast(scond_t *cond);
**/
void scond_signal(scond_t *cond);
#if defined(__cplusplus)
}
#endif
RETRO_END_DECLS
#endif

View File

@ -28,12 +28,10 @@
#include <sys/types.h>
#include <retro_common.h>
#include <retro_common_api.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
RETRO_BEGIN_DECLS
typedef struct RFILE RFILE;
@ -70,8 +68,6 @@ int filestream_putc(RFILE *stream, int c);
int filestream_get_fd(RFILE *stream);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif

View File

@ -28,9 +28,9 @@
#include <string.h>
#include <boolean.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
bool string_is_empty(const char *data);
@ -45,8 +45,6 @@ char *string_to_lower(char *s);
char *string_replace_substring(const char *in, const char *pattern,
const char *by);
#ifdef __cplusplus
}
#endif
RETRO_END_DECLS
#endif