Skip to content

Commit

Permalink
mkcxxxr with inline reference functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dragoncoder047 authored Apr 4, 2024
1 parent 34ed242 commit bf68fcb
Show file tree
Hide file tree
Showing 8 changed files with 694 additions and 559 deletions.
126 changes: 126 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,131 @@
{
"cSpell.words": [
"caaaaaar",
"caaaaadr",
"caaaaar",
"caaaadar",
"caaaaddr",
"caaaadr",
"caaaar",
"caaadaar",
"caaadadr",
"caaadar",
"caaaddar",
"caaadddr",
"caaaddr",
"caaadr",
"caaar",
"caadaaar",
"caadaadr",
"caadaar",
"caadadar",
"caadaddr",
"caadadr",
"caadar",
"caaddaar",
"caaddadr",
"caaddar",
"caadddar",
"caaddddr",
"caadddr",
"caaddr",
"caadr",
"caar",
"cadaaaar",
"cadaaadr",
"cadaaar",
"cadaadar",
"cadaaddr",
"cadaadr",
"cadaar",
"cadadaar",
"cadadadr",
"cadadar",
"cadaddar",
"cadadddr",
"cadaddr",
"cadadr",
"cadar",
"caddaaar",
"caddaadr",
"caddaar",
"caddadar",
"caddaddr",
"caddadr",
"caddar",
"cadddaar",
"cadddadr",
"cadddar",
"caddddar",
"cadddddr",
"caddddr",
"cadddr",
"caddr",
"cadr",
"cdaaaaar",
"cdaaaadr",
"cdaaaar",
"cdaaadar",
"cdaaaddr",
"cdaaadr",
"cdaaar",
"cdaadaar",
"cdaadadr",
"cdaadar",
"cdaaddar",
"cdaadddr",
"cdaaddr",
"cdaadr",
"cdaar",
"cdadaaar",
"cdadaadr",
"cdadaar",
"cdadadar",
"cdadaddr",
"cdadadr",
"cdadar",
"cdaddaar",
"cdaddadr",
"cdaddar",
"cdadddar",
"cdaddddr",
"cdadddr",
"cdaddr",
"cdadr",
"cdar",
"cddaaaar",
"cddaaadr",
"cddaaar",
"cddaadar",
"cddaaddr",
"cddaadr",
"cddaar",
"cddadaar",
"cddadadr",
"cddadar",
"cddaddar",
"cddadddr",
"cddaddr",
"cddadr",
"cddar",
"cdddaaar",
"cdddaadr",
"cdddaar",
"cdddadar",
"cdddaddr",
"cdddadr",
"cdddar",
"cddddaar",
"cddddadr",
"cddddar",
"cdddddar",
"cddddddr",
"cdddddr",
"cddddr",
"cdddr",
"cddr",
"cxxxr",
"mkcxxxr",
"stobject",
"stthread",
"stvm",
Expand Down
128 changes: 128 additions & 0 deletions cxxxr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
/* AUTO-GENERATED FILE */
#include "tinobsy.hpp"
inline object*& car(object* x) { return x->car; }
inline object*& cdr(object* x) { return x->cdr; }
inline object*& caar(object* x) { return car(car(x)); }
inline object*& cadr(object* x) { return car(cdr(x)); }
inline object*& cdar(object* x) { return cdr(car(x)); }
inline object*& cddr(object* x) { return cdr(cdr(x)); }
inline object*& caaar(object* x) { return car(caar(x)); }
inline object*& caadr(object* x) { return car(cadr(x)); }
inline object*& cadar(object* x) { return car(cdar(x)); }
inline object*& caddr(object* x) { return car(cddr(x)); }
inline object*& cdaar(object* x) { return cdr(caar(x)); }
inline object*& cdadr(object* x) { return cdr(cadr(x)); }
inline object*& cddar(object* x) { return cdr(cdar(x)); }
inline object*& cdddr(object* x) { return cdr(cddr(x)); }
inline object*& caaaar(object* x) { return car(caaar(x)); }
inline object*& caaadr(object* x) { return car(caadr(x)); }
inline object*& caadar(object* x) { return car(cadar(x)); }
inline object*& caaddr(object* x) { return car(caddr(x)); }
inline object*& cadaar(object* x) { return car(cdaar(x)); }
inline object*& cadadr(object* x) { return car(cdadr(x)); }
inline object*& caddar(object* x) { return car(cddar(x)); }
inline object*& cadddr(object* x) { return car(cdddr(x)); }
inline object*& cdaaar(object* x) { return cdr(caaar(x)); }
inline object*& cdaadr(object* x) { return cdr(caadr(x)); }
inline object*& cdadar(object* x) { return cdr(cadar(x)); }
inline object*& cdaddr(object* x) { return cdr(caddr(x)); }
inline object*& cddaar(object* x) { return cdr(cdaar(x)); }
inline object*& cddadr(object* x) { return cdr(cdadr(x)); }
inline object*& cdddar(object* x) { return cdr(cddar(x)); }
inline object*& cddddr(object* x) { return cdr(cdddr(x)); }
inline object*& caaaaar(object* x) { return car(caaaar(x)); }
inline object*& caaaadr(object* x) { return car(caaadr(x)); }
inline object*& caaadar(object* x) { return car(caadar(x)); }
inline object*& caaaddr(object* x) { return car(caaddr(x)); }
inline object*& caadaar(object* x) { return car(cadaar(x)); }
inline object*& caadadr(object* x) { return car(cadadr(x)); }
inline object*& caaddar(object* x) { return car(caddar(x)); }
inline object*& caadddr(object* x) { return car(cadddr(x)); }
inline object*& cadaaar(object* x) { return car(cdaaar(x)); }
inline object*& cadaadr(object* x) { return car(cdaadr(x)); }
inline object*& cadadar(object* x) { return car(cdadar(x)); }
inline object*& cadaddr(object* x) { return car(cdaddr(x)); }
inline object*& caddaar(object* x) { return car(cddaar(x)); }
inline object*& caddadr(object* x) { return car(cddadr(x)); }
inline object*& cadddar(object* x) { return car(cdddar(x)); }
inline object*& caddddr(object* x) { return car(cddddr(x)); }
inline object*& cdaaaar(object* x) { return cdr(caaaar(x)); }
inline object*& cdaaadr(object* x) { return cdr(caaadr(x)); }
inline object*& cdaadar(object* x) { return cdr(caadar(x)); }
inline object*& cdaaddr(object* x) { return cdr(caaddr(x)); }
inline object*& cdadaar(object* x) { return cdr(cadaar(x)); }
inline object*& cdadadr(object* x) { return cdr(cadadr(x)); }
inline object*& cdaddar(object* x) { return cdr(caddar(x)); }
inline object*& cdadddr(object* x) { return cdr(cadddr(x)); }
inline object*& cddaaar(object* x) { return cdr(cdaaar(x)); }
inline object*& cddaadr(object* x) { return cdr(cdaadr(x)); }
inline object*& cddadar(object* x) { return cdr(cdadar(x)); }
inline object*& cddaddr(object* x) { return cdr(cdaddr(x)); }
inline object*& cdddaar(object* x) { return cdr(cddaar(x)); }
inline object*& cdddadr(object* x) { return cdr(cddadr(x)); }
inline object*& cddddar(object* x) { return cdr(cdddar(x)); }
inline object*& cdddddr(object* x) { return cdr(cddddr(x)); }
inline object*& caaaaaar(object* x) { return car(caaaaar(x)); }
inline object*& caaaaadr(object* x) { return car(caaaadr(x)); }
inline object*& caaaadar(object* x) { return car(caaadar(x)); }
inline object*& caaaaddr(object* x) { return car(caaaddr(x)); }
inline object*& caaadaar(object* x) { return car(caadaar(x)); }
inline object*& caaadadr(object* x) { return car(caadadr(x)); }
inline object*& caaaddar(object* x) { return car(caaddar(x)); }
inline object*& caaadddr(object* x) { return car(caadddr(x)); }
inline object*& caadaaar(object* x) { return car(cadaaar(x)); }
inline object*& caadaadr(object* x) { return car(cadaadr(x)); }
inline object*& caadadar(object* x) { return car(cadadar(x)); }
inline object*& caadaddr(object* x) { return car(cadaddr(x)); }
inline object*& caaddaar(object* x) { return car(caddaar(x)); }
inline object*& caaddadr(object* x) { return car(caddadr(x)); }
inline object*& caadddar(object* x) { return car(cadddar(x)); }
inline object*& caaddddr(object* x) { return car(caddddr(x)); }
inline object*& cadaaaar(object* x) { return car(cdaaaar(x)); }
inline object*& cadaaadr(object* x) { return car(cdaaadr(x)); }
inline object*& cadaadar(object* x) { return car(cdaadar(x)); }
inline object*& cadaaddr(object* x) { return car(cdaaddr(x)); }
inline object*& cadadaar(object* x) { return car(cdadaar(x)); }
inline object*& cadadadr(object* x) { return car(cdadadr(x)); }
inline object*& cadaddar(object* x) { return car(cdaddar(x)); }
inline object*& cadadddr(object* x) { return car(cdadddr(x)); }
inline object*& caddaaar(object* x) { return car(cddaaar(x)); }
inline object*& caddaadr(object* x) { return car(cddaadr(x)); }
inline object*& caddadar(object* x) { return car(cddadar(x)); }
inline object*& caddaddr(object* x) { return car(cddaddr(x)); }
inline object*& cadddaar(object* x) { return car(cdddaar(x)); }
inline object*& cadddadr(object* x) { return car(cdddadr(x)); }
inline object*& caddddar(object* x) { return car(cddddar(x)); }
inline object*& cadddddr(object* x) { return car(cdddddr(x)); }
inline object*& cdaaaaar(object* x) { return cdr(caaaaar(x)); }
inline object*& cdaaaadr(object* x) { return cdr(caaaadr(x)); }
inline object*& cdaaadar(object* x) { return cdr(caaadar(x)); }
inline object*& cdaaaddr(object* x) { return cdr(caaaddr(x)); }
inline object*& cdaadaar(object* x) { return cdr(caadaar(x)); }
inline object*& cdaadadr(object* x) { return cdr(caadadr(x)); }
inline object*& cdaaddar(object* x) { return cdr(caaddar(x)); }
inline object*& cdaadddr(object* x) { return cdr(caadddr(x)); }
inline object*& cdadaaar(object* x) { return cdr(cadaaar(x)); }
inline object*& cdadaadr(object* x) { return cdr(cadaadr(x)); }
inline object*& cdadadar(object* x) { return cdr(cadadar(x)); }
inline object*& cdadaddr(object* x) { return cdr(cadaddr(x)); }
inline object*& cdaddaar(object* x) { return cdr(caddaar(x)); }
inline object*& cdaddadr(object* x) { return cdr(caddadr(x)); }
inline object*& cdadddar(object* x) { return cdr(cadddar(x)); }
inline object*& cdaddddr(object* x) { return cdr(caddddr(x)); }
inline object*& cddaaaar(object* x) { return cdr(cdaaaar(x)); }
inline object*& cddaaadr(object* x) { return cdr(cdaaadr(x)); }
inline object*& cddaadar(object* x) { return cdr(cdaadar(x)); }
inline object*& cddaaddr(object* x) { return cdr(cdaaddr(x)); }
inline object*& cddadaar(object* x) { return cdr(cdadaar(x)); }
inline object*& cddadadr(object* x) { return cdr(cdadadr(x)); }
inline object*& cddaddar(object* x) { return cdr(cdaddar(x)); }
inline object*& cddadddr(object* x) { return cdr(cdadddr(x)); }
inline object*& cdddaaar(object* x) { return cdr(cddaaar(x)); }
inline object*& cdddaadr(object* x) { return cdr(cddaadr(x)); }
inline object*& cdddadar(object* x) { return cdr(cddadar(x)); }
inline object*& cdddaddr(object* x) { return cdr(cddaddr(x)); }
inline object*& cddddaar(object* x) { return cdr(cdddaar(x)); }
inline object*& cddddadr(object* x) { return cdr(cdddadr(x)); }
inline object*& cdddddar(object* x) { return cdr(cddddar(x)); }
inline object*& cddddddr(object* x) { return cdr(cdddddr(x)); }
16 changes: 11 additions & 5 deletions mkcxxxr.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#! /usr/bin/env python

def mkcxxxr(n, bw):
if bw == 1 and (n == 0 or n == 1):
return f"#define c{'ad'[n]}r(x) ((x)->c{'ad'[n]}r)"
return f"inline object*& c{'ad'[n]}r(object* x) {{ return x->c{'ad'[n]}r; }}"
binstr = bin(n)[2:].rjust(bw, '0').replace('1', 'd').replace('0', 'a')
return f"#define c{binstr}r(x) c{binstr[0]}r(c{binstr[1:]}r(x))"
print("c" + binstr + "r")
return f"inline object*& c{binstr}r(object* x) {{ return c{binstr[0]}r(c{binstr[1:]}r(x)); }}"


for bw in range(1, 7):
for n in range(2**bw):
print(mkcxxxr(n, bw))
with open("cxxxr.h", "w") as f:
print('/* AUTO-GENERATED FILE */\n#include "tinobsy.hpp"', file=f)
for bw in range(1, 7):
for n in range(2**bw):
print(mkcxxxr(n, bw), file=f)
Loading

0 comments on commit bf68fcb

Please sign in to comment.