From 52a70a10a77e3c0b84490a9cf424985171285a42 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 3 Apr 2026 22:31:45 +0200 Subject: [PATCH 1/3] Add h2pas wizard settings file --- .../translate-sdl3-h2paswizard.h2p | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 tools/h2paswizard/translate-sdl3-h2paswizard.h2p diff --git a/tools/h2paswizard/translate-sdl3-h2paswizard.h2p b/tools/h2paswizard/translate-sdl3-h2paswizard.h2p new file mode 100644 index 0000000..1f3b4f5 --- /dev/null +++ b/tools/h2paswizard/translate-sdl3-h2paswizard.h2p @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From fcbf9f4da445158cb8e9d46141d181a3a5c8cd16 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 3 Apr 2026 23:24:24 +0200 Subject: [PATCH 2/3] add helper files for h2pas wizard --- tools/h2paswizard/sdl3code.h | 21 +++++++++++++++++++++ tools/h2paswizard/sdl3code.inc | 2 ++ 2 files changed, 23 insertions(+) create mode 100644 tools/h2paswizard/sdl3code.h create mode 100644 tools/h2paswizard/sdl3code.inc diff --git a/tools/h2paswizard/sdl3code.h b/tools/h2paswizard/sdl3code.h new file mode 100644 index 0000000..679b078 --- /dev/null +++ b/tools/h2paswizard/sdl3code.h @@ -0,0 +1,21 @@ + +{ paste source code from a C header (.h) file into this file } + +{ fictional test source code } +{ + +/** + * Fictional comment of a fictional type + */ +typedef Uint64 SDL_FictionalType; + +#define SDL_FI1 0x0000000000000001 /**< FI 1 Comment */ +#define SDL_FI2 0x0000000000000002 /**< FI 2 Comment */ +#define SDL_FI3 0x0000000000000004 /**< FI 3 Comment */ + +/** + * Fictional comment of a fictional function + */ +extern SDL_DECLSPEC bool SDLCALL FictionalFunction(SDL_FictionalID fictionalID, SDL_Rect *rect); + +} diff --git a/tools/h2paswizard/sdl3code.inc b/tools/h2paswizard/sdl3code.inc new file mode 100644 index 0000000..dd34ba2 --- /dev/null +++ b/tools/h2paswizard/sdl3code.inc @@ -0,0 +1,2 @@ + +{ h2pas wizard result shows up in this file } From bc0f5d82a0165736f7781bb700395f3662b0b1bc Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 4 Apr 2026 00:05:51 +0200 Subject: [PATCH 3/3] Add README.MD --- tools/h2paswizard/README.MD | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/h2paswizard/README.MD diff --git a/tools/h2paswizard/README.MD b/tools/h2paswizard/README.MD new file mode 100644 index 0000000..814a44f --- /dev/null +++ b/tools/h2paswizard/README.MD @@ -0,0 +1,40 @@ +# SDL3-for-Pascal H2Paswizard Tool + +This file describes how to use the +[H2Paswizard tool](https://wiki.freepascal.org/H2Paswizard) +to translate SDL3 header files into Pascal units for the +[SDL3 for Pascal Project](https://github.com/PascalGameDevelopment/SDL3-for-Pascal). +[H2Pas](https://wiki.freepascal.org/H2Pas) is a command line tool to translate +C header files into Pascal units. H2Paswizard is a GUI for easier use of H2Pas. + +H2Paswizard is shipped as package alongside with the Lazarus IDE but is not +installed. The file `translate-sdl3-h2paswizard.h2p` is specifically created by +us to translate SDL3 header files into Pascal units as required for +SDL3-for-Pascal. + +## How to start + +- [Install the H2Paswizard package](https://wiki.lazarus.freepascal.org/Install_Packages) +to the Lazarus IDE +- Start H2Paswizard: Select menu item Tools -> H2Pas... +- Click on "Add .h files..."-button and add `sdl3code.h` (from SDL3-for-Pascal +tools/h2paswizard folder) +- Click on "Open Settings"-button and open `translate-sdl3-h2paswizard.h2p` +- Open "H2Pas Options"-tab; activate the following options: -e, -i, -D, -c, -p, -T, -C +- Further options: -l Library name: "SDL3" +- Output extension: ".inc" +- Output directory: e.g. SDL3-for-Pascal/tools/h2paswizard/ +- Open `sdl3code.h` and `sdl3code.inc` in Lazarus +- Now you are ready to copy C code into `sdl3code.h` and get the resulting Pascal +code in `sdl3code.inc` by hitting "Run H2Pas" + +*Hint:* You should open the settings always again, if you closed H2Paswizard. +Otherwise the settings file is not recognized. + +*Important:* The results are not perfect, they must always be revised. + + + + + +