Islet Examples

This directory contains example programs demonstrating various features of libislet.

Building Examples

From this directory:

make

Or build individual examples:

make basic
make iteration
make persistence
make 3d_world

Example Programs

1. basic.c - Fundamental Operations

What it demonstrates:

Run:

./basic

Expected output: Shows basic CRUD operations on spatial coordinates.


2. iteration.c - Spatial Queries

What it demonstrates:

Run:

./iteration

Expected output: Various spatial queries showing iteration patterns and results.


3. persistence.c - File-Backed Databases

What it demonstrates:

Run:

./persistence

Expected output: Creates example_world.db and example_multi.db files, demonstrates data persisting across database close/reopen operations.

Generated files:

Cleanup:

rm example_*.db

4. 3d_world.c - Realistic Voxel World

What it demonstrates:

Run:

./3d_world

Expected output: Generates a 3ร—3 chunk voxel world, demonstrates player views, block manipulation, and shows performance with realistic data.

Generated files:

Cleanup:

rm world.db

Prerequisites

These examples require:

Ensure you've built and installed the main libislet library before compiling examples:

cd ..
make
sudo make install  # Or install to PREFIX if needed
cd examples
make

Learning Path

Recommended order for learning:

  1. basic.c - Start here to learn fundamental operations
  2. iteration.c - Learn spatial queries and region traversal
  3. persistence.c - Understand file-backed databases
  4. 3d_world.c - See realistic application patterns

Tips

`sh valgrind --leak-check=full ./basic `

`sh man islet_open man islet_iter_3 `

Common Issues

Undefined reference errors:

Segmentation faults:

File permission errors:

Further Reading

License

These examples are provided with the same license as libislet. Feel free to use them as starting points for your own projects.