@@ -137,3 +137,37 @@ function SDL_realloc(mem: Pointer; size: csize_t): Pointer; cdecl;
137
137
*)
138
138
procedure SDL_free (mem: Pointer); cdecl;
139
139
external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_free' { $ENDIF} { $ENDIF} ;
140
+
141
+ (* *
142
+ * This function converts a string between encodings in one pass, returning a
143
+ * string that must be freed with SDL_free(), or NIL on error.
144
+ *
145
+ * \since This function is available since SDL 2.0.0.
146
+ *)
147
+ function SDL_iconv_string (Const tocode, fromcode, inbuf: PAnsiChar; inbytesleft: csize_t): PAnsiChar; cdecl;
148
+ external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_iconv_string' { $ENDIF} { $ENDIF} ;
149
+
150
+ // These are macros in the original C headers, we will reimplement them as simple Pascal functions.
151
+ function SDL_iconv_utf8_locale (Const str: PAnsiChar): PAnsiChar; cdecl;
152
+ function SDL_iconv_utf8_ucs2 (Const str: PAnsiChar): pcUint16; cdecl;
153
+ function SDL_iconv_utf8_ucs4 (Const str: PAnsiChar): pcUint32; cdecl;
154
+
155
+ (* The SDL implementation of iconv() returns these error codes *)
156
+ const
157
+ SDL_ICONV_ERROR = csize_t(-1 );
158
+ SDL_ICONV_E2BIG = csize_t(-2 );
159
+ SDL_ICONV_EILSEQ = csize_t(-3 );
160
+ SDL_ICONV_EINVAL = csize_t(-4 );
161
+
162
+ type
163
+ TSDL_iconv = record end ;
164
+ PSDL_iconv = ^TSDL_iconv;
165
+
166
+ function SDL_iconv_open (Const tocode, fromcode: PAnsiChar): PSDL_iconv; cdecl;
167
+ external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_iconv_open' { $ENDIF} { $ENDIF} ;
168
+
169
+ function SDL_iconv_close (cd: PSDL_iconv): cint; cdecl;
170
+ external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_iconv_close' { $ENDIF} { $ENDIF} ;
171
+
172
+ function SDL_iconv (cd: PSDL_iconv; Const inbuf: PPAnsiChar; inbytesleft: pcsize_t; outbuf: PPAnsiChar; outbytesleft: pcsize_t): csize_t; cdecl;
173
+ external SDL_LibName { $IFDEF DELPHI} { $IFDEF MACOS} name ' _SDL_iconv' { $ENDIF} { $ENDIF} ;
0 commit comments