From a7215257ac06edb37bbebb1dafb224ec7d549ece Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Wed, 5 Nov 2014 13:54:52 -0800 Subject: [PATCH] Some renamings and cleanups. --- Makefile | 4 +-- {include => i}/all.h | 2 -- i/c/c3.md | 60 +++++++++++++++++++++++++++++++++++++ {include => i}/c/defs.h | 0 {include => i}/c/motes.h | 0 {include => i}/c/portable.h | 0 {include => i}/c/types.h | 0 {include => i}/g/a.h | 0 {include => i}/g/e.h | 0 {include => i}/g/h.h | 0 {include => i}/g/i.h | 0 {include => i}/g/j.h | 0 {include => i}/g/m.h | 0 {include => i}/g/n.h | 0 {include => i}/g/r.h | 0 {include => i}/g/t.h | 0 {include => i}/g/v.h | 0 {include => i}/g/x.h | 0 {include => i}/g/z.h | 0 {include => i}/j/k.h | 0 {include => i}/j/q.h | 0 {include => i}/j/w.h | 0 {include => i}/v/vere.h | 0 include/c/comd.h | 22 -------------- include/c/tune.h | 0 25 files changed, 62 insertions(+), 26 deletions(-) rename {include => i}/all.h (98%) create mode 100644 i/c/c3.md rename {include => i}/c/defs.h (100%) rename {include => i}/c/motes.h (100%) rename {include => i}/c/portable.h (100%) rename {include => i}/c/types.h (100%) rename {include => i}/g/a.h (100%) rename {include => i}/g/e.h (100%) rename {include => i}/g/h.h (100%) rename {include => i}/g/i.h (100%) rename {include => i}/g/j.h (100%) rename {include => i}/g/m.h (100%) rename {include => i}/g/n.h (100%) rename {include => i}/g/r.h (100%) rename {include => i}/g/t.h (100%) rename {include => i}/g/v.h (100%) rename {include => i}/g/x.h (100%) rename {include => i}/g/z.h (100%) rename {include => i}/j/k.h (100%) rename {include => i}/j/q.h (100%) rename {include => i}/j/w.h (100%) rename {include => i}/v/vere.h (100%) delete mode 100644 include/c/comd.h delete mode 100644 include/c/tune.h diff --git a/Makefile b/Makefile index 3bb1aab675..3a44d0fa1f 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ else LIBS=-lssl -lcrypto -lgmp -lncurses -lsigsegv $(OSLIBS) endif -INCLUDE=include +INCLUDE=i MDEFINES=-DU3_OS_$(OS) -DU3_OS_ENDIAN_$(ENDIAN) -D U3_LIB=\"$(LIB)\" # NOTFORCHECKIN - restore -O3 @@ -337,7 +337,7 @@ $(LIBANACHRONISM): $(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBRE2) $(CXX) $(CXXFLAGS) -c $< $(LIBRE2) -o $@ -$(V_OFILES): include/v/vere.h +$(V_OFILES): i/v/vere.h $(BIN)/vere: $(LIBCRE) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) mkdir -p $(BIN) diff --git a/include/all.h b/i/all.h similarity index 98% rename from include/all.h rename to i/all.h index c52db8a14a..5f6c0941d1 100644 --- a/include/all.h +++ b/i/all.h @@ -38,11 +38,9 @@ /** c: the c3 layer, C portability and definitions. **/ # include "c/portable.h" -# include "c/tune.h" # include "c/types.h" # include "c/defs.h" # include "c/motes.h" -# include "c/comd.h" /** miscellaneous definitions and data structures. **/ diff --git a/i/c/c3.md b/i/c/c3.md new file mode 100644 index 0000000000..231946b3a1 --- /dev/null +++ b/i/c/c3.md @@ -0,0 +1,60 @@ +# u3: noun processing in C. + +`u3` is the C library that makes Urbit work. If it wasn't called +`u3`, it might be called `libnoun` - it's a library for making +and storing nouns. + +What's a noun? A noun is either a cell or an atom. A cell is an +ordered pair of any two nouns. An atom is an unsigned integer of +any size. + +To the C programmer, this is not a terribly complicated data +structure, so why do you need a library for it? + +One: nouns have a well-defined computation kernel, Nock, whose +spec fits on a page and gzips to 340 bytes. But the only +arithmetic operation in Nock is increment. So it's nontrivial +to compute both efficiently and correctly. + +Two: `u3` is designed to support "permanent computing," ie, a +single-level store which is transparently checkpointed. This +implies a specialized memory-management model. + +Does `u3` depend on the higher levels of Urbit, Arvo and Hoon? +Yes and no. It expects you to load something shaped like an Arvo +kernel, and use it as an event-processing function. But you +don't need to use this feature if you don't want, and your kernel +can be anything you want. + + +## u3: l + +The best way to introduce `u3` is with a simple map of the Urbit +build directory - folding things we don't care about right now: + + g/ u3 implementation + g/a.c allocation + g/e.c persistence + g/h.c hashtables + g/i.c noun construction + g/j.c jet control + g/m.c master state + g/n.c nock execution + g/r.c noun access, error returns + g/t.c tracing/profiling + g/v.c arvo kernel + g/x.c noun access, error crashes + g/z.c memoization/caching + i/ all includes + i/v Urbit systems headers + i/g u3 headers (matching filenames) + i/c c3 headers + i/c/ + v/ Urbit systems code + + outside/ all external bundled code + +# C3: C in the Urbit environment + +Urbit has two distinct - but easily confused - contexts where +we program in C. Logically, Urbit is a pure noun processing diff --git a/include/c/defs.h b/i/c/defs.h similarity index 100% rename from include/c/defs.h rename to i/c/defs.h diff --git a/include/c/motes.h b/i/c/motes.h similarity index 100% rename from include/c/motes.h rename to i/c/motes.h diff --git a/include/c/portable.h b/i/c/portable.h similarity index 100% rename from include/c/portable.h rename to i/c/portable.h diff --git a/include/c/types.h b/i/c/types.h similarity index 100% rename from include/c/types.h rename to i/c/types.h diff --git a/include/g/a.h b/i/g/a.h similarity index 100% rename from include/g/a.h rename to i/g/a.h diff --git a/include/g/e.h b/i/g/e.h similarity index 100% rename from include/g/e.h rename to i/g/e.h diff --git a/include/g/h.h b/i/g/h.h similarity index 100% rename from include/g/h.h rename to i/g/h.h diff --git a/include/g/i.h b/i/g/i.h similarity index 100% rename from include/g/i.h rename to i/g/i.h diff --git a/include/g/j.h b/i/g/j.h similarity index 100% rename from include/g/j.h rename to i/g/j.h diff --git a/include/g/m.h b/i/g/m.h similarity index 100% rename from include/g/m.h rename to i/g/m.h diff --git a/include/g/n.h b/i/g/n.h similarity index 100% rename from include/g/n.h rename to i/g/n.h diff --git a/include/g/r.h b/i/g/r.h similarity index 100% rename from include/g/r.h rename to i/g/r.h diff --git a/include/g/t.h b/i/g/t.h similarity index 100% rename from include/g/t.h rename to i/g/t.h diff --git a/include/g/v.h b/i/g/v.h similarity index 100% rename from include/g/v.h rename to i/g/v.h diff --git a/include/g/x.h b/i/g/x.h similarity index 100% rename from include/g/x.h rename to i/g/x.h diff --git a/include/g/z.h b/i/g/z.h similarity index 100% rename from include/g/z.h rename to i/g/z.h diff --git a/include/j/k.h b/i/j/k.h similarity index 100% rename from include/j/k.h rename to i/j/k.h diff --git a/include/j/q.h b/i/j/q.h similarity index 100% rename from include/j/q.h rename to i/j/q.h diff --git a/include/j/w.h b/i/j/w.h similarity index 100% rename from include/j/w.h rename to i/j/w.h diff --git a/include/v/vere.h b/i/v/vere.h similarity index 100% rename from include/v/vere.h rename to i/v/vere.h diff --git a/include/c/comd.h b/include/c/comd.h deleted file mode 100644 index 2bcf5929ee..0000000000 --- a/include/c/comd.h +++ /dev/null @@ -1,22 +0,0 @@ -/* include/comd.h -** -** This file is in the public domain. -*/ - /** Functions. - **/ - /* c3_comd_init(): - ** - ** Initialize the readline console. Return the history filename. - */ - c3_c* // produce - c3_comd_init(void); - - /* c3_comd_line(): - ** - ** Read a line from the console, saving to history file `fel`. - ** - ** Returns 0 iff the console has exited. - */ - c3_c* // produce - c3_comd_line(const c3_c *fel_c, - const c3_c *prm_c); // retain diff --git a/include/c/tune.h b/include/c/tune.h deleted file mode 100644 index e69de29bb2..0000000000