Closed suve closed 1 year ago
Thanks!
Sorry for the delayed response.
The following points I like to hint to or ask about:
const
keyword (general code style convention).strlen
instead of adding/using SDL_StrLen
? For me the latter solution seems more appropriate here.Best regards Matthias
I'd like to ask why you go for the Strings unit implementation of strlen instead of adding/using SDL_StrLen? For me the latter solution seems more appropriate here.
We already do something similar for SDL_FRectEqualsEpsilon()
, where we call FPC's System.Abs()
instead of SDL_fabsf()
. (link)
I've asked this in #62 but didn't really receive an answer - do we want to go all-in and add definitions for all the cstdlib-like SDL functions? If so, then I'll follow up this PR with another one (or more) adding stdinc.h
symbols and fixing any relevant macros.
We already do something similar for
SDL_FRectEqualsEpsilon()
, where we call FPC'sSystem.Abs()
instead ofSDL_fabsf()
. (link)I've asked this in #62 but didn't really receive an answer - do we want to go all-in and add definitions for all the cstdlib-like SDL functions? If so, then I'll follow up this PR with another one (or more) adding
stdinc.h
symbols and fixing any relevant macros.
Thanks for the elaborated answer.
I see your point, the main reason why I stumbled about this, is the introduction of the Strings
unit, which could be prevented when using SDL's own function. This would be desirable to have less dependency on certain units and higher compatibility between compilers. It seems Delphi has no Strings
unit but a AnsiStrings
unit for StrLen. Also, FPC and Delphi have strlen as part of their SysUtils
unit (see FPC SysUtils.strlen and Delphi SysUtils.StrLen), which would be more compatible as we don't have to distinguish between the used units based on the compiler. - Unfortunately Delphi marked the SysUtils.StrLen as deprecated.
Please fix this PR to be Delphi-compatible.
I'm sorry, I forgot about your reply in #62 . Let's discuss this in general there. But to answer your question
do we want to go all-in and add definitions for all the cstdlib-like SDL functions? here, which is highly related to the fix-up,
I would suggest to go for addition of cherry-picked, useful SDL functions if it is worth it. To my mind it is worth it, if we can prevent adding new units (dependencies).
Best regards Matthias
Thanks for the insight regarding Delphi compatibility. I've pushed one more commit that should include the proper unit based on the compiler used. Sorry for the long wait.
I'll follow this up with a couple of PRs introducing some cherry-picked functions from SDL_stdint.h
.
This changeset adds
SDL_iconv*
functions and related types.Note: Since many other symbols found in
SDL_stdinc.h
are missing from oursdlstdinc.inc
, some changes have been made:Strings.strlen()
is called instead ofSDL_strlen()
, where approriate.SDL_iconv_wchar_utf8()
macro is not included in this changeset, as it requiresSDL_wcslen()
.