VSF Documented
SDL_stdinc.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_SDL2_STDINC_H__
19#define __VSF_SDL2_STDINC_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "../../vsf_sdl2_cfg.h"
24
25#if VSF_USE_SDL2 == ENABLED
26
27#include <stdint.h>
28#include <string.h>
29#include <stdio.h>
30#include <ctype.h>
31#include <stdlib.h>
32
33#include "SDL_error.h"
34#include "begin_code.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40/*============================ MACROS ========================================*/
41
42#define SDL_arraysize dimof
43#define SDL_TABLESIZE SDL_arraysize
44
45// stdlib
46#define SDL_assert VSF_SDL2_ASSERT
47#define SDL_free free
48#define SDL_malloc malloc
49#define SDL_realloc realloc
50#define SDL_calloc calloc
51#define SDL_memcmp memcmp
52#define SDL_atoi atoi
53
54#define SDL_stack_alloc(__type, __count) (__type*)SDL_malloc(sizeof(__type) * (__count))
55#define SDL_stack_free(__data) SDL_free(__data)
56
57#define SDL_min vsf_min
58#define SDL_max vsf_max
59
60// string
61#define SDL_memset memset
62#define SDL_memcpy memcpy
63#define SDL_strlen strlen
64#define SDL_strcmp strcmp
65#define SDL_strcasecmp strcasecmp
66#define SDL_strlcpy strlcpy
67#define SDL_strrchr strrchr
68#define SDL_strchr strchr
69#define SDL_strdup strdup
70#define SDL_vsnprintf vsnprintf
71#define SDL_strtol strtol
72#define SDL_strtoll strtoll
73#define SDL_strtoul strtoul
74#define SDL_strtoull strtoull
75#define SDL_strtof strtof
76#define SDL_strtod strtod
77#define SDL_itoa itoa
78#define SDL_atoi atoi
79#define SDL_atof atof
80
81// ctype
82#define SDL_toupper toupper
83
84// cmath
85#define SDL_ceil ceil
86#define SDL_ceilf ceilf
87#define SDL_ceill ceill
88
89#define SDL_getenv getenv
90
91#define SDL_COMPILE_TIME_ASSERT(__N, __X) VSF_STATIC_ASSERT(__X)
92
93/*============================ MACROFIED FUNCTIONS ===========================*/
94/*============================ TYPES =========================================*/
95
96typedef enum SDL_bool {
98 SDL_TRUE = 1
100
101#define SDL_MAX_SINT8 INT8_MAX
102#define SDL_MIN_SINT8 INT8_MIN
103typedef int8_t Sint8;
104
105#define SDL_MAX_UINT8 UINT8_MAX
106#define SDL_MIN_UINT8 0
108
109#define SDL_MAX_SINT16 INT16_MAX
110#define SDL_MIN_SINT16 INT16_MIN
112
113#define SDL_MAX_UINT16 UINT16_MAX
114#define SDL_MIN_UINT16 0
116
117#define SDL_MAX_SINT32 INT32_MAX
118#define SDL_MIN_SINT32 INT32_MIN
120
121#define SDL_MAX_UINT32 UINT32_MAX
122#define SDL_MIN_UINT32 0
124
125
126#define SDL_MAX_SINT64 INT64_MAX
127#define SDL_MIN_SINT64 INT64_MIN
129
130#define SDL_MAX_UINT64 UINT64_MAX
131#define SDL_MIN_UINT64 0
133
134/*============================ GLOBAL VARIABLES ==============================*/
135/*============================ LOCAL VARIABLES ===============================*/
136/*============================ PROTOTYPES ====================================*/
137
138// extern APIs in math
139double ceil(double x);
140float ceilf(float x);
141long double ceill(long double x);
142
143#ifdef __cplusplus
144}
145#endif
146#include "close_code.h"
147
148#endif // VSF_USE_SDL2
149#endif // __VSF_SDL2_STDINC_H__
150/* EOF */
double ceil(double x)
uint8_t Uint8
Definition SDL_stdinc.h:107
int64_t Sint64
Definition SDL_stdinc.h:128
uint16_t Uint16
Definition SDL_stdinc.h:115
int8_t Sint8
Definition SDL_stdinc.h:103
int32_t Sint32
Definition SDL_stdinc.h:119
float ceilf(float x)
SDL_bool
Definition SDL_stdinc.h:96
@ SDL_TRUE
Definition SDL_stdinc.h:98
@ SDL_FALSE
Definition SDL_stdinc.h:97
int16_t Sint16
Definition SDL_stdinc.h:111
uint64_t Uint64
Definition SDL_stdinc.h:132
uint32_t Uint32
Definition SDL_stdinc.h:123
long double ceill(long double x)
unsigned short uint16_t
Definition stdint.h:7
unsigned uint32_t
Definition stdint.h:9
int int32_t
Definition stdint.h:8
long long int64_t
Definition stdint.h:10
short int16_t
Definition stdint.h:6
unsigned long long uint64_t
Definition stdint.h:11
unsigned char uint8_t
Definition stdint.h:5
signed char int8_t
Definition stdint.h:4