11<!-- SPDX-License-Identifier: PMPL-1.0-or-later -->
22{{~ Aditionally delete this line and fill out the template below ~ }}
33
4- # {{PROJECT}} ABI/FFI Documentation
4+ # WOKELANG ABI/FFI Documentation
55
66## Overview
77
@@ -27,7 +27,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
2727 ▼
2828┌─────────────────────────────────────────────┐
2929│ C Headers (auto-generated) │
30- │ generated/abi/{{project}} .h │
30+ │ generated/abi/wokelang .h │
3131└─────────────────┬───────────────────────────┘
3232 │
3333 │ imported by
@@ -40,7 +40,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
4040│ - Memory-safe by default │
4141└─────────────────┬───────────────────────────┘
4242 │
43- │ compiled to lib{{project}} .so/.a
43+ │ compiled to libwokelang .so/.a
4444 ▼
4545┌─────────────────────────────────────────────┐
4646│ Any Language via C ABI │
@@ -51,7 +51,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
5151## Directory Structure
5252
5353```
54- {{project}} /
54+ wokelang /
5555├── src/
5656│ ├── abi/ # ABI definitions (Idris2)
5757│ │ ├── Types.idr # Core type definitions with proofs
@@ -68,11 +68,11 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
6868│ ├── test/
6969│ │ └── integration_test.zig
7070│ └── include/
71- │ └── {{project}} .h # C header (optional, can be generated)
71+ │ └── wokelang .h # C header (optional, can be generated)
7272│
7373├── generated/ # Auto-generated files
7474│ └── abi/
75- │ └── {{project}} .h # Generated from Idris2 ABI
75+ │ └── wokelang .h # Generated from Idris2 ABI
7676│
7777└── bindings/ # Language-specific wrappers (optional)
7878 ├── rust/
@@ -200,7 +200,7 @@ zig build test # Run tests
200200
201201``` bash
202202cd src/abi
203- idris2 --cg c-header Types.idr -o ../../generated/abi/{{project}} .h
203+ idris2 --cg c-header Types.idr -o ../../generated/abi/wokelang .h
204204```
205205
206206### Cross-Compile
@@ -223,32 +223,32 @@ zig build -Dtarget=x86_64-windows
223223### From C
224224
225225``` c
226- #include " {{project}} .h"
226+ #include " wokelang .h"
227227
228228int main () {
229- void* handle = {{project}}_init ();
229+ void* handle = wokelang_init ();
230230 if (!handle) return 1;
231231
232- int result = {{project}}_process (handle, 42);
232+ int result = wokelang_process (handle, 42);
233233 if (result != 0) {
234- const char* err = {{project}}_last_error ();
234+ const char* err = wokelang_last_error ();
235235 fprintf (stderr, "Error: %s\n", err);
236236 }
237237
238- {{project}}_free (handle);
238+ wokelang_free (handle);
239239 return 0;
240240}
241241```
242242
243243Compile with:
244244``` bash
245- gcc -o example example.c -l{{project}} -L./zig-out/lib
245+ gcc -o example example.c -lwokelang -L./zig-out/lib
246246```
247247
248248### From Idris2
249249
250250``` idris
251- import {{PROJECT}} .ABI.Foreign
251+ import WOKELANG .ABI.Foreign
252252
253253main : IO ()
254254main = do
@@ -265,44 +265,44 @@ main = do
265265### From Rust
266266
267267``` rust
268- #[link(name = " {{project}} " )]
268+ #[link(name = " wokelang " )]
269269extern " C" {
270- fn {{ project }} _init () -> * mut std :: ffi :: c_void ;
271- fn {{ project }} _free (handle : * mut std :: ffi :: c_void );
272- fn {{ project }} _process (handle : * mut std :: ffi :: c_void , input : u32 ) -> i32 ;
270+ fn wokelang_init () -> * mut std :: ffi :: c_void ;
271+ fn wokelang_free (handle : * mut std :: ffi :: c_void );
272+ fn wokelang_process (handle : * mut std :: ffi :: c_void , input : u32 ) -> i32 ;
273273}
274274
275275fn main () {
276276 unsafe {
277- let handle = {{ project }} _init ();
277+ let handle = wokelang_init ();
278278 assert! (! handle . is_null ());
279279
280- let result = {{ project }} _process (handle , 42 );
280+ let result = wokelang_process (handle , 42 );
281281 assert_eq! (result , 0 );
282282
283- {{ project }} _free (handle );
283+ wokelang_free (handle );
284284 }
285285}
286286```
287287
288288### From Julia
289289
290290``` julia
291- const lib{{project}} = " lib{{project}} "
291+ const libwokelang = " libwokelang "
292292
293293function init ()
294- handle = ccall ((:{{project}}_init, lib{{project}} ), Ptr{Cvoid}, ())
294+ handle = ccall ((:wokelang_init , libwokelang ), Ptr{Cvoid}, ())
295295 handle == C_NULL && error (" Failed to initialize" )
296296 handle
297297end
298298
299299function process (handle, input)
300- result = ccall ((:{{project}}_process, lib{{project}} ), Cint, (Ptr{Cvoid}, UInt32), handle, input)
300+ result = ccall ((:wokelang_process , libwokelang ), Cint, (Ptr{Cvoid}, UInt32), handle, input)
301301 result
302302end
303303
304304function cleanup (handle)
305- ccall ((:{{project}}_free, lib{{project}} ), Cvoid, (Ptr{Cvoid},), handle)
305+ ccall ((:wokelang_free , libwokelang ), Cvoid, (Ptr{Cvoid},), handle)
306306end
307307
308308# Usage
@@ -356,7 +356,7 @@ When modifying the ABI/FFI:
356356
3573572 . ** Generate C header**
358358 ``` bash
359- idris2 --cg c-header src/abi/Types.idr -o generated/abi/{{project}} .h
359+ idris2 --cg c-header src/abi/Types.idr -o generated/abi/wokelang .h
360360 ```
361361
3623623 . ** Update FFI implementation** (` ffi/zig/src/main.zig ` )
0 commit comments