Worgmap is a utility included with Worgle.
The creation of Worgmap started off with a crazy idea: what could happen if Worgle was able to generate small SQLite databases from programs written in Worgle? Worgmap is an attempt at answering this question.
Worgmap is a small commandline utility designed to navigate a generated database from worgle and extract meaningful bits of information. At the time of writing, this consists of a simple "get" interface, and some very initial code for an HTML and dot code exporter.
Worgmap will continue to grow based on the needs of software and tools written in using Worgle.
In the worgle codebase, a database can be generated by
make db. This will produce a SQLite database
a.db, which is what worgmap reads by default.
Worgmap can list all the tangled files with the
$ worgmap get filelist worgle.c worgle.h worgle_private.h sorg.c db.c db.h
More specific file information on say, db.c can be retrieved
$ worgmap get ffile id = 7 filename = db.c top = 5 (db-top) next_file = 15 program id = 2
Amongst the information, this tells us that the top code block is called "db-top". The program ID is an identifier that allows separately tangled program to exist in one database.
The hierarchy code block structure can be printed for
db.c via the top block using
tree. The program id (2) must
be supplied. Trees are a great way to get the idea a
program as it is seen in code rather than in how it is
presented in the markup.
$ worgmap get tree db-top 2 static_db_functions functions schemas inserts
functions codeblock is used to store all the
functions. It is composed of multiple block segments. Each
reference can be found using
$ worgmap get blkref functions 2 db.org:40 db.org:55 db.org:73 db.org:386 db.org:417 db.org:489 db.org:585 db.org:669 db.org:757 db.org:782 db.org:842
blkref can help mitigate spaghetti-code logic
that can sometimes appear in literate programming
environments that allow code to be declared out of order
and/or in completely different places.