Skip to content

Commit

Permalink
partial sqlite integration; not fast enough for rev cache
Browse files Browse the repository at this point in the history
  • Loading branch information
inimino committed Jun 22, 2024
1 parent 80111f6 commit dc359fe
Show file tree
Hide file tree
Showing 5 changed files with 749 additions and 74 deletions.
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@ CC := gcc

all: dist/cmpr

CFLAGS := -O2 -Wall
CFLAGS := -O2 -Wall -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
LDFLAGS := -lm

debug: CFLAGS := -g -O0 -Wall -fsanitize=address
debug: CFLAGS := -g -O0 -Wall -fsanitize=address -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
debug: dist/cmpr

dev: CFLAGS := -O2 -Wall -Werror -fsanitize=address
dev: CFLAGS := -O2 -Wall -Werror -fsanitize=address -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION
dev: dist/cmpr

dist/cmpr: fdecls.h cmpr.c spanio.c
dist/cmpr: cmpr.c fdecls.h spanio.c siphash/siphash.o siphash/halfsiphash.o libs/sqlite3.o
mkdir -p dist
(VER=8; D=$$(date +%Y%m%d-%H%M%S); GIT=$$(git log -1 --pretty="%h %f"); echo '#line 2 "cmpr.c"' >cmpr-sed.c; sed 's/\$$VERSION\$$/'"$$VER"' (build: '"$$D"' '"$$GIT"')/' <cmpr.c >>cmpr-sed.c; echo "Version: $$VER (build: $$D $$GIT)"; $(CC) -o dist/cmpr-$$D cmpr-sed.c siphash/siphash.c siphash/halfsiphash.c $(CFLAGS) $(LDFLAGS) && rm -f dist/cmpr && ln -s cmpr-$$D dist/cmpr)
(VER=8; D=$$(date +%Y%m%d-%H%M%S); GIT=$$(git log -1 --pretty="%h %f"); echo '#line 1 "cmpr.c"' >cmpr-sed.c; sed 's/\$$VERSION\$$/'"$$VER"' (build: '"$$D"' '"$$GIT"')/' <cmpr.c >>cmpr-sed.c; echo "Version: $$VER (build: $$D $$GIT)"; $(CC) -o dist/cmpr-$$D cmpr-sed.c siphash/siphash.o siphash/halfsiphash.o libs/sqlite3.o $(CFLAGS) $(LDFLAGS) && rm -f dist/cmpr && ln -s cmpr-$$D dist/cmpr)

siphash/siphash.o: siphash/siphash.c
$(CC) -c siphash/siphash.c $(CFLAGS) -o siphash/siphash.o

siphash/halfsiphash.o: siphash/halfsiphash.c
$(CC) -c siphash/halfsiphash.c $(CFLAGS) -o siphash/halfsiphash.o

libs/sqlite3.o: libs/sqlite3.c
$(CC) -c libs/sqlite3.c $(CFLAGS) -o libs/sqlite3.o

fdecls.h: cmpr.c
python3 extract_decls.py < cmpr.c > fdecls.h

clean:
rm -rf dist

install: dist/cmpr
install -m 755 dist/cmpr /usr/local/bin/cmpr
11 changes: 6 additions & 5 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -149,23 +149,26 @@
✓ merge 2 PRs
✓ bugfix :inrefs, :toprefs crashes
✓ chmod issue on Windows (exec bit)
✓ bump version and push v8




WHAT WE ARE CURRENTLY DOING:
bump version and push v8
integrate sqlite




rename bootstrap to global context block
scope the templating work (first pass: template our own stuff)
change the "----" thing now that chatgpt does markdown everywhere
dedup transitive block references
Arena overflow for spans
I think flush should probably never apply to cmp, only out
rename bootstrap to global context block
"Error: Block does not belong to any file." happened
context: added a space before a "#" in the last markdown block in the last file, then :wq
actually index block ids
Also there was an error when creating a new file in a Python project (because the file was empty, I think)
make "@" be a menu of references from this block
"@@" or sth is menu of blocks that refer to us
automatically suggest regen of stale downstream blocks
Expand All @@ -175,7 +178,6 @@ WHAT WE ARE CURRENTLY DOING:
make LLM calls asynchronous
clipboard model set automatically
add :allfiles to autopopulate conf, and an empty state (?)
cmprdir should be auto-set
~/.cmpr for top-level conf
send everything to LLM and create a bootstrap? ctags?
ship with some kind of bootstrap bootstrap?
Expand All @@ -189,7 +191,6 @@ WHAT WE ARE CURRENTLY DOING:
QA on --init and setting language
turn a template into a shell script with cmpr calls embedded
idea: cmpr --expand takes a template on stdin and returns text on stdout (or --eval) (it makes cmpr a database)
cmprdir should default to .cmpr/
test / fix check_conf_vars (e.g. cmprdir missing)
support other AIs via an external script
idea: when a TODO item is done, put the relevant blocks in a comment
Expand Down
Loading

0 comments on commit dc359fe

Please sign in to comment.