Skip to content

Commit 83da570

Browse files
Update CHEATSHEET.md to reflect double pointer type decision + opaque type decision
1 parent d2c8459 commit 83da570

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

CHEATSHEET.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ Pascal:
5656

5757
```pascal
5858
type
59+
PPSDL_JoystickPowerLevel = ^PSDL_JoystickPowerLevel;
60+
PSDL_JoystickPowerLevel = ^TSDL_JoystickPowerLevel;
5961
TSDL_JoystickPowerLevel = type Integer;
6062
6163
const
@@ -85,6 +87,8 @@ without typecasting.
8587

8688
## Structs
8789

90+
### Defined Structs
91+
8892
C:
8993

9094
```c
@@ -100,6 +104,7 @@ Pascal:
100104

101105
```pascal
102106
type
107+
PPSDL_Version = ^PSDL_Version;
103108
PSDL_Version = ^TSDL_Version;
104109
TSDL_Version = record
105110
major: cuint8 { major version }
@@ -108,10 +113,12 @@ type
108113
end;
109114
```
110115

111-
Hint 1: If you have something like ```typedef struct name name```. the concrete
112-
structure is probably opaque. You should translate it as follows, although
113-
the best way to handle this is still not finally decided on. (see issue
116+
### Opaque Structs
117+
118+
If you have something like ```typedef struct name name```. the concrete
119+
structure is opaque. See issue
114120
[#63](https://github.com/PascalGameDevelopment/SDL2-for-Pascal/issues/63))
121+
for details.
115122

116123
C:
117124

@@ -121,8 +128,18 @@ typedef struct SDL_Window SDL_Window;
121128

122129
Pascal:
123130

131+
Prefered:
132+
```pascal
133+
type
134+
PPSDL_Window = ^PSDL_Window;
135+
PSDL_Window = ^TSDL_Window;
136+
TSDL_Window = type Pointer;
137+
```
138+
139+
Alternativly:
124140
```pascal
125141
type
142+
PPSDL_Window = ^PSDL_Window;
126143
PSDL_Window = ^TSDL_Window;
127144
TSDL_Window = record end;
128145
```
@@ -143,6 +160,7 @@ Pascal:
143160

144161
```pascal
145162
type
163+
PPSDL_WindowShapeParams = ^PSDL_WindowShapeParams;
146164
PSDL_WindowShapeParams = ^TSDL_WindowShapeParams;
147165
TSDL_WindowShapeParams = record
148166
case cint of

0 commit comments

Comments
 (0)