Rev 1 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 8 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | Simple DirectMedia Layer |
2 | Simple DirectMedia Layer |
3 | Copyright (C) 1997- |
3 | Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org> |
4 | 4 | ||
5 | This software is provided 'as-is', without any express or implied |
5 | This software is provided 'as-is', without any express or implied |
6 | warranty. In no event will the authors be held liable for any damages |
6 | warranty. In no event will the authors be held liable for any damages |
7 | arising from the use of this software. |
7 | arising from the use of this software. |
8 | 8 | ||
Line 83... | Line 83... | ||
83 | # endif |
83 | # endif |
84 | # include <math.h> |
84 | # include <math.h> |
85 | #endif |
85 | #endif |
86 | #ifdef HAVE_FLOAT_H |
86 | #ifdef HAVE_FLOAT_H |
87 | # include <float.h> |
87 | # include <float.h> |
- | 88 | #endif |
|
- | 89 | #if defined(HAVE_ALLOCA) && !defined(alloca) |
|
- | 90 | # if defined(HAVE_ALLOCA_H) |
|
- | 91 | # include <alloca.h> |
|
- | 92 | # elif defined(__GNUC__) |
|
- | 93 | # define alloca __builtin_alloca |
|
- | 94 | # elif defined(_MSC_VER) |
|
- | 95 | # include <malloc.h> |
|
- | 96 | # define alloca _alloca |
|
- | 97 | # elif defined(__WATCOMC__) |
|
- | 98 | # include <malloc.h> |
|
- | 99 | # elif defined(__BORLANDC__) |
|
- | 100 | # include <malloc.h> |
|
- | 101 | # elif defined(__DMC__) |
|
- | 102 | # include <stdlib.h> |
|
- | 103 | # elif defined(__AIX__) |
|
- | 104 | #pragma alloca |
|
- | 105 | # elif defined(__MRC__) |
|
- | 106 | void *alloca(unsigned); |
|
- | 107 | # else |
|
- | 108 | char *alloca(); |
|
- | 109 | # endif |
|
88 | #endif |
110 | #endif |
89 | 111 | ||
90 | /** |
112 | /** |
91 | * The number of elements in an array. |
113 | * The number of elements in an array. |
92 | */ |
114 | */ |
Line 326... | Line 348... | ||
326 | /* Set up for C function definitions, even when using C++ */ |
348 | /* Set up for C function definitions, even when using C++ */ |
327 | #ifdef __cplusplus |
349 | #ifdef __cplusplus |
328 | extern "C" { |
350 | extern "C" { |
329 | #endif |
351 | #endif |
330 | 352 | ||
331 | #if defined(HAVE_ALLOCA) && !defined(alloca) |
- | |
332 | # if defined(HAVE_ALLOCA_H) |
- | |
333 | # include <alloca.h> |
- | |
334 | # elif defined(__GNUC__) |
- | |
335 | # define alloca __builtin_alloca |
- | |
336 | # elif defined(_MSC_VER) |
- | |
337 | # include <malloc.h> |
- | |
338 | # define alloca _alloca |
- | |
339 | # elif defined(__WATCOMC__) |
- | |
340 | # include <malloc.h> |
- | |
341 | # elif defined(__BORLANDC__) |
- | |
342 | # include <malloc.h> |
- | |
343 | # elif defined(__DMC__) |
- | |
344 | # include <stdlib.h> |
- | |
345 | # elif defined(__AIX__) |
- | |
346 | #pragma alloca |
- | |
347 | # elif defined(__MRC__) |
- | |
348 | void *alloca(unsigned); |
- | |
349 | # else |
- | |
350 | char *alloca(); |
- | |
351 | # endif |
- | |
352 | #endif |
- | |
353 | #ifdef HAVE_ALLOCA |
353 | #ifdef HAVE_ALLOCA |
354 | #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) |
354 | #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) |
355 | #define SDL_stack_free(data) |
355 | #define SDL_stack_free(data) |
356 | #else |
356 | #else |
357 | #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) |
357 | #define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count)) |
Line 442... | Line 442... | ||
442 | case 1: *_p++ = _val; /* fallthrough */ |
442 | case 1: *_p++ = _val; /* fallthrough */ |
443 | } while ( --_n ); |
443 | } while ( --_n ); |
444 | } |
444 | } |
445 | #endif |
445 | #endif |
446 | } |
446 | } |
447 | - | ||
448 | 447 | ||
449 | extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); |
448 | extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); |
450 | 449 | ||
451 | extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); |
450 | extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); |
452 | extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); |
451 | extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); |
453 | 452 | ||
- | 453 | extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); |
|
454 | extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); |
454 | extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); |
455 | extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); |
455 | extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); |
456 | extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); |
456 | extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); |
457 | extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); |
457 | extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); |
458 | 458 | ||
Line 499... | Line 499... | ||
499 | #define M_PI 3.14159265358979323846264338327950288 /**< pi */ |
499 | #define M_PI 3.14159265358979323846264338327950288 /**< pi */ |
500 | #endif |
500 | #endif |
501 | #endif |
501 | #endif |
502 | 502 | ||
503 | extern DECLSPEC double SDLCALL SDL_acos(double x); |
503 | extern DECLSPEC double SDLCALL SDL_acos(double x); |
- | 504 | extern DECLSPEC float SDLCALL SDL_acosf(float x); |
|
504 | extern DECLSPEC double SDLCALL SDL_asin(double x); |
505 | extern DECLSPEC double SDLCALL SDL_asin(double x); |
- | 506 | extern DECLSPEC float SDLCALL SDL_asinf(float x); |
|
505 | extern DECLSPEC double SDLCALL SDL_atan(double x); |
507 | extern DECLSPEC double SDLCALL SDL_atan(double x); |
- | 508 | extern DECLSPEC float SDLCALL SDL_atanf(float x); |
|
506 | extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); |
509 | extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); |
- | 510 | extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); |
|
507 | extern DECLSPEC double SDLCALL SDL_ceil(double x); |
511 | extern DECLSPEC double SDLCALL SDL_ceil(double x); |
- | 512 | extern DECLSPEC float SDLCALL SDL_ceilf(float x); |
|
508 | extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); |
513 | extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); |
- | 514 | extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); |
|
509 | extern DECLSPEC double SDLCALL SDL_cos(double x); |
515 | extern DECLSPEC double SDLCALL SDL_cos(double x); |
510 | extern DECLSPEC float SDLCALL SDL_cosf(float x); |
516 | extern DECLSPEC float SDLCALL SDL_cosf(float x); |
- | 517 | extern DECLSPEC double SDLCALL SDL_exp(double x); |
|
- | 518 | extern DECLSPEC float SDLCALL SDL_expf(float x); |
|
511 | extern DECLSPEC double SDLCALL SDL_fabs(double x); |
519 | extern DECLSPEC double SDLCALL SDL_fabs(double x); |
- | 520 | extern DECLSPEC float SDLCALL SDL_fabsf(float x); |
|
512 | extern DECLSPEC double SDLCALL SDL_floor(double x); |
521 | extern DECLSPEC double SDLCALL SDL_floor(double x); |
- | 522 | extern DECLSPEC float SDLCALL SDL_floorf(float x); |
|
- | 523 | extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); |
|
- | 524 | extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); |
|
513 | extern DECLSPEC double SDLCALL SDL_log(double x); |
525 | extern DECLSPEC double SDLCALL SDL_log(double x); |
- | 526 | extern DECLSPEC float SDLCALL SDL_logf(float x); |
|
- | 527 | extern DECLSPEC double SDLCALL SDL_log10(double x); |
|
- | 528 | extern DECLSPEC float SDLCALL SDL_log10f(float x); |
|
514 | extern DECLSPEC double SDLCALL SDL_pow(double x, double y); |
529 | extern DECLSPEC double SDLCALL SDL_pow(double x, double y); |
- | 530 | extern DECLSPEC float SDLCALL SDL_powf(float x, float y); |
|
515 | extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); |
531 | extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); |
- | 532 | extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); |
|
516 | extern DECLSPEC double SDLCALL SDL_sin(double x); |
533 | extern DECLSPEC double SDLCALL SDL_sin(double x); |
517 | extern DECLSPEC float SDLCALL SDL_sinf(float x); |
534 | extern DECLSPEC float SDLCALL SDL_sinf(float x); |
518 | extern DECLSPEC double SDLCALL SDL_sqrt(double x); |
535 | extern DECLSPEC double SDLCALL SDL_sqrt(double x); |
519 | extern DECLSPEC float SDLCALL SDL_sqrtf(float x); |
536 | extern DECLSPEC float SDLCALL SDL_sqrtf(float x); |
520 | extern DECLSPEC double SDLCALL SDL_tan(double x); |
537 | extern DECLSPEC double SDLCALL SDL_tan(double x); |