Skip to content

Commit 4fe2132

Browse files
furious programmingsuve
authored andcommitted
Added missing double-pointers declarations in all ".inc" and "pas" files.
1 parent 700376d commit 4fe2132

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+322
-35
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ Exception: Replace `*char` by `PAnsiChar`! (see issue [#26](https://github.com/P
7171

7272
4. If an identifier or a function declaration is gone, mark them as `deprecated`. (see issue [#34](https://github.com/PascalGameDevelopment/SDL2-for-Pascal/issues/34))
7373

74-
5. Have a look at our [Translation Cheat Sheet](CHEATSHEET.md) for reference.
74+
5. For convenience we encourage to add single and double pointers for any SDL type. (See #105)
75+
76+
6. Have a look at our [Translation Cheat Sheet](CHEATSHEET.md) for reference.
7577

7678
## Versions
7779

units/ctypes.inc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@
2424
type
2525
DWord = LongWord;
2626

27+
ppcbool = ^pcbool;
2728
pcbool = ^cbool;
2829
cbool = LongBool;
2930
{$EXTERNALSYM cbool}
3031

32+
ppcint8 = ^pcint8;
3133
pcint8 = ^cint8;
3234
cint8 = ShortInt;
3335
{$EXTERNALSYM cint8}
@@ -36,50 +38,60 @@ type
3638
cuint8 = Byte;
3739
{$EXTERNALSYM cuint8}
3840

41+
ppcint16 = ^pcint16;
3942
pcint16 = ^cint16;
4043
cint16 = SmallInt;
4144
{$EXTERNALSYM cint16}
4245

46+
ppcuint16 = ^pcuint16;
4347
pcuint16 = ^cuint16;
4448
cuint16 = Word;
4549
{$EXTERNALSYM cuint16}
4650

51+
ppcushort = ^pcushort;
4752
pcushort = ^cushort;
4853
cushort = Word;
4954
{$EXTERNALSYM cushort}
5055

56+
ppcint32 = ^pcint32;
5157
pcint32 = ^cint32;
5258
cint32 = LongInt;
5359
{$EXTERNALSYM cint32}
5460

61+
ppcuint32 = ^pcuint32;
5562
pcuint32 = ^cuint32;
5663
cuint32 = LongWord;
5764
{$EXTERNALSYM cuint32}
5865

5966
{$IFNDEF Has_Int64}
67+
ppcint64 = ^pcint64;
6068
pcint64 = ^cint64;
6169
cint64 = record
6270
hi: cuint32;
6371
lo: cuint32;
6472
end;
6573
{$EXTERNALSYM cint64}
6674

75+
ppcuint64 = ^pcuint64;
6776
pcuint64 = ^cuint64;
6877
cuint64 = record
6978
hi: cuint32;
7079
lo: cuint32;
7180
end;
7281
{$EXTERNALSYM cuint64}
7382
{$ELSE}
83+
ppcint64 = ^pcint64;
7484
pcint64 = ^cint64;
7585
cint64 = Int64;
7686
{$EXTERNALSYM cint64}
7787

88+
ppcuint64 = ^pcuint64;
7889
pcuint64 = ^cuint64;
7990
cuint64 = UInt64;
8091
{$EXTERNALSYM cuint64}
8192
{$ENDIF}
8293

94+
ppcsize_t = ^pcsize_t;
8395
pcsize_t = ^csize_t;
8496
{$IFNDEF WIN64}
8597
csize_t = cuint32;
@@ -88,17 +100,26 @@ type
88100
{$ENDIF}
89101
{$EXTERNALSYM csize_t}
90102

103+
ppcfloat = ^pcfloat;
91104
pcfloat = ^cfloat;
92105
cfloat = Single;
93106
{$EXTERNALSYM cfloat}
94107

108+
ppcdouble = ^pcdouble;
95109
pcdouble = ^cdouble;
96110
cdouble = Double;
97111
{$EXTERNALSYM cfloat}
98112

113+
ppcint = ^pcint;
99114
pcint = ^cint;
115+
116+
ppcuint = ^pcuint;
100117
pcuint = ^cuint;
118+
119+
ppclong = ^pclong;
101120
pclong = ^clong;
121+
122+
ppculong = ^pculong;
102123
pculong = ^culong;
103124
{
104125
Integer type sizes based on:
@@ -127,6 +148,7 @@ type
127148

128149
{ Data types for all compilers }
129150
type
151+
PPUInt8Array = ^PUInt8Array;
130152
PUInt8Array = ^TUInt8Array;
131153
TUInt8Array = array [0..MAXINT shr 1] of cuint8;
132154

units/sdl.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// based on "sdl.h"
22

33
type
4+
PPSDL_Init = ^PSDL_Init;
5+
PSDL_Init = ^TSDL_Init;
46
TSDL_Init = type cuint32;
57

68
const

units/sdl2_image.pas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ function IMG_Linked_Version: PSDL_Version cdecl; external IMG_LibName {$IFDEF DE
9090
IMG_INIT_WEBP = $00000008;
9191

9292
type
93+
PPIMG_InitFlags = ^PIMG_InitFlags;
94+
PIMG_InitFlags = ^TIMG_InitFlags;
9395
TIMG_InitFlags = DWord;
9496

9597
{* Loads dynamic libraries and prepares them for use. Flags should be

units/sdl2_mixer.pas

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ function Mix_Linked_Version: PSDL_Version cdecl; external MIX_LibName {$IFDEF DE
9595
MIX_INIT_FLUIDSYNTH = $00000020;
9696
}
9797
type
98+
PPMIX_InitFlags = ^PMIX_InitFlags;
99+
PMIX_InitFlags = ^TMIX_InitFlags;
98100
TMIX_InitFlags = cint;
99101

100102
{* Loads dynamic libraries and prepares them for use. Flags should be
@@ -131,6 +133,7 @@ procedure Mix_Quit() cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS}
131133

132134
{* The internal format for an audio chunk *}
133135
type
136+
PPMix_Chunk = ^PMix_Chunk;
134137
PMix_Chunk = ^TMix_Chunk;
135138
TMix_Chunk = record
136139
allocated: cint;
@@ -141,8 +144,12 @@ TMix_Chunk = record
141144

142145
{* The different fading types supported *}
143146
type
147+
PPMix_Fading = ^PMix_Fading;
148+
PMix_Fading = ^TMix_Fading;
144149
TMix_Fading = (MIX_NO_FADING, MIX_FADING_OUT, MIX_FADING_IN);
145150

151+
PPMix_MusicType = ^PMix_MusicType;
152+
PMix_MusicType = ^TMix_MusicType;
146153
TMix_MusicType = (
147154
MUS_NONE,
148155
MUS_CMD,
@@ -158,6 +165,7 @@ TMix_Chunk = record
158165
);
159166

160167
{* The internal format for a music chunk interpreted via mikmod *}
168+
PPMix_Music = ^PMix_Music;
161169
PMix_Music = ^TMix_Music;
162170
TMix_Music = record end;
163171

@@ -240,6 +248,8 @@ function Mix_GetMusicType(music: TMix_Music): TMix_MusicType cdecl; external MIX
240248
or add a custom mixer filter for the stream data.
241249
*}
242250
type
251+
PPMix_Func = ^PMix_Func;
252+
PMix_Func = ^TMix_Func;
243253
TMix_Func = procedure(udata: Pointer; stream: pcuint8; len: cint) cdecl;
244254

245255
procedure Mix_SetPostMix(func: TMix_Func; arg: Pointer) cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_SetPostMix' {$ENDIF} {$ENDIF};
@@ -253,6 +263,7 @@ procedure Mix_HookMusic(func: TMix_Func; arg: Pointer) cdecl; external MIX_LibNa
253263
* or when it is stopped from a call to Mix_HaltMusic.
254264
*}
255265
type
266+
PPMix_Music_Finished = ^PMix_Music_Finished;
256267
PMix_Music_Finished = ^TMix_Music_Finished;
257268
TMix_Music_Finished = procedure() cdecl;
258269

@@ -270,6 +281,8 @@ function Mix_GetMusicHookData: Pointer cdecl; external MIX_LibName {$IFDEF DELPH
270281
* before calling your callback.
271282
*}
272283
type
284+
PPMix_Channel_Finished = ^PMix_Channel_Finished;
285+
PMix_Channel_Finished = ^TMix_Channel_Finished;
273286
TMix_Channel_Finished = procedure(channel: cint) cdecl;
274287

275288
procedure Mix_ChannelFinished(channel_finished: TMix_Channel_Finished) cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_ChannelFinished' {$ENDIF} {$ENDIF};
@@ -296,6 +309,8 @@ procedure Mix_ChannelFinished(channel_finished: TMix_Channel_Finished) cdecl; ex
296309
* DO NOT EVER call SDL_LockAudio() from your callback function!
297310
*}
298311
type
312+
PPMix_EffectFunc_t = ^PMix_EffectFunc_t;
313+
PMix_EffectFunc_t = ^TMix_EffectFunc_t;
299314
TMix_EffectFunc_t = procedure(chan: cint; stream: Pointer; len: cint; udata: Pointer) cdecl;
300315

301316
{*
@@ -308,6 +323,8 @@ procedure Mix_ChannelFinished(channel_finished: TMix_Channel_Finished) cdecl; ex
308323
* DO NOT EVER call SDL_LockAudio() from your callback function!
309324
*}
310325
type
326+
PPMix_EffectDone_t = ^PMix_EffectDone_t;
327+
PMix_EffectDone_t = ^TMix_EffectDone_t;
311328
TMix_EffectDone_t = procedure(chan: cint; udata: Pointer) cdecl;
312329

313330
{* Register a special effect function. At mixing time, the channel data is
@@ -652,6 +669,8 @@ function Mix_SetSoundFonts(paths: PAnsiChar): cint cdecl; external MIX_LibName {
652669
function Mix_GetSoundFonts: PAnsiChar cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_GetSoundFonts' {$ENDIF} {$ENDIF};
653670

654671
type
672+
PPMix_SoundFunc = ^PMix_SoundFunc;
673+
PMix_SoundFunc = ^TMix_SoundFunc;
655674
TMix_SoundFunc = function(c: PAnsiChar; p: Pointer): cint cdecl;
656675

657676
function Mix_EachSoundFont(func: TMix_SoundFunc; data: Pointer): cint cdecl; external MIX_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_MIX_EachSoundFont' {$ENDIF} {$ENDIF};

units/sdl2_net.pas

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ interface
5959

6060

6161
type
62-
TSDLNet_Version = TSDL_Version;
62+
PPSDLNet_Version = ^PSDLNet_Version;
63+
PSDLNet_Version = ^TSDLNet_Version;
64+
TSDLNet_Version = TSDL_Version;
6365

6466
const
6567
{* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL *}
@@ -89,11 +91,12 @@ procedure SDLNet_Quit() cdecl; external SDLNet_LibName {$IFDEF DELPHI} {$IFDEF M
8991
{***********************************************************************}
9092
{* IPv4 hostname resolution API *}
9193
{***********************************************************************}
94+
PPIPaddress = ^PIPaddress;
95+
PIPaddress = ^TIPaddress;
9296
TIPaddress = record
9397
host: cuint32; {* 32-bit IPv4 host address *}
9498
port: cuint16; {* 16-bit protocol port *}
9599
end;
96-
PIPaddress = ^TIPaddress;
97100

98101
{* Resolve a host name and port to an IP address in network form.
99102
If the function succeeds, it will return 0.
@@ -178,10 +181,13 @@ procedure SDLNet_TCP_Close(sock: TTCPSocket) cdecl; external SDLNet_LibName {$IF
178181
SDLNET_MAX_UDPADDRESSES = 4;
179182

180183
type
184+
PPUDPSocket = ^PUDPSocket;
185+
PUDPSocket = ^TUDPSocket;
181186
TUDPSocket = record
182187
end;
183-
PUDPSocket = ^TUDPSocket;
184188

189+
PPUDPPacket = ^PUDPPacket;
190+
PUDPPacket = ^TUDPPacket;
185191
TUDPPacket = record
186192
channel: cint; {* The src/dst channel of the packet *}
187193
data: pcuint8; {* The packet data *}
@@ -190,8 +196,6 @@ TUDPPacket = record
190196
status: cint; {* packet status after sending *}
191197
address: TIPaddress; {* The source/dest address of an incoming/outgoing packet *}
192198
end;
193-
PUDPPacket = ^TUDPPacket;
194-
PPUDPPacket = ^PUDPPacket;
195199

196200
{* Allocate/resize/free a single UDP packet 'size' bytes long.
197201
The new packet is returned, or NULL if the function ran out of memory.
@@ -297,15 +301,17 @@ procedure SDLNet_UDP_Close(sock: TUDPSocket) cdecl; external SDLNet_LibName {$IF
297301
{***********************************************************************}
298302

299303
type
304+
PPSDLNet_SocketSet = ^PSDLNet_SocketSet;
305+
PSDLNet_SocketSet = ^TSDLNet_SocketSet;
300306
TSDLNet_SocketSet = record
301307
end;
302-
PSDLNet_SocketSet = ^TSDLNet_SocketSet;
303308

304309
{* Any network socket can be safely cast to this socket type *}
310+
PPSDLNet_GenericSocket = ^PSDLNet_GenericSocket;
311+
PSDLNet_GenericSocket = ^TSDLNet_GenericSocket;
305312
TSDLNet_GenericSocket = record
306313
ready: cint;
307314
end;
308-
PSDLNet_GenericSocket = ^TSDLNet_GenericSocket;
309315

310316
{* Allocate a socket set for use with SDLNet_CheckSockets()
311317
This returns a socket set for up to 'maxsockets' sockets, or NULL if

units/sdl2_ttf.pas

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ procedure TTF_ByteSwappedUNICODE(swapped: TSDL_bool); cdecl;
174174

175175
{* The internal structure containing font information *}
176176
type
177+
PPTTF_Font = ^PTTF_Font;
177178
PTTF_Font = ^TTTF_Font;
178179
TTTF_Font = record end; //todo?
179180

@@ -2277,6 +2278,7 @@ function TTF_GetError: PAnsiChar; cdecl;
22772278
* \sa TTF_SetFontDirection
22782279
}
22792280
type
2281+
PPTTF_Direction = ^PTTF_Direction;
22802282
PTTF_Direction = ^TTTF_Direction;
22812283
TTTF_Direction = type Integer;
22822284

units/sdlatomic.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* The atomic locks are not safe to lock recursively.
1111
*}
1212
type
13+
PPSDL_SpinLock = ^PSDL_SpinLock;
1314
PSDL_SpinLock = ^TSDL_SpinLock;
1415
TSDL_SpinLock = type cint;
1516

@@ -40,11 +41,12 @@ procedure SDL_AtomicUnlock(lock: PSDL_SpinLock); cdecl;
4041
procedure SDL_CompilerBarrier();
4142

4243
type
43-
PSDL_Atomic = ^TSDL_Atomic;
4444
{**
4545
* A type representing an atomic integer value. It is a record
4646
* so people don't accidentally use numeric operations on it.
4747
*}
48+
PPSDL_Atomic = ^PSDL_Atomic;
49+
PSDL_Atomic = ^TSDL_Atomic;
4850
TSDL_Atomic = record
4951
Value: cint
5052
end;

units/sdlaudio.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* There are macros in SDL 2.0 and later to query these bits.
2020
*}
2121
type
22+
PPSDL_AudioFormat = ^PSDL_AudioFormat;
23+
PSDL_AudioFormat = ^TSDL_AudioFormat;
2224
TSDL_AudioFormat = cuint16;
2325

2426
{**
@@ -118,6 +120,8 @@ const
118120
* you like. Just open your audio device with a NULL callback.
119121
*}
120122
type
123+
PPSDL_AudioCallback = ^PSDL_AudioCallback;
124+
PSDL_AudioCallback = ^TSDL_AudioCallback;
121125
TSDL_AudioCallback = procedure(userdata: Pointer; stream: pcuint8; len: cint); cdecl;
122126

123127
{**
@@ -133,6 +137,7 @@ type
133137
* 8: FL FR FC LFE BL BR SL SR (7.1 surround)
134138
*}
135139
type
140+
PPSDL_AudioSpec = ^PSDL_AudioSpec;
136141
PSDL_AudioSpec = ^TSDL_AudioSpec;
137142
TSDL_AudioSpec = record
138143
freq: cint; {**< DSP frequency -- samples per second *}
@@ -157,6 +162,7 @@ const
157162
SDL_AUDIOCVT_MAX_FILTERS = 9;
158163

159164
type
165+
PPSDL_AudioCVT = ^PSDL_AudioCVT;
160166
PSDL_AudioCVT = ^TSDL_AudioCVT;
161167
TSDL_AudioFilter = procedure(cvt: PSDL_AudioCVT; format: TSDL_AudioFormat); cdecl;
162168

@@ -359,6 +365,8 @@ function SDL_OpenAudio(desired: PSDL_AudioSpec; obtained: PSDL_AudioSpec): cint;
359365
* specific, or capture devices.
360366
*}
361367
type
368+
PPSDL_AudioDeviceID = ^PSDL_AudioDeviceID;
369+
PSDL_AudioDeviceID = ^TSDL_AudioDeviceID;
362370
TSDL_AudioDeviceID = cuint32;
363371

364372
{**
@@ -620,6 +628,7 @@ function SDL_OpenAudioDevice(device: PAnsiChar;
620628
*}
621629

622630
type
631+
PPSDL_AudioStatus = ^PSDL_AudioStatus;
623632
PSDL_AudioStatus = ^TSDL_AudioStatus;
624633
TSDL_AudioStatus = type cint;
625634

0 commit comments

Comments
 (0)