#!/usr/bin/env python3

def read_lib(path):
    with open(path, 'rt') as source:
        return "".join([line for line in source.readlines() if not line.startswith(';')])

with open('LispLibrary.h', 'wt') as lib_header:
    lib_header.write(f"""// Library of additional Lisp functions with integral documentation
// LispLibrary.h - Version 2 - 5th November 2023

const char LispLibrary[] PROGMEM = R"lisplibrary(
{read_lib('library.lsp')}
(when (eq (platform) :t-deck)
{read_lib('tdeck.lsp')}
)
)lisplibrary";
""")
