From 40a253a930238e155286bde1734066806ce18217 Mon Sep 17 00:00:00 2001 From: XXIV <13811862+thechampagne@users.noreply.github.com> Date: Sun, 22 Oct 2023 00:40:44 +0300 Subject: [PATCH] add pascal binding --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index fa3222aa..0ac37f1b 100644 --- a/README.md +++ b/README.md @@ -589,6 +589,39 @@ void main() } ``` +#### [Pascal](https://en.wikipedia.org/wiki/Pascal_(programming_language)) +> Third party binding: [thechampagne/zip-pascal](https://github.com/thechampagne/zip-pascal) + +```pas +program main; + +{$linklib c} +{$linklib zip} + +uses ctypes; + +function zip_open(zipname:Pchar; level:longint; mode:char):pointer;cdecl;external; +procedure zip_close(zip:pointer);cdecl;external; +function zip_entry_open(zip:pointer; entryname:Pchar):longint;cdecl;external; +function zip_entry_close(zip:pointer):longint;cdecl;external; +function zip_entry_write(zip:pointer; buf:pointer; bufsize:csize_t):longint;cdecl;external; + +const + content: Pchar = 'test content'; +var + zip : pointer; + +begin + zip := zip_open('/tmp/pascal.zip', 6, 'w'); + + zip_entry_open(zip, 'test'); + + zip_entry_write(zip, content, strlen(content)); + zip_entry_close(zip); + zip_close(zip); +end. +``` + ### Check out more cool projects which use this library * [Filament](https://github.com/google/filament): Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small as possible and as efficient as possible on Android.