Skip to content

Creates C code to utilize Joint Memory Allocation (DoD) - Now with Struct of Array support!

License

Notifications You must be signed in to change notification settings

kjcommon138/ordnat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ordnat

Ordnat generates C code for joint memory allocations of data structures defined in TOML files.

Requirements

  • Any C compiler such as gcc, clang, or msvc.
  • Python3
  • pip3 for python package installation

Quick Start

# Install packages
pip3 install -r requirements.txt

# Generate header file
python3 main.py -o jointmesh.h test.toml

# Replace gcc with applicable c compiler
gcc main.c
./a.out

We recommend using Makefiles or CMake files to generate the necessary headers from this script before compiling c libraries/source files.

TOML Guide

See test.toml for examples of data structure definitions.

# This is a TOML document.
# Standard libs with '<lib.h>'
# User libs with '"lib.h"'
[header]
lib = ['"math.h"', '<stdio.h>']

# Example field in data struct:
# { type = "int", name = "foo" }
[data]
mesh = [
  { type = "Vector3", name = "position" },
  { type = "int", name = "index" },
  { type = "Vector2", name = "uv" }
]

Resources