Commit graph

206 commits

Author SHA1 Message Date
Sam Lantinga
473feab2a4 Added SDL_unsetenv() 2024-07-27 09:10:08 -07:00
Anonymous Maarten
3374e57102 stdinc: strcasecmp is declared in strings.h 2024-07-27 15:19:20 +00:00
Sam Lantinga
4f55271571 Removed temporary memory from the API
It was intended to make the API easier to use, but various automatic garbage collection all had flaws, and making the application periodically clean up temporary memory added cognitive load to using the API, and in many cases was it was difficult to restructure threaded code to handle this.

So, we're largely going back to the original system, where the API returns allocated results and you free them.

In addition, to solve the problems we originally wanted temporary memory for:
* Short strings with a finite count, like device names, get stored in a per-thread string pool.
* Events continue to use temporary memory internally, which is cleaned up on the next event processing cycle.
2024-07-26 20:59:14 -07:00
SDL Wiki Bot
230161a50c Sync SDL3 wiki -> header 2024-07-23 22:49:23 +00:00
Sam Lantinga
29f0fd33dc SDL_getenv() should return const
This also allows us to use SDL_FreeLater() and make SDL_getenv() thread-safe on Windows.
2024-07-22 13:00:39 -07:00
Ozkan Sezer
70c1012e8c SDL_stdinc.h (SDL_COMPILE_TIME_ASSERT): Keep C++ case alone (after PR/10331)
Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.
Reference issue: https://github.com/libsdl-org/SDL/issues/6078 which was fixed by
f6b81125b3
2024-07-22 16:00:37 +03:00
Anonymous Maarten
22bfbdbc02 stdinc: c23 deprecated _Static_assert in favor of static_assert 2024-07-21 21:51:55 +03:00
Sam Lantinga
637e9700dd Standardize placement of '*' in function declarations
Implemented using these sed commands on the headers:
sed -E -i'' '/SDLCALL|;/ s,([a-z])\* ,\1 *,g' *
sed -E -i'' 's,(\(.*[^\*])\* ([a-z])(.*\)),\1*\2\3,g' *
sed -E -i'' 's,\*const,* const,g' *
sed -E -i'' 's,\*SDLCALL,* SDLCALL,g' *
sed -E -i'' 's,void\(,void (,g' *
git checkout *gl*
2024-07-19 12:22:03 -07:00
SDL Wiki Bot
0cdc60666b Sync SDL3 wiki -> header 2024-07-14 21:04:37 +00:00
Ryan C. Gordon
f61900465c
stdinc: Fixed up documentation details for standard types. 2024-07-14 17:03:15 -04:00
Sam Lantinga
cad9e6ea20 Fixed SDL_SINT64_C typo
Apparently all the platforms we compile on have INT64_C defined?

Fixes https://github.com/libsdl-org/SDL/issues/10268
2024-07-14 12:53:32 -07:00
SDL Wiki Bot
b43f1688d9 Sync SDL3 wiki -> header 2024-07-04 15:12:07 +00:00
Ryan C. Gordon
c3bf874abf stdlib: Clean up and export SDL_UCS4ToUTF8().
Also fix internal usage of the function.

Fixes #10157.
2024-07-04 11:10:50 -04:00
SDL Wiki Bot
b7ab5182d3 Sync SDL3 wiki -> header 2024-06-27 21:37:27 +00:00
Ryan C. Gordon
a9cfcf6bde stdinc: Drastically improve SDL_StepUTF8() and make it a public API.
Fixes #10105.
2024-06-27 17:36:09 -04:00
SDL Wiki Bot
2c745dbd3c Sync SDL3 wiki -> header 2024-06-24 18:50:19 +00:00
Sam Lantinga
2f5b20fcb5 Updated based on feedback from @JKaniarz 2024-06-24 11:49:15 -07:00
Sam Lantinga
96f2f23240 Simplified SDL random function names and added thread-safe versions 2024-06-24 11:49:15 -07:00
Sam Lantinga
89cdadf7c3 Added SDL_isinf(), SDL_isinff(), SDL_isnan(), and SDL_isnanf() 2024-06-24 11:49:15 -07:00
SDL Wiki Bot
e6944584a0 Sync SDL3 wiki -> header 2024-06-20 00:01:27 +00:00
John Kaniarz
8f29f8cae5 Renamed SDL_rand() to SDL_rand_bits() and updated tests 2024-06-19 17:00:58 -07:00
SDL Wiki Bot
237bbfcb9d Sync SDL3 wiki -> header 2024-06-19 18:02:45 +00:00
John Kaniarz
16e69cb4c9 Removed SDL_rand_r() 2024-06-19 11:02:02 -07:00
John Kaniarz
86b06f74dc Updated docs 2024-06-19 11:02:02 -07:00
John Kaniarz
83d21e20df Added SDL_rand_float and SDL_rand_n to API 2024-06-19 11:02:02 -07:00
Sam Lantinga
182a28b343 Fixed documentation typo 2024-06-16 08:01:16 -07:00
SDL Wiki Bot
4e5ed569c3 Sync SDL3 wiki -> header 2024-06-16 14:42:00 +00:00
Sam Lantinga
d1d484ddbe Added SDL_srand(), SDL_rand(), and SDL_rand_r() (thanks @JKaniarz!)
These are simple random functions that should not be used for serious random number generation.

Fixes https://github.com/libsdl-org/SDL/issues/4968
2024-06-16 07:41:00 -07:00
Ryan C. Gordon
51902d4ac5
Updated headers with latest wikiheaders tweaks. 2024-06-14 02:09:55 -04:00
Ryan C. Gordon
2ad7c70ac6
documentation: clean up a minor syntax issue. 2024-06-13 18:10:28 -04:00
SDL Wiki Bot
fa3e22c5da Sync SDL3 wiki -> header 2024-06-13 21:04:27 +00:00
Ryan C. Gordon
12119cbaad
include: Several documentation tweaks; cleaned up new wikiheaders warnings. 2024-06-13 17:03:31 -04:00
SDL Wiki Bot
99f0309ac1 Sync SDL3 wiki -> header 2024-06-12 23:34:42 +00:00
Ryan C. Gordon
96f2ef77ab
include: Make function pointer params into typedefs.
This is easier to read and document in general, but will also make some
new parsing work in wikiheaders much easier.
2024-06-11 12:22:46 -04:00
Ryan C. Gordon
8af58b4bec
SDL_FLT_EPSILON: Updated documentation to be wikiheaders-friendly. 2024-06-08 23:15:21 -04:00
Sam Lantinga
e69272344c Added documentation for SDL_FLT_EPSILON (thanks @MrOnlineCoder!)
Closes https://github.com/libsdl-org/sdlwiki/pull/549
2024-06-08 08:29:17 -07:00
Ozkan Sezer
49b6c24722 always define PRI?64 using 'I64' when targeting windows
avoids -Wformat warnings from mingw toolchains -- e.g.:
src/test/SDL_test_harness.c:581:37: warning: unknown conversion type character 'l' in format [-Wformat=]
2024-06-01 22:35:40 +03:00
SDL Wiki Bot
c168ccc3c3 Sync SDL3 wiki -> header 2024-05-27 02:00:01 +00:00
Sam Lantinga
6f2621438a Renamed DECLSPEC to SDL_DECLSPEC 2024-05-17 17:09:09 -07:00
Ryan C. Gordon
5e6d85b8f0
wikiheaders: bridge wiki Category docs to the headers!
Did an initial cleanup on the headers and wrote a few pieces of documentation,
but this needs more work to fill out the documentation.
2024-05-16 11:48:23 -04:00
Ozkan Sezer
890ceb4ac4 SDL_stdinc.h: add fallback cases for SDL_SINT64_C and SDL_UINT64_C
These are needed when INT64_C and UINT64_C macros are either not
available (not likely), or guarded by __STDC_LIMIT_MACROS in C++
compilations (which is the case in many old SDKs.)
2024-05-09 20:55:56 +03:00
SDL Wiki Bot
ea1904eda1 Sync SDL3 wiki -> header 2024-05-06 16:09:31 +00:00
Petar Popovic
45ac1a09d9 System dependent 64 bit integer suffixes
Added macros SDL_SINT64_C() and SDL_UINT64_C().
Integer suffixes of SDL_MAX_SINT64, SDL_MIN_SINT64, SDL_MAX_UINT64
and SDL_MIN_UINT64 are now system dependent.
2024-05-06 09:08:49 -07:00
Ryan C. Gordon
9f842e9b5a
wikiheaders: Bind #defines below a function to it, like typedefs.
This effectively adds the property symbols for various functions to the
function's wiki page.
2024-05-02 12:49:30 -04:00
SDL Wiki Bot
8b06473a11 Sync SDL3 wiki -> header 2024-04-29 20:53:27 +00:00
Petar Popovic
7bfecacc02 Removing function macro SDL_TABLESIZE() 2024-04-29 13:52:48 -07:00
Petar Popovic
8d0ad44edd Adding tag names to enums
Adding tag names to following enums:
SDL_JoystickType, SDL_JoystickConnectionState, SDL_TouchDeviceType, SDL_DUMMY_ENUM
2024-04-28 16:09:37 -07:00
Ryan C. Gordon
21bc72bef1
wikiheaders: Allow parts of the headers to be ignored.
The specific cases here were SDL_size_mul_overflow_builtin and
SDL_size_add_overflow_builtin, which are forced-inline symbols in
SDL_stdinc.h that have to exist, but aren't really part of the public API,
and thus shouldn't be exported as documentation.
2024-04-13 22:57:23 -04:00
SDL Wiki Bot
e4f097805b Sync SDL3 wiki -> header 2024-04-14 00:22:23 +00:00
Ryan C. Gordon
0df988389c
include: Add \since to all documentation that was missing it. 2024-04-11 13:34:29 -04:00