1- {{~ Aditionally delete this line and fill out the template below ~ }}
2-
3- # {{PROJECT}} ABI/FFI Documentation
1+ # TANGLE ABI/FFI Documentation
42
53## Overview
64
@@ -26,7 +24,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
2624 ▼
2725┌─────────────────────────────────────────────┐
2826│ C Headers (auto-generated) │
29- │ generated/abi/{{project}} .h │
27+ │ generated/abi/tangle .h │
3028└─────────────────┬───────────────────────────┘
3129 │
3230 │ imported by
@@ -39,7 +37,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
3937│ - Memory-safe by default │
4038└─────────────────┬───────────────────────────┘
4139 │
42- │ compiled to lib{{project}} .so/.a
40+ │ compiled to libtangle .so/.a
4341 ▼
4442┌─────────────────────────────────────────────┐
4543│ Any Language via C ABI │
@@ -50,7 +48,7 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
5048## Directory Structure
5149
5250```
53- {{project}} /
51+ tangle /
5452├── src/
5553│ ├── abi/ # ABI definitions (Idris2)
5654│ │ ├── Types.idr # Core type definitions with proofs
@@ -67,11 +65,11 @@ This library follows the **Hyperpolymath RSR Standard** for ABI and FFI design:
6765│ ├── test/
6866│ │ └── integration_test.zig
6967│ └── include/
70- │ └── {{project}} .h # C header (optional, can be generated)
68+ │ └── tangle .h # C header (optional, can be generated)
7169│
7270├── generated/ # Auto-generated files
7371│ └── abi/
74- │ └── {{project}} .h # Generated from Idris2 ABI
72+ │ └── tangle .h # Generated from Idris2 ABI
7573│
7674└── bindings/ # Language-specific wrappers (optional)
7775 ├── rust/
@@ -199,7 +197,7 @@ zig build test # Run tests
199197
200198``` bash
201199cd src/abi
202- idris2 --cg c-header Types.idr -o ../../generated/abi/{{project}} .h
200+ idris2 --cg c-header Types.idr -o ../../generated/abi/tangle .h
203201```
204202
205203### Cross-Compile
@@ -222,32 +220,32 @@ zig build -Dtarget=x86_64-windows
222220### From C
223221
224222``` c
225- #include " {{project}} .h"
223+ #include " tangle .h"
226224
227225int main () {
228- void* handle = {{project}}_init ();
226+ void* handle = tangle_init ();
229227 if (!handle) return 1;
230228
231- int result = {{project}}_process (handle, 42);
229+ int result = tangle_process (handle, 42);
232230 if (result != 0) {
233- const char* err = {{project}}_last_error ();
231+ const char* err = tangle_last_error ();
234232 fprintf (stderr, "Error: %s\n", err);
235233 }
236234
237- {{project}}_free (handle);
235+ tangle_free (handle);
238236 return 0;
239237}
240238```
241239
242240Compile with:
243241``` bash
244- gcc -o example example.c -l{{project}} -L./zig-out/lib
242+ gcc -o example example.c -ltangle -L./zig-out/lib
245243```
246244
247245### From Idris2
248246
249247``` idris
250- import {{PROJECT}} .ABI.Foreign
248+ import TANGLE .ABI.Foreign
251249
252250main : IO ()
253251main = do
@@ -264,44 +262,44 @@ main = do
264262### From Rust
265263
266264``` rust
267- #[link(name = " {{project}} " )]
265+ #[link(name = " tangle " )]
268266extern " C" {
269- fn {{ project }} _init () -> * mut std :: ffi :: c_void ;
270- fn {{ project }} _free (handle : * mut std :: ffi :: c_void );
271- fn {{ project }} _process (handle : * mut std :: ffi :: c_void , input : u32 ) -> i32 ;
267+ fn tangle_init () -> * mut std :: ffi :: c_void ;
268+ fn tangle_free (handle : * mut std :: ffi :: c_void );
269+ fn tangle_process (handle : * mut std :: ffi :: c_void , input : u32 ) -> i32 ;
272270}
273271
274272fn main () {
275273 unsafe {
276- let handle = {{ project }} _init ();
274+ let handle = tangle_init ();
277275 assert! (! handle . is_null ());
278276
279- let result = {{ project }} _process (handle , 42 );
277+ let result = tangle_process (handle , 42 );
280278 assert_eq! (result , 0 );
281279
282- {{ project }} _free (handle );
280+ tangle_free (handle );
283281 }
284282}
285283```
286284
287285### From Julia
288286
289287``` julia
290- const lib{{project}} = " lib{{project}} "
288+ const libtangle = " libtangle "
291289
292290function init ()
293- handle = ccall ((:{{project}}_init, lib{{project}} ), Ptr{Cvoid}, ())
291+ handle = ccall ((:tangle_init , libtangle ), Ptr{Cvoid}, ())
294292 handle == C_NULL && error (" Failed to initialize" )
295293 handle
296294end
297295
298296function process (handle, input)
299- result = ccall ((:{{project}}_process, lib{{project}} ), Cint, (Ptr{Cvoid}, UInt32), handle, input)
297+ result = ccall ((:tangle_process , libtangle ), Cint, (Ptr{Cvoid}, UInt32), handle, input)
300298 result
301299end
302300
303301function cleanup (handle)
304- ccall ((:{{project}}_free, lib{{project}} ), Cvoid, (Ptr{Cvoid},), handle)
302+ ccall ((:tangle_free , libtangle ), Cvoid, (Ptr{Cvoid},), handle)
305303end
306304
307305# Usage
@@ -355,7 +353,7 @@ When modifying the ABI/FFI:
355353
3563542 . ** Generate C header**
357355 ``` bash
358- idris2 --cg c-header src/abi/Types.idr -o generated/abi/{{project}} .h
356+ idris2 --cg c-header src/abi/Types.idr -o generated/abi/tangle .h
359357 ```
360358
3613593 . ** Update FFI implementation** (` ffi/zig/src/main.zig ` )
0 commit comments