mirror of
https://github.com/urbit/shrub.git
synced 2024-11-28 13:54:20 +03:00
Merge branch 'cc-release' into ccr-fast-boot
This commit is contained in:
commit
704abb09ca
@ -9,9 +9,9 @@ node_js:
|
||||
# email: false
|
||||
|
||||
before_install:
|
||||
# try to get pill early, so configuration errors will be quickly caught
|
||||
#
|
||||
# try to get pill early, so configuration errors will be quickly caught
|
||||
- cd .travis
|
||||
- bash check-trailing-whitespace.sh
|
||||
- bash get-brass-pill.sh
|
||||
- cd ..
|
||||
- wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
|
||||
|
15
.travis/check-trailing-whitespace.sh
Executable file
15
.travis/check-trailing-whitespace.sh
Executable file
@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
whitespace=$(
|
||||
find .. -path ../.git -prune -o \
|
||||
-path ../subprojects -prune -o \
|
||||
-type f \
|
||||
-exec egrep -l " +$" {} ';' \
|
||||
)
|
||||
|
||||
if [ -n "$whitespace" ]
|
||||
then
|
||||
echo 'found trailing whitespace in:';
|
||||
echo $whitespace;
|
||||
exit 1;
|
||||
fi
|
@ -93,7 +93,7 @@ source files that are denoted by comments and are actually indented one
|
||||
level.
|
||||
|
||||
Hoon will be a less familiar language to many contributors. More details
|
||||
are forthcoming; for now, the `%ford` vane (in
|
||||
are forthcoming; for now, the `%ford` vane (in
|
||||
[`sys/vane/ford.hoon`](https://github.com/urbit/arvo/blob/master/sys/vane/ford.hoon))
|
||||
is the highest quality code in the kernel.
|
||||
|
||||
|
@ -1083,7 +1083,7 @@ ZOO place where animals are kept for public exhibition
|
||||
ZUZ ancient Hebrew silver coin {OSPD4}
|
||||
ZZZ intj. representing the sound of snoring {OSPD4}
|
||||
|
||||
----------------------------------------------------------------------
|
||||
----------------------------------------------------------------------
|
||||
San Jose Scrabble® Club No. 21
|
||||
Director: Rick Wong
|
||||
Last modified: T2Q (26 Feb 2009) Clarified status of this list.
|
||||
|
@ -1,4 +1,4 @@
|
||||
A noun is an atom or a cell. An atom is a natural number. A cell is an ordered
|
||||
A noun is an atom or a cell. An atom is a natural number. A cell is an ordered
|
||||
pair of nouns.
|
||||
|
||||
nock(a) *a
|
||||
|
112
Spec/u3.md
112
Spec/u3.md
@ -30,7 +30,7 @@ dependencies at all between Hoon the language and `u3`.)
|
||||
|
||||
## c3: C in Urbit
|
||||
|
||||
Under `u3` is the simple `c3` layer, which is just how we write C
|
||||
Under `u3` is the simple `c3` layer, which is just how we write C
|
||||
in Urbit.
|
||||
|
||||
When writing C in u3, please of course follow the conventions of
|
||||
@ -39,7 +39,7 @@ important that every function have a header comment, even if it
|
||||
says nothing interesting.
|
||||
|
||||
But some of our idiosyncrasies go beyond convention. Yes, we've
|
||||
done awful things to C. Here's what we did and why we did.
|
||||
done awful things to C. Here's what we did and why we did.
|
||||
|
||||
### c3: integer types
|
||||
|
||||
@ -188,7 +188,7 @@ pointer into the loom - see below. The structures are:
|
||||
|
||||
typedef struct {
|
||||
c3_w mug_w;
|
||||
u3_noun hed;
|
||||
u3_noun hed;
|
||||
u3_noun tel;
|
||||
} u3a_cell;
|
||||
|
||||
@ -205,7 +205,7 @@ be `u3_none`.
|
||||
### u3: reference counts
|
||||
|
||||
The only really essential thing you need to know about `u3` is
|
||||
how to handle reference counts. Everything else, you can skip
|
||||
how to handle reference counts. Everything else, you can skip
|
||||
and just get to work.
|
||||
|
||||
u3 deals with reference-counted, immutable, acyclic nouns.
|
||||
@ -247,7 +247,7 @@ callee, which "gives back" any return. For instance, if I have
|
||||
{
|
||||
u3_noun foo = u3i_string("foobar");
|
||||
u3_noun bar;
|
||||
|
||||
|
||||
bar = u3f_futz(foo);
|
||||
[...]
|
||||
u3z(bar);
|
||||
@ -265,7 +265,7 @@ need to write
|
||||
{
|
||||
u3_noun foo = u3i_string("foobar");
|
||||
u3_noun bar;
|
||||
|
||||
|
||||
bar = u3f_futz(foo);
|
||||
[...]
|
||||
u3z(foo);
|
||||
@ -299,7 +299,7 @@ what your function does. There is a convention for it, which
|
||||
depends on where it is, not what it does. Follow the convention.
|
||||
|
||||
### u3: reference conventions
|
||||
|
||||
|
||||
The `u3` convention is that, unless otherwise specified, *all
|
||||
functions have transfer semantics* - with the exception of the
|
||||
prefixes: `u3r`, `u3x`, `u3z`, `u3q` and `u3w`. Also, within
|
||||
@ -352,7 +352,7 @@ and stack can point in *either direction*. Therefore, inside
|
||||
a road, we can nest another road in the *opposite direction*.
|
||||
|
||||
When the opposite road completes, its heap is left on top of
|
||||
the opposite heap's stack. It's no more than the normal
|
||||
the opposite heap's stack. It's no more than the normal
|
||||
behavior of a stack machine for all subcomputations to push
|
||||
their results on the stack.
|
||||
|
||||
@ -361,7 +361,7 @@ the road - is that if the outer computation wants to preserve the
|
||||
results of the inner one, not just use them for temporary
|
||||
purposes, it has to *copy them*.
|
||||
|
||||
This is a trivial cost in some cases, a prohibitive cost in
|
||||
This is a trivial cost in some cases, a prohibitive cost in
|
||||
others. The upside, of course, is that all garbage accrued
|
||||
in the inner computation is discarded at zero cost.
|
||||
|
||||
@ -404,7 +404,7 @@ frame; `#` is free memory.
|
||||
|
||||
Pointer restrictions: pointers stored in `+` can point anywhere.
|
||||
Of course, pointing to `#` (free memory) would be a bug.
|
||||
Pointers in `-` can only point to `-` or `~`; pointers in `~`
|
||||
Pointers in `-` can only point to `-` or `~`; pointers in `~`
|
||||
only point to `~`.
|
||||
|
||||
To "leap" is to create a new inner road in the `###` free space.
|
||||
@ -491,7 +491,7 @@ road or in a deep road. You can test this by testing
|
||||
ie: does the pier's home road equal the current road pointer?
|
||||
|
||||
Normally in this context you assume you're obeying the rules of
|
||||
running on an inner road, ie, "deep memory." Remember, however,
|
||||
running on an inner road, ie, "deep memory." Remember, however,
|
||||
that the interpreter *can* run on surface memory - but anything
|
||||
you can do deep, you can do on the surface. The converse is by
|
||||
no means the case.
|
||||
@ -508,16 +508,16 @@ replacements, `u3a_malloc()`, `u3a_free()`, `u3a_realloc()`.)
|
||||
|
||||
A good example is the different meaning of `c3_assert()` inside
|
||||
and outside the interpreter. At either layer, you can use
|
||||
regular assert(), which will just kill your process. On the
|
||||
regular assert(), which will just kill your process. On the
|
||||
surface, `c3_assert()` will just... kill your process.
|
||||
|
||||
In deep execution, `c3_assert()` will issue an exception that
|
||||
queues an error event, complete with trace stack, on the Arvo
|
||||
queues an error event, complete with trace stack, on the Arvo
|
||||
event queue. Let's see how this happens.
|
||||
|
||||
### u3: exceptions
|
||||
|
||||
You produce an exception with
|
||||
You produce an exception with
|
||||
|
||||
/* u3m_bail(): bail out. Does not return.
|
||||
**
|
||||
@ -532,7 +532,7 @@ You produce an exception with
|
||||
** %meme :: out of memory
|
||||
** %time :: timed out
|
||||
** %oops :: assertion failure
|
||||
*/
|
||||
*/
|
||||
c3_i
|
||||
u3m_bail(c3_m how_m);
|
||||
|
||||
@ -593,7 +593,7 @@ functions are commented, but the comments may be cryptic.
|
||||
|
||||
### u3m: main control
|
||||
|
||||
To start `u3`, run
|
||||
To start `u3`, run
|
||||
|
||||
/* u3m_boot(): start the u3 system.
|
||||
*/
|
||||
@ -653,7 +653,7 @@ prettyprinting routines, none perfect, are available, mainly for
|
||||
debugging printfs: `u3m_pretty()`, `u3m_p()`, `u3m_tape()` and
|
||||
`u3m_wall()`.
|
||||
|
||||
It's sometimes nice to run a mark-and-sweep garbage collector,
|
||||
It's sometimes nice to run a mark-and-sweep garbage collector,
|
||||
`u3m_grab()`, which collects the world from a list of roots,
|
||||
and asserts if it finds any leaks or incorrect refcounts. This
|
||||
tool is for debugging and long-term maintenance only; refcounts
|
||||
@ -674,7 +674,7 @@ It's easy to assume that jets represent an architectural coupling
|
||||
between Hoon language semantics and Nock interpreter internals.
|
||||
Indeed such a coupling would be wholly wrongtious and un-Urbit.
|
||||
But the jet system is not Hoon-specific. It is specific to nock
|
||||
runtime systems that use a design pattern we call a `core`.
|
||||
runtime systems that use a design pattern we call a `core`.
|
||||
|
||||
#### u3j: core structure
|
||||
|
||||
@ -713,7 +713,7 @@ breaks the Nock compliance of the system as a whole. So don't.
|
||||
Now, a casual observer might look at `[battery payload]` and
|
||||
expect the simplest case of it to be `[formula subject]`. That
|
||||
is: to execute a simple core whose battery is a single formula,
|
||||
we compute
|
||||
we compute
|
||||
|
||||
nock(+.a -.a)
|
||||
|
||||
@ -752,9 +752,9 @@ The typical gate will thus be, for example,
|
||||
|
||||
[formula [sample [battery battery battery constant]]]
|
||||
|
||||
but we would be most foolish to restrict the jet mechanism to
|
||||
cores of this particular structure. We cannot constrain a
|
||||
payload to be `[sample static-core]`, or even `[sample core]`.
|
||||
but we would be most foolish to restrict the jet mechanism to
|
||||
cores of this particular structure. We cannot constrain a
|
||||
payload to be `[sample static-core]`, or even `[sample core]`.
|
||||
Any such constraint would not be rich enough to handle Hoon,
|
||||
let alone other languages.
|
||||
|
||||
@ -787,7 +787,7 @@ There is only one hot state, the global jet dashboard
|
||||
`u3j_Dash` or `u3D` for short. In the present implementation,
|
||||
u3D is a static structure not modified at runtime, except for
|
||||
numbering itself on process initialization. This structure -
|
||||
which embeds function pointers to all the jets - is defined
|
||||
which embeds function pointers to all the jets - is defined
|
||||
in `j/tree.c`. The data structures:
|
||||
|
||||
/* u3j_harm: driver arm.
|
||||
@ -806,8 +806,8 @@ in `j/tree.c`. The data structures:
|
||||
c3_c* cos_c; // control string
|
||||
struct _u3j_harm* arm_u; // blank-terminated static list
|
||||
struct _u3j_core* dev_u; // blank-terminated static list
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
c3_l jax_l; // dynamic jet index
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
c3_l jax_l; // dynamic jet index
|
||||
} u3j_core;
|
||||
|
||||
/* u3e_dash, u3_Dash, u3D: jet dashboard singleton
|
||||
@ -827,14 +827,14 @@ roads, we also nest jet state. The jet state in the road is:
|
||||
u3_noun das; // cold state
|
||||
} jed;
|
||||
|
||||
In case you understand Hoon, `das` (cold state) is a `++dash`,
|
||||
In case you understand Hoon, `das` (cold state) is a `++dash`,
|
||||
and `har_p` (warm state) is a map from battery to `++calx`:
|
||||
|
||||
++ bane ,@tas :: battery name
|
||||
++ bash ,@uvH :: label hash
|
||||
++ bosh ,@uvH :: local battery hash
|
||||
++ batt ,* :: battery
|
||||
++ calf ::
|
||||
++ calf ::
|
||||
$: jax=,@ud :: hot core index
|
||||
hap=(map ,@ud ,@ud) :: axis/hot arm index
|
||||
lab=path :: label as path
|
||||
@ -854,7 +854,7 @@ state has to be reset when we reload the pier in a new process.
|
||||
|
||||
Why is jet state nested? Nock of course is a functional system,
|
||||
so as we compute we don't explicitly create state. Jet state is
|
||||
an exception to this principle (which works only because it can't
|
||||
an exception to this principle (which works only because it can't
|
||||
be semantically detected from Nock/Hoon) - but it can't violate
|
||||
the fundamental rules of the allocation system.
|
||||
|
||||
@ -900,8 +900,8 @@ Typically the `context` is itself a library core, which itself
|
||||
has a jet binding. If so, the parent axis of this gate is `7`.
|
||||
|
||||
If the parent is already bound - and the parent *must* be already
|
||||
bound, in this road or a road containing it - we can hook this core
|
||||
bottom-up into a tree hierarchy. Normally the child core is
|
||||
bound, in this road or a road containing it - we can hook this core
|
||||
bottom-up into a tree hierarchy. Normally the child core is
|
||||
produced by an arm of the parent core, so this is not a problem -
|
||||
we wouldn't have the child if we hadn't already made the parent.
|
||||
|
||||
@ -924,7 +924,7 @@ instance, if the core is a Hoon gate - a function - we will call
|
||||
### u3j: the cold jet dashboard
|
||||
|
||||
For even more fun, the jet tree is not actually a tree of
|
||||
batteries. It's a tree of battery *labels*, where a label is
|
||||
batteries. It's a tree of battery *labels*, where a label is
|
||||
an [axis term] path from the root of the tree. (At the root,
|
||||
if the core pattern is always followed properly, is a core whose
|
||||
payload is an atomic constant, conventionally the Hoon version.)
|
||||
@ -1029,7 +1029,7 @@ formula within the battery) to driver arm index (into `arm_u` in
|
||||
other dynamic data that may speed up execution.
|
||||
|
||||
We construct `hap`, when we create the calx, by iterating through
|
||||
the arms registered in the `u3j_core`. Note the way a `u3j_harm`
|
||||
the arms registered in the `u3j_core`. Note the way a `u3j_harm`
|
||||
declares itself, with the string `fcs_c` which can contain either
|
||||
an axis or a name. Most jetted cores are of course gates, which
|
||||
have one formula at one axis within the core: `fcs_c` is `".3"`.
|
||||
@ -1064,10 +1064,10 @@ If it exists, the core matches a driver and the driver jets this
|
||||
arm. If not, we return `u3_none`.
|
||||
|
||||
Otherwise, we call `fun_f` in our `u3j_harm`. This obeys the
|
||||
same protocol as `u3j_kick()`; it can refuse to function by
|
||||
same protocol as `u3j_kick()`; it can refuse to function by
|
||||
returning `u3_none`, or consume the noun.
|
||||
|
||||
Besides the actual function pointer `fun_f`, we have some flags
|
||||
Besides the actual function pointer `fun_f`, we have some flags
|
||||
in the `u3j_harm` which tell us how to call the arm function.
|
||||
|
||||
If `ice` is yes (`&`, `0`), the jet is known to be perfect and we
|
||||
@ -1075,7 +1075,7 @@ can just trust the product of `fun_f`. Otherwise, we need to run
|
||||
*both* the Nock arm and `fun_f`, and compare their results.
|
||||
|
||||
(Note that while executing the C side of this test, we have to
|
||||
set `ice` to yes; on the Nock side, we have to set `liv` to no.
|
||||
set `ice` to yes; on the Nock side, we have to set `liv` to no.
|
||||
Otherwise, many non-exponential functions become exponential.
|
||||
When auto-testing jets in this way, the principle is that the
|
||||
test is on the outermost layer of recursion.)
|
||||
@ -1092,8 +1092,8 @@ c3__punt. This feature has a cost: the jet runs in a subroad.
|
||||
Finally, if `liv` is no (`|`, 1), the jet is off and doesn't run.
|
||||
|
||||
It should be easy to see how the tree of cores gets declared -
|
||||
precisely, in `j/dash.c`. We declare the hierarchy as a tree
|
||||
of `u3j_core` structures, each of which comes with a static list
|
||||
precisely, in `j/dash.c`. We declare the hierarchy as a tree
|
||||
of `u3j_core` structures, each of which comes with a static list
|
||||
of arms `arm_u` and sub-cores `dev_u`.
|
||||
|
||||
In `u3j_boot()`, we traverse the hierarchy, fill in parent
|
||||
@ -1110,7 +1110,7 @@ always be the case with a certain amount of core functionality.
|
||||
For instance, there are some jet functions that we need to call
|
||||
as part of loading the Arvo kernel - like `++cue` to unpack a
|
||||
noun from an atom. And obviously it makes sense, when jets are
|
||||
significant enough to compile into `u3`, to export their symbols
|
||||
significant enough to compile into `u3`, to export their symbols
|
||||
in headers and the linker.
|
||||
|
||||
There are three interface prefixes for standard jet functions:
|
||||
@ -1135,7 +1135,7 @@ is added for functions within subcores. The filename, under
|
||||
`j/`, follows the tier and the function name.
|
||||
|
||||
For instance, `++add` is `u3wa_add(cor)`, `u3qa_add(a, b)`, or
|
||||
`u3ka_add(a, b)`, in `j/a/add.c`. `++get` in `++by` is
|
||||
`u3ka_add(a, b)`, in `j/a/add.c`. `++get` in `++by` is
|
||||
`u3wdb_get(cor)`, `u3kdb_get(a, b)`, etc, in `j/d/by_get.c`.
|
||||
|
||||
For historical reasons, all internal jet code in `j/[a-f]`
|
||||
@ -1151,7 +1151,7 @@ structures are uninteresting and typical of a naive allocator.
|
||||
The two most-used `u3a` functions are `u3a_gain()` to add a
|
||||
reference count, and `u3a_lose()` to release one (and free the
|
||||
noun, if the use count is zero). For convenience, `u3a_gain()`
|
||||
returns its argument. The pair are generally abbreviated with
|
||||
returns its argument. The pair are generally abbreviated with
|
||||
the macros `u3k()` and `u3z()` respectively.
|
||||
|
||||
Normally we create nouns through `u3i` functions, and don't call
|
||||
@ -1249,12 +1249,12 @@ which slams a *gate* (`gat`) on a sample (`sam`). (In a normal
|
||||
programming language which didn't talk funny and was retarded,
|
||||
`u3n_slam_on()` would call a function on an argument.) We could
|
||||
write it most simply as:
|
||||
|
||||
u3_noun
|
||||
|
||||
u3_noun
|
||||
u3n_slam_on(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
u3_noun pro = u3n_nock_on
|
||||
(u3nc(u3k(u3h(gat)),
|
||||
(u3nc(u3k(u3h(gat)),
|
||||
u3nc(sam, u3k(u3t(u3t(gat))))),
|
||||
u3k(u3h(gat)));
|
||||
u3z(gat);
|
||||
@ -1265,7 +1265,7 @@ Simpler is `u3n_kick_on(u3_noun gat)`, which slams a gate (or,
|
||||
more generally, a *trap* - because sample structure is not even
|
||||
needed here) without changing its sample:
|
||||
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3n_kick_on(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3n_nock_on(gat, u3k(u3h(gat)));
|
||||
@ -1275,7 +1275,7 @@ The `_on` functions in `u3n` are all defined as pure Nock. But
|
||||
actually, even though we say we don't extend Nock, we do. But we
|
||||
don't. But we do.
|
||||
|
||||
Note that `u3` has a well-developed error handling system -
|
||||
Note that `u3` has a well-developed error handling system -
|
||||
`u3m_bail()` to throw an exception, `u3m_soft_*` to catch one.
|
||||
But Nock has no exception model at all. That's okay - all it
|
||||
means if that if an `_on` function bails, the exception is an
|
||||
@ -1309,8 +1309,8 @@ to a `fly` is a `++path`, just a list of text `span`.
|
||||
++ toon $% [%0 p=noun] :: success
|
||||
[%1 p=(list path)] :: blocking paths
|
||||
[%2 p=(list tank)] :: stack trace
|
||||
== ::
|
||||
++ tank :: printable
|
||||
== ::
|
||||
++ tank :: printable
|
||||
$% [%leaf p=tape] :: flat text
|
||||
$: %palm :: backstep list
|
||||
p=[p=tape q=tape r=tape s=tape] :: mid cap open close
|
||||
@ -1320,7 +1320,7 @@ to a `fly` is a `++path`, just a list of text `span`.
|
||||
p=[p=tape q=tape r=tape] :: mid open close
|
||||
q=(list tank) :: contents
|
||||
== ::
|
||||
==
|
||||
==
|
||||
|
||||
(Note that `tank` is overdesigned and due for replacement.)
|
||||
|
||||
@ -1329,7 +1329,7 @@ noun]`, or could not finish because it blocked on one or more
|
||||
global paths (`[1 (list path)]`), or it exited with a stack trace
|
||||
(`[2 (list tank)]`).
|
||||
|
||||
Note that of all the `u3` exceptions, only `%exit` is produced
|
||||
Note that of all the `u3` exceptions, only `%exit` is produced
|
||||
deterministically by the Nock definition. Therefore, only
|
||||
`%exit` produces a `2` result. Any other argument to
|
||||
`u3m_bail()` will unwind the virtualization stack all the way to
|
||||
@ -1397,7 +1397,7 @@ same nouns cannot have a different mug. It's important to
|
||||
understand the performance characteristics of `u3r_sing()`:
|
||||
the worst possible case is a comparison of duplicate nouns,
|
||||
which have the same value but were created separately. In this
|
||||
case, the tree is traversed
|
||||
case, the tree is traversed
|
||||
|
||||
`u3r_sung()` is a deeply funky and frightening version of
|
||||
`u3r_sing()` that unifies pointers to the duplicate nouns it
|
||||
@ -1471,13 +1471,13 @@ and save with
|
||||
u3_noun u3z_save_4(c3_m, u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
|
||||
|
||||
where the value is the last argument. To eliminate duplicate
|
||||
nouns, there is also
|
||||
nouns, there is also
|
||||
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_uniq(u3_noun);
|
||||
|
||||
`u3z` functions retain keys and transfer values.
|
||||
|
||||
|
||||
The `u3z` cache, built on `u3h` hashes, is part of the current
|
||||
road, and goes away when it goes away. (In future, we may wish
|
||||
to promote keys/values which outlive the road, as we do with jet
|
||||
@ -1499,7 +1499,7 @@ core? Slightly pseudocoded:
|
||||
^- [(list ovum) _+>]
|
||||
!!
|
||||
++ keep |= [now=@da hap=path] :: 4
|
||||
^- (unit ,@da)
|
||||
^- (unit ,@da)
|
||||
!!
|
||||
++ load |= [yen=@ ova=(list ovum) nyf=pane] :: 86
|
||||
^- [(list ovum) _+>]
|
||||
@ -1555,13 +1555,13 @@ commented, but unfortunately it's hard to describe this API as
|
||||
clean at present. The problem is that `u3v` remains design
|
||||
coupled to the old `vere` event handling code written for `u2`.
|
||||
But let's describe the functions you should be calling, assuming
|
||||
you're not writing the next event system. There are only two.
|
||||
you're not writing the next event system. There are only two.
|
||||
|
||||
`u3v_wish(str_c)` wraps the `++wish` functionality in a cache
|
||||
(which is read-only unless you're on the surface road).
|
||||
|
||||
`u3v_do()` uses `wish` to provide a convenient interface for
|
||||
calling Hoon kernel functions by name. Even more conveniently,
|
||||
calling Hoon kernel functions by name. Even more conveniently,
|
||||
we tend to call `u3v_do()` with these convenient aliases:
|
||||
|
||||
#define u3do(txt_c, arg) u3v_do(txt_c, arg)
|
||||
|
@ -1,3 +1,3 @@
|
||||
Extras Readme
|
||||
|
||||
This folder is for all the useful, but not strictly essential, stuff for developers.
|
||||
This folder is for all the useful, but not strictly essential, stuff for developers.
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
;; Copyright (C) 2014–2015 Urbit
|
||||
|
||||
;; Author:
|
||||
;; Author:
|
||||
;; * Adam Bliss https://github.com/abliss <abliss@gmail.com>
|
||||
;; Contributors:
|
||||
;; Contributors:
|
||||
;; * N Gvrnd https://github.com/ngvrnd
|
||||
;; * TJamesCorcoran https://github.com/TJamesCorcoran <jamescorcoran@gmail.com>
|
||||
;; * Rastus Vernon https://github.com/rastus-vernon <rastus.vernon@protonmail.ch>
|
||||
@ -133,7 +133,7 @@
|
||||
; translation: "do not sharpen chainsaw while it is running"
|
||||
; 4) the commands that are executed when the DSL is interpreted are likewise written in C
|
||||
;
|
||||
; The upshot is...
|
||||
; The upshot is...
|
||||
;
|
||||
; WAIT. A better way exists. Instead of hacking the mode-line format,
|
||||
; just invoke 'rename-buffer, which also lives down in the C
|
||||
@ -144,7 +144,7 @@
|
||||
|
||||
(defun hoon-mode-hack-the-modeline ()
|
||||
;; (setq mode-line-format
|
||||
;; '("%e"
|
||||
;; '("%e"
|
||||
;; mode-line-front-space
|
||||
;; mode-line-mule-info
|
||||
;; mode-line-client
|
||||
@ -159,7 +159,7 @@
|
||||
;; mode-line-modes
|
||||
;; mode-line-misc-info
|
||||
;; mode-line-end-spaces))
|
||||
;; (setq hoon-buffer-string
|
||||
;; (setq hoon-buffer-string
|
||||
;; (concat
|
||||
;; (nth 1 (reverse (split-string (file-name-directory (buffer-file-name)) "/")))
|
||||
;; "/"
|
||||
|
@ -4,105 +4,105 @@ endif
|
||||
|
||||
let g:submode_timeout = 0
|
||||
|
||||
call submode#enter_with('hoon_ninja', 'i', '', '//')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bar', '\|')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gal', '<')
|
||||
call submode#map('hoon_ninja', 'i', '', 'per', ')')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gar', '>')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sel', '[')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bas', '\')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hax', '#')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sem', ';')
|
||||
call submode#map('hoon_ninja', 'i', '', 'buc', '$')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hep', '-')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ser', ']')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cab', '_')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kel', '{')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sig', '~')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cen', '%')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ker', '}')
|
||||
call submode#map('hoon_ninja', 'i', '', 'soq', "'")
|
||||
call submode#map('hoon_ninja', 'i', '', 'col', ':')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ket', '^')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tar', '*')
|
||||
call submode#map('hoon_ninja', 'i', '', 'com', ',')
|
||||
call submode#map('hoon_ninja', 'i', '', 'lus', '+')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tec', '`')
|
||||
call submode#map('hoon_ninja', 'i', '', 'doq', '"')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pam', '&')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tis', '=')
|
||||
call submode#map('hoon_ninja', 'i', '', 'dot', '.')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pat', '@')
|
||||
call submode#map('hoon_ninja', 'i', '', 'wut', '?')
|
||||
call submode#map('hoon_ninja', 'i', '', 'fas', '/')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pel', '(')
|
||||
call submode#enter_with('hoon_ninja', 'i', '', '//')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bar', '\|')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gal', '<')
|
||||
call submode#map('hoon_ninja', 'i', '', 'per', ')')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gar', '>')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sel', '[')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bas', '\')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hax', '#')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sem', ';')
|
||||
call submode#map('hoon_ninja', 'i', '', 'buc', '$')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hep', '-')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ser', ']')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cab', '_')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kel', '{')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sig', '~')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cen', '%')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ker', '}')
|
||||
call submode#map('hoon_ninja', 'i', '', 'soq', "'")
|
||||
call submode#map('hoon_ninja', 'i', '', 'col', ':')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ket', '^')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tar', '*')
|
||||
call submode#map('hoon_ninja', 'i', '', 'com', ',')
|
||||
call submode#map('hoon_ninja', 'i', '', 'lus', '+')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tec', '`')
|
||||
call submode#map('hoon_ninja', 'i', '', 'doq', '"')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pam', '&')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tis', '=')
|
||||
call submode#map('hoon_ninja', 'i', '', 'dot', '.')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pat', '@')
|
||||
call submode#map('hoon_ninja', 'i', '', 'wut', '?')
|
||||
call submode#map('hoon_ninja', 'i', '', 'fas', '/')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pel', '(')
|
||||
call submode#map('hoon_ninja', 'i', '', 'zap', '!')
|
||||
|
||||
call submode#map('hoon_ninja', 'i', '', 'br', '\|')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gl', '<')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pr', ')')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gr', '>')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sl', '[')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bs', '\')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hx', '#')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sm', ';')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bc', '$')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hp', '-')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sr', ']')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cb', '_')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kl', '{')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sg', '~')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cn', '%')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kr', '}')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sq', "'")
|
||||
call submode#map('hoon_ninja', 'i', '', 'cl', ':')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kt', '^')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tr', '*')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cm', ',')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ls', '+')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tc', '`')
|
||||
call submode#map('hoon_ninja', 'i', '', 'dq', '"')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pm', '&')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ts', '=')
|
||||
call submode#map('hoon_ninja', 'i', '', 'dt', '.')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pt', '@')
|
||||
call submode#map('hoon_ninja', 'i', '', 'wt', '?')
|
||||
call submode#map('hoon_ninja', 'i', '', 'fs', '/')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pl', '(')
|
||||
call submode#map('hoon_ninja', 'i', '', 'br', '\|')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gl', '<')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pr', ')')
|
||||
call submode#map('hoon_ninja', 'i', '', 'gr', '>')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sl', '[')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bs', '\')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hx', '#')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sm', ';')
|
||||
call submode#map('hoon_ninja', 'i', '', 'bc', '$')
|
||||
call submode#map('hoon_ninja', 'i', '', 'hp', '-')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sr', ']')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cb', '_')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kl', '{')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sg', '~')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cn', '%')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kr', '}')
|
||||
call submode#map('hoon_ninja', 'i', '', 'sq', "'")
|
||||
call submode#map('hoon_ninja', 'i', '', 'cl', ':')
|
||||
call submode#map('hoon_ninja', 'i', '', 'kt', '^')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tr', '*')
|
||||
call submode#map('hoon_ninja', 'i', '', 'cm', ',')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ls', '+')
|
||||
call submode#map('hoon_ninja', 'i', '', 'tc', '`')
|
||||
call submode#map('hoon_ninja', 'i', '', 'dq', '"')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pm', '&')
|
||||
call submode#map('hoon_ninja', 'i', '', 'ts', '=')
|
||||
call submode#map('hoon_ninja', 'i', '', 'dt', '.')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pt', '@')
|
||||
call submode#map('hoon_ninja', 'i', '', 'wt', '?')
|
||||
call submode#map('hoon_ninja', 'i', '', 'fs', '/')
|
||||
call submode#map('hoon_ninja', 'i', '', 'pl', '(')
|
||||
call submode#map('hoon_ninja', 'i', '', 'zp', '!')
|
||||
|
||||
call submode#enter_with('hoon_ajnin', 'i', '', '??')
|
||||
call submode#map('hoon_ajnin', 'i', '', '\|', 'bar')
|
||||
call submode#map('hoon_ajnin', 'i', '', '<', 'gal')
|
||||
call submode#map('hoon_ajnin', 'i', '', ')', 'per')
|
||||
call submode#map('hoon_ajnin', 'i', '', '>', 'gar')
|
||||
call submode#map('hoon_ajnin', 'i', '', '[', 'sel')
|
||||
call submode#map('hoon_ajnin', 'i', '', '\', 'bas')
|
||||
call submode#map('hoon_ajnin', 'i', '', '#', 'hax')
|
||||
call submode#map('hoon_ajnin', 'i', '', ';', 'sem')
|
||||
call submode#map('hoon_ajnin', 'i', '', '$', 'buc')
|
||||
call submode#map('hoon_ajnin', 'i', '', '-', 'hep')
|
||||
call submode#map('hoon_ajnin', 'i', '', ']', 'ser')
|
||||
call submode#map('hoon_ajnin', 'i', '', '_', 'cab')
|
||||
call submode#map('hoon_ajnin', 'i', '', '{', 'kel')
|
||||
call submode#map('hoon_ajnin', 'i', '', '~', 'sig')
|
||||
call submode#map('hoon_ajnin', 'i', '', '%', 'cen')
|
||||
call submode#map('hoon_ajnin', 'i', '', '}', 'ker')
|
||||
call submode#map('hoon_ajnin', 'i', '', '"', 'soq')
|
||||
call submode#map('hoon_ajnin', 'i', '', ':', 'col')
|
||||
call submode#map('hoon_ajnin', 'i', '', '^', 'ket')
|
||||
call submode#map('hoon_ajnin', 'i', '', '*', 'tar')
|
||||
call submode#map('hoon_ajnin', 'i', '', ',', 'com')
|
||||
call submode#map('hoon_ajnin', 'i', '', '+', 'lus')
|
||||
call submode#map('hoon_ajnin', 'i', '', '`', 'tec')
|
||||
call submode#map('hoon_ajnin', 'i', '', '"', 'doq')
|
||||
call submode#map('hoon_ajnin', 'i', '', '&', 'pam')
|
||||
call submode#map('hoon_ajnin', 'i', '', '=', 'tis')
|
||||
call submode#map('hoon_ajnin', 'i', '', '.', 'dot')
|
||||
call submode#map('hoon_ajnin', 'i', '', '@', 'pat')
|
||||
call submode#map('hoon_ajnin', 'i', '', '?', 'wut')
|
||||
call submode#map('hoon_ajnin', 'i', '', '/', 'fas')
|
||||
call submode#map('hoon_ajnin', 'i', '', '(', 'pel')
|
||||
call submode#enter_with('hoon_ajnin', 'i', '', '??')
|
||||
call submode#map('hoon_ajnin', 'i', '', '\|', 'bar')
|
||||
call submode#map('hoon_ajnin', 'i', '', '<', 'gal')
|
||||
call submode#map('hoon_ajnin', 'i', '', ')', 'per')
|
||||
call submode#map('hoon_ajnin', 'i', '', '>', 'gar')
|
||||
call submode#map('hoon_ajnin', 'i', '', '[', 'sel')
|
||||
call submode#map('hoon_ajnin', 'i', '', '\', 'bas')
|
||||
call submode#map('hoon_ajnin', 'i', '', '#', 'hax')
|
||||
call submode#map('hoon_ajnin', 'i', '', ';', 'sem')
|
||||
call submode#map('hoon_ajnin', 'i', '', '$', 'buc')
|
||||
call submode#map('hoon_ajnin', 'i', '', '-', 'hep')
|
||||
call submode#map('hoon_ajnin', 'i', '', ']', 'ser')
|
||||
call submode#map('hoon_ajnin', 'i', '', '_', 'cab')
|
||||
call submode#map('hoon_ajnin', 'i', '', '{', 'kel')
|
||||
call submode#map('hoon_ajnin', 'i', '', '~', 'sig')
|
||||
call submode#map('hoon_ajnin', 'i', '', '%', 'cen')
|
||||
call submode#map('hoon_ajnin', 'i', '', '}', 'ker')
|
||||
call submode#map('hoon_ajnin', 'i', '', '"', 'soq')
|
||||
call submode#map('hoon_ajnin', 'i', '', ':', 'col')
|
||||
call submode#map('hoon_ajnin', 'i', '', '^', 'ket')
|
||||
call submode#map('hoon_ajnin', 'i', '', '*', 'tar')
|
||||
call submode#map('hoon_ajnin', 'i', '', ',', 'com')
|
||||
call submode#map('hoon_ajnin', 'i', '', '+', 'lus')
|
||||
call submode#map('hoon_ajnin', 'i', '', '`', 'tec')
|
||||
call submode#map('hoon_ajnin', 'i', '', '"', 'doq')
|
||||
call submode#map('hoon_ajnin', 'i', '', '&', 'pam')
|
||||
call submode#map('hoon_ajnin', 'i', '', '=', 'tis')
|
||||
call submode#map('hoon_ajnin', 'i', '', '.', 'dot')
|
||||
call submode#map('hoon_ajnin', 'i', '', '@', 'pat')
|
||||
call submode#map('hoon_ajnin', 'i', '', '?', 'wut')
|
||||
call submode#map('hoon_ajnin', 'i', '', '/', 'fas')
|
||||
call submode#map('hoon_ajnin', 'i', '', '(', 'pel')
|
||||
call submode#map('hoon_ajnin', 'i', '', '!', 'zap')
|
||||
call submode#map('hoon_ajnin', 'i', '', '1', 'zap')
|
||||
call submode#map('hoon_ajnin', 'i', '', '2', 'pat')
|
||||
@ -115,38 +115,38 @@ call submode#map('hoon_ajnin', 'i', '', '8', 'lus')
|
||||
call submode#map('hoon_ajnin', 'i', '', '9', 'pel')
|
||||
call submode#map('hoon_ajnin', 'i', '', '0', 'per')
|
||||
|
||||
call submode#enter_with('hoon_jnn', 'i', '', '/?')
|
||||
call submode#map('hoon_jnn', 'i', '', '\|', 'br')
|
||||
call submode#map('hoon_jnn', 'i', '', '<', 'gl')
|
||||
call submode#map('hoon_jnn', 'i', '', ')', 'pr')
|
||||
call submode#map('hoon_jnn', 'i', '', '>', 'gr')
|
||||
call submode#map('hoon_jnn', 'i', '', '[', 'sl')
|
||||
call submode#map('hoon_jnn', 'i', '', '\', 'bs')
|
||||
call submode#map('hoon_jnn', 'i', '', '#', 'hx')
|
||||
call submode#map('hoon_jnn', 'i', '', ';', 'sm')
|
||||
call submode#map('hoon_jnn', 'i', '', '$', 'bc')
|
||||
call submode#map('hoon_jnn', 'i', '', '-', 'hp')
|
||||
call submode#map('hoon_jnn', 'i', '', ']', 'sr')
|
||||
call submode#map('hoon_jnn', 'i', '', '_', 'cb')
|
||||
call submode#map('hoon_jnn', 'i', '', '{', 'kl')
|
||||
call submode#map('hoon_jnn', 'i', '', '~', 'sg')
|
||||
call submode#map('hoon_jnn', 'i', '', '%', 'cn')
|
||||
call submode#map('hoon_jnn', 'i', '', '}', 'kr')
|
||||
call submode#map('hoon_jnn', 'i', '', '"', 'sq')
|
||||
call submode#map('hoon_jnn', 'i', '', ':', 'cl')
|
||||
call submode#map('hoon_jnn', 'i', '', '^', 'kt')
|
||||
call submode#map('hoon_jnn', 'i', '', '*', 'tr')
|
||||
call submode#map('hoon_jnn', 'i', '', ',', 'cm')
|
||||
call submode#map('hoon_jnn', 'i', '', '+', 'ls')
|
||||
call submode#map('hoon_jnn', 'i', '', '`', 'tc')
|
||||
call submode#map('hoon_jnn', 'i', '', '"', 'dq')
|
||||
call submode#map('hoon_jnn', 'i', '', '&', 'pm')
|
||||
call submode#map('hoon_jnn', 'i', '', '=', 'ts')
|
||||
call submode#map('hoon_jnn', 'i', '', '.', 'dt')
|
||||
call submode#map('hoon_jnn', 'i', '', '@', 'pt')
|
||||
call submode#map('hoon_jnn', 'i', '', '?', 'wt')
|
||||
call submode#map('hoon_jnn', 'i', '', '/', 'fs')
|
||||
call submode#map('hoon_jnn', 'i', '', '(', 'pl')
|
||||
call submode#enter_with('hoon_jnn', 'i', '', '/?')
|
||||
call submode#map('hoon_jnn', 'i', '', '\|', 'br')
|
||||
call submode#map('hoon_jnn', 'i', '', '<', 'gl')
|
||||
call submode#map('hoon_jnn', 'i', '', ')', 'pr')
|
||||
call submode#map('hoon_jnn', 'i', '', '>', 'gr')
|
||||
call submode#map('hoon_jnn', 'i', '', '[', 'sl')
|
||||
call submode#map('hoon_jnn', 'i', '', '\', 'bs')
|
||||
call submode#map('hoon_jnn', 'i', '', '#', 'hx')
|
||||
call submode#map('hoon_jnn', 'i', '', ';', 'sm')
|
||||
call submode#map('hoon_jnn', 'i', '', '$', 'bc')
|
||||
call submode#map('hoon_jnn', 'i', '', '-', 'hp')
|
||||
call submode#map('hoon_jnn', 'i', '', ']', 'sr')
|
||||
call submode#map('hoon_jnn', 'i', '', '_', 'cb')
|
||||
call submode#map('hoon_jnn', 'i', '', '{', 'kl')
|
||||
call submode#map('hoon_jnn', 'i', '', '~', 'sg')
|
||||
call submode#map('hoon_jnn', 'i', '', '%', 'cn')
|
||||
call submode#map('hoon_jnn', 'i', '', '}', 'kr')
|
||||
call submode#map('hoon_jnn', 'i', '', '"', 'sq')
|
||||
call submode#map('hoon_jnn', 'i', '', ':', 'cl')
|
||||
call submode#map('hoon_jnn', 'i', '', '^', 'kt')
|
||||
call submode#map('hoon_jnn', 'i', '', '*', 'tr')
|
||||
call submode#map('hoon_jnn', 'i', '', ',', 'cm')
|
||||
call submode#map('hoon_jnn', 'i', '', '+', 'ls')
|
||||
call submode#map('hoon_jnn', 'i', '', '`', 'tc')
|
||||
call submode#map('hoon_jnn', 'i', '', '"', 'dq')
|
||||
call submode#map('hoon_jnn', 'i', '', '&', 'pm')
|
||||
call submode#map('hoon_jnn', 'i', '', '=', 'ts')
|
||||
call submode#map('hoon_jnn', 'i', '', '.', 'dt')
|
||||
call submode#map('hoon_jnn', 'i', '', '@', 'pt')
|
||||
call submode#map('hoon_jnn', 'i', '', '?', 'wt')
|
||||
call submode#map('hoon_jnn', 'i', '', '/', 'fs')
|
||||
call submode#map('hoon_jnn', 'i', '', '(', 'pl')
|
||||
call submode#map('hoon_jnn', 'i', '', '!', 'zp')
|
||||
call submode#map('hoon_jnn', 'i', '', '1', 'zp')
|
||||
call submode#map('hoon_jnn', 'i', '', '2', 'pt')
|
||||
|
@ -24,7 +24,7 @@ function! HoonIndent(lnum)
|
||||
return 0
|
||||
endif
|
||||
let prevl = substitute(getline(prevlnum),'::.*$','','')
|
||||
|
||||
|
||||
let ind = indent(prevlnum)
|
||||
if prevl =~ '++\s*\w*\s*$'
|
||||
" luslus operator
|
||||
|
@ -6,7 +6,7 @@ if exists("b:current_syntax")
|
||||
endif
|
||||
|
||||
set autoindent
|
||||
map g/ /++
|
||||
map g/ /++
|
||||
nmap gs :let varname = '\<<C-R><C-W>\>'<CR>?++ <C-R>=varname<CR><CR>
|
||||
set tabstop=2
|
||||
" nmap gc :let &colorcolumn=join(range(81,999),",")<CR>
|
||||
@ -41,8 +41,8 @@ set tabstop=2
|
||||
syn case match
|
||||
|
||||
" Declarations
|
||||
hi def link hoonDeclaration Define
|
||||
hi def link hoonSymbol Constant
|
||||
hi def link hoonDeclaration Define
|
||||
hi def link hoonSymbol Constant
|
||||
hi def link hoonAtom Identifier
|
||||
hi def link hoonRune Operator
|
||||
hi def link hoonIdentifier Identifier
|
||||
@ -54,7 +54,7 @@ hi def link hoonComment Comment
|
||||
hi def link hoonTodo Todo
|
||||
hi def link hoonString String
|
||||
|
||||
syn match hoonDeclaration "+[+-]" nextgroup=hoonSymbolDec skipwhite
|
||||
syn match hoonDeclaration "+[+-]" nextgroup=hoonSymbolDec skipwhite
|
||||
syn match hoonSymbol /%\%(\%(\%(\w\|-\)\+\)\|[|&$]\|\%(\.n\)\|\%(\.y\)\)/
|
||||
syn match hoonAtom /\%(@\w*\)\|\^/
|
||||
syn match hoonName "\w*" contained
|
||||
|
@ -29,7 +29,7 @@
|
||||
u3_noun u3gb_need(u3_noun);
|
||||
u3_noun u3gb_reap(u3_atom, u3_noun);
|
||||
u3_noun u3gb_reel(u3_noun, u3_noun);
|
||||
u3_noun u3gb_roll(u3_noun, u3_noun);
|
||||
u3_noun u3gb_roll(u3_noun, u3_noun);
|
||||
u3_noun u3gb_skid(u3_noun, u3_noun);
|
||||
u3_noun u3gb_skim(u3_noun, u3_noun);
|
||||
u3_noun u3gb_skip(u3_noun, u3_noun);
|
||||
@ -211,7 +211,7 @@
|
||||
u3_noun u3gf_slot(u3_atom, u3_noun);
|
||||
u3_noun u3gf_type(u3_noun);
|
||||
|
||||
u3_noun u3gfl_bunt(u3_noun, u3_noun);
|
||||
u3_noun u3gfl_bunt(u3_noun, u3_noun);
|
||||
u3_noun u3gfl_whip(u3_noun, u3_noun, u3_noun);
|
||||
|
||||
u3_noun u3gfp_hack(u3_noun, u3_noun);
|
||||
@ -232,7 +232,7 @@
|
||||
u3_noun u3gfu_conk(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3gfu_crop(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3gfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
|
||||
u3_noun u3gfu_duck(u3_noun, u3_noun);
|
||||
u3_noun u3gfu_duck(u3_noun, u3_noun);
|
||||
u3_noun u3gfu_dung(u3_noun, u3_noun cap, u3_noun);
|
||||
u3_noun u3gfu_dunq(u3_noun, const c3_c*, u3_noun);
|
||||
void u3gfu_dump(u3_noun, const c3_c*, u3_noun);
|
||||
@ -257,7 +257,7 @@
|
||||
u3_noun u3gfu_repo(u3_noun, u3_noun);
|
||||
u3_noun u3gfu_rest(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3gfu_shep(u3_noun, const c3_c*, u3_noun, u3_noun);
|
||||
u3_noun u3gfu_shew(u3_noun, u3_noun);
|
||||
u3_noun u3gfu_shew(u3_noun, u3_noun);
|
||||
u3_noun u3gfu_sift(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3gfu_snub(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3gfu_tack(u3_noun, u3_noun, u3_noun, u3_noun);
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
/** Tier 1.
|
||||
**/
|
||||
u3_noun u3ka_add(u3_noun a, u3_noun b);
|
||||
u3_noun u3ka_add(u3_noun a, u3_noun b);
|
||||
u3_noun u3ka_sub(u3_noun a, u3_noun b);
|
||||
u3_noun u3ka_mul(u3_noun a, u3_noun b);
|
||||
u3_noun u3ka_gth(u3_noun a, u3_noun b);
|
||||
@ -102,7 +102,7 @@
|
||||
|
||||
/* u3kdi_uni(): set union.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3kdi_uni(u3_noun a, u3_noun b);
|
||||
|
||||
# define u3kdb_tap(a) u3kdi_tap(a)
|
||||
@ -134,7 +134,7 @@
|
||||
u3_noun
|
||||
u3kz_fork(u3_noun yed);
|
||||
|
||||
/* u3kfu_repo():
|
||||
/* u3kfu_repo():
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3kfu_repo(u3_noun, u3_noun);
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
/** Tier 1.
|
||||
**/
|
||||
u3_noun u3la_add(u3_noun a, u3_noun b);
|
||||
u3_noun u3la_add(u3_noun a, u3_noun b);
|
||||
u3_noun u3la_sub(u3_noun a, u3_noun b);
|
||||
u3_noun u3la_mul(u3_noun a, u3_noun b);
|
||||
u3_noun u3la_gth(u3_noun a, u3_noun b);
|
||||
@ -77,7 +77,7 @@
|
||||
|
||||
/* u3ldi_uni(): set union.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3ldi_uni(u3_noun a, u3_noun b);
|
||||
|
||||
# define u3ldb_tap(a) u3ldi_tap(a)
|
||||
@ -109,7 +109,7 @@
|
||||
u3_noun
|
||||
u3kz_fork(u3_noun yed);
|
||||
|
||||
/* u3lfu_repo():
|
||||
/* u3lfu_repo():
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3lfu_repo(u3_noun, u3_noun);
|
||||
|
@ -29,7 +29,7 @@
|
||||
u3_noun u3qb_need(u3_noun);
|
||||
u3_noun u3qb_reap(u3_atom, u3_noun);
|
||||
u3_noun u3qb_reel(u3_noun, u3_noun);
|
||||
u3_noun u3qb_roll(u3_noun, u3_noun);
|
||||
u3_noun u3qb_roll(u3_noun, u3_noun);
|
||||
u3_noun u3qb_skid(u3_noun, u3_noun);
|
||||
u3_noun u3qb_skim(u3_noun, u3_noun);
|
||||
u3_noun u3qb_skip(u3_noun, u3_noun);
|
||||
@ -231,7 +231,7 @@
|
||||
u3_noun u3qf_slot(u3_atom, u3_noun);
|
||||
u3_noun u3qf_type(u3_noun);
|
||||
|
||||
u3_noun u3qfl_bunt(u3_noun, u3_noun);
|
||||
u3_noun u3qfl_bunt(u3_noun, u3_noun);
|
||||
u3_noun u3qfl_whip(u3_noun, u3_noun, u3_noun);
|
||||
|
||||
u3_noun u3qfr_fish(u3_noun, u3_noun, u3_noun, u3_noun);
|
||||
@ -255,7 +255,7 @@
|
||||
u3_noun u3qfu_conk(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3qfu_crop(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3qfu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
|
||||
u3_noun u3qfu_duck(u3_noun, u3_noun);
|
||||
u3_noun u3qfu_duck(u3_noun, u3_noun);
|
||||
u3_noun u3qfu_dung(u3_noun, u3_noun cap, u3_noun);
|
||||
u3_noun u3qfu_dunq(u3_noun, const c3_c*, u3_noun);
|
||||
void u3qfu_dump(u3_noun, const c3_c*, u3_noun);
|
||||
@ -281,7 +281,7 @@
|
||||
u3_noun u3qfu_repo(u3_noun, u3_noun);
|
||||
u3_noun u3qfu_rest(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3qfu_shep(u3_noun, const c3_c*, u3_noun, u3_noun);
|
||||
u3_noun u3qfu_shew(u3_noun, u3_noun);
|
||||
u3_noun u3qfu_shew(u3_noun, u3_noun);
|
||||
u3_noun u3qfu_sift(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3qfu_snub(u3_noun, u3_noun, u3_noun);
|
||||
u3_noun u3qfu_tack(u3_noun, u3_noun, u3_noun, u3_noun);
|
||||
|
@ -66,6 +66,7 @@
|
||||
u3_noun u3wc_rep(u3_noun);
|
||||
u3_noun u3wc_rev(u3_noun);
|
||||
u3_noun u3wc_rip(u3_noun);
|
||||
u3_noun u3wc_ripn(u3_noun);
|
||||
u3_noun u3wc_rsh(u3_noun);
|
||||
u3_noun u3wc_swp(u3_noun);
|
||||
u3_noun u3wc_sqt(u3_noun);
|
||||
|
@ -3,7 +3,7 @@
|
||||
** This file is in the public domain.
|
||||
*/
|
||||
/** Constants.
|
||||
**/
|
||||
**/
|
||||
/* u3_none - u3_noun which is not a noun.
|
||||
*/
|
||||
# define u3_none (u3_noun)0xffffffff
|
||||
|
@ -55,7 +55,7 @@
|
||||
|
||||
typedef struct {
|
||||
c3_w mug_w;
|
||||
u3_noun hed;
|
||||
u3_noun hed;
|
||||
u3_noun tel;
|
||||
} u3a_cell;
|
||||
|
||||
@ -218,7 +218,7 @@
|
||||
# define u3a_north_is_senior(r, dog) \
|
||||
__((u3a_to_off(dog) < r->rut_p) || \
|
||||
(u3a_to_off(dog) >= r->mat_p))
|
||||
|
||||
|
||||
# define u3a_north_is_junior(r, dog) \
|
||||
__((u3a_to_off(dog) >= r->cap_p) && \
|
||||
(u3a_to_off(dog) < r->mat_p))
|
||||
@ -421,7 +421,7 @@
|
||||
|
||||
/* u3a_lush(): leak push.
|
||||
*/
|
||||
c3_w
|
||||
c3_w
|
||||
u3a_lush(c3_w lab_w);
|
||||
|
||||
/* u3a_lop(): leak pop.
|
||||
|
@ -7,7 +7,7 @@
|
||||
/* u3e_line: control line.
|
||||
*/
|
||||
typedef struct _u3e_line {
|
||||
c3_w pag_w;
|
||||
c3_w pag_w;
|
||||
c3_w mug_w;
|
||||
} u3e_line;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/* u3_cs_patch: memory change, top level.
|
||||
*/
|
||||
typedef struct _u3_cs_patch {
|
||||
typedef struct _u3_cs_patch {
|
||||
c3_i ctl_i;
|
||||
c3_i mem_i;
|
||||
u3e_control* con_u;
|
||||
@ -40,7 +40,7 @@
|
||||
/* u3e_pool: entire memory system.
|
||||
*/
|
||||
typedef struct _u3e_pool {
|
||||
c3_c* dir_c; // path to
|
||||
c3_c* dir_c; // path to
|
||||
c3_d evt_d; // last patch written at event
|
||||
c3_w dit_w[u3a_pages >> 5]; // touched since last save
|
||||
u3e_image nor_u; // north segment
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
/** Data structures.
|
||||
**/
|
||||
/** Straightforward implementation of the classic Bagwell
|
||||
/** Straightforward implementation of the classic Bagwell
|
||||
*** HAMT (hash array mapped trie), using a mug hash.
|
||||
***
|
||||
*** Because a mug is 31 bits, the root table has 64 slots.
|
||||
@ -18,7 +18,7 @@
|
||||
*** clock-algorithm reclamation policy, not yet implemented.
|
||||
*** Search "clock algorithm" to figure it out.
|
||||
**/
|
||||
/* u3h_slot: map slot.
|
||||
/* u3h_slot: map slot.
|
||||
**
|
||||
** Either a key-value cell or a loom offset, decoded as a pointer
|
||||
** to a u3h_node, or a u3h_buck at the bottom. Matches the u3_noun
|
||||
|
@ -75,7 +75,7 @@
|
||||
** Mutate `som` with a 0-terminated list of axis, noun pairs.
|
||||
** Axes must be cats (31 bit).
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3i_molt(u3_noun som, ...);
|
||||
|
||||
/* u3i_chubs():
|
||||
|
@ -68,7 +68,7 @@
|
||||
struct _u3j_core* dev_u; // blank-terminated static list
|
||||
c3_c** bas_u; // blank-terminated static list
|
||||
struct _u3j_hood* huc_u; // blank-terminated static list
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
c3_l jax_l; // index in global dashboard
|
||||
} u3j_core;
|
||||
|
||||
@ -151,7 +151,7 @@
|
||||
|
||||
/* u3j_hook():
|
||||
**
|
||||
** Execute hook from core.
|
||||
** Execute hook from core.
|
||||
*/
|
||||
u3_noun
|
||||
u3j_hook(u3_noun cor,
|
||||
@ -167,7 +167,7 @@
|
||||
|
||||
/* u3j_kick(): try to kick by jet. If no kick, produce u3_none.
|
||||
**
|
||||
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
|
||||
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
|
||||
** is no kick, TRANSFERRED if one.
|
||||
*/
|
||||
u3_weak
|
||||
|
@ -33,7 +33,7 @@
|
||||
** %meme :: out of memory
|
||||
** %time :: timed out
|
||||
** %oops :: assertion failure
|
||||
*/
|
||||
*/
|
||||
c3_i
|
||||
u3m_bail(c3_m how_m) __attribute__((noreturn));
|
||||
|
||||
@ -76,22 +76,22 @@
|
||||
|
||||
/* u3m_soft_slam: top-level call.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_slam(u3_noun gat, u3_noun sam);
|
||||
|
||||
/* u3m_soft_nock: top-level nock.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_nock(u3_noun bus, u3_noun fol);
|
||||
|
||||
/* u3m_soft_sure(): top-level call assumed correct.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_sure(u3_funk fun_f, u3_noun arg);
|
||||
|
||||
/* u3m_soft_run(): descend into virtualization context.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_run(u3_noun gul,
|
||||
u3_funq fun_f,
|
||||
u3_noun aga,
|
||||
@ -119,7 +119,7 @@
|
||||
|
||||
/* u3m_pretty(): dumb prettyprint to string. RETAIN.
|
||||
*/
|
||||
c3_c*
|
||||
c3_c*
|
||||
u3m_pretty(u3_noun som);
|
||||
|
||||
/* u3m_p(): dumb print with caption. RETAIN.
|
||||
|
@ -145,7 +145,7 @@
|
||||
** within (a) or (b)!
|
||||
*/
|
||||
c3_o
|
||||
u3r_sung(u3_noun a, u3_noun b);
|
||||
u3r_sung(u3_noun a, u3_noun b);
|
||||
|
||||
/* u3r_sing_c):
|
||||
**
|
||||
|
@ -42,7 +42,7 @@
|
||||
} ova;
|
||||
} u3v_arvo;
|
||||
|
||||
/* u3v_home: all internal (within image) state.
|
||||
/* u3v_home: all internal (within image) state.
|
||||
*/
|
||||
typedef struct _u3v_home {
|
||||
u3a_road rod_u; // storage state
|
||||
|
@ -28,6 +28,6 @@
|
||||
|
||||
/* u3z_uniq(): uniquify with memo cache.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_uniq(u3_noun som);
|
||||
|
||||
|
@ -262,7 +262,7 @@
|
||||
*/
|
||||
typedef struct _u3_mess {
|
||||
c3_d len_d; // blob length in bytes
|
||||
c3_d has_d; // currently held
|
||||
c3_d has_d; // currently held
|
||||
struct _u3_meat* meq_u; // exit of message queue
|
||||
struct _u3_meat* qem_u; // entry of message queue
|
||||
} u3_mess;
|
||||
@ -327,7 +327,7 @@
|
||||
typedef struct _u3_dire {
|
||||
c3_c* pax_c; // path of directory
|
||||
uv_file fil_u; // file, opened read-only to fsync
|
||||
u3_dent* all_u; // file list
|
||||
u3_dent* all_u; // file list
|
||||
} u3_dire;
|
||||
|
||||
/* u3_ames: ames networking.
|
||||
@ -412,7 +412,7 @@
|
||||
struct _u3_udir* par_u; // parent
|
||||
struct _u3_unod* nex_u; // internal list
|
||||
} u3_unod;
|
||||
|
||||
|
||||
/* u3_ufil: synchronized file.
|
||||
*/
|
||||
typedef struct _u3_ufil {
|
||||
@ -424,7 +424,7 @@
|
||||
c3_w mug_w; // mug of last %into
|
||||
c3_w gum_w; // mug of last %ergo
|
||||
} u3_ufil;
|
||||
|
||||
|
||||
/* u3_ufil: synchronized directory.
|
||||
*/
|
||||
typedef struct _u3_udir {
|
||||
@ -640,7 +640,7 @@
|
||||
** at present, all sets are ordered and can be defined by a
|
||||
** simple counter. any events <= the counter is in the set.
|
||||
*/
|
||||
typedef struct _u3_disk {
|
||||
typedef struct _u3_disk {
|
||||
u3_dire* dir_u; // main pier directory
|
||||
u3_dire* urb_u; // urbit system data
|
||||
u3_dire* com_u; // log directory
|
||||
@ -657,7 +657,7 @@
|
||||
/* u3_boot: startup controller.
|
||||
*/
|
||||
typedef struct _u3_boot {
|
||||
|
||||
|
||||
} u3_boot;
|
||||
|
||||
/* u3_pier: ship controller.
|
||||
@ -697,6 +697,7 @@
|
||||
u3_pier** tab_u; // lord table
|
||||
uv_pipe_t cmd_u; // command socket
|
||||
u3_moor* cli_u; // connected clients
|
||||
uv_timer_t tim_u; // gc timer
|
||||
} u3_king;
|
||||
|
||||
# define u3L u3_Host.lup_u // global event loop
|
||||
@ -834,7 +835,7 @@
|
||||
|
||||
/* u3_ve_save(): save internal file as atom.
|
||||
*/
|
||||
c3_o
|
||||
c3_o
|
||||
u3_ve_save(c3_c* ext_c, u3_noun tah, u3_noun dat);
|
||||
|
||||
/* u3_ve_zeus(): prayer to internal file path. Return unit.
|
||||
@ -1022,7 +1023,7 @@
|
||||
|
||||
/* u3_ames_ef_bake(): send initial events.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u3_ames_io_bake(u3_pier* pir_u);
|
||||
|
||||
/* u3_ames_io_exit(): terminate ames I/O.
|
||||
@ -1056,7 +1057,7 @@
|
||||
void
|
||||
u3_unix_ef_hold(void);
|
||||
|
||||
/* u3_unix_ef_boot(): boot actions
|
||||
/* u3_unix_ef_boot(): boot actions
|
||||
*/
|
||||
void
|
||||
u3_unix_ef_boot(u3_pier *pir_u);
|
||||
@ -1259,7 +1260,7 @@
|
||||
u3_pier*
|
||||
u3_pier_stub(void);
|
||||
|
||||
/* u3_pier_plan(): submit event; fake pier
|
||||
/* u3_pier_plan(): submit event; fake pier
|
||||
*/
|
||||
void
|
||||
u3_pier_plan(u3_noun pax, u3_noun fav);
|
||||
@ -1293,6 +1294,11 @@
|
||||
void
|
||||
u3_pier_sway(c3_l tab_l, u3_noun tax);
|
||||
|
||||
/* u3_pier_mark(): mark all Loom allocations in all u3_pier structs.
|
||||
*/
|
||||
c3_w
|
||||
u3_pier_mark(FILE* fil_u);
|
||||
|
||||
/* u3_dawn_come(): mine a comet
|
||||
*/
|
||||
u3_noun
|
||||
@ -1307,3 +1313,8 @@
|
||||
*/
|
||||
void
|
||||
u3_king_commence();
|
||||
|
||||
/* u3_king_grab(): gc the kingdom
|
||||
*/
|
||||
void
|
||||
u3_king_grab(void* vod_p);
|
||||
|
@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3ka_gth(u3_noun a,
|
||||
u3ka_gth(u3_noun a,
|
||||
u3_noun b)
|
||||
{
|
||||
u3_noun c = u3qa_gth(a, b);
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
if ( c3y == hoz ) {
|
||||
nex = u3nc(u3nc(u3k(u3h(a)), u3k(u3h(acc))), u3k(u3t(acc)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
nex = u3nc(u3k(u3h(acc)), u3nc(u3k(u3h(a)), u3k(u3t(acc))));
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
}
|
||||
}
|
||||
u3_noun
|
||||
u3kb_weld(u3_noun a,
|
||||
u3kb_weld(u3_noun a,
|
||||
u3_noun b)
|
||||
{
|
||||
u3_noun c = u3qb_weld(a, b);
|
||||
|
@ -7,7 +7,7 @@
|
||||
// good old linear search
|
||||
//
|
||||
static u3_noun
|
||||
_po_find(u3_noun buf,
|
||||
_po_find(u3_noun buf,
|
||||
u3_noun a)
|
||||
{
|
||||
if ( !_(u3a_is_cat(a)) ) {
|
||||
|
@ -80,7 +80,7 @@
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
u3_noun pro;
|
||||
|
||||
|
||||
pro = u3qc_rap(a, b);
|
||||
return pro;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
u3_noun pro;
|
||||
|
||||
|
||||
pro = u3qc_rep(a, b);
|
||||
return pro;
|
||||
}
|
||||
|
154
jets/c/rip.c
154
jets/c/rip.c
@ -1,92 +1,86 @@
|
||||
/* j/3/rip.c
|
||||
**
|
||||
*/
|
||||
#include "all.h"
|
||||
|
||||
u3_noun u3qc_rip(u3_atom bloq, u3_atom b) {
|
||||
if ( !_(u3a_is_cat(bloq)) || (bloq >= 32) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3qc_rip(u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
|
||||
c3_g bloq_g = bloq;
|
||||
|
||||
/*
|
||||
This is a fast-path for the case where all the resulting blocks will
|
||||
fit in 31-bit direct atoms.
|
||||
*/
|
||||
if ( bloq_g < 5 ) { // produce direct atoms
|
||||
u3_noun acc = u3_nul;
|
||||
|
||||
c3_w met_w = u3r_met(bloq_g, b); // num blocks in atom
|
||||
c3_w nbits_w = 1 << bloq_g; // block size in bits
|
||||
c3_w bmask_w = (1 << nbits_w) - 1; // result mask
|
||||
|
||||
for ( c3_w i_w = 0; i_w < met_w; i_w++ ) { // `i_w` is block index
|
||||
c3_w nex_w = i_w + 1; // next block
|
||||
c3_w pat_w = met_w - nex_w; // blks left after this
|
||||
c3_w bit_w = pat_w << bloq_g; // bits left after this
|
||||
c3_w wor_w = bit_w >> 5; // wrds left after this
|
||||
c3_w sif_w = bit_w & 31; // bits left in word
|
||||
c3_w src_w = u3r_word(wor_w, b); // find word by index
|
||||
c3_w rip_w = (src_w >> sif_w) & bmask_w; // get item from word
|
||||
|
||||
acc = u3nc(rip_w, acc);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
u3_noun acc = u3_nul;
|
||||
c3_w met_w = u3r_met(bloq_g, b);
|
||||
c3_w len_w = u3r_met(5, b);
|
||||
c3_g san_g = (bloq_g - 5);
|
||||
c3_w san_w = 1 << san_g;
|
||||
c3_w dif_w = (met_w << san_g) - len_w;
|
||||
c3_w tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w));
|
||||
|
||||
for ( c3_w i_w = 0; i_w < met_w; i_w++ ) {
|
||||
c3_w pat_w = (met_w - (i_w + 1));
|
||||
c3_w wut_w = (pat_w << san_g);
|
||||
c3_w sap_w = ((0 == i_w) ? tub_w : san_w);
|
||||
c3_w* sal_w = u3a_slab(sap_w);
|
||||
|
||||
if ( 0 == sal_w ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
else {
|
||||
u3_noun pir = u3_nul;
|
||||
c3_g a_g = a;
|
||||
c3_w i_w;
|
||||
|
||||
if ( a_g < 5 ) {
|
||||
c3_w met_w = u3r_met(a_g, b);
|
||||
c3_w mek_w = ((1 << (1 << a_g)) - 1);
|
||||
c3_w j_w;
|
||||
u3_atom rip;
|
||||
|
||||
for ( i_w = 0; i_w < met_w; i_w++ ) {
|
||||
c3_w pat_w = (met_w - (i_w + 1));
|
||||
c3_w bit_w = (pat_w << a_g);
|
||||
c3_w wor_w = (bit_w >> 5);
|
||||
c3_w sif_w = (bit_w & 31);
|
||||
c3_w src_w = u3r_word(wor_w, b);
|
||||
c3_w rip_w = ((src_w >> sif_w) & mek_w);
|
||||
|
||||
pir = u3nc(rip_w, pir);
|
||||
}
|
||||
return pir;
|
||||
}
|
||||
else {
|
||||
c3_w met_w = u3r_met(a_g, b);
|
||||
c3_w len_w = u3r_met(5, b);
|
||||
c3_g san_g = (a_g - 5);
|
||||
c3_w san_w = 1 << san_g;
|
||||
c3_w dif_w = (met_w << san_g) - len_w;
|
||||
c3_w tub_w = ((dif_w == 0) ? san_w : (san_w - dif_w));
|
||||
|
||||
for ( i_w = 0; i_w < met_w; i_w++ ) {
|
||||
c3_w pat_w = (met_w - (i_w + 1));
|
||||
c3_w wut_w = (pat_w << san_g);
|
||||
c3_w sap_w = ((0 == i_w) ? tub_w : san_w);
|
||||
c3_w* sal_w = u3a_slab(sap_w);
|
||||
|
||||
if ( 0 == sal_w ) {
|
||||
return u3m_bail(c3__fail);
|
||||
} else {
|
||||
c3_w j_w;
|
||||
u3_atom rip;
|
||||
|
||||
for ( j_w = 0; j_w < sap_w; j_w++ ) {
|
||||
sal_w[j_w] = u3r_word(wut_w + j_w, b);
|
||||
}
|
||||
|
||||
rip = u3a_malt(sal_w);
|
||||
pir = u3nc(rip, pir);
|
||||
}
|
||||
len_w -= san_w;
|
||||
}
|
||||
}
|
||||
return pir;
|
||||
for ( j_w = 0; j_w < sap_w; j_w++ ) {
|
||||
sal_w[j_w] = u3r_word(wut_w + j_w, b);
|
||||
}
|
||||
}
|
||||
u3_noun
|
||||
u3wc_rip(u3_noun cor)
|
||||
{
|
||||
u3_noun a, b;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ||
|
||||
(c3n == u3ud(a)) ||
|
||||
(c3n == u3ud(b)) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
} else {
|
||||
return u3qc_rip(a, b);
|
||||
}
|
||||
rip = u3a_malt(sal_w);
|
||||
acc = u3nc(rip, acc);
|
||||
len_w -= san_w;
|
||||
}
|
||||
u3_noun
|
||||
u3kc_rip(u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
u3_noun res = u3qc_rip(a, b);
|
||||
|
||||
u3z(a); u3z(b);
|
||||
return res;
|
||||
return acc;
|
||||
}
|
||||
|
||||
u3_noun u3wc_rip(u3_noun cor) {
|
||||
u3_noun a, b;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a, u3x_sam_3, &b, 0)) ||
|
||||
(c3n == u3ud(a)) ||
|
||||
(c3n == u3ud(b))
|
||||
) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
|
||||
return u3qc_rip(a, b);
|
||||
}
|
||||
|
||||
u3_noun u3kc_rip(u3_atom a, u3_atom b) {
|
||||
u3_noun res = u3qc_rip(a, b);
|
||||
u3z(a); u3z(b);
|
||||
return res;
|
||||
}
|
||||
|
100
jets/c/ripn.c
Normal file
100
jets/c/ripn.c
Normal file
@ -0,0 +1,100 @@
|
||||
#include "all.h"
|
||||
|
||||
/*
|
||||
Get the lowest `n` bits of a word `w` using a bitmask.
|
||||
*/
|
||||
#define TAKEBITS(n,w) \
|
||||
((n)==32) ? (w) : \
|
||||
((n)==0) ? 0 : \
|
||||
((w) & ((1 << (n)) - 1))
|
||||
|
||||
/*
|
||||
Divide, rounding up.
|
||||
*/
|
||||
#define DIVCEIL(x,y) \
|
||||
(x==0) ? 0 : \
|
||||
1 + ((x - 1) / y);
|
||||
|
||||
/*
|
||||
`ripn` breaks `atom` into a list of blocks, of bit-width `bits`. The
|
||||
resulting list will be least-significant block first.
|
||||
|
||||
XX TODO This only handles cases where the bit-width is <= 32.
|
||||
|
||||
For each block we produce, we need to grab the relevant words inside
|
||||
`atom`, so we first compute their indicies.
|
||||
|
||||
`ins_idx` is the word-index of the least-significant word we
|
||||
care about, and `sig_idx` is the word after that.
|
||||
|
||||
Next we grab those words (`ins_word` and `sig_word`) from the atom
|
||||
using `u3r_word`. Note that `sig_idx` might be out-of-bounds for the
|
||||
underlying array of `atom`, but `u3r_word` returns 0 in that case,
|
||||
which is exatly what we want.
|
||||
|
||||
Now, we need to grab the relevant bits out of both words, and combine
|
||||
them. `bits_rem_in_ins_word` is the number of remaining (insignificant)
|
||||
bits in `ins_word`, `nbits_ins` is the number of bits we want from the
|
||||
less-significant word, and `nbits_sig` from the more-significant one.
|
||||
|
||||
Take the least significant `nbits_sig` bits from `sig_word`, and take
|
||||
the slice we care about from `ins_word`. In order to take that slice,
|
||||
we drop `bits_rem_in_ins_word` insignificant bits, and then take the
|
||||
`nbits_sig` most-significant bits.
|
||||
|
||||
Last, we slice out those bits from the two words, combine them into
|
||||
one word, and cons them onto the front of the result.
|
||||
*/
|
||||
u3_noun u3qc_ripn(u3_atom bits, u3_atom atom) {
|
||||
if ( !_(u3a_is_cat(bits) || bits==0 || bits>31) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
|
||||
c3_w bit_width = u3r_met(0, atom);
|
||||
c3_w num_blocks = DIVCEIL(bit_width, bits);
|
||||
|
||||
u3_noun res = u3_nul;
|
||||
|
||||
for ( c3_w blk = 0; blk < num_blocks; blk++ ) {
|
||||
c3_w next_blk = blk + 1;
|
||||
c3_w blks_rem = num_blocks - next_blk;
|
||||
c3_w bits_rem = blks_rem * bits;
|
||||
c3_w ins_idx = bits_rem / 32;
|
||||
c3_w sig_idx = ins_idx + 1;
|
||||
|
||||
c3_w bits_rem_in_ins_word = bits_rem % 32;
|
||||
|
||||
c3_w ins_word = u3r_word(ins_idx, atom);
|
||||
c3_w sig_word = u3r_word(sig_idx, atom);
|
||||
c3_w nbits_ins = c3_min(bits, 32 - bits_rem_in_ins_word);
|
||||
c3_w nbits_sig = bits - nbits_ins;
|
||||
|
||||
c3_w ins_word_bits = TAKEBITS(nbits_ins, ins_word >> bits_rem_in_ins_word);
|
||||
c3_w sig_word_bits = TAKEBITS(nbits_sig, sig_word);
|
||||
|
||||
c3_w item = ins_word_bits | (sig_word_bits << nbits_ins);
|
||||
|
||||
res = u3nc(item, res);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
u3_noun u3wc_ripn(u3_noun cor) {
|
||||
u3_noun bits, atom;
|
||||
|
||||
if ( (c3n == u3r_mean(cor, u3x_sam_2, &bits, u3x_sam_3, &atom, 0)) ||
|
||||
(c3n == u3ud(bits)) ||
|
||||
(c3n == u3ud(atom)) )
|
||||
{
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
|
||||
return u3qc_ripn(bits, atom);
|
||||
}
|
||||
|
||||
u3_noun u3kc_ripn(u3_atom bits, u3_atom atom) {
|
||||
u3_noun res = u3qc_ripn(bits, atom);
|
||||
u3z(bits), u3z(atom);
|
||||
return res;
|
||||
}
|
@ -41,7 +41,7 @@
|
||||
} else {
|
||||
c = _b_bif_putroot(r_a, b);
|
||||
u3r_trel(c, &n_c, &l_c, &r_c);
|
||||
d = u3nt(u3k(n_c),
|
||||
d = u3nt(u3k(n_c),
|
||||
u3nt(u3k(n_a), u3k(l_a), u3k(l_c)),
|
||||
u3k(r_c)
|
||||
);
|
||||
@ -64,7 +64,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
u3_noun u3qdb_bif(u3_noun a,
|
||||
u3_noun u3qdb_bif(u3_noun a,
|
||||
u3_noun b)
|
||||
{
|
||||
u3_noun c, n_c, l_c, r_c;
|
||||
|
@ -36,7 +36,7 @@
|
||||
} else {
|
||||
c = _i_bif_putroot(r_a, b);
|
||||
u3r_trel(c, &n_c, &l_c, &r_c);
|
||||
d = u3nt(u3k(n_c),
|
||||
d = u3nt(u3k(n_c),
|
||||
u3nt(u3k(n_a), u3k(l_a), u3k(l_c)),
|
||||
u3k(r_c));
|
||||
u3z(c);
|
||||
|
@ -73,7 +73,7 @@
|
||||
|
||||
if ( c3n == u3r_mean(cor, u3x_sam, &b, u3x_con_sam, &a, 0) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3qdi_mer(a, b);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ _in_uni(u3_noun a, u3_noun b)
|
||||
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3kdi_uni(u3_noun a,
|
||||
u3_noun b)
|
||||
{
|
||||
|
@ -13,7 +13,7 @@
|
||||
/* functions
|
||||
*/
|
||||
u3_noun
|
||||
u3qea_en(u3_atom a,
|
||||
u3qea_en(u3_atom a,
|
||||
u3_atom b)
|
||||
{
|
||||
c3_y a_y[32];
|
||||
|
@ -9,7 +9,7 @@
|
||||
/* functions
|
||||
*/
|
||||
static u3_noun
|
||||
_cqee_sign(u3_noun a,
|
||||
_cqee_sign(u3_noun a,
|
||||
u3_noun b)
|
||||
{
|
||||
c3_y sig_y[64];
|
||||
|
@ -232,7 +232,7 @@
|
||||
break;
|
||||
}
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
_xpd(&c, &d);
|
||||
switch ( i ) {
|
||||
c3_ws x;
|
||||
@ -369,7 +369,7 @@
|
||||
mpz_init_set(mp, mn);
|
||||
mpz_set_ui(i, 1);
|
||||
mpz_mul_2exp(i, i, d.precision - 1);
|
||||
if ( (mpz_cmp(c.a, i) == 0) &&
|
||||
if ( (mpz_cmp(c.a, i) == 0) &&
|
||||
((mpz_cmp(c.e, d.minExp) != 0 ) ||
|
||||
(d.eMode == c3__i)) ) {
|
||||
mpz_mul_2exp(mp, mp, 1);
|
||||
|
@ -455,7 +455,7 @@
|
||||
(c3n == u3r_mean(van, u3x_sam_2, &hez, u3x_sam_3, &sef, 0)) )
|
||||
{
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return _cqe_here_fun(hez, sef, tub);
|
||||
}
|
||||
|
@ -23,10 +23,10 @@ static void byte_reverse(c3_y *i_y, /* in */
|
||||
|
||||
/* Identical to u3r_bytes, but reverses bytes in place.
|
||||
could be cleaner if we modified u3r_bytes(), but not gonna do that.
|
||||
|
||||
|
||||
This func exists bc Urbit code base is explicitly little-endian,
|
||||
and secp256k1 library is explicitly big-endian.
|
||||
|
||||
|
||||
Several times below we do the pattern of (1) invoke u3r_bytes, (2) invert. Do it in a func.
|
||||
*/
|
||||
|
||||
@ -55,9 +55,9 @@ static void u3r_bytes_reverse(c3_w a_w,
|
||||
u3_noun
|
||||
u3we_sign(u3_noun cor)
|
||||
{
|
||||
|
||||
|
||||
u3_noun has, prv;
|
||||
|
||||
|
||||
if ( (c3n == u3r_mean(cor,
|
||||
u3x_sam_2, &has,
|
||||
u3x_sam_3, &prv,
|
||||
@ -72,14 +72,14 @@ u3we_sign(u3_noun cor)
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3qe_sign(u3_atom has,
|
||||
u3_atom prv)
|
||||
u3qe_sign(u3_atom has,
|
||||
u3_atom prv)
|
||||
{
|
||||
/* build library context object once (and only once) */
|
||||
static secp256k1_context * ctx_u = NULL;
|
||||
if (NULL == ctx_u) {
|
||||
ctx_u = secp256k1_context_create(SECP256K1_CONTEXT_SIGN);
|
||||
}
|
||||
}
|
||||
|
||||
/* parse arguments, convert endianness */
|
||||
c3_y has_y[32]; /* hash */
|
||||
@ -87,9 +87,9 @@ u3qe_sign(u3_atom has,
|
||||
u3r_bytes_reverse(0, 32, has_y, has);
|
||||
u3r_bytes_reverse(0, 32, prv_y, prv);
|
||||
|
||||
|
||||
|
||||
/* sign
|
||||
N.B. if we want the 'v' field we can't use default secp256k1_ecdsa_sign(),
|
||||
N.B. if we want the 'v' field we can't use default secp256k1_ecdsa_sign(),
|
||||
but must use secp256k1_ecdsa_sign_recoverable() */
|
||||
c3_ws ret;
|
||||
secp256k1_ecdsa_recoverable_signature sig_u;
|
||||
@ -104,9 +104,9 @@ u3qe_sign(u3_atom has,
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
|
||||
/* convert opaque 65 byte signature into v + [r + s]
|
||||
/* convert opaque 65 byte signature into v + [r + s]
|
||||
convert endianness while we're at it */
|
||||
c3_y rec_y[64];
|
||||
c3_y rec_y[64];
|
||||
c3_ws v = 0;
|
||||
ret = secp256k1_ecdsa_recoverable_signature_serialize_compact(ctx_u,
|
||||
rec_y, /* OUT: 64 byte sig (r,s) */
|
||||
@ -129,7 +129,7 @@ u3qe_sign(u3_atom has,
|
||||
}
|
||||
|
||||
|
||||
/* recover pubkey from signature (which is how we verify signatures)
|
||||
/* recover pubkey from signature (which is how we verify signatures)
|
||||
*/
|
||||
|
||||
u3_noun
|
||||
@ -137,7 +137,7 @@ u3we_reco(u3_noun cor)
|
||||
{
|
||||
u3_noun has, /* hash */
|
||||
siv, sir, sis; /* signature: v, r, s */
|
||||
|
||||
|
||||
if ( (c3n == u3r_mean(cor,
|
||||
u3x_sam_2, &has,
|
||||
u3x_sam_6, &siv,
|
||||
@ -162,12 +162,12 @@ u3qe_reco(u3_atom has,
|
||||
u3_atom sir, /* signature: r */
|
||||
u3_atom sis) /* signature: s */
|
||||
{
|
||||
|
||||
|
||||
/* build library context object once (and only once) */
|
||||
static secp256k1_context * ctx_u = NULL;
|
||||
if (NULL == ctx_u) {
|
||||
ctx_u = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY);
|
||||
}
|
||||
}
|
||||
|
||||
/* parse arguments, convert endianness */
|
||||
c3_y has_y[32];
|
||||
@ -203,7 +203,7 @@ u3qe_reco(u3_atom has,
|
||||
|
||||
/* turn sign into puk_u */
|
||||
secp256k1_pubkey puk_u;
|
||||
memset((void *) & puk_u, 0, sizeof(secp256k1_pubkey) );
|
||||
memset((void *) & puk_u, 0, sizeof(secp256k1_pubkey) );
|
||||
ret = secp256k1_ecdsa_recover(ctx_u, /* IN: context */
|
||||
& puk_u, /* OUT: pub key */
|
||||
& sig_u, /* IN: signature */
|
||||
@ -217,7 +217,7 @@ u3qe_reco(u3_atom has,
|
||||
/* convert puk_u into serialized form that we can get x,y out of */
|
||||
c3_y puk_y[65];
|
||||
size_t outputlen = 65;
|
||||
memset((void *) puk_y, 0, 65);
|
||||
memset((void *) puk_y, 0, 65);
|
||||
|
||||
ret = secp256k1_ec_pubkey_serialize( ctx_u, /* IN: */
|
||||
puk_y, /* OUT: */
|
||||
@ -238,9 +238,9 @@ u3qe_reco(u3_atom has,
|
||||
byte 0: signal bits (???)
|
||||
bytes 1-32: x
|
||||
bytes 33-64: y
|
||||
|
||||
|
||||
convert endianness while we're at it */
|
||||
|
||||
|
||||
c3_y x_y[32];
|
||||
for (i_ws = 0; i_ws < 32; i_ws++) {
|
||||
x_y[i_ws] = puk_y[32 - i_ws];
|
||||
@ -252,7 +252,7 @@ u3qe_reco(u3_atom has,
|
||||
y_y[i_ws] = puk_y[64 - i_ws];
|
||||
}
|
||||
u3_noun y = u3i_bytes(32, y_y);
|
||||
|
||||
|
||||
/* returns x,y */
|
||||
return(u3nc(x, y));
|
||||
}
|
||||
@ -287,13 +287,13 @@ u3qe_make(u3_atom has,
|
||||
c3_y heb_y[32]; /* hash, big endian */
|
||||
u3r_bytes(0, 32, hel_y, has);
|
||||
byte_reverse(hel_y, heb_y, 32);
|
||||
|
||||
|
||||
c3_y pel_y[32]; /* priv key, little endian */
|
||||
c3_y peb_y[32]; /* priv key, big endian */
|
||||
u3r_bytes(0, 32, pel_y, prv);
|
||||
byte_reverse(pel_y, peb_y, 32);
|
||||
|
||||
|
||||
|
||||
c3_ws ret_ws;
|
||||
c3_y neb_y[32]; /* nonce */
|
||||
ret_ws = secp256k1_nonce_function_rfc6979(neb_y, /* OUT: return arg for nonce */
|
||||
|
@ -135,11 +135,11 @@ u3_noun
|
||||
u3we_shay(u3_noun cor)
|
||||
{
|
||||
u3_noun a, b;
|
||||
|
||||
|
||||
// static int few = 0;
|
||||
// if(few == 0) printf("foo\r\n");
|
||||
// few++; few %= 1000;
|
||||
|
||||
|
||||
|
||||
if ( (u3_none == (a = u3r_at(u3x_sam_2, cor))) ||
|
||||
(u3_none == (b = u3r_at(u3x_sam_3, cor))) ||
|
||||
|
@ -556,7 +556,7 @@
|
||||
{
|
||||
return u3nt(c3__sggr,
|
||||
u3nq(c3__live,
|
||||
c3__dtzz,
|
||||
c3__dtzz,
|
||||
u3_blip,
|
||||
u3k(p_gen)),
|
||||
u3k(q_gen));
|
||||
@ -1017,7 +1017,7 @@
|
||||
{
|
||||
u3_noun gat = u3j_soft(_ar_core(van, ref, syn), "fish");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(axe),
|
||||
0));
|
||||
|
@ -31,7 +31,7 @@
|
||||
u3nc(0,
|
||||
u3qc_peg(p_mal, pq_buz)));
|
||||
}
|
||||
else return u3nt(7,
|
||||
else return u3nt(7,
|
||||
u3k(mal),
|
||||
u3k(buz));
|
||||
}
|
||||
@ -42,7 +42,7 @@
|
||||
(0 == u3h(q_mal)) &&
|
||||
(1 == u3t(q_mal)) )
|
||||
{
|
||||
return u3nt(8,
|
||||
return u3nt(8,
|
||||
u3k(p_mal),
|
||||
u3k(buz));
|
||||
}
|
||||
@ -52,7 +52,7 @@
|
||||
{
|
||||
return u3k(mal);
|
||||
}
|
||||
else return u3nt(7,
|
||||
else return u3nt(7,
|
||||
u3k(mal),
|
||||
u3k(buz));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
if ( (c3__void == lup) || (c3__void == mar) ) {
|
||||
return c3__void;
|
||||
} else {
|
||||
return u3nq(c3__fine,
|
||||
return u3nq(c3__fine,
|
||||
u3k(fuv),
|
||||
u3k(lup),
|
||||
u3k(mar));
|
||||
|
@ -33,15 +33,15 @@
|
||||
if ( c3__void != i_yed ) {
|
||||
if ( (c3y == u3du(i_yed)) && (c3__fork == u3h(i_yed)) ) {
|
||||
lez = u3kdi_uni(lez, u3k(u3t(i_yed)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
lez = u3kdi_put(lez, u3k(i_yed));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
yed = u3t(yed);
|
||||
}
|
||||
|
||||
|
||||
if ( u3_nul == lez ) {
|
||||
return c3__void;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* functions
|
||||
|
@ -45,7 +45,7 @@
|
||||
pro = _loot_in(cog, r_dom, nax);
|
||||
u3z(nax);
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun u_yep = u3t(yep);
|
||||
u3_noun nax = u3qc_peg(axe, 2);
|
||||
@ -65,7 +65,7 @@
|
||||
pro = _loot_in(cog, l_dom, nax);
|
||||
u3z(nax);
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun u_yep = u3t(yep);
|
||||
u3_noun nax = u3qc_peg(axe, 2);
|
||||
@ -87,7 +87,7 @@
|
||||
|
||||
if ( u3_nul != pey ) {
|
||||
return pey;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun nax = u3qc_peg(axe, 7);
|
||||
u3_noun pro;
|
||||
|
@ -64,7 +64,7 @@
|
||||
c3_c* pfix_c = u3r_string((c3y == u3du(typ)) ? u3h(typ) : typ);
|
||||
c3_c ugh_c[1024];
|
||||
|
||||
sprintf(ugh_c, "%s: %s: 0x%8x:",
|
||||
sprintf(ugh_c, "%s: %s: 0x%8x:",
|
||||
paz_c, pfix_c, u3r_mug(typ));
|
||||
#if 0
|
||||
u3_pier_tank(0, u3n_kick_on(u3qfu_dunq(van, ugh_c, typ)));
|
||||
|
@ -15,10 +15,10 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("_cqfu_buss-buss", von, "buss");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(cog),
|
||||
u3x_sam_3,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(cog),
|
||||
u3x_sam_3,
|
||||
u3k(gen),
|
||||
0));
|
||||
}
|
||||
@ -31,7 +31,7 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("_cqfu_busk-busk", von, "busk");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(gen),
|
||||
0));
|
||||
|
@ -38,7 +38,7 @@
|
||||
{
|
||||
if ( u3_nul == p_sut ) {
|
||||
return u3_nul;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3nc(_crop_dext(van, u3h(p_sut), ref, bix),
|
||||
_crop_dext_fork(van, u3t(p_sut), ref, bix));
|
||||
@ -49,7 +49,7 @@
|
||||
{
|
||||
if ( u3_nul == p_ref ) {
|
||||
return u3k(sut);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun tuz = _crop_dext(van, sut, u3h(p_ref), bix);
|
||||
u3_noun zat = _crop_sint_fork(van, tuz, u3t(p_ref), bix);
|
||||
@ -136,7 +136,7 @@
|
||||
}
|
||||
case c3__core:
|
||||
{
|
||||
if ( (c3__atom == u3h(ref)) ||
|
||||
if ( (c3__atom == u3h(ref)) ||
|
||||
(c3__cell == u3h(ref)) ) {
|
||||
return u3k(sut);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
/* `u3qfu_felt_arm` is a helper function for
|
||||
* u3qfu_felt. It handles the case in which the
|
||||
* opal is for an arm, by creating a list of
|
||||
* opal is for an arm, by creating a list of
|
||||
* parent core types. These will be converted to
|
||||
* a single `fork` type.
|
||||
*/
|
||||
@ -45,12 +45,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* `u3qfu_felt` takes an opal, lap, and converts
|
||||
* it to a type. The opal comes from the last
|
||||
* limb of the wing processed by `+fond`. The
|
||||
* type is used in +fond as the subject type of
|
||||
/* `u3qfu_felt` takes an opal, lap, and converts
|
||||
* it to a type. The opal comes from the last
|
||||
* limb of the wing processed by `+fond`. The
|
||||
* type is used in +fond as the subject type of
|
||||
* the next limb in the wing.
|
||||
*/
|
||||
*/
|
||||
static u3_noun
|
||||
u3qfu_felt(u3_noun lap)
|
||||
{
|
||||
@ -77,17 +77,17 @@
|
||||
static u3_noun
|
||||
u3qfu_fund(u3_noun van,
|
||||
u3_noun sut,
|
||||
u3_noun way,
|
||||
u3_noun way,
|
||||
u3_noun gen)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("u3qfu_fund-fund", von, "fund");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(way),
|
||||
u3k(way),
|
||||
u3x_sam_3,
|
||||
u3k(gen),
|
||||
u3k(gen),
|
||||
0));
|
||||
}
|
||||
|
||||
@ -99,9 +99,9 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("u3qfu_fine-fine", von, "fine");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(tor),
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(tor),
|
||||
0));
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@
|
||||
u3nc(u3_nul, u3k(axe)),
|
||||
u3k(lon)),
|
||||
u3nc(c3y, u3k(sut)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3nt
|
||||
(c3n, c3y, u3qa_dec(p_heg));
|
||||
@ -242,20 +242,20 @@
|
||||
#if 1
|
||||
if ( qpq_sut == c3__wet ) {
|
||||
zut = u3nc(c3__wet, u3k(qu_zem));
|
||||
}
|
||||
}
|
||||
else if ( qpq_sut == c3__dry ) {
|
||||
zut = u3nc(c3__dry, u3k(qu_zem));
|
||||
}
|
||||
}
|
||||
else u3m_bail(c3__fail);
|
||||
#endif
|
||||
|
||||
|
||||
pro = u3nt
|
||||
(c3y,
|
||||
u3nc(u3nc(u3_nul, u3k(axe)), u3k(lon)),
|
||||
u3nt(c3n,
|
||||
u3qc_peg(2, pu_zem),
|
||||
u3nt(u3nc(u3k(sut), zut), u3_nul, u3_nul)));
|
||||
|
||||
|
||||
u3z(zem);
|
||||
return pro;
|
||||
}
|
||||
@ -287,9 +287,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
static u3_noun
|
||||
static u3_noun
|
||||
_find_twin(u3_noun van,
|
||||
u3_noun hax,
|
||||
u3_noun hax,
|
||||
u3_noun yor)
|
||||
{
|
||||
if ( c3y == u3r_sing(hax, yor) ) {
|
||||
@ -342,7 +342,7 @@
|
||||
u3_noun pp_yor = u3h(p_yor); // vein
|
||||
u3_noun qp_hax = u3t(p_hax); // opal
|
||||
u3_noun qp_yor = u3t(p_yor); // opal
|
||||
|
||||
|
||||
if ( c3n == u3r_sing(pp_hax, pp_yor) ) {
|
||||
return u3m_error("find-fork-e");
|
||||
}
|
||||
@ -354,7 +354,7 @@
|
||||
u3_noun pqp_hax = u3t(qp_hax); // type
|
||||
u3_noun pqp_yor = u3t(qp_yor); // type
|
||||
|
||||
return
|
||||
return
|
||||
u3nt(c3y,
|
||||
u3k(pp_hax),
|
||||
u3nc(c3y, u3kf_fork
|
||||
@ -372,8 +372,8 @@
|
||||
if ( c3n == u3r_sing(pqp_hax, pqp_yor) ) {
|
||||
return u3m_error("find-fork-h");
|
||||
} else {
|
||||
return
|
||||
u3nt(c3y,
|
||||
return
|
||||
u3nt(c3y,
|
||||
u3k(pp_hax),
|
||||
u3nt(c3n, u3k(pqp_hax), u3qdi_uni(qqp_hax, qqp_yor)));
|
||||
}
|
||||
@ -389,7 +389,7 @@
|
||||
{
|
||||
if ( u3_nul == wiz ) {
|
||||
return u3_nul;
|
||||
}
|
||||
}
|
||||
else if ( u3_nul == u3t(wiz) ) {
|
||||
return u3k(u3h(wiz));
|
||||
}
|
||||
@ -405,7 +405,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
static u3_noun
|
||||
static u3_noun
|
||||
_find_buck_fork_turn(u3_noun van,
|
||||
u3_noun yed,
|
||||
u3_noun way,
|
||||
@ -417,7 +417,7 @@
|
||||
{
|
||||
if ( u3_nul == yed ) {
|
||||
return u3_nul;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun fid = _find_buck(van, u3h(yed), way, p_heg, q_heg, axe, lon, gil);
|
||||
|
||||
@ -427,7 +427,7 @@
|
||||
(van, u3t(yed), way, p_heg, q_heg, axe, lon, gil));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static u3_noun
|
||||
_find_buck_fork(u3_noun van,
|
||||
u3_noun sut,
|
||||
@ -445,10 +445,10 @@
|
||||
|
||||
wiz = _find_buck_fork_turn(van, yed, way, p_heg, q_heg, axe, lon, gil);
|
||||
u3z(yed);
|
||||
|
||||
|
||||
ret = _find_buck_fork_twin(van, wiz);
|
||||
u3z(wiz);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -511,8 +511,8 @@
|
||||
u3z(tor);
|
||||
|
||||
ret = u3nt
|
||||
(c3n,
|
||||
c3n,
|
||||
(c3n,
|
||||
c3n,
|
||||
u3nc(u3k(u3h(vat)), u3qf_comb(cob, u3t(vat))));
|
||||
|
||||
u3z(vat);
|
||||
@ -548,7 +548,7 @@
|
||||
if ( c3y == u3ud(p_sut) ) {
|
||||
if ( c3y == u3r_sing(p_sut, uq_heg) ) {
|
||||
return _find_buck_here(van, q_sut, way, p_heg, q_heg, axe, lon, gil);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return _find_buck_lose(van, sut, way, p_heg, q_heg, axe, lon, gil);
|
||||
}
|
||||
@ -587,10 +587,10 @@
|
||||
u3_noun nol = // vein
|
||||
u3nt(u3_nul, u3nc(u3_nul, u3k(axe)), u3k(lon));
|
||||
u3_noun ret;
|
||||
|
||||
|
||||
ret = u3nt(c3y, u3qb_weld(pp_tor, nol), u3k(qp_tor));
|
||||
u3z(nol);
|
||||
u3z(tor);
|
||||
u3z(tor);
|
||||
u3z(tyr);
|
||||
return ret;
|
||||
}
|
||||
@ -601,11 +601,11 @@
|
||||
u3_noun dog = u3nc(0, u3k(axe)); // nock
|
||||
u3_noun ret;
|
||||
|
||||
ret = u3nt(c3n,
|
||||
c3n,
|
||||
ret = u3nt(c3n,
|
||||
c3n,
|
||||
u3nc(u3k(pp_tor), u3qf_comb(dog, qp_tor)));
|
||||
u3z(dog);
|
||||
u3z(tor);
|
||||
u3z(tor);
|
||||
u3z(tyr);
|
||||
|
||||
return ret;
|
||||
@ -642,12 +642,12 @@
|
||||
else switch ( u3h(sut) ) {
|
||||
default: return u3m_bail(c3__fail);
|
||||
|
||||
case c3__atom:
|
||||
case c3__atom:
|
||||
{
|
||||
// fprintf(stderr, "atom\r\n");
|
||||
return _find_buck_stop(van, sut, way, p_heg, q_heg, axe, lon, gil);
|
||||
}
|
||||
case c3__cell:
|
||||
case c3__cell:
|
||||
{
|
||||
// fprintf(stderr, "cell\r\n");
|
||||
return _find_buck_cell(van, sut, way, p_heg, q_heg, axe, lon, gil);
|
||||
@ -711,7 +711,7 @@
|
||||
? u3k(i_hyp)
|
||||
: u3nq(c3n, 0, u3_nul, u3k(i_hyp));
|
||||
u3_noun ret;
|
||||
|
||||
|
||||
if ( c3y == u3h(heg) ) {
|
||||
u3_noun p_heg = u3t(heg); // axis
|
||||
|
||||
@ -759,14 +759,14 @@
|
||||
|
||||
if ( c3y == u3h(p_mor) ) {
|
||||
return mor;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun pp_mor = u3t(p_mor); // {span nock}
|
||||
u3_noun ppp_mor = u3h(pp_mor); // span
|
||||
u3_noun qpp_mor = u3t(pp_mor); // nock
|
||||
u3_noun gen = u3nt(c3__wing, u3k(i_hyp), u3_nul);
|
||||
u3_noun fex = u3qfu_mint(van, ppp_mor, c3__noun, gen);
|
||||
u3_noun ret = u3nt(c3n,
|
||||
u3_noun ret = u3nt(c3n,
|
||||
c3n,
|
||||
u3nc(u3k(u3h(fex)),
|
||||
u3qf_comb(qpp_mor, u3t(fex))));
|
||||
@ -794,7 +794,7 @@
|
||||
u3_noun hyp)
|
||||
{
|
||||
u3_noun taf;
|
||||
|
||||
|
||||
taf = _find_pony(van, sut, way, hyp);
|
||||
|
||||
return taf;
|
||||
@ -814,7 +814,7 @@
|
||||
else {
|
||||
if ( c3y == u3h(taf) ) {
|
||||
u3_noun fat = u3nc(c3y, u3k(u3t(taf)));
|
||||
|
||||
|
||||
u3z(taf);
|
||||
return fat;
|
||||
}
|
||||
@ -822,7 +822,7 @@
|
||||
if ( c3n == u3h(u3t(taf)) ) {
|
||||
u3_noun fat = u3nc(c3n, u3k(u3t(u3t(u3t(taf)))));
|
||||
|
||||
u3z(taf);
|
||||
u3z(taf);
|
||||
return fat;
|
||||
}
|
||||
else {
|
||||
|
@ -46,7 +46,7 @@
|
||||
u3_noun mul = u3qfu_mull(von, sut, c3__noun, dox, gen);
|
||||
|
||||
ret = c3y;
|
||||
|
||||
|
||||
u3z(mul);
|
||||
u3z(von);
|
||||
u3z(rob);
|
||||
|
@ -16,7 +16,7 @@
|
||||
{
|
||||
if ( u3_nul == p_sut ) {
|
||||
return u3nc(1, 1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun hed = _fish_in(van, u3h(p_sut), axe, vit);
|
||||
u3_noun tal = _fish_fork(van, u3t(p_sut), axe, vit);
|
||||
|
@ -36,7 +36,7 @@
|
||||
{
|
||||
if ( u3_nul == p_sut ) {
|
||||
return u3_nul;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3nc(_fuse_in(van, u3h(p_sut), ref, bix),
|
||||
_fuse_in_fork(van, u3t(p_sut), ref, bix));
|
||||
@ -86,7 +86,7 @@
|
||||
if ( c3y == u3r_sing(q_ref, q_sut) ) {
|
||||
return u3nt(c3__atom, foc, u3k(q_sut));
|
||||
}
|
||||
else {
|
||||
else {
|
||||
u3z(foc);
|
||||
return c3__void;
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
u3_noun
|
||||
u3qfu_gain(u3_noun van,
|
||||
u3qfu_gain(u3_noun van,
|
||||
u3_noun sut,
|
||||
u3_noun gen)
|
||||
{
|
||||
|
@ -56,9 +56,9 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "feel");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(rot),
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(rot),
|
||||
0));
|
||||
}
|
||||
|
||||
@ -73,9 +73,9 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "mine");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(mel),
|
||||
u3k(mel),
|
||||
u3x_sam_6,
|
||||
u3k(nym),
|
||||
u3x_sam_14,
|
||||
@ -732,7 +732,7 @@
|
||||
u3_noun pqp_fid = u3t(qp_fid);
|
||||
u3_noun axe = _mint_tend(pp_fid);
|
||||
u3_noun ret;
|
||||
|
||||
|
||||
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
|
||||
u3qfr_fish(van, pqp_fid, p_gen, axe));
|
||||
|
||||
@ -762,16 +762,16 @@
|
||||
u3_noun gat = u3j_cook("_mint_in-blow", von, "blow");
|
||||
u3_noun pro;
|
||||
|
||||
pro = u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(gol),
|
||||
u3x_sam_3,
|
||||
pro = u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(gol),
|
||||
u3x_sam_3,
|
||||
u3k(p_gen),
|
||||
0));
|
||||
|
||||
|
||||
return u3z_save_4(fun_m, vrf, sut, gol, p_gen, pro);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
|
||||
_mint_used();
|
||||
|
@ -38,9 +38,9 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "feel");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(rot),
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(rot),
|
||||
0));
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
{
|
||||
if ( 0 == u3h(nug) ) {
|
||||
return u3k(u3t(nug));
|
||||
}
|
||||
}
|
||||
else if ( 11 == u3h(nug) ) {
|
||||
return _mull_cove(u3t(u3t(nug)));
|
||||
}
|
||||
@ -89,11 +89,11 @@
|
||||
u3_noun gat = u3j_hook(von, "mile");
|
||||
|
||||
// fprintf(stderr, "mile\r\n");
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(dox),
|
||||
u3x_sam_6,
|
||||
u3k(mel),
|
||||
u3k(mel),
|
||||
u3x_sam_14,
|
||||
u3k(nym),
|
||||
u3x_sam_30,
|
||||
@ -178,10 +178,10 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("_mull_cnts-emul", von, "emul");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(gol),
|
||||
u3x_sam_6,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(gol),
|
||||
u3x_sam_6,
|
||||
u3k(dox),
|
||||
u3x_sam_14,
|
||||
u3k(hyp),
|
||||
@ -369,7 +369,7 @@
|
||||
if ( c3y != u3h(fid) ) {
|
||||
return u3m_error("mull-bonk-x");
|
||||
}
|
||||
else {
|
||||
else {
|
||||
u3_noun pp_fid = u3h(u3t(fid));
|
||||
u3_noun qp_fid = u3t(u3t(fid));
|
||||
|
||||
@ -385,7 +385,7 @@
|
||||
if ( c3y != u3h(gax) ) {
|
||||
return u3m_error("mull-bonk-x");
|
||||
}
|
||||
else {
|
||||
else {
|
||||
u3_noun pp_gax = u3h(u3t(gax));
|
||||
u3_noun qp_gax = u3t(u3t(gax));
|
||||
|
||||
@ -405,7 +405,7 @@
|
||||
|
||||
u3z(old_axis);
|
||||
u3z(new_axis);
|
||||
u3z(gax);
|
||||
u3z(gax);
|
||||
u3z(fid);
|
||||
|
||||
return _mull_both(van, gol, _mull_bean());
|
||||
@ -557,10 +557,10 @@
|
||||
_mull_used();
|
||||
{
|
||||
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
|
||||
u3_noun pro = u3nc(u3qfu_wrap(van,
|
||||
u3_noun pro = u3nc(u3qfu_wrap(van,
|
||||
u3h(vat),
|
||||
c3__iron),
|
||||
u3qfu_wrap(van,
|
||||
u3qfu_wrap(van,
|
||||
u3t(vat),
|
||||
c3__iron));
|
||||
|
||||
@ -573,7 +573,7 @@
|
||||
_mull_used();
|
||||
{
|
||||
u3_noun vat = _mull_in(van, sut, gol, dox, p_gen);
|
||||
u3_noun pro = u3nc(u3qfu_wrap(van,
|
||||
u3_noun pro = u3nc(u3qfu_wrap(van,
|
||||
u3h(vat),
|
||||
c3__zinc),
|
||||
u3qfu_wrap(van,
|
||||
@ -617,7 +617,7 @@
|
||||
case c3__tune: p_gen = u3t(gen);
|
||||
_mull_used();
|
||||
{
|
||||
return u3nc(u3qf_face(p_gen, sut),
|
||||
return u3nc(u3qf_face(p_gen, sut),
|
||||
u3qf_face(p_gen, dox));
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
u3x_trel(hem, &n_hem, &l_hem, &r_hem);
|
||||
|
||||
if ( (c3n == _nest_deep(van, sut, tel, ref, l_dab, l_hem, gil)) ||
|
||||
(c3n == _nest_deep(van, sut, tel, ref, r_dab, r_hem, gil)) )
|
||||
(c3n == _nest_deep(van, sut, tel, ref, r_dab, r_hem, gil)) )
|
||||
{
|
||||
return c3n;
|
||||
}
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
if ( c3n == u3r_sing(pn_dab, pn_hem) ) {
|
||||
return c3n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun vis = u3qfu_play(van, sut, qn_dab);
|
||||
u3_noun lon = u3qfu_play(van, ref, qn_hem);
|
||||
@ -80,7 +80,7 @@
|
||||
u3x_trel(vim, &n_vim, &l_vim, &r_vim);
|
||||
|
||||
if ( (c3n == _nest_dope(van, sut, tel, ref, l_dom, l_vim, gil)) ||
|
||||
(c3n == _nest_dope(van, sut, tel, ref, r_dom, r_vim, gil)) )
|
||||
(c3n == _nest_dope(van, sut, tel, ref, r_dom, r_vim, gil)) )
|
||||
{
|
||||
return c3n;
|
||||
}
|
||||
@ -109,8 +109,8 @@
|
||||
u3_noun pq_sut, qq_sut, rq_sut;
|
||||
u3_noun pq_ref, qq_ref, rq_ref;
|
||||
u3_noun prq_sut, qrq_sut, prq_ref, qrq_ref;
|
||||
u3_noun ppq_sut, qpq_sut, rpq_sut;
|
||||
u3_noun ppq_ref, qpq_ref, rpq_ref;
|
||||
u3_noun ppq_sut, qpq_sut, rpq_sut;
|
||||
u3_noun ppq_ref, qpq_ref, rpq_ref;
|
||||
u3_noun ret;
|
||||
|
||||
u3x_trel(sut, 0, &p_sut, &q_sut);
|
||||
@ -118,7 +118,7 @@
|
||||
|
||||
u3x_trel(q_sut, &pq_sut, &qq_sut, &rq_sut);
|
||||
u3x_trel(q_ref, &pq_ref, &qq_ref, &rq_ref);
|
||||
|
||||
|
||||
u3x_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut);
|
||||
u3x_trel(pq_ref, &ppq_ref, &qpq_ref, &rpq_ref);
|
||||
|
||||
@ -141,9 +141,9 @@
|
||||
return c3n;
|
||||
}
|
||||
else {
|
||||
if ( (rpq_sut != rpq_ref) &&
|
||||
if ( (rpq_sut != rpq_ref) &&
|
||||
(c3__lead != rpq_sut) &&
|
||||
(c3__gold != rpq_ref) )
|
||||
(c3__gold != rpq_ref) )
|
||||
{
|
||||
return c3n;
|
||||
}
|
||||
@ -224,7 +224,7 @@
|
||||
u3_noun sut,
|
||||
u3_noun tel,
|
||||
u3_noun ref,
|
||||
u3_noun seg,
|
||||
u3_noun seg,
|
||||
u3_noun reg,
|
||||
u3_noun gil)
|
||||
{
|
||||
@ -246,13 +246,13 @@
|
||||
case c3__atom: {
|
||||
if ( (c3n == u3r_trel(sut, 0, &p_sut, &q_sut)) ) {
|
||||
return u3m_bail(c3__fail);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( c3y == u3r_pq(ref, c3__atom, &p_ref, &q_ref) ) {
|
||||
if ( (c3n == u3qf_fitz(p_sut, p_ref)) ||
|
||||
( (c3y == u3du(q_sut)) &&
|
||||
( (c3y == u3du(q_sut)) &&
|
||||
( (c3n == u3du(q_ref)) ||
|
||||
(c3n == u3r_sing(q_sut, q_ref)))) )
|
||||
(c3n == u3r_sing(q_sut, q_ref)))) )
|
||||
{
|
||||
return c3n;
|
||||
}
|
||||
@ -335,7 +335,7 @@
|
||||
u3z(hud);
|
||||
|
||||
return c3y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun gus = u3qdi_put(seg, sut);
|
||||
u3_noun zoc = u3qdi_put(gil, hud);
|
||||
@ -403,8 +403,8 @@
|
||||
else {
|
||||
pro = _nest_dext_to(van, sut, tel, ref, seg, reg, gil);
|
||||
|
||||
if ( ((c3y == pro) && (u3_nul == reg)) ||
|
||||
((c3n == pro) && (u3_nul == seg)) )
|
||||
if ( ((c3y == pro) && (u3_nul == reg)) ||
|
||||
((c3n == pro) && (u3_nul == seg)) )
|
||||
{
|
||||
return u3z_save_2(fun_m, sut, ref, pro);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@
|
||||
else {
|
||||
|
||||
if ( way != c3__read ) {
|
||||
return u3m_error("payload-block");
|
||||
return u3m_error("payload-block");
|
||||
}
|
||||
|
||||
u3_noun typ;
|
||||
|
@ -20,17 +20,17 @@
|
||||
|
||||
static u3_noun
|
||||
_play_rock(u3_noun odo, u3_noun bob)
|
||||
{
|
||||
{
|
||||
if ( c3y == u3ud(bob) ) {
|
||||
return u3nq(c3__atom, u3k(odo), u3_nul, u3k(bob));
|
||||
}
|
||||
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
|
||||
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
|
||||
_play_rock(odo, u3t(bob)));
|
||||
}
|
||||
|
||||
static u3_noun
|
||||
_play_sand(u3_noun odo, u3_noun bob)
|
||||
{
|
||||
{
|
||||
if ( c3y == u3ud(bob) ) {
|
||||
if ( 'n' == odo ) {
|
||||
if ( (bob != 0) ) {
|
||||
@ -48,7 +48,7 @@
|
||||
}
|
||||
return u3nt(c3__atom, u3k(odo), u3_nul);
|
||||
}
|
||||
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
|
||||
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
|
||||
_play_rock(odo, u3t(bob)));
|
||||
}
|
||||
|
||||
@ -87,14 +87,14 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "feel");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(rot),
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
u3k(rot),
|
||||
0));
|
||||
}
|
||||
|
||||
#if 0
|
||||
static u3_noun
|
||||
static u3_noun
|
||||
_play_loc_term(u3_noun van,
|
||||
u3_noun loc)
|
||||
{
|
||||
@ -123,10 +123,10 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("_play_cnts-epla", von, "epla");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(hyp),
|
||||
u3x_sam_3,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(hyp),
|
||||
u3x_sam_3,
|
||||
u3k(rig),
|
||||
0));
|
||||
}
|
||||
@ -312,12 +312,12 @@
|
||||
return _play_bean();
|
||||
}
|
||||
|
||||
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
|
||||
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
|
||||
_play_used();
|
||||
{
|
||||
return _play_bean();
|
||||
}
|
||||
|
||||
|
||||
case c3__dtls: p_gen = u3t(gen);
|
||||
_play_used();
|
||||
{
|
||||
|
@ -48,7 +48,7 @@
|
||||
} else {
|
||||
u3_noun old = u3nc(u3nc(u3k(p_sut), u3k(q_sut)), u3_nul);
|
||||
u3_noun ret;
|
||||
|
||||
|
||||
ret = u3qfu_rest(van, sut, old);
|
||||
u3z(old);
|
||||
return ret;
|
||||
|
@ -12,10 +12,10 @@
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_cook("u3qfu_tack-tack", von, "tack");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(hyp),
|
||||
u3x_sam_3,
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
u3k(hyp),
|
||||
u3x_sam_3,
|
||||
u3k(mur),
|
||||
0));
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
{
|
||||
if ( u3_nul == p_sut ) {
|
||||
return u3_nul;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3nc(_cqfu_wrap(van, u3h(p_sut), yoz),
|
||||
_wrap_fork(van, u3t(p_sut), yoz));
|
||||
|
21
jets/tree.c
21
jets/tree.c
@ -1,5 +1,18 @@
|
||||
/* j/tree.c
|
||||
/*
|
||||
To generate the hashes, take the sha256 of the jammed battery. For example:
|
||||
|
||||
```
|
||||
> `@ux`(shax (jam -:ripn))
|
||||
0x2759.a693.1e9e.f9a5.2c8e.ee43.1088.43d9.4d39.32a6.b04f.86cb.6ba1.5553.4329.3a28
|
||||
```
|
||||
|
||||
Becomes:
|
||||
|
||||
```
|
||||
2759a6931e9ef9a52c8eee43108843d94d3932a6b04f86cb6ba1555343293a28
|
||||
```
|
||||
*/
|
||||
|
||||
#include "all.h"
|
||||
|
||||
static u3j_harm _141_hex_aes_ecba_en_a[] = {{".2", u3wea_ecba_en}, {}};
|
||||
@ -1473,6 +1486,11 @@ static c3_c* _141_two_rip_ha[] = {
|
||||
"e8e0b834aded0d2738bcf38a93bf373d412a51e0cee7f274277a6393e634a65e",
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_two_ripn_a[] = {{".2", u3wc_ripn, c3y}, {}};
|
||||
static c3_c* _141_two_ripn_ha[] = {
|
||||
"2759a6931e9ef9a52c8eee43108843d94d3932a6b04f86cb6ba1555343293a28",
|
||||
0
|
||||
};
|
||||
static u3j_harm _141_two_rsh_a[] = {{".2", u3wc_rsh, c3y}, {}};
|
||||
static c3_c* _141_two_rsh_ha[] = {
|
||||
"a401145b4c11ec8d17a729fe30f06c295865ffed1b970b0a788f0fec1ed0a703",
|
||||
@ -1710,6 +1728,7 @@ static u3j_core _141_two_d[] =
|
||||
{ "rep", 7, _141_two_rep_a, 0, _141_two_rep_ha },
|
||||
{ "rev", 7, _141_two_rev_a, 0, _141_two_rev_ha },
|
||||
{ "rip", 7, _141_two_rip_a, 0, _141_two_rip_ha },
|
||||
{ "ripn", 7, _141_two_ripn_a, 0, _141_two_ripn_ha },
|
||||
{ "rsh", 7, _141_two_rsh_a, 0, _141_two_rsh_ha },
|
||||
{ "swp", 7, _141_two_swp_a, 0, _141_two_swp_ha },
|
||||
{ "rub", 7, _141_two_rub_a, 0, _141_two_rub_ha },
|
||||
|
@ -73,6 +73,7 @@ jets_c_src = [
|
||||
'jets/c/rep.c',
|
||||
'jets/c/rev.c',
|
||||
'jets/c/rip.c',
|
||||
'jets/c/ripn.c',
|
||||
'jets/c/rsh.c',
|
||||
'jets/c/swp.c',
|
||||
'jets/c/sqt.c'
|
||||
|
104
noun/allocate.c
104
noun/allocate.c
@ -257,7 +257,7 @@ _ca_box_make_hat(c3_w len_w, c3_w ald_w, c3_w alp_w, c3_w use_w)
|
||||
{
|
||||
c3_w pad_w, siz_w;
|
||||
u3_post all_p;
|
||||
|
||||
|
||||
if ( c3y == u3a_is_north(u3R) ) {
|
||||
all_p = u3R->hat_p;
|
||||
pad_w = _me_align_pad(all_p, ald_w, alp_w);
|
||||
@ -267,7 +267,7 @@ _ca_box_make_hat(c3_w len_w, c3_w ald_w, c3_w alp_w, c3_w use_w)
|
||||
return 0;
|
||||
}
|
||||
u3R->hat_p = (all_p + siz_w);
|
||||
}
|
||||
}
|
||||
else {
|
||||
all_p = (u3R->hat_p - len_w);
|
||||
pad_w = _me_align_dap(all_p, ald_w, alp_w);
|
||||
@ -305,10 +305,10 @@ _me_road_all_cap(c3_w len_w)
|
||||
if ( c3y == u3a_is_north(u3R) ) {
|
||||
u3R->cap_p -= len_w;
|
||||
return u3a_into(u3R->cap_p);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_post all_p;
|
||||
|
||||
|
||||
all_p = u3R->cap_p;
|
||||
u3R->cap_p += len_w;
|
||||
return u3a_into(all_p);
|
||||
@ -323,10 +323,10 @@ void
|
||||
u3a_sane(void)
|
||||
{
|
||||
c3_w i_w;
|
||||
|
||||
|
||||
for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) {
|
||||
u3a_fbox* fre_u = u3R->all.fre_u[i_w];
|
||||
|
||||
|
||||
while ( fre_u ) {
|
||||
if ( fre_u == u3R->all.fre_u[i_w] ) {
|
||||
c3_assert(fre_u->pre_u == 0);
|
||||
@ -371,14 +371,14 @@ void
|
||||
u3a_reclaim(void)
|
||||
{
|
||||
if ( (0 == u3R->cax.har_p) ||
|
||||
(0 == u3to(u3h_root, u3R->cax.har_p)->use_w) )
|
||||
(0 == u3to(u3h_root, u3R->cax.har_p)->use_w) )
|
||||
{
|
||||
fprintf(stderr, "allocate: reclaim: memo cache: empty\r\n");
|
||||
u3m_bail(c3__meme);
|
||||
}
|
||||
|
||||
#if 1
|
||||
fprintf(stderr, "allocate: reclaim: half of %d entries\r\n",
|
||||
#if 1
|
||||
fprintf(stderr, "allocate: reclaim: half of %d entries\r\n",
|
||||
u3to(u3h_root, u3R->cax.har_p)->use_w);
|
||||
|
||||
u3h_trim_to(u3R->cax.har_p, u3to(u3h_root, u3R->cax.har_p)->use_w / 2);
|
||||
@ -420,7 +420,7 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
// nothing in top free list; chip away at the hat
|
||||
//
|
||||
u3a_box* box_u;
|
||||
|
||||
|
||||
// memory nearly empty; reclaim; should not be needed
|
||||
//
|
||||
// if ( (u3a_open(u3R) + u3R->all.fre_w) < 65536 ) { u3a_reclaim(); }
|
||||
@ -452,7 +452,7 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
*/
|
||||
pfr_p = &(u3to(u3a_fbox, *pfr_p)->nex_p);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_box* box_u = &(u3to(u3a_fbox, *pfr_p)->box_u);
|
||||
|
||||
@ -463,17 +463,17 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
_box_count(-(box_u->siz_w));
|
||||
{
|
||||
{
|
||||
c3_assert((0 == u3to(u3a_fbox, *pfr_p)->pre_p) ||
|
||||
(u3to(u3a_fbox, u3to(u3a_fbox, *pfr_p)->pre_p)->nex_p
|
||||
c3_assert((0 == u3to(u3a_fbox, *pfr_p)->pre_p) ||
|
||||
(u3to(u3a_fbox, u3to(u3a_fbox, *pfr_p)->pre_p)->nex_p
|
||||
== (*pfr_p)));
|
||||
|
||||
c3_assert((0 == u3to(u3a_fbox, *pfr_p)->nex_p) ||
|
||||
(u3to(u3a_fbox, u3to(u3a_fbox, *pfr_p)->nex_p)->pre_p
|
||||
c3_assert((0 == u3to(u3a_fbox, *pfr_p)->nex_p) ||
|
||||
(u3to(u3a_fbox, u3to(u3a_fbox, *pfr_p)->nex_p)->pre_p
|
||||
== (*pfr_p)));
|
||||
}
|
||||
|
||||
if ( 0 != u3to(u3a_fbox, *pfr_p)->nex_p ) {
|
||||
u3to(u3a_fbox, u3to(u3a_fbox, *pfr_p)->nex_p)->pre_p =
|
||||
u3to(u3a_fbox, u3to(u3a_fbox, *pfr_p)->nex_p)->pre_p =
|
||||
u3to(u3a_fbox, *pfr_p)->pre_p;
|
||||
}
|
||||
*pfr_p = u3to(u3a_fbox, *pfr_p)->nex_p;
|
||||
@ -483,7 +483,7 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
*/
|
||||
if ( (siz_w + u3a_minimum) <= box_u->siz_w ) {
|
||||
/* Split the block.
|
||||
*/
|
||||
*/
|
||||
c3_w* box_w = ((c3_w *)(void *)box_u);
|
||||
c3_w* end_w = box_w + siz_w;
|
||||
c3_w lef_w = (box_u->siz_w - siz_w);
|
||||
@ -496,7 +496,7 @@ _ca_willoc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
box_u->use_w = 1;
|
||||
|
||||
#ifdef U3_MEMORY_DEBUG
|
||||
box_u->cod_w = u3_Code;
|
||||
box_u->cod_w = u3_Code;
|
||||
#endif
|
||||
return u3a_boxto(box_u);
|
||||
}
|
||||
@ -512,7 +512,7 @@ static void*
|
||||
_ca_walloc(c3_w len_w, c3_w ald_w, c3_w alp_w)
|
||||
{
|
||||
void* ptr_v;
|
||||
|
||||
|
||||
while ( 1 ) {
|
||||
ptr_v = _ca_willoc(len_w, ald_w, alp_w);
|
||||
if ( 0 != ptr_v ) {
|
||||
@ -529,7 +529,7 @@ void*
|
||||
u3a_walloc(c3_w len_w)
|
||||
{
|
||||
void* ptr_v;
|
||||
|
||||
|
||||
ptr_v = _ca_walloc(len_w, 1, 0);
|
||||
|
||||
#if 0
|
||||
@ -538,7 +538,7 @@ u3a_walloc(c3_w len_w)
|
||||
static int xuc_i;
|
||||
|
||||
printf("xuc_i %d\r\n", xuc_i);
|
||||
if ( 1 == xuc_i ) {
|
||||
if ( 1 == xuc_i ) {
|
||||
u3a_box* box_u = u3a_botox(ptr_v);
|
||||
|
||||
box_u->cod_w = 999;
|
||||
@ -556,7 +556,7 @@ u3a_wealloc(void* lag_v, c3_w len_w)
|
||||
{
|
||||
if ( !lag_v ) {
|
||||
return u3a_malloc(len_w);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_box* box_u = u3a_botox(lag_v);
|
||||
c3_w* old_w = lag_v;
|
||||
@ -685,7 +685,7 @@ u3a_cellblock(c3_w num_w)
|
||||
if ( c3y == u3a_is_north(u3R) ) {
|
||||
if ( u3R->cap_p <= (u3R->hat_p + (num_w * u3a_minimum)) ) {
|
||||
return c3n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_post hat_p = u3R->hat_p;
|
||||
u3_post cel_p = u3R->all.cel_p;
|
||||
@ -719,7 +719,7 @@ u3a_cellblock(c3_w num_w)
|
||||
else {
|
||||
if ( (u3R->cap_p + (num_w * u3a_minimum)) >= u3R->hat_p ) {
|
||||
return c3n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_post hat_p = u3R->hat_p;
|
||||
u3_post cel_p = u3R->all.cel_p;
|
||||
@ -751,7 +751,7 @@ u3a_cellblock(c3_w num_w)
|
||||
_box_count(num_w * u3a_minimum);
|
||||
return c3y;
|
||||
}
|
||||
|
||||
|
||||
/* u3a_celloc(): allocate a cell.
|
||||
*/
|
||||
c3_w*
|
||||
@ -770,7 +770,7 @@ u3a_celloc(void)
|
||||
// no cell allocator on home road
|
||||
//
|
||||
return u3a_walloc(c3_wiseof(u3a_cell));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( c3n == u3a_cellblock(4096) ) {
|
||||
return u3a_walloc(c3_wiseof(u3a_cell));
|
||||
@ -805,10 +805,10 @@ u3a_cfree(c3_w* cel_w)
|
||||
|
||||
if ( u3R == &(u3H->rod_u) ) {
|
||||
return u3a_wfree(cel_w);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_box* box_u = u3a_botox(cel_w);
|
||||
u3p(u3a_fbox) fre_p = u3of(u3a_fbox, box_u);
|
||||
u3p(u3a_fbox) fre_p = u3of(u3a_fbox, box_u);
|
||||
|
||||
_box_count(u3a_minimum);
|
||||
|
||||
@ -824,7 +824,7 @@ u3a_realloc(void* lag_v, size_t len_i)
|
||||
{
|
||||
if ( !lag_v ) {
|
||||
return u3a_malloc(len_i);
|
||||
}
|
||||
}
|
||||
else {
|
||||
c3_w len_w = (c3_w)((len_i + 3) >> 2);
|
||||
c3_w* lag_w = lag_v;
|
||||
@ -908,11 +908,11 @@ _me_wash_north(u3_noun dog)
|
||||
|
||||
if ( _(u3a_is_pom(dog)) ) {
|
||||
u3a_cell* god_u = (u3a_cell *)(void *)dog_u;
|
||||
|
||||
|
||||
_me_wash_north_in(god_u->hed);
|
||||
_me_wash_north_in(god_u->tel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* _me_wash_south(): clean up mug slots after copy.
|
||||
@ -941,11 +941,11 @@ _me_wash_south(u3_noun dog)
|
||||
|
||||
if ( _(u3a_is_pom(dog)) ) {
|
||||
u3a_cell* god_u = (u3a_cell *)(void *)dog_u;
|
||||
|
||||
|
||||
_me_wash_south_in(god_u->hed);
|
||||
_me_wash_south_in(god_u->tel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* u3a_wash(): wash all lazy mugs. RETAIN.
|
||||
@ -960,7 +960,7 @@ u3a_wash(u3_noun som)
|
||||
if ( _(u3a_north_is_junior(u3R, som)) ) {
|
||||
_me_wash_north(som);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( _(u3a_south_is_junior(u3R, som)) ) {
|
||||
_me_wash_south(som);
|
||||
@ -1040,7 +1040,7 @@ _me_copy_north_in(u3_noun som)
|
||||
if ( _(u3a_is_cat(som)) ) {
|
||||
return som;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
u3_noun dog = som;
|
||||
|
||||
if ( _(u3a_north_is_senior(u3R, dog)) ) {
|
||||
@ -1067,7 +1067,7 @@ _me_copy_north(u3_noun dog)
|
||||
_me_gain_use(dog);
|
||||
}
|
||||
return dog;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_noun* dog_u = u3a_to_ptr(dog);
|
||||
|
||||
@ -1096,7 +1096,7 @@ _me_copy_north(u3_noun dog)
|
||||
*/
|
||||
old_u->mug_w = new;
|
||||
return new;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_atom* old_u = u3a_to_ptr(dog);
|
||||
c3_w* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom));
|
||||
@ -1132,7 +1132,7 @@ _me_copy_south_in(u3_noun som)
|
||||
if ( _(u3a_is_cat(som)) ) {
|
||||
return som;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
u3_noun dog = som;
|
||||
|
||||
if ( _(u3a_south_is_senior(u3R, dog)) ) {
|
||||
@ -1159,7 +1159,7 @@ _me_copy_south(u3_noun dog)
|
||||
_me_gain_use(dog);
|
||||
}
|
||||
return dog;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_noun* dog_u = u3a_to_ptr(dog);
|
||||
|
||||
@ -1197,7 +1197,7 @@ _me_copy_south(u3_noun dog)
|
||||
*/
|
||||
old_u->mug_w = new;
|
||||
return new;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3a_atom* old_u = u3a_to_ptr(dog);
|
||||
c3_w* new_w = u3a_walloc(old_u->len_w + c3_wiseof(u3a_atom));
|
||||
@ -1482,7 +1482,7 @@ u3a_use(u3_noun som)
|
||||
{
|
||||
if ( _(u3a_is_cat(som)) ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
c3_w* dog_w = u3a_to_ptr(som);
|
||||
u3a_box* box_u = u3a_botox(dog_w);
|
||||
@ -1512,15 +1512,15 @@ c3_w
|
||||
u3a_mark_ptr(void* ptr_v)
|
||||
{
|
||||
if ( _(u3a_is_north(u3R)) ) {
|
||||
if ( !((ptr_v >= u3a_into(u3R->rut_p)) &&
|
||||
if ( !((ptr_v >= u3a_into(u3R->rut_p)) &&
|
||||
(ptr_v < u3a_into(u3R->hat_p))) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( !((ptr_v >= u3a_into(u3R->hat_p)) &&
|
||||
(ptr_v < u3a_into(u3R->rut_p))) )
|
||||
if ( !((ptr_v >= u3a_into(u3R->hat_p)) &&
|
||||
(ptr_v < u3a_into(u3R->rut_p))) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -1558,7 +1558,7 @@ u3a_mark_ptr(void* ptr_v)
|
||||
else if ( use_ws < 0 ) {
|
||||
use_ws -= 1;
|
||||
siz_w = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
use_ws = -1;
|
||||
siz_w = box_u->siz_w;
|
||||
@ -1792,13 +1792,13 @@ u3a_sweep(void)
|
||||
c3_w fre_w = 0;
|
||||
c3_w i_w;
|
||||
|
||||
end_w = _(u3a_is_north(u3R))
|
||||
end_w = _(u3a_is_north(u3R))
|
||||
? (u3R->hat_p - u3R->rut_p)
|
||||
: (u3R->rut_p - u3R->hat_p);
|
||||
|
||||
for ( i_w = 0; i_w < u3a_fbox_no; i_w++ ) {
|
||||
u3p(u3a_fbox) fre_p = u3R->all.fre_p[i_w];
|
||||
|
||||
|
||||
while ( fre_p ) {
|
||||
u3a_fbox* fre_u = u3to(u3a_fbox, fre_p);
|
||||
|
||||
@ -1885,10 +1885,10 @@ u3a_sweep(void)
|
||||
}
|
||||
|
||||
#ifdef U3_MEMORY_DEBUG
|
||||
tot_w = _(u3a_is_north(u3R))
|
||||
tot_w = _(u3a_is_north(u3R))
|
||||
? u3R->mat_p - u3R->rut_p
|
||||
: u3R->rut_p - u3R->mat_p;
|
||||
caf_w = _(u3a_is_north(u3R))
|
||||
caf_w = _(u3a_is_north(u3R))
|
||||
? u3R->mat_p - u3R->cap_p
|
||||
: u3R->cap_p - u3R->mat_p;
|
||||
|
||||
@ -2018,7 +2018,7 @@ _ca_detect(u3p(u3h_root) har_p, u3_noun fum, u3_noun som, c3_d axe_d)
|
||||
}
|
||||
}
|
||||
|
||||
/* u3a_detect(): for debugging, check if (som) is referenced from (fum).
|
||||
/* u3a_detect(): for debugging, check if (som) is referenced from (fum).
|
||||
**
|
||||
** (som) and (fum) are both RETAINED.
|
||||
*/
|
||||
@ -2085,7 +2085,7 @@ u3a_mint(c3_w* sal_w, c3_w len_w)
|
||||
#ifdef U3_MEMORY_DEBUG
|
||||
/* u3a_lush(): leak push.
|
||||
*/
|
||||
c3_w
|
||||
c3_w
|
||||
u3a_lush(c3_w lab_w)
|
||||
{
|
||||
c3_w cod_w = u3_Code;
|
||||
@ -2104,7 +2104,7 @@ u3a_lop(c3_w lab_w)
|
||||
#else
|
||||
/* u3a_lush(): leak push.
|
||||
*/
|
||||
c3_w
|
||||
c3_w
|
||||
u3a_lush(c3_w lab_w)
|
||||
{
|
||||
return 0;
|
||||
|
@ -176,7 +176,7 @@ _ch_some_add(void* han_v, c3_w lef_w, c3_w rem_w, u3_noun kev, c3_w *use_w)
|
||||
else return _ch_node_add((u3h_node*)han_v, lef_w, rem_w, kev, use_w);
|
||||
}
|
||||
|
||||
/* _ch_slot_put(): store a key-value pair in a u3h_slot (root or node)
|
||||
/* _ch_slot_put(): store a key-value pair in a u3h_slot (root or node)
|
||||
*/
|
||||
static void
|
||||
_ch_slot_put(u3h_slot* sot_w, u3_noun kev, c3_w lef_w, c3_w rem_w, c3_w* use_w)
|
||||
@ -202,10 +202,10 @@ _ch_slot_put(u3h_slot* sot_w, u3_noun kev, c3_w lef_w, c3_w rem_w, c3_w* use_w)
|
||||
}
|
||||
}
|
||||
else {
|
||||
void* hav_v = _ch_some_add(u3h_slot_to_node(*sot_w),
|
||||
lef_w,
|
||||
rem_w,
|
||||
kev,
|
||||
void* hav_v = _ch_some_add(u3h_slot_to_node(*sot_w),
|
||||
lef_w,
|
||||
rem_w,
|
||||
kev,
|
||||
use_w);
|
||||
|
||||
c3_assert( c3y == u3h_slot_is_node(*sot_w) );
|
||||
@ -274,7 +274,7 @@ _ch_trim_buck(u3h_root* har_u, u3h_slot* sot_w)
|
||||
c3_w i_w, len_w;
|
||||
u3h_buck* hab_u = u3h_slot_to_node(*sot_w);
|
||||
|
||||
for ( har_u->arm_u.buc_o = c3y, len_w = hab_u->len_w;
|
||||
for ( har_u->arm_u.buc_o = c3y, len_w = hab_u->len_w;
|
||||
har_u->arm_u.inx_w < len_w;
|
||||
har_u->arm_u.inx_w += 1 )
|
||||
{
|
||||
@ -358,7 +358,7 @@ _ch_trim_slot(u3h_root* har_u, u3h_slot *sot_w, c3_w lef_w, c3_w rem_w)
|
||||
har_u->arm_u.mug_w = _ch_skip_slot(har_u->arm_u.mug_w, lef_w);
|
||||
return c3y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* _ch_trim_slot(): trim one entry from a hashtable
|
||||
*/
|
||||
@ -369,7 +369,7 @@ _ch_trim_root(u3h_root* har_u)
|
||||
c3_w inx_w = mug_w >> 25; // 6 bits
|
||||
c3_w rem_w = mug_w & ((1 << 25) - 1);
|
||||
u3h_slot* sot_w = &(har_u->sot_w[inx_w]);
|
||||
|
||||
|
||||
return _ch_trim_slot(har_u, sot_w, 25, rem_w);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ u3i_cell(u3_noun a, u3_noun b)
|
||||
|
||||
#ifdef U3_CPU_DEBUG
|
||||
u3R->pro.cel_d++;
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
// c3_w* nov_w = u3a_walloc(c3_wiseof(u3a_cell));
|
||||
c3_w* nov_w = u3a_celloc();
|
||||
@ -495,7 +495,7 @@ u3i_list(u3_weak one, ...);
|
||||
|
||||
if ( c3n == u3a_is_cell(som) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3i_cell
|
||||
(_molt_apply(u3a_h(som), cut_w, pms_m),
|
||||
@ -505,7 +505,7 @@ u3i_list(u3_weak one, ...);
|
||||
}
|
||||
|
||||
__attribute__((no_sanitize("address")))
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3i_molt(u3_noun som, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
28
noun/jets.c
28
noun/jets.c
@ -125,7 +125,7 @@ _cj_bash(u3_noun bat)
|
||||
c3_w* wor_w;
|
||||
c3_y* fat_y;
|
||||
c3_y dig_y[32];
|
||||
|
||||
|
||||
wor_w = u3qe_jam_buf(bat, &bit_w);
|
||||
met_w = bit_w >> 3;
|
||||
if ( bit_w != met_w << 3 ) {
|
||||
@ -256,8 +256,8 @@ _cj_axis(u3_noun fol)
|
||||
if ( !_(u3r_cell(fol, &p_fol, &q_fol)) ||
|
||||
(0 != p_fol) ||
|
||||
(!_(u3a_is_cat(q_fol))) )
|
||||
{
|
||||
fprintf(stderr, "axis: bad a\r\n");
|
||||
{
|
||||
fprintf(stderr, "axis: bad a\r\n");
|
||||
return 0;
|
||||
}
|
||||
return q_fol;
|
||||
@ -395,16 +395,16 @@ _cj_by_gut(u3_noun a, u3_noun b)
|
||||
|
||||
/* _cj_chum(): decode chum as string.
|
||||
*/
|
||||
static c3_c*
|
||||
static c3_c*
|
||||
_cj_chum(u3_noun chu)
|
||||
{
|
||||
if ( _(u3ud(chu)) ) {
|
||||
return u3r_string(chu);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun h_chu = u3h(chu);
|
||||
u3_noun t_chu = u3t(chu);
|
||||
|
||||
|
||||
if ( !_(u3a_is_cat(t_chu)) ) {
|
||||
return 0;
|
||||
} else {
|
||||
@ -802,8 +802,8 @@ _cj_hot_mean(c3_l par_l, u3_noun nam)
|
||||
while ( (cop_u = &dev_u[i_l])->cos_c ) {
|
||||
if ( _(u3r_sing_c(cop_u->cos_c, nam)) ) {
|
||||
#if 0
|
||||
fprintf(stderr, "hot: bound jet %d/%s/%s/\r\n",
|
||||
cop_u->jax_l,
|
||||
fprintf(stderr, "hot: bound jet %d/%s/%s/\r\n",
|
||||
cop_u->jax_l,
|
||||
cop_u->cos_c,
|
||||
par_u ? par_u->cos_c : "~");
|
||||
#endif
|
||||
@ -854,7 +854,7 @@ _cj_soft(u3_noun cor, u3_noun axe)
|
||||
|
||||
/* _cj_kick_z(): try to kick by jet. If no kick, produce u3_none.
|
||||
**
|
||||
** `cor` is RETAINED iff there is no kick, TRANSFERRED if one.
|
||||
** `cor` is RETAINED iff there is no kick, TRANSFERRED if one.
|
||||
** `axe` is RETAINED.
|
||||
*/
|
||||
static u3_weak
|
||||
@ -915,7 +915,7 @@ _cj_kick_z(u3_noun cor, u3j_core* cop_u, u3j_harm* ham_u, u3_atom axe)
|
||||
fprintf(stderr, "test: %s %s: mismatch: good %x, bad %x\r\n",
|
||||
cop_u->cos_c,
|
||||
(!strcmp(".2", ham_u->fcs_c)) ? "$" : ham_u->fcs_c,
|
||||
u3r_mug(ame),
|
||||
u3r_mug(ame),
|
||||
u3r_mug(pro));
|
||||
ham_u->liv = c3n;
|
||||
|
||||
@ -1034,7 +1034,7 @@ _cj_hook_in(u3_noun cor,
|
||||
/* u3j_soft(): execute soft hook.
|
||||
*/
|
||||
u3_noun
|
||||
u3j_soft(u3_noun cor,
|
||||
u3j_soft(u3_noun cor,
|
||||
const c3_c* tam_c)
|
||||
{
|
||||
u3_noun pro;
|
||||
@ -1222,7 +1222,7 @@ _cj_sink(u3_noun cor, u3_noun axe)
|
||||
|
||||
/* u3j_kick(): new kick.
|
||||
**
|
||||
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
|
||||
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
|
||||
** is no kick, TRANSFERRED if one.
|
||||
*/
|
||||
u3_weak
|
||||
@ -1630,7 +1630,7 @@ u3j_cook(const c3_c* key_c,
|
||||
pro = _cj_burn(han_u->sit_u.pog_p, inn);
|
||||
}
|
||||
u3z(cor);
|
||||
|
||||
|
||||
u3z(key);
|
||||
u3z(tam);
|
||||
u3t_off(glu_o);
|
||||
@ -1750,7 +1750,7 @@ _cj_minx(u3_noun cey, u3_noun cor)
|
||||
}
|
||||
pel = _cj_spot(par, NULL);
|
||||
if ( u3_none == pel ) {
|
||||
fprintf(stderr, "fund: in %s, parent %x not found at %d\r\n",
|
||||
fprintf(stderr, "fund: in %s, parent %x not found at %d\r\n",
|
||||
u3r_string(nam),
|
||||
u3r_mug(u3h(par)),
|
||||
axe);
|
||||
|
120
noun/manage.c
120
noun/manage.c
@ -64,7 +64,7 @@
|
||||
|
||||
/* u3m_soft_top(): top-level safety wrapper.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
c3_w pad_w, // base memory pad
|
||||
u3_funk fun_f,
|
||||
@ -123,7 +123,7 @@ static void _cm_overflow(void *arg1, void *arg2, void *arg3)
|
||||
/* _cm_signal_handle(): handle a signal in general.
|
||||
*/
|
||||
static void
|
||||
_cm_signal_handle(c3_l sig_l)
|
||||
_cm_signal_handle(c3_l sig_l)
|
||||
{
|
||||
if ( c3__over == sig_l ) {
|
||||
sigsegv_leave_handler(_cm_overflow, NULL, NULL, NULL);
|
||||
@ -161,7 +161,7 @@ _cm_signal_handle_intr(int x)
|
||||
//
|
||||
if ( &(u3H->rod_u) == u3R ) {
|
||||
_cm_emergency("ignored", c3__intr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_cm_signal_handle(c3__intr);
|
||||
}
|
||||
@ -197,13 +197,13 @@ _cm_stack_recover(u3a_road* rod_u)
|
||||
u3_noun tax = rod_u->bug.tax;
|
||||
|
||||
while ( tax ) {
|
||||
len_w++;
|
||||
len_w++;
|
||||
tax = u3t(tax);
|
||||
}
|
||||
|
||||
if ( len_w < 4096 ) {
|
||||
return u3a_take(rod_u->bug.tax);
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun beg, fin;
|
||||
c3_w i_w;
|
||||
@ -259,7 +259,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
|
||||
|
||||
if ( &(u3H->rod_u) == u3R ) {
|
||||
// A top-level crash - rather odd. We should GC.
|
||||
//
|
||||
//
|
||||
_cm_emergency("recover: top", sig_l);
|
||||
u3C.wag_w |= u3o_check_corrupt;
|
||||
|
||||
@ -293,10 +293,10 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
|
||||
|
||||
u3R = &(u3H->rod_u);
|
||||
rod_u = u3R;
|
||||
|
||||
|
||||
while ( rod_u->kid_p ) {
|
||||
#if 0
|
||||
fprintf(stderr, "collecting %d frames\r\n",
|
||||
fprintf(stderr, "collecting %d frames\r\n",
|
||||
u3kb_lent((u3to(u3_road, rod_u->kid_p)->bug.tax));
|
||||
#endif
|
||||
tax = u3kb_weld(_cm_stack_recover(u3to(u3_road, rod_u->kid_p)), tax);
|
||||
@ -313,7 +313,7 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* _cm_signal_deep(): start deep processing; set timer for sec_w or 0.
|
||||
*/
|
||||
static void
|
||||
@ -327,7 +327,7 @@ _cm_signal_deep(c3_w sec_w)
|
||||
signal(SIGINT, _cm_signal_handle_intr);
|
||||
signal(SIGTERM, _cm_signal_handle_term);
|
||||
|
||||
// Provide a little emergency memory, for use in case things
|
||||
// Provide a little emergency memory, for use in case things
|
||||
// go utterly haywire.
|
||||
//
|
||||
if ( 0 == u3H->rod_u.bug.mer ) {
|
||||
@ -375,7 +375,7 @@ _cm_signal_done()
|
||||
void
|
||||
u3m_signal(u3_noun sig_l)
|
||||
{
|
||||
siglongjmp(u3_Signal, sig_l);
|
||||
siglongjmp(u3_Signal, sig_l);
|
||||
}
|
||||
|
||||
/* u3m_file(): load file, as atom, or bail.
|
||||
@ -442,10 +442,10 @@ _pave_north(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
|
||||
rod_u->rut_p = u3of(c3_w, rut_w);
|
||||
rod_u->hat_p = u3of(c3_w, hat_w);
|
||||
|
||||
|
||||
rod_u->mat_p = u3of(c3_w, mat_w);
|
||||
rod_u->cap_p = u3of(c3_w, cap_w);
|
||||
|
||||
|
||||
return rod_u;
|
||||
}
|
||||
|
||||
@ -465,10 +465,10 @@ _pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
|
||||
rod_u->rut_p = u3of(c3_w, rut_w);
|
||||
rod_u->hat_p = u3of(c3_w, hat_w);
|
||||
|
||||
|
||||
rod_u->mat_p = u3of(c3_w, mat_w);
|
||||
rod_u->cap_p = u3of(c3_w, cap_w);
|
||||
|
||||
|
||||
return rod_u;
|
||||
}
|
||||
|
||||
@ -504,16 +504,16 @@ void
|
||||
u3m_pave(c3_o nuu_o, c3_o bug_o)
|
||||
{
|
||||
if ( c3y == nuu_o ) {
|
||||
u3H = (void *)_pave_north(u3_Loom + 1,
|
||||
c3_wiseof(u3v_home),
|
||||
u3H = (void *)_pave_north(u3_Loom + 1,
|
||||
c3_wiseof(u3v_home),
|
||||
u3a_words - 1);
|
||||
u3R = &u3H->rod_u;
|
||||
|
||||
_pave_parts();
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3H = (void *)_find_north(u3_Loom + 1,
|
||||
c3_wiseof(u3v_home),
|
||||
u3H = (void *)_find_north(u3_Loom + 1,
|
||||
c3_wiseof(u3v_home),
|
||||
u3a_words - 1);
|
||||
u3R = &u3H->rod_u;
|
||||
}
|
||||
@ -537,12 +537,12 @@ u3m_dump(void)
|
||||
c3_w fre_w = 0;
|
||||
c3_w i_w;
|
||||
|
||||
hat_w = _(u3a_is_north(u3R)) ? u3R->hat_w - u3R->rut_w
|
||||
hat_w = _(u3a_is_north(u3R)) ? u3R->hat_w - u3R->rut_w
|
||||
: u3R->rut_w - u3R->hat_w;
|
||||
|
||||
for ( i_w = 0; i_w < u3_cc_fbox_no; i_w++ ) {
|
||||
u3a_fbox* fre_u = u3R->all.fre_u[i_w];
|
||||
|
||||
|
||||
while ( fre_u ) {
|
||||
fre_w += fre_u->box_u.siz_w;
|
||||
fre_u = fre_u->nex_u;
|
||||
@ -614,7 +614,7 @@ u3m_bail(u3_noun how)
|
||||
str_c[3] = ((how >> 24) & 0xff);
|
||||
str_c[4] = 0;
|
||||
fprintf(stderr, "\r\nbail: %s\r\n", str_c);
|
||||
}
|
||||
}
|
||||
else {
|
||||
c3_assert(_(u3ud(u3h(how))));
|
||||
fprintf(stderr, "\r\nbail: %d\r\n", u3h(how));
|
||||
@ -706,7 +706,7 @@ u3m_leap(c3_w pad_w)
|
||||
#if 0
|
||||
if ( pad_w < u3R->all.fre_w ) {
|
||||
pad_w = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
pad_w -= u3R->all.fre_w;
|
||||
}
|
||||
@ -731,7 +731,7 @@ u3m_leap(c3_w pad_w)
|
||||
fprintf(stderr, "leap: from north %p (cap %x), to south %p\r\n",
|
||||
u3R,
|
||||
u3R->cap_p + len_p,
|
||||
rod_u);
|
||||
rod_u);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
@ -743,7 +743,7 @@ u3m_leap(c3_w pad_w)
|
||||
fprintf(stderr, "leap: from north %p (cap %p), to south %p\r\n",
|
||||
u3R,
|
||||
u3R->cap_p - len_p,
|
||||
rod_u);
|
||||
rod_u);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -805,7 +805,7 @@ u3m_hate(c3_w pad_w)
|
||||
c3_assert(0 == u3R->ear_p);
|
||||
|
||||
u3R->ear_p = u3R->cap_p;
|
||||
u3m_leap(pad_w);
|
||||
u3m_leap(pad_w);
|
||||
}
|
||||
|
||||
/* u3m_love(): return product from leap.
|
||||
@ -841,7 +841,7 @@ u3m_golf(void)
|
||||
{
|
||||
if ( c3y == u3a_is_north(u3R) ) {
|
||||
return u3R->mat_p - u3R->cap_p;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3R->cap_p - u3R->mat_p;
|
||||
}
|
||||
@ -860,12 +860,12 @@ u3m_flog(c3_w gof_w)
|
||||
|
||||
// memset(u3R->cap_w, 0, 4 * len_w);
|
||||
u3R->cap_p = bot_p;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_post bot_p = u3R->mat_p + gof_w;
|
||||
// c3_w len_w = (u3R->cap_w - bot_w);
|
||||
|
||||
// memset(bot_w, 0, 4 * len_w); //
|
||||
// memset(bot_w, 0, 4 * len_w); //
|
||||
u3R->cap_p = bot_p;
|
||||
}
|
||||
}
|
||||
@ -883,7 +883,7 @@ u3m_water(c3_w* low_w, c3_w* hig_w)
|
||||
|
||||
/* u3m_soft_top(): top-level safety wrapper.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
c3_w pad_w, // base memory pad
|
||||
u3_funk fun_f,
|
||||
@ -929,7 +929,7 @@ u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
#endif
|
||||
u3m_grab(pro, u3_none);
|
||||
}
|
||||
|
||||
|
||||
/* Revert to external signal regime.
|
||||
*/
|
||||
_cm_signal_done();
|
||||
@ -959,7 +959,7 @@ u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
|
||||
/* u3m_soft_sure(): top-level call assumed correct.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_sure(u3_funk fun_f, u3_noun arg)
|
||||
{
|
||||
u3_noun pro, pru = u3m_soft_top(0, (1 << 18), fun_f, arg);
|
||||
@ -974,7 +974,7 @@ u3m_soft_sure(u3_funk fun_f, u3_noun arg)
|
||||
/* u3m_soft_slam: top-level call.
|
||||
*/
|
||||
u3_noun _cm_slam(u3_noun arg) { return u3n_slam_on(u3h(arg), u3t(arg)); }
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_slam(u3_noun gat, u3_noun sam)
|
||||
{
|
||||
return u3m_soft_sure(_cm_slam, u3nc(gat, sam));
|
||||
@ -983,7 +983,7 @@ u3m_soft_slam(u3_noun gat, u3_noun sam)
|
||||
/* u3m_soft_nock: top-level nock.
|
||||
*/
|
||||
u3_noun _cm_nock(u3_noun arg) { return u3n_nock_on(u3h(arg), u3t(arg)); }
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_nock(u3_noun bus, u3_noun fol)
|
||||
{
|
||||
return u3m_soft_sure(_cm_nock, u3nc(bus, fol));
|
||||
@ -991,7 +991,7 @@ u3m_soft_nock(u3_noun bus, u3_noun fol)
|
||||
|
||||
/* u3m_soft_run(): descend into virtualization context.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft_run(u3_noun gul,
|
||||
u3_funq fun_f,
|
||||
u3_noun aga,
|
||||
@ -1002,7 +1002,7 @@ u3m_soft_run(u3_noun gul,
|
||||
/* Record the cap, and leap.
|
||||
*/
|
||||
u3m_hate(1 << 18);
|
||||
|
||||
|
||||
/* Configure the new road.
|
||||
*/
|
||||
{
|
||||
@ -1054,7 +1054,7 @@ u3m_soft_run(u3_noun gul,
|
||||
u3_noun yod = u3m_love(u3t(why));
|
||||
|
||||
u3m_bail
|
||||
(u3nt(3,
|
||||
(u3nt(3,
|
||||
u3a_take(u3h(yod)),
|
||||
u3kb_weld(u3t(yod), u3k(u3R->bug.tax))));
|
||||
} break;
|
||||
@ -1085,8 +1085,8 @@ u3_noun
|
||||
u3m_soft_esc(u3_noun ref, u3_noun sam)
|
||||
{
|
||||
u3_noun why, gul, pro;
|
||||
|
||||
/* Assert preconditions.
|
||||
|
||||
/* Assert preconditions.
|
||||
*/
|
||||
{
|
||||
c3_assert(0 != u3R->ski.gul);
|
||||
@ -1096,7 +1096,7 @@ u3m_soft_esc(u3_noun ref, u3_noun sam)
|
||||
/* Record the cap, and leap.
|
||||
*/
|
||||
u3m_hate(1 << 18);
|
||||
|
||||
|
||||
/* Configure the new road.
|
||||
*/
|
||||
{
|
||||
@ -1162,17 +1162,17 @@ u3m_grab(u3_noun som, ...) // terminate with u3_none
|
||||
u3a_sweep();
|
||||
}
|
||||
|
||||
/* u3m_soft(): top-level wrapper.
|
||||
/* u3m_soft(): top-level wrapper.
|
||||
**
|
||||
** Produces [0 product] or [%error (list tank)], top last.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3m_soft(c3_w sec_w,
|
||||
u3_funk fun_f,
|
||||
u3_noun arg)
|
||||
{
|
||||
u3_noun why;
|
||||
|
||||
|
||||
why = u3m_soft_top(sec_w, (1 << 20), fun_f, arg); // 2MB pad
|
||||
|
||||
if ( 0 == u3h(why) ) {
|
||||
@ -1227,7 +1227,7 @@ _cm_is_tas(u3_atom som, c3_w len_w)
|
||||
for ( i_w = 0; i_w < len_w; i_w++ ) {
|
||||
c3_c c_c = u3r_byte(i_w, som);
|
||||
|
||||
if ( islower(c_c) ||
|
||||
if ( islower(c_c) ||
|
||||
(isdigit(c_c) && (0 != i_w) && ((len_w - 1) != i_w))
|
||||
|| '-' == c_c )
|
||||
{
|
||||
@ -1259,8 +1259,8 @@ _cm_is_ta(u3_noun som, c3_w len_w)
|
||||
*/
|
||||
c3_y _cm_hex(c3_y c_y)
|
||||
{
|
||||
if ( c_y < 10 )
|
||||
return '0' + c_y;
|
||||
if ( c_y < 10 )
|
||||
return '0' + c_y;
|
||||
else return 'a' + (c_y - 10);
|
||||
}
|
||||
|
||||
@ -1291,7 +1291,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
|
||||
sel_w += 1;
|
||||
}
|
||||
return one_w + two_w + 1 + sel_w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( som < 65536 ) {
|
||||
c3_c buf_c[6];
|
||||
@ -1310,7 +1310,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
|
||||
c3_w len_w = u3r_met(3, som);
|
||||
|
||||
if ( str_c ) {
|
||||
*(str_c++) = '%';
|
||||
*(str_c++) = '%';
|
||||
u3r_bytes(0, len_w, (c3_y *)str_c, som);
|
||||
str_c += len_w;
|
||||
}
|
||||
@ -1318,10 +1318,10 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
|
||||
}
|
||||
else if ( _(_cm_is_ta(som, len_w)) ) {
|
||||
if ( str_c ) {
|
||||
*(str_c++) = '\'';
|
||||
*(str_c++) = '\'';
|
||||
u3r_bytes(0, len_w, (c3_y *)str_c, som);
|
||||
str_c += len_w;
|
||||
*(str_c++) = '\'';
|
||||
*(str_c++) = '\'';
|
||||
}
|
||||
return len_w + 2;
|
||||
}
|
||||
@ -1333,7 +1333,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
|
||||
|
||||
buf_c[a_w++] = '0';
|
||||
buf_c[a_w++] = 'x';
|
||||
|
||||
|
||||
for ( i_w = 0; i_w < len_w; i_w++ ) {
|
||||
c3_y c_y = u3r_byte(len_w - (i_w + 1), som);
|
||||
|
||||
@ -1358,7 +1358,7 @@ _cm_in_pretty(u3_noun som, c3_o sel_o, c3_c* str_c)
|
||||
|
||||
/* u3m_pretty(): dumb prettyprint to string.
|
||||
*/
|
||||
c3_c*
|
||||
c3_c*
|
||||
u3m_pretty(u3_noun som)
|
||||
{
|
||||
c3_w len_w = _cm_in_pretty(som, c3y, 0);
|
||||
@ -1431,7 +1431,7 @@ _cm_limits(void)
|
||||
{
|
||||
ret_i = getrlimit(RLIMIT_STACK, &rlm);
|
||||
c3_assert(0 == ret_i);
|
||||
rlm.rlim_cur = (rlm.rlim_max > (65536 << 10))
|
||||
rlm.rlim_cur = (rlm.rlim_max > (65536 << 10))
|
||||
? (65536 << 10)
|
||||
: rlm.rlim_max;
|
||||
if ( 0 != setrlimit(RLIMIT_STACK, &rlm) ) {
|
||||
@ -1479,9 +1479,9 @@ _cm_signals(void)
|
||||
// Block SIGPROF, so that if/when we reactivate it on the
|
||||
// main thread for profiling, we won't get hits in parallel
|
||||
// on other threads.
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
sigset_t set;
|
||||
|
||||
|
||||
sigemptyset(&set);
|
||||
sigaddset(&set, SIGPROF);
|
||||
|
||||
@ -1526,8 +1526,8 @@ u3m_init(void)
|
||||
fprintf(stderr, "boot: mapping %dMB failed\r\n", (len_w / (1024 * 1024)));
|
||||
fprintf(stderr, "see urbit.org/docs/getting-started#swap for adding swap space\r\n");
|
||||
if ( -1 != (c3_ps)map_v ) {
|
||||
fprintf(stderr,
|
||||
"if porting to a new platform, try U3_OS_LoomBase %p\r\n",
|
||||
fprintf(stderr,
|
||||
"if porting to a new platform, try U3_OS_LoomBase %p\r\n",
|
||||
dyn_v);
|
||||
}
|
||||
exit(1);
|
||||
@ -1570,8 +1570,8 @@ _cm_init_new(void)
|
||||
fprintf(stderr, "boot: mapping %dMB failed\r\n", (len_w / (1024 * 1024)));
|
||||
fprintf(stderr, "see urbit.org/docs/using/install to add swap space\r\n");
|
||||
if ( -1 != (c3_ps)map_v ) {
|
||||
fprintf(stderr,
|
||||
"if porting to a new platform, try U3_OS_LoomBase %p\r\n",
|
||||
fprintf(stderr,
|
||||
"if porting to a new platform, try U3_OS_LoomBase %p\r\n",
|
||||
dyn_v);
|
||||
}
|
||||
exit(1);
|
||||
|
22
noun/nock.c
22
noun/nock.c
@ -66,7 +66,7 @@ static u3_noun _n_nock_on(u3_noun bus, u3_noun fol);
|
||||
/* _n_hint(): process hint.
|
||||
*/
|
||||
static u3_noun
|
||||
_n_hint(u3_noun zep,
|
||||
_n_hint(u3_noun zep,
|
||||
u3_noun hod,
|
||||
u3_noun bus,
|
||||
u3_noun nex)
|
||||
@ -349,7 +349,7 @@ _n_nock_on(u3_noun bus, u3_noun fol)
|
||||
{
|
||||
u3_noun seb = _n_nock_on(bus, u3k(c_gal));
|
||||
u3_noun pro;
|
||||
|
||||
|
||||
u3t_off(noc_o);
|
||||
pro = u3j_kick(seb, b_gal);
|
||||
u3t_on(noc_o);
|
||||
@ -416,7 +416,7 @@ _n_nock_on(u3_noun bus, u3_noun fol)
|
||||
|
||||
if ( !_(u3du(val)) ) {
|
||||
u3m_bail(u3nt(1, gof, 0));
|
||||
}
|
||||
}
|
||||
if ( !_(u3du(u3t(val))) ) {
|
||||
//
|
||||
// replace with proper error stack push
|
||||
@ -434,7 +434,7 @@ _n_nock_on(u3_noun bus, u3_noun fol)
|
||||
|
||||
return pro;
|
||||
}
|
||||
}
|
||||
}
|
||||
c3_assert(!"not reached");
|
||||
}
|
||||
}
|
||||
@ -569,7 +569,7 @@ _n_arg(c3_y cod_y)
|
||||
case LILS: case LITS: case LISL: case LISK:
|
||||
case SAMS: case SANS: case SIPS: case SINS:
|
||||
case SLIS: case SKIS: case KICS: case TICS:
|
||||
case SUSH: case SAST: case SALT:
|
||||
case SUSH: case SAST: case SALT:
|
||||
case MUTS: case KUTS: case MITS: case KITS:
|
||||
return sizeof(c3_s);
|
||||
|
||||
@ -680,7 +680,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w,
|
||||
c3_assert(0);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case BUSH: case FIBK: case FIBL:
|
||||
case SANB: case LIBL: case LIBK:
|
||||
case KITB: case MITB:
|
||||
@ -880,9 +880,9 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
|
||||
|
||||
/* 8-bit direct args */
|
||||
case FABK: case FABL:
|
||||
case LITB: case LILB:
|
||||
case LITB: case LILB:
|
||||
case MUTB: case KUTB:
|
||||
case SAMB:
|
||||
case SAMB:
|
||||
buf_y[i_w--] = (c3_y) u3t(op);
|
||||
buf_y[i_w] = (c3_y) cod;
|
||||
break;
|
||||
@ -911,7 +911,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
|
||||
}
|
||||
|
||||
/* literal index args */
|
||||
case FIBK: case FIBL:
|
||||
case FIBK: case FIBL:
|
||||
case LIBK: case LIBL:
|
||||
case BUSH: case SANB:
|
||||
case KITB: case MITB:
|
||||
@ -1524,7 +1524,7 @@ _n_find(u3_noun pre, u3_noun fol)
|
||||
pog = u3h_git(rod_u->byc.har_p, key);
|
||||
if ( u3_none != pog ) {
|
||||
c3_w i_w;
|
||||
u3n_prog* old = _n_prog_old(u3to(u3n_prog, pog));
|
||||
u3n_prog* old = _n_prog_old(u3to(u3n_prog, pog));
|
||||
for ( i_w = 0; i_w < old->reg_u.len_w; ++i_w ) {
|
||||
u3j_rite* rit_u = &(old->reg_u.rit_u[i_w]);
|
||||
rit_u->own_o = c3n;
|
||||
@ -1719,7 +1719,7 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off)
|
||||
top = _n_peek(off);
|
||||
*top = u3nc(*top, x); // [pro]
|
||||
BURN();
|
||||
|
||||
|
||||
do_snoc: // [hed tel]
|
||||
x = _n_pep(mov, off);
|
||||
top = _n_peek(off);
|
||||
|
@ -215,7 +215,7 @@ _sang_one(u3_noun* a, u3_noun* b)
|
||||
{
|
||||
if ( *a == *b ) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
c3_o asr_o = u3a_is_senior(u3R, *a);
|
||||
c3_o bsr_o = u3a_is_senior(u3R, *b);
|
||||
@ -229,32 +229,32 @@ _sang_one(u3_noun* a, u3_noun* b)
|
||||
return;
|
||||
}
|
||||
if ( _(asr_o) && !_(bsr_o) ){
|
||||
// u3z(*b);
|
||||
// u3z(*b);
|
||||
*b = *a;
|
||||
}
|
||||
if ( _(bsr_o) && !_(asr_o) ) {
|
||||
// u3z(*a);
|
||||
// u3z(*a);
|
||||
*a = *b;
|
||||
}
|
||||
if ( u3a_is_north(u3R) ) {
|
||||
if ( *a <= *b ) {
|
||||
u3k(*a);
|
||||
// u3z(*b);
|
||||
// u3z(*b);
|
||||
*b = *a;
|
||||
} else {
|
||||
u3k(*b);
|
||||
// u3z(*a);
|
||||
// u3z(*a);
|
||||
*a = *b;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( *a >= *b ) {
|
||||
u3k(*a);
|
||||
// u3z(*b);
|
||||
// u3z(*b);
|
||||
*b = *a;
|
||||
} else {
|
||||
u3k(*b);
|
||||
// u3z(*a);
|
||||
// u3z(*a);
|
||||
*a = *b;
|
||||
}
|
||||
}
|
||||
@ -620,7 +620,7 @@ u3r_sing(u3_noun a, u3_noun b)
|
||||
#ifndef U3_MEMORY_DEBUG
|
||||
if ( u3R->par_p ) {
|
||||
return u3r_sang(a, b);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
{
|
||||
c3_o ret_o;
|
||||
@ -1228,7 +1228,7 @@ u3r_bytes(c3_w a_w,
|
||||
memcpy(c_y, x_y, z_w);
|
||||
if ( b_w > n_w - a_w ) {
|
||||
memset(c_y + z_w, 0, b_w + a_w - n_w);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1341,13 +1341,13 @@ u3r_words(c3_w a_w,
|
||||
if ( a_w >= d_u->len_w ) {
|
||||
memset((c3_y*)c_w, 0, b_w << 2);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
c3_w z_w = c3_min(b_w, d_u->len_w - a_w);
|
||||
c3_w* x_w = d_u->buf_w + a_w;
|
||||
memcpy((c3_y*)c_w, (c3_y*)x_w, z_w << 2);
|
||||
if ( b_w > d_u->len_w - a_w ) {
|
||||
memset((c3_y*)(c_w + z_w), 0, (b_w + a_w - d_u->len_w) << 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1384,7 +1384,7 @@ u3r_chop(c3_g met_g,
|
||||
c3_w i_w;
|
||||
c3_w len_w;
|
||||
c3_w* buf_w;
|
||||
|
||||
|
||||
c3_assert(u3_none != src);
|
||||
c3_assert(_(u3a_is_atom(src)));
|
||||
|
||||
@ -1394,7 +1394,7 @@ u3r_chop(c3_g met_g,
|
||||
}
|
||||
else {
|
||||
u3a_atom* src_u = u3a_to_ptr(src);
|
||||
|
||||
|
||||
len_w = src_u->len_w;
|
||||
buf_w = src_u->buf_w;
|
||||
}
|
||||
@ -1559,8 +1559,8 @@ u3r_mug_cell(u3_noun hed,
|
||||
typedef struct mugframe
|
||||
{
|
||||
u3_noun veb;
|
||||
c3_w a;
|
||||
c3_w b;
|
||||
c3_w a;
|
||||
c3_w b;
|
||||
} mugframe;
|
||||
|
||||
static inline mugframe*
|
||||
@ -1610,7 +1610,7 @@ _mug_pop(c3_ys mov, c3_ys off, c3_w mug_w)
|
||||
// shouldn't reach
|
||||
//
|
||||
else {
|
||||
c3_assert(0);
|
||||
c3_assert(0);
|
||||
}
|
||||
return fam;
|
||||
}
|
||||
@ -1656,7 +1656,7 @@ c3_w
|
||||
u3r_mug(u3_noun veb)
|
||||
{
|
||||
c3_assert( u3_none != veb );
|
||||
|
||||
|
||||
if ( _(u3a_is_atom(veb)) ) {
|
||||
return _mug_atom(veb);
|
||||
}
|
||||
|
32
noun/trace.c
32
noun/trace.c
@ -53,18 +53,18 @@ _t_slog_time(void)
|
||||
static struct timeval b4, f2, d0;
|
||||
static c3_d b4_d;
|
||||
c3_w ms_w;
|
||||
|
||||
|
||||
if ( old ) {
|
||||
gettimeofday(&f2, 0);
|
||||
gettimeofday(&f2, 0);
|
||||
timersub(&f2, &b4, &d0);
|
||||
ms_w = (d0.tv_sec * 1000) + (d0.tv_usec / 1000);
|
||||
if (ms_w > 1) {
|
||||
#if 0
|
||||
fprintf(stderr, "%6d.%02dms: %9d ",
|
||||
fprintf(stderr, "%6d.%02dms: %9d ",
|
||||
ms_w, (int) (d0.tv_usec % 1000) / 10,
|
||||
((int) (u3R->pro.nox_d - b4_d)));
|
||||
#else
|
||||
fprintf(stderr, "%6d.%02dms ",
|
||||
fprintf(stderr, "%6d.%02dms ",
|
||||
ms_w, (int) (d0.tv_usec % 1000) / 10);
|
||||
#endif
|
||||
gettimeofday(&b4, 0);
|
||||
@ -106,7 +106,7 @@ u3t_slog(u3_noun hod)
|
||||
|
||||
/* u3t_shiv(): quick print.
|
||||
*/
|
||||
void
|
||||
void
|
||||
u3t_shiv(u3_noun hod)
|
||||
{
|
||||
#ifdef U3_EVENT_TIME_DEBUG
|
||||
@ -141,11 +141,11 @@ u3t_heck(u3_atom cog)
|
||||
//
|
||||
if ( &(u3H->rod_u) != u3R ) {
|
||||
u3a_road* rod_u;
|
||||
|
||||
|
||||
rod_u = u3R;
|
||||
u3R = &(u3H->rod_u);
|
||||
{
|
||||
if ( 0 == u3R->pro.day ) {
|
||||
if ( 0 == u3R->pro.day ) {
|
||||
u3R->pro.day = u3v_do("doss", 0);
|
||||
}
|
||||
u3R->pro.day = u3dc("pi-heck", u3i_string(str_c), u3R->pro.day);
|
||||
@ -191,7 +191,7 @@ _t_samp_process(u3_road* rod_u)
|
||||
u3a_wash(laj);
|
||||
|
||||
// Add the label to the traced label stack, trimming recursion.
|
||||
//
|
||||
//
|
||||
{
|
||||
u3_noun old;
|
||||
|
||||
@ -206,7 +206,7 @@ _t_samp_process(u3_road* rod_u)
|
||||
u3z(muf);
|
||||
while ( len_w > (old + 1) ) {
|
||||
u3_noun t_pef = u3k(u3t(pef));
|
||||
|
||||
|
||||
len_w -= 1;
|
||||
u3z(pef);
|
||||
pef = t_pef;
|
||||
@ -220,7 +220,7 @@ _t_samp_process(u3_road* rod_u)
|
||||
rod_u = u3tn(u3_road, rod_u->par_p);
|
||||
}
|
||||
u3z(muf);
|
||||
|
||||
|
||||
// Lose the maps and save a pure label stack in original order.
|
||||
//
|
||||
{
|
||||
@ -268,7 +268,7 @@ u3t_samp(void)
|
||||
home++;
|
||||
c3_l mot_l;
|
||||
u3a_road* rod_u;
|
||||
|
||||
|
||||
if ( _(u3T.mal_o) ) {
|
||||
mot_l = c3_s3('m','a','l');
|
||||
}
|
||||
@ -298,7 +298,7 @@ u3t_samp(void)
|
||||
u3_noun lab = _t_samp_process(rod_u);
|
||||
|
||||
c3_assert(u3R == &u3H->rod_u);
|
||||
if ( 0 == u3R->pro.day ) {
|
||||
if ( 0 == u3R->pro.day ) {
|
||||
/* bunt a +doss
|
||||
*/
|
||||
u3R->pro.day = u3nt(u3nq(0, 0, 0, u3nq(0, 0, 0, 0)), 0, 0);
|
||||
@ -567,7 +567,7 @@ u3t_print_steps(c3_c* cap_c, c3_d sep_d)
|
||||
|
||||
if ( sep_d ) {
|
||||
if ( gib_w ) {
|
||||
fprintf(fil_f, "%s: G/%d.%03d.%03d.%03d\r\n",
|
||||
fprintf(fil_f, "%s: G/%d.%03d.%03d.%03d\r\n",
|
||||
cap_c, gib_w, mib_w, kib_w, bib_w);
|
||||
}
|
||||
else if ( mib_w ) {
|
||||
@ -608,8 +608,8 @@ u3t_damp(void)
|
||||
|
||||
/* _ct_sigaction(): profile sigaction callback.
|
||||
*/
|
||||
void _ct_sigaction(c3_i x_i)
|
||||
{
|
||||
void _ct_sigaction(c3_i x_i)
|
||||
{
|
||||
// fprintf(stderr, "itimer!\r\n"); abort();
|
||||
u3t_samp();
|
||||
}
|
||||
@ -632,7 +632,7 @@ u3t_init(void)
|
||||
void
|
||||
u3t_boot(void)
|
||||
{
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
_ct_lop_o = c3n;
|
||||
#if defined(U3_OS_osx) || defined(U3_OS_linux)
|
||||
// skip profiling if we don't yet have an arvo kernel
|
||||
|
@ -101,7 +101,7 @@ u3v_lite(u3_noun pil)
|
||||
u3_noun bot, cor, pro;
|
||||
|
||||
u3x_trel(arv, &bot, 0, 0);
|
||||
|
||||
|
||||
fprintf(stderr, "lite: arvo formula %x\r\n", u3r_mug(arv));
|
||||
cor = u3n_nock_on(bot, lyf);
|
||||
fprintf(stderr, "lite: core %x\r\n", u3r_mug(cor));
|
||||
@ -109,6 +109,7 @@ u3v_lite(u3_noun pil)
|
||||
pro = u3k(u3r_at(7, cor));
|
||||
|
||||
u3z(cor);
|
||||
u3z(arv);
|
||||
return pro;
|
||||
}
|
||||
|
||||
@ -124,7 +125,7 @@ u3v_boot(c3_c* pas_c)
|
||||
if ( !u3A->sys ) {
|
||||
u3A->sys = u3m_file(pas_c);
|
||||
}
|
||||
|
||||
|
||||
pru = u3m_soft(0, u3v_load, u3k(u3A->sys));
|
||||
|
||||
if ( u3h(pru) != 0 ) {
|
||||
@ -216,7 +217,7 @@ u3v_wish(const c3_c* str_c)
|
||||
if ( u3_none == exp ) {
|
||||
exp = _cv_nock_wish(u3k(txt));
|
||||
|
||||
// It's probably not a good idea to use u3v_wish()
|
||||
// It's probably not a good idea to use u3v_wish()
|
||||
// outside the top level... (as the result is uncached)
|
||||
//
|
||||
if ( u3R == &u3H->rod_u ) {
|
||||
|
30
noun/zave.c
30
noun/zave.c
@ -5,7 +5,7 @@
|
||||
|
||||
/* u3z_find(): find in memo cache. Arguments retained.
|
||||
*/
|
||||
u3_weak
|
||||
u3_weak
|
||||
u3z_find(c3_m fun, u3_noun one)
|
||||
{
|
||||
u3_noun key = u3nc(fun, u3k(one));
|
||||
@ -15,7 +15,7 @@ u3z_find(c3_m fun, u3_noun one)
|
||||
u3z(key);
|
||||
return val;
|
||||
}
|
||||
u3_weak
|
||||
u3_weak
|
||||
u3z_find_2(c3_m fun, u3_noun one, u3_noun two)
|
||||
{
|
||||
u3_noun key = u3nt(fun, u3k(one), u3k(two));
|
||||
@ -25,7 +25,7 @@ u3z_find_2(c3_m fun, u3_noun one, u3_noun two)
|
||||
u3z(key);
|
||||
return val;
|
||||
}
|
||||
u3_weak
|
||||
u3_weak
|
||||
u3z_find_3(c3_m fun, u3_noun one, u3_noun two, u3_noun tri)
|
||||
{
|
||||
u3_noun key = u3nq(fun, u3k(one), u3k(two), u3k(tri));
|
||||
@ -35,7 +35,7 @@ u3z_find_3(c3_m fun, u3_noun one, u3_noun two, u3_noun tri)
|
||||
u3z(key);
|
||||
return val;
|
||||
}
|
||||
u3_weak
|
||||
u3_weak
|
||||
u3z_find_4(c3_m fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun qua)
|
||||
{
|
||||
u3_noun key = u3nc(fun, u3nq(u3k(one), u3k(two), u3k(tri), u3k(qua)));
|
||||
@ -48,7 +48,7 @@ u3z_find_4(c3_m fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun qua)
|
||||
|
||||
/* u3z_save*(): save in memo cache.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_save(c3_m fun, u3_noun one, u3_noun val)
|
||||
{
|
||||
u3_noun key = u3nc(fun, u3k(one));
|
||||
@ -57,7 +57,7 @@ u3z_save(c3_m fun, u3_noun one, u3_noun val)
|
||||
u3z(key);
|
||||
return val;
|
||||
}
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_save_2(c3_m fun, u3_noun one, u3_noun two, u3_noun val)
|
||||
{
|
||||
u3_noun key = u3nt(fun, u3k(one), u3k(two));
|
||||
@ -66,7 +66,7 @@ u3z_save_2(c3_m fun, u3_noun one, u3_noun two, u3_noun val)
|
||||
u3z(key);
|
||||
return val;
|
||||
}
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_save_3(c3_m fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun val)
|
||||
{
|
||||
u3_noun key = u3nq(fun, u3k(one), u3k(two), u3k(tri));
|
||||
@ -75,12 +75,12 @@ u3z_save_3(c3_m fun, u3_noun one, u3_noun two, u3_noun tri, u3_noun val)
|
||||
u3z(key);
|
||||
return val;
|
||||
}
|
||||
u3_noun
|
||||
u3z_save_4(c3_m fun,
|
||||
u3_noun one,
|
||||
u3_noun two,
|
||||
u3_noun tri,
|
||||
u3_noun qua,
|
||||
u3_noun
|
||||
u3z_save_4(c3_m fun,
|
||||
u3_noun one,
|
||||
u3_noun two,
|
||||
u3_noun tri,
|
||||
u3_noun qua,
|
||||
u3_noun val)
|
||||
{
|
||||
u3_noun key = u3nc(fun, u3nq(u3k(one), u3k(two), u3k(tri), u3k(qua)));
|
||||
@ -92,7 +92,7 @@ u3z_save_4(c3_m fun,
|
||||
|
||||
/* u3z_uniq(): uniquify with memo cache.
|
||||
*/
|
||||
u3_noun
|
||||
u3_noun
|
||||
u3z_uniq(u3_noun som)
|
||||
{
|
||||
u3_noun key = u3nc(c3__uniq, u3k(som));
|
||||
@ -100,7 +100,7 @@ u3z_uniq(u3_noun som)
|
||||
|
||||
if ( u3_none != val ) {
|
||||
u3z(key); u3z(som); return val;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3h_put(u3R->cax.har_p, key, u3k(som));
|
||||
return som;
|
||||
|
@ -54,7 +54,7 @@ _test_mug(void)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
{
|
||||
{
|
||||
// stick some zero bytes in a string
|
||||
//
|
||||
u3_noun str = u3kc_lsh(3, 1,
|
||||
|
@ -203,11 +203,11 @@ _test_leap(void)
|
||||
#if 1
|
||||
// u3m_dump();
|
||||
{
|
||||
u3_noun pil;
|
||||
u3_noun pil;
|
||||
u3_noun cue, jam;
|
||||
c3_w gof_w = u3m_golf();
|
||||
|
||||
pil = u3_walk_load("urb/urbit.pill");
|
||||
pil = u3_walk_load("urb/urbit.pill");
|
||||
u3m_leap(0);
|
||||
printf("cueing pill - %d bytes\n", u3r_met(3, pil));
|
||||
cue = u3ke_cue(pil);
|
||||
@ -236,8 +236,8 @@ static void
|
||||
_test_test(void)
|
||||
{
|
||||
u3_noun fol = u3ke_cue(u3_walk_load("pill/west.pill"));
|
||||
u3_noun val;
|
||||
|
||||
u3_noun val;
|
||||
|
||||
printf("test_test: formula mug %x\n", u3r_mug(fol));
|
||||
val = u3n_nock_on(u3nc(42, 17), fol);
|
||||
printf("val %d\n", val);
|
||||
|
@ -19,7 +19,7 @@
|
||||
/* _ames_alloc(): libuv buffer allocator.
|
||||
*/
|
||||
static void
|
||||
_ames_alloc(uv_handle_t* had_u,
|
||||
_ames_alloc(uv_handle_t* had_u,
|
||||
size_t len_i,
|
||||
uv_buf_t* buf
|
||||
)
|
||||
@ -426,12 +426,12 @@ _ames_io_start(u3_pier* pir_u)
|
||||
add_u.sin_port = htons(por_s);
|
||||
|
||||
int ret;
|
||||
if ( (ret = uv_udp_bind(&sam_u->wax_u,
|
||||
if ( (ret = uv_udp_bind(&sam_u->wax_u,
|
||||
(const struct sockaddr*) & add_u, 0)) != 0 ) {
|
||||
uL(fprintf(uH, "ames: bind: %s\n",
|
||||
uv_strerror(ret)));
|
||||
if (UV_EADDRINUSE == ret){
|
||||
uL(fprintf(uH,
|
||||
uL(fprintf(uH,
|
||||
" ...perhaps you've got two copies of vere running?\n"));
|
||||
}
|
||||
u3_pier_exit();
|
||||
|
76
vere/foil.c
76
vere/foil.c
@ -27,10 +27,10 @@
|
||||
/* assumptions:
|
||||
** all measurements are in chubs (double-words, c3_d, uint64_t).
|
||||
** little-endian addressing is ASSUMED.
|
||||
**
|
||||
**
|
||||
** framing:
|
||||
** the last two chubs of a frame:
|
||||
**
|
||||
**
|
||||
** {
|
||||
** 64-bit frame length
|
||||
** {
|
||||
@ -78,7 +78,7 @@ _foil_close(uv_file fil_f)
|
||||
/* _foil_path(): allocate path.
|
||||
*/
|
||||
static c3_c*
|
||||
_foil_path(u3_dire* dir_u,
|
||||
_foil_path(u3_dire* dir_u,
|
||||
const c3_c* nam_c)
|
||||
{
|
||||
c3_w len_w = strlen(dir_u->pax_c);
|
||||
@ -95,7 +95,7 @@ _foil_path(u3_dire* dir_u,
|
||||
/* u3_foil_folder(): load directory, blockingly. null if nonexistent.
|
||||
*/
|
||||
u3_dire*
|
||||
u3_foil_folder(const c3_c* pax_c)
|
||||
u3_foil_folder(const c3_c* pax_c)
|
||||
{
|
||||
u3_dire* dir_u;
|
||||
uv_fs_t ruq_u;
|
||||
@ -152,11 +152,11 @@ u3_foil_folder(const c3_c* pax_c)
|
||||
/* open directory file for reading, to fsync
|
||||
*/
|
||||
{
|
||||
if ( 0 > (err_i = uv_fs_open(u3L,
|
||||
&ruq_u,
|
||||
pax_c,
|
||||
if ( 0 > (err_i = uv_fs_open(u3L,
|
||||
&ruq_u,
|
||||
pax_c,
|
||||
O_RDONLY,
|
||||
0600,
|
||||
0600,
|
||||
0)) )
|
||||
{
|
||||
_foil_fail("open directory", err_i);
|
||||
@ -185,13 +185,13 @@ u3_foil_folder(const c3_c* pax_c)
|
||||
{
|
||||
struct _foil_create_request* req_u = (void *)ruq_u;
|
||||
u3_foil* fol_u;
|
||||
|
||||
|
||||
fol_u = c3_malloc(sizeof(*fol_u));
|
||||
fol_u->fil_u = ruq_u->result;
|
||||
fol_u->dir_u = req_u->dir_u;
|
||||
fol_u->nam_c = req_u->nam_c;
|
||||
fol_u->end_d = 0;
|
||||
|
||||
|
||||
req_u->fun_f(req_u->vod_p, fol_u);
|
||||
|
||||
c3_free(req_u->pax_c);
|
||||
@ -216,7 +216,7 @@ u3_foil_create(void (*fun_f)(void*, // context pointer
|
||||
*/
|
||||
{
|
||||
struct _foil_create_request* req_u;
|
||||
|
||||
|
||||
req_u = c3_malloc(sizeof(*req_u));
|
||||
|
||||
req_u->fun_f = fun_f;
|
||||
@ -226,9 +226,9 @@ u3_foil_create(void (*fun_f)(void*, // context pointer
|
||||
strcpy(req_u->nam_c, nam_c);
|
||||
req_u->pax_c = pax_c;
|
||||
|
||||
if ( 0 != (err_i = uv_fs_open(u3L,
|
||||
&req_u->ruq_u,
|
||||
pax_c,
|
||||
if ( 0 != (err_i = uv_fs_open(u3L,
|
||||
&req_u->ruq_u,
|
||||
pax_c,
|
||||
O_CREAT | O_WRONLY,
|
||||
0600,
|
||||
_foil_create_cb)) )
|
||||
@ -253,11 +253,11 @@ u3_foil_absorb(u3_dire* dir_u, // directory
|
||||
{
|
||||
c3_c* pax_c = _foil_path(dir_u, nam_c);
|
||||
|
||||
if ( 0 > (err_i = uv_fs_open(u3L,
|
||||
&ruq_u,
|
||||
pax_c,
|
||||
O_RDWR | O_CREAT,
|
||||
0600,
|
||||
if ( 0 > (err_i = uv_fs_open(u3L,
|
||||
&ruq_u,
|
||||
pax_c,
|
||||
O_RDWR | O_CREAT,
|
||||
0600,
|
||||
0)) )
|
||||
{
|
||||
_foil_fail(pax_c, err_i);
|
||||
@ -312,7 +312,7 @@ u3_foil_absorb(u3_dire* dir_u, // directory
|
||||
if ( req_u->fun_f ) {
|
||||
req_u->fun_f(req_u->vod_p);
|
||||
}
|
||||
|
||||
|
||||
c3_free(req_u->pax_c);
|
||||
c3_free(req_u->fol_u->nam_c);
|
||||
c3_free(req_u->fol_u);
|
||||
@ -336,7 +336,7 @@ u3_foil_delete(void (*fun_f)(void*), // context pointer
|
||||
*/
|
||||
{
|
||||
struct _foil_delete_request* req_u;
|
||||
|
||||
|
||||
req_u = c3_malloc(sizeof(*req_u));
|
||||
|
||||
req_u->fun_f = fun_f;
|
||||
@ -344,9 +344,9 @@ u3_foil_delete(void (*fun_f)(void*), // context pointer
|
||||
req_u->fol_u = fol_u;
|
||||
req_u->pax_c = pax_c;
|
||||
|
||||
if ( 0 != (err_i = uv_fs_unlink(u3L,
|
||||
&req_u->ruq_u,
|
||||
pax_c,
|
||||
if ( 0 != (err_i = uv_fs_unlink(u3L,
|
||||
&req_u->ruq_u,
|
||||
pax_c,
|
||||
_foil_delete_cb)) )
|
||||
{
|
||||
_foil_fail("uv_fs_unlink", err_i);
|
||||
@ -381,7 +381,7 @@ u3_foil_delete(void (*fun_f)(void*), // context pointer
|
||||
uv_fs_req_cleanup(ruq_u);
|
||||
c3_free(req_u->buf_d);
|
||||
|
||||
uv_fs_fsync(u3L, &req_u->ruq_u,
|
||||
uv_fs_fsync(u3L, &req_u->ruq_u,
|
||||
req_u->fol_u->fil_u,
|
||||
_foil_append_cb_2);
|
||||
}
|
||||
@ -413,7 +413,7 @@ u3_foil_append(void (*fun_f)(void*), // context pointer
|
||||
c3_w top_w, bot_w;
|
||||
|
||||
fol_u->end_d = pos_d + len_d + 2;
|
||||
|
||||
|
||||
/* XX: assumes "little-endian won", 32-bit frame length.
|
||||
*/
|
||||
top_w = u3r_mug_words((c3_w *)(void *) buf_d, (2 * len_d));
|
||||
@ -432,7 +432,7 @@ u3_foil_append(void (*fun_f)(void*), // context pointer
|
||||
buf_u[0] = uv_buf_init((void *)buf_d, (len_d * 8));
|
||||
buf_u[1] = uv_buf_init((void *)req_u->fam_d, 16);
|
||||
|
||||
if ( 0 != (err_i = uv_fs_write(u3L,
|
||||
if ( 0 != (err_i = uv_fs_write(u3L,
|
||||
&req_u->ruq_u,
|
||||
fol_u->fil_u,
|
||||
buf_u,
|
||||
@ -467,11 +467,11 @@ u3_foil_reveal(u3_foil* fol_u, // file from
|
||||
uv_buf_t buf_u = uv_buf_init((void *)fam_d, 16);
|
||||
|
||||
fam_d[0] = fam_d[1] = 0;
|
||||
if ( 0 > (err_i = uv_fs_read(u3L,
|
||||
&ruq_u,
|
||||
if ( 0 > (err_i = uv_fs_read(u3L,
|
||||
&ruq_u,
|
||||
fol_u->fil_u,
|
||||
&buf_u, 1,
|
||||
(8ULL * (pos_d - 2ULL)),
|
||||
&buf_u, 1,
|
||||
(8ULL * (pos_d - 2ULL)),
|
||||
0)) )
|
||||
{
|
||||
_foil_fail("uv_fs_read", err_i);
|
||||
@ -510,11 +510,11 @@ u3_foil_reveal(u3_foil* fol_u, // file from
|
||||
uv_buf_t buf_u = uv_buf_init((void *)buf_d, 8 * *len_d);
|
||||
c3_l gum_l;
|
||||
|
||||
if ( 0 > (err_i = uv_fs_read(u3L,
|
||||
&ruq_u,
|
||||
if ( 0 > (err_i = uv_fs_read(u3L,
|
||||
&ruq_u,
|
||||
fol_u->fil_u,
|
||||
&buf_u, 1,
|
||||
(8ULL * (pos_d - (*len_d + 2ULL))),
|
||||
&buf_u, 1,
|
||||
(8ULL * (pos_d - (*len_d + 2ULL))),
|
||||
0) ) )
|
||||
{
|
||||
_foil_fail("uv_fs_read", err_i);
|
||||
@ -568,7 +568,7 @@ u3_foil_reveal(u3_foil* fol_u, // file from
|
||||
_foil_close(req_u->fol_u->fil_u);
|
||||
|
||||
c3_free(req_u);
|
||||
}
|
||||
}
|
||||
else {
|
||||
req_u->num_d++;
|
||||
}
|
||||
@ -593,8 +593,8 @@ u3_foil_reveal(u3_foil* fol_u, // file from
|
||||
|
||||
/* fsync the parent directory, since we just created a file.
|
||||
*/
|
||||
uv_fs_fsync(u3L, &req_u->ruq_u,
|
||||
req_u->fol_u->dir_u->fil_u,
|
||||
uv_fs_fsync(u3L, &req_u->ruq_u,
|
||||
req_u->fol_u->dir_u->fil_u,
|
||||
_foil_invent_cb_2b);
|
||||
|
||||
u3_foil_append(_foil_invent_cb_2a,
|
||||
|
52
vere/fuse.c
52
vere/fuse.c
@ -46,8 +46,8 @@
|
||||
memset(&sat_u, 0, sizeof(sat_u));
|
||||
sat_u.st_ino = ino_i;
|
||||
|
||||
fuse_add_direntry(req_u,
|
||||
buf_u->buf_c + old_z,
|
||||
fuse_add_direntry(req_u,
|
||||
buf_u->buf_c + old_z,
|
||||
buf_u->siz_z - old_z,
|
||||
nam_c,
|
||||
&sat_u,
|
||||
@ -55,7 +55,7 @@
|
||||
}
|
||||
|
||||
static void
|
||||
_fuse_buf_reply(fuse_req_t req_u,
|
||||
_fuse_buf_reply(fuse_req_t req_u,
|
||||
c3_c* buf_c,
|
||||
c3_z siz_z,
|
||||
c3_f off_f,
|
||||
@ -120,8 +120,8 @@ _inode_new(void)
|
||||
|
||||
if ( fus_u->ion_u.len_w == fus_u->ion_u.ino_i ) {
|
||||
fus_u->ion_u.len_w *= 2;
|
||||
fus_u->ion_u.nod_u = realloc(fus_u->ion_u.nod_u,
|
||||
(fus_u->ion_u.len_w *
|
||||
fus_u->ion_u.nod_u = realloc(fus_u->ion_u.nod_u,
|
||||
(fus_u->ion_u.len_w *
|
||||
sizeof(struct fnod *)));
|
||||
}
|
||||
return nod_u;
|
||||
@ -178,11 +178,11 @@ static u3_noun
|
||||
_inode_path(u3_fnod* nod_u, u3_noun end)
|
||||
{
|
||||
if ( nod_u->par_u == 0 ) {
|
||||
return end;
|
||||
return end;
|
||||
}
|
||||
else {
|
||||
end = u3nc(u3i_string(nod_u->nam_c), end);
|
||||
|
||||
|
||||
return _inode_path(nod_u->par_u, end);
|
||||
}
|
||||
}
|
||||
@ -194,7 +194,7 @@ _inode_load_arch(u3_noun hap)
|
||||
{
|
||||
if ( u3_nul == u3A->own ) {
|
||||
return u3_none;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun our = u3dc("scot", 'p', u3k(u3h(u3A->own)));
|
||||
u3_noun pax = u3nc(c3__cy, u3nq(our, c3__home, u3k(u3A->wen), hap));
|
||||
@ -218,7 +218,7 @@ _inode_load_data(u3_noun hap)
|
||||
{
|
||||
if ( u3_nul == u3A->own ) {
|
||||
return u3_none;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun our = u3dc("scot", 'p', u3k(u3h(u3A->own)));
|
||||
u3_noun pax = u3nc(c3__cx, u3nq(our, c3__home, u3k(u3A->wen), hap));
|
||||
@ -258,7 +258,7 @@ _inode_fill_directory(u3_fnod* par_u, u3_noun kiz)
|
||||
u3_noun ph_zik = u3h(u3h(zik));
|
||||
c3_c* nam_c = u3r_string(ph_zik);
|
||||
u3_fent* fen_u = calloc(1, sizeof(u3_fent));
|
||||
|
||||
|
||||
fen_u->nod_u = _inode_make(par_u, nam_c);
|
||||
fen_u->nex_u = dir_u->fen_u;
|
||||
dir_u->fen_u = fen_u;
|
||||
@ -294,11 +294,11 @@ _inode_load(u3_fnod* nod_u)
|
||||
{
|
||||
if ( u3_nul == u3A->own ) {
|
||||
return c3n;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( nod_u->typ_e != u3_fuse_type_unknown ) {
|
||||
return c3y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun hap = _inode_path(nod_u, u3_nul);
|
||||
u3_weak ark = _inode_load_arch(u3k(hap));
|
||||
@ -359,9 +359,9 @@ _fuse_ll_init(void* usr_v,
|
||||
* @param parent inode number of the parent directory
|
||||
* @param name the name to look up
|
||||
*/
|
||||
static void
|
||||
_fuse_ll_lookup(fuse_req_t req_u,
|
||||
fuse_ino_t pno_i,
|
||||
static void
|
||||
_fuse_ll_lookup(fuse_req_t req_u,
|
||||
fuse_ino_t pno_i,
|
||||
const c3_c* nam_c)
|
||||
{
|
||||
uL(fprintf(uH, "ll_lookup %ld %s\n", pno_i, nam_c));
|
||||
@ -381,7 +381,7 @@ _fuse_ll_lookup(fuse_req_t req_u,
|
||||
nod_u = _inode_make(par_u, strdup(nam_c));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( c3n == _inode_load(nod_u) ) {
|
||||
fuse_reply_err(req_u, ENOENT);
|
||||
}
|
||||
@ -430,7 +430,7 @@ _fuse_ll_getattr(fuse_req_t req_u,
|
||||
|
||||
if ( c3n == _inode_stat(nod_u, &buf_u) ) {
|
||||
fuse_reply_err(req_u, ENOENT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fuse_reply_attr(req_u, &buf_u, 1.0);
|
||||
}
|
||||
@ -480,16 +480,16 @@ _fuse_ll_readdir(fuse_req_t req_u,
|
||||
|
||||
memset(&buf_u, 0, sizeof(buf_u));
|
||||
_fusedr_buf_add(req_u, &buf_u, ".", ino_i);
|
||||
_fusedr_buf_add(req_u, &buf_u, "..", nod_u->par_u
|
||||
_fusedr_buf_add(req_u, &buf_u, "..", nod_u->par_u
|
||||
? nod_u->par_u->ino_i
|
||||
: ino_i);
|
||||
{
|
||||
u3_fent* fen_u;
|
||||
|
||||
for ( fen_u = nod_u->dir_u->fen_u; fen_u; fen_u = fen_u->nex_u ) {
|
||||
_fusedr_buf_add(req_u,
|
||||
&buf_u,
|
||||
fen_u->nod_u->nam_c,
|
||||
_fusedr_buf_add(req_u,
|
||||
&buf_u,
|
||||
fen_u->nod_u->nam_c,
|
||||
fen_u->nod_u->ino_i);
|
||||
}
|
||||
}
|
||||
@ -584,10 +584,10 @@ _fuse_ll_read(fuse_req_t req_u,
|
||||
if ( c3n == _inode_load(nod_u) ) {
|
||||
fuse_reply_err(req_u, ENOENT);
|
||||
} else {
|
||||
_fuse_buf_reply(req_u,
|
||||
_fuse_buf_reply(req_u,
|
||||
(c3_c*)(nod_u->val_u->buf_y),
|
||||
nod_u->val_u->siz_z,
|
||||
off_f,
|
||||
off_f,
|
||||
max_z);
|
||||
}
|
||||
}
|
||||
@ -595,17 +595,17 @@ _fuse_ll_read(fuse_req_t req_u,
|
||||
|
||||
static struct fuse_lowlevel_ops fuse_api = {
|
||||
.init = _fuse_ll_init,
|
||||
.lookup = _fuse_ll_lookup,
|
||||
.lookup = _fuse_ll_lookup,
|
||||
.getattr = _fuse_ll_getattr,
|
||||
.readdir = _fuse_ll_readdir,
|
||||
.open = _fuse_ll_open,
|
||||
.read = _fuse_ll_read,
|
||||
};
|
||||
|
||||
/* _fuse_poll_cb():
|
||||
/* _fuse_poll_cb():
|
||||
*/
|
||||
static void
|
||||
_fuse_poll_cb(uv_poll_t* wax_u,
|
||||
_fuse_poll_cb(uv_poll_t* wax_u,
|
||||
c3_i sas_i,
|
||||
c3_i evt_i)
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/* generated from ivory.pill with md5 ed6ccaf0217c42734445244b2f19199d.
|
||||
** arvo commit: 5ff2c4c283d441b0099a7ef0c53d209d88fd4366.
|
||||
** toolchain:
|
||||
** toolchain:
|
||||
** .ivory/pill +ivory
|
||||
** xxd -i play/$ship/urb/.put/ivory.pill >ivory.c
|
||||
*/
|
||||
|
44
vere/king.c
44
vere/king.c
@ -375,14 +375,16 @@ _king_bail(u3_moor *vod_p, const c3_c *err_c)
|
||||
{
|
||||
u3_moor *free_p;
|
||||
fprintf(stderr, "_king_bail: %s\r\n", err_c);
|
||||
|
||||
if ( vod_p == 0 ) {
|
||||
free_p = u3K.cli_u;
|
||||
u3K.cli_u = u3K.cli_u->nex_u;
|
||||
u3a_free(free_p);
|
||||
} else {
|
||||
c3_free(free_p);
|
||||
}
|
||||
else {
|
||||
free_p = vod_p->nex_u;
|
||||
vod_p->nex_u = vod_p->nex_u->nex_u;
|
||||
u3a_free(free_p);
|
||||
c3_free(free_p);
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,14 +394,17 @@ void
|
||||
_king_socket_connect(uv_stream_t *sock, int status)
|
||||
{
|
||||
u3_moor *mor_u;
|
||||
|
||||
if ( u3K.cli_u == 0 ) {
|
||||
u3K.cli_u = u3a_malloc(sizeof(u3_moor));
|
||||
u3K.cli_u = c3_malloc(sizeof(u3_moor));
|
||||
mor_u = u3K.cli_u;
|
||||
mor_u->vod_p = 0;
|
||||
mor_u->nex_u = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for (mor_u = u3K.cli_u; mor_u->nex_u; mor_u = mor_u->nex_u);
|
||||
mor_u->nex_u = u3a_malloc(sizeof(u3_moor));
|
||||
|
||||
mor_u->nex_u = c3_malloc(sizeof(u3_moor));
|
||||
mor_u->nex_u->vod_p = mor_u;
|
||||
mor_u = mor_u->nex_u;
|
||||
mor_u->nex_u = 0;
|
||||
@ -781,8 +786,6 @@ u3_king_commence()
|
||||
//
|
||||
sag_w = u3C.wag_w;
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
u3C.wag_w &= ~u3o_debug_ram;
|
||||
u3C.wag_w &= ~u3o_check_corrupt;
|
||||
|
||||
u3m_boot_pier();
|
||||
{
|
||||
@ -810,6 +813,8 @@ u3_king_commence()
|
||||
u3K.soc_c = strdup(buf_c);
|
||||
}
|
||||
|
||||
uv_timer_init(u3L, &u3K.tim_u);
|
||||
|
||||
uv_pipe_init(u3L, &u3K.cmd_u, 0);
|
||||
uv_pipe_bind(&u3K.cmd_u, u3K.soc_c);
|
||||
uv_listen((uv_stream_t *)&u3K.cmd_u, 128, _king_socket_connect);
|
||||
@ -822,3 +827,26 @@ u3_king_commence()
|
||||
_king_loop_exit();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/* u3_king_grab(): gc the kingdom
|
||||
*/
|
||||
void
|
||||
u3_king_grab(void* vod_p)
|
||||
{
|
||||
// XX fix leaks and enable
|
||||
//
|
||||
#if 0
|
||||
c3_w man_w = 0, pir_w = 0;
|
||||
FILE* fil_u = stderr;
|
||||
|
||||
c3_assert( u3R == &(u3H->rod_u) );
|
||||
|
||||
fprintf(fil_u, "measuring king:\r\n");
|
||||
|
||||
man_w = u3m_mark(fil_u);
|
||||
pir_w = u3_pier_mark(fil_u);
|
||||
|
||||
u3a_print_memory(fil_u, "total marked", man_w + pir_w);
|
||||
u3a_print_memory(fil_u, "sweep", u3a_sweep());
|
||||
#endif
|
||||
}
|
||||
|
10
vere/newt.c
10
vere/newt.c
@ -54,7 +54,7 @@ _newt_consume(u3_moat* mot_u)
|
||||
memcpy(met_u->hun_y, mot_u->rag_y, mot_u->len_d);
|
||||
|
||||
#if 0
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"newt: %d: create: msg %p, new block %p, len %"
|
||||
PRIu64 ", has %" PRIu64 ", needs %" PRIu64 "\r\n",
|
||||
getpid(),
|
||||
@ -82,7 +82,7 @@ _newt_consume(u3_moat* mot_u)
|
||||
mot_u->rag_y = 0;
|
||||
}
|
||||
else {
|
||||
/* no message, but enough stray bytes to fill in
|
||||
/* no message, but enough stray bytes to fill in
|
||||
** a length; collect them and create a message.
|
||||
*/
|
||||
if ( mot_u->len_d >= 8ULL ) {
|
||||
@ -115,8 +115,8 @@ _newt_consume(u3_moat* mot_u)
|
||||
else {
|
||||
/* remove consumed length from stray bytes
|
||||
*/
|
||||
c3_y* buf_y = c3_malloc(mot_u->len_d);
|
||||
|
||||
c3_y* buf_y = c3_malloc(mot_u->len_d);
|
||||
|
||||
memcpy(buf_y, mot_u->rag_y + 8, mot_u->len_d);
|
||||
|
||||
c3_free(mot_u->rag_y);
|
||||
@ -205,7 +205,7 @@ _newt_consume(u3_moat* mot_u)
|
||||
/* _raft_alloc(): libuv-style allocator for raft.
|
||||
*/
|
||||
static void
|
||||
_newt_alloc(uv_handle_t* had_u,
|
||||
_newt_alloc(uv_handle_t* had_u,
|
||||
size_t len_i,
|
||||
uv_buf_t* buf_u)
|
||||
{
|
||||
|
132
vere/pier.c
132
vere/pier.c
@ -36,13 +36,13 @@
|
||||
** anything in parallel.
|
||||
**
|
||||
** in parallel, we try to save the event. it goes through phases:
|
||||
**
|
||||
**
|
||||
** generated
|
||||
** precommit requested
|
||||
** precommit complete
|
||||
** commit requested
|
||||
** commit complete
|
||||
**
|
||||
**
|
||||
** the sanity constraints that connect these two paths:
|
||||
**
|
||||
** - an event can't request a commit until it's computed.
|
||||
@ -53,7 +53,7 @@
|
||||
** events as we receive them.
|
||||
**
|
||||
** events are executed in order by the working process, and
|
||||
** (at present) precommitted and committed in strict order.
|
||||
** (at present) precommitted and committed in strict order.
|
||||
**
|
||||
** physically, precommits are saved to individual files, then
|
||||
** appended to a single commit log once successfully computed.
|
||||
@ -138,7 +138,7 @@ _pier_work_boot(u3_pier* pir_u, c3_o sav_o)
|
||||
|
||||
u3_newt_write(&god_u->inn_u, mat, 0);
|
||||
}
|
||||
|
||||
|
||||
/* _pier_disk_shutdown(): close the log.
|
||||
*/
|
||||
static void
|
||||
@ -223,7 +223,7 @@ _pier_disk_precommit_complete(void* vod_p,
|
||||
// fprintf(stderr, "pier: (%" PRIu64 "): precommit: replaced\r\n", wit_u->evt_d);
|
||||
|
||||
u3_foil_delete(0, 0, fol_u);
|
||||
wit_u->fol_u = 0;
|
||||
wit_u->fol_u = 0;
|
||||
}
|
||||
else {
|
||||
/* advance the precommit complete pointer.
|
||||
@ -294,7 +294,7 @@ _pier_disk_precommit_replace(u3_writ* wit_u)
|
||||
u3_pier* pir_u = wit_u->pir_u;
|
||||
u3_disk* log_u = pir_u->log_u;
|
||||
|
||||
/* if the replaced event is already precommitted,
|
||||
/* if the replaced event is already precommitted,
|
||||
** undo the precommit and delete the file.
|
||||
*/
|
||||
if ( wit_u->evt_d <= log_u->pre_d ) {
|
||||
@ -308,7 +308,7 @@ _pier_disk_precommit_replace(u3_writ* wit_u)
|
||||
log_u->pre_d -= 1ULL;
|
||||
|
||||
u3_foil_delete(0, wit_u, wit_u->fol_u);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* otherwise, decrement the precommit request counter.
|
||||
** the returning request will notice this and rerequest.
|
||||
@ -334,8 +334,8 @@ _pier_disk_commit_complete(void* vod_p)
|
||||
/* advance commit counter
|
||||
*/
|
||||
{
|
||||
c3_assert(wit_u->evt_d == log_u->moc_d);
|
||||
c3_assert(wit_u->evt_d == (1ULL + log_u->com_d));
|
||||
c3_assert(wit_u->evt_d == log_u->moc_d);
|
||||
c3_assert(wit_u->evt_d == (1ULL + log_u->com_d));
|
||||
log_u->com_d += 1ULL;
|
||||
}
|
||||
|
||||
@ -357,12 +357,12 @@ _pier_disk_commit_request(u3_writ* wit_u)
|
||||
{
|
||||
c3_d len_d = u3r_met(6, wit_u->mat);
|
||||
c3_d* buf_d = c3_malloc(8 * len_d);
|
||||
|
||||
|
||||
u3r_chubs(0, len_d, buf_d, wit_u->mat);
|
||||
u3_foil_append(_pier_disk_commit_complete,
|
||||
wit_u,
|
||||
log_u->fol_u,
|
||||
buf_d,
|
||||
buf_d,
|
||||
len_d);
|
||||
}
|
||||
|
||||
@ -432,7 +432,7 @@ _pier_work_build(u3_writ* wit_u)
|
||||
if ( 0 == wit_u->mat ) {
|
||||
c3_assert(0 != wit_u->job);
|
||||
|
||||
wit_u->mat = u3ke_jam(u3nq(c3__work,
|
||||
wit_u->mat = u3ke_jam(u3nq(c3__work,
|
||||
u3i_chubs(1, &wit_u->evt_d),
|
||||
wit_u->mug_l,
|
||||
u3k(wit_u->job)));
|
||||
@ -516,7 +516,7 @@ _pier_work_replace(u3_writ* wit_u,
|
||||
/* move backward in work processing
|
||||
*/
|
||||
{
|
||||
u3z(wit_u->job);
|
||||
u3z(wit_u->job);
|
||||
wit_u->job = job;
|
||||
|
||||
u3z(wit_u->mat);
|
||||
@ -606,7 +606,7 @@ start:
|
||||
*/
|
||||
if ( (wit_u->evt_d <= god_u->rel_d) &&
|
||||
(wit_u->evt_d == (1 + log_u->moc_d)) &&
|
||||
(wit_u->evt_d == (1 + log_u->com_d)) )
|
||||
(wit_u->evt_d == (1 + log_u->com_d)) )
|
||||
{
|
||||
_pier_disk_commit_request(wit_u);
|
||||
act_o = c3y;
|
||||
@ -615,7 +615,7 @@ start:
|
||||
/* if writ is (a) committed and (b) computed, delete from queue
|
||||
*/
|
||||
if ( (wit_u->evt_d <= log_u->com_d) &&
|
||||
(wit_u->evt_d <= god_u->dun_d) )
|
||||
(wit_u->evt_d <= god_u->dun_d) )
|
||||
{
|
||||
// fprintf(stderr, "pier: (%" PRIu64 "): delete\r\n", wit_u->evt_d);
|
||||
|
||||
@ -635,7 +635,7 @@ start:
|
||||
wit_u = pir_u->ext_u;
|
||||
act_o = c3y;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
/* otherwise, continue backward
|
||||
*/
|
||||
wit_u = wit_u->nex_u;
|
||||
@ -698,8 +698,8 @@ _pier_disk_load_precommit_file(u3_pier* pir_u,
|
||||
c3_free(wit_u);
|
||||
return 0;
|
||||
}
|
||||
if ( 0 == (buf_d = u3_foil_reveal(wit_u->fol_u,
|
||||
&pos_d,
|
||||
if ( 0 == (buf_d = u3_foil_reveal(wit_u->fol_u,
|
||||
&pos_d,
|
||||
&len_d)) )
|
||||
{
|
||||
// fprintf(stderr, "pier: load: precommit: reveal failed: %s\r\n", nam_c);
|
||||
@ -755,7 +755,7 @@ _pier_compare(const void* vod_p, const void* dov_p)
|
||||
/* _pier_disk_load_precommit(): load all precommits.
|
||||
*/
|
||||
static u3_writ**
|
||||
_pier_disk_load_precommit(u3_pier* pir_u,
|
||||
_pier_disk_load_precommit(u3_pier* pir_u,
|
||||
c3_d lav_d)
|
||||
{
|
||||
u3_disk* log_u = pir_u->log_u;
|
||||
@ -764,8 +764,8 @@ _pier_disk_load_precommit(u3_pier* pir_u,
|
||||
c3_w num_w = 0;
|
||||
|
||||
while ( all_u ) {
|
||||
u3_writ* wit_u = _pier_disk_load_precommit_file(pir_u,
|
||||
lav_d,
|
||||
u3_writ* wit_u = _pier_disk_load_precommit_file(pir_u,
|
||||
lav_d,
|
||||
all_u->nam_c);
|
||||
|
||||
if ( wit_u ) {
|
||||
@ -779,7 +779,7 @@ _pier_disk_load_precommit(u3_pier* pir_u,
|
||||
{
|
||||
u3_writ** ray_u = c3_malloc((1 + num_w) * sizeof(u3_writ*));
|
||||
c3_w i_w;
|
||||
|
||||
|
||||
i_w = 0;
|
||||
while ( pre_u ) {
|
||||
ray_u[i_w++] = pre_u;
|
||||
@ -801,7 +801,7 @@ _pier_disk_load_commit(u3_pier* pir_u,
|
||||
{
|
||||
u3_disk* log_u = pir_u->log_u;
|
||||
c3_d old_d = 0;
|
||||
|
||||
|
||||
log_u->fol_u = u3_foil_absorb(log_u->com_u, "commit.urbit-log");
|
||||
|
||||
if ( !log_u->fol_u ) {
|
||||
@ -884,7 +884,7 @@ _pier_disk_load_commit(u3_pier* pir_u,
|
||||
}
|
||||
|
||||
if ( evt_d < lav_d ) {
|
||||
u3z(mat);
|
||||
u3z(mat);
|
||||
u3z(job);
|
||||
|
||||
return c3y;
|
||||
@ -908,7 +908,7 @@ _pier_disk_load_commit(u3_pier* pir_u,
|
||||
if ( (1ULL + wit_u->evt_d) != pir_u->ext_u->evt_d ) {
|
||||
fprintf(stderr, "pier: load: commit: event gap: %" PRIx64 ", %"
|
||||
PRIx64 "\r\n",
|
||||
wit_u->evt_d,
|
||||
wit_u->evt_d,
|
||||
pir_u->ext_u->evt_d);
|
||||
u3z(mat);
|
||||
u3z(job);
|
||||
@ -1158,7 +1158,7 @@ _pier_disk_consolidate(u3_pier* pir_u,
|
||||
*/
|
||||
log_u->pre_d = log_u->rep_d = log_u->com_d;
|
||||
|
||||
/* in addition, what are these precommits? in the current
|
||||
/* in addition, what are these precommits? in the current
|
||||
** overly strict implementation, there can be only one live
|
||||
** precommit at a time. however, this implementation supports
|
||||
** multiple precommits.
|
||||
@ -1169,7 +1169,7 @@ _pier_disk_consolidate(u3_pier* pir_u,
|
||||
while ( *rep_u ) {
|
||||
if ( pir_u->ent_u == 0 ) {
|
||||
pir_u->ent_u = pir_u->ext_u = *rep_u;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( (*rep_u)->evt_d <= log_u->com_d ) {
|
||||
fprintf(stderr, "pier: consolidate: stale precommit %" PRIu64 "\r\n",
|
||||
@ -1249,7 +1249,7 @@ _pier_disk_create(u3_pier* pir_u,
|
||||
{
|
||||
u3_disk* log_u = c3_calloc(sizeof(*log_u));
|
||||
u3_writ** ray_u;
|
||||
|
||||
|
||||
log_u->pir_u = pir_u;
|
||||
pir_u->log_u = log_u;
|
||||
|
||||
@ -1362,10 +1362,10 @@ _pier_play(u3_pier* pir_u,
|
||||
*/
|
||||
_pier_disk_create(pir_u, lav_d);
|
||||
}
|
||||
|
||||
|
||||
/* _pier_work_exit(): handle subprocess exit.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
_pier_work_exit(uv_process_t* req_u,
|
||||
c3_ds sas_i,
|
||||
c3_i sig_i)
|
||||
@ -1482,7 +1482,7 @@ _pier_work_poke(void* vod_p,
|
||||
default: goto error;
|
||||
|
||||
case c3__work: {
|
||||
if ( (c3n == u3r_qual(jar, 0, &p_jar, &q_jar, &r_jar)) ||
|
||||
if ( (c3n == u3r_qual(jar, 0, &p_jar, &q_jar, &r_jar)) ||
|
||||
(c3n == u3ud(p_jar)) ||
|
||||
(u3r_met(6, p_jar) != 1) ||
|
||||
(c3n == u3ud(q_jar)) ||
|
||||
@ -1490,7 +1490,7 @@ _pier_work_poke(void* vod_p,
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
c3_d evt_d = u3r_chub(0, p_jar);
|
||||
c3_l mug_l = u3r_word(0, q_jar);
|
||||
u3_writ* wit_u = _pier_work_writ(pir_u, evt_d);
|
||||
@ -1514,9 +1514,9 @@ _pier_work_poke(void* vod_p,
|
||||
_pier_work_replace(wit_u, u3k(r_jar), mat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
case c3__done: {
|
||||
if ( (c3n == u3r_qual(jar, 0, &p_jar, &q_jar, &r_jar)) ||
|
||||
if ( (c3n == u3r_qual(jar, 0, &p_jar, &q_jar, &r_jar)) ||
|
||||
(c3n == u3ud(p_jar)) ||
|
||||
(u3r_met(6, p_jar) != 1) ||
|
||||
(c3n == u3ud(q_jar)) ||
|
||||
@ -1524,7 +1524,7 @@ _pier_work_poke(void* vod_p,
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
else {
|
||||
else {
|
||||
c3_d evt_d = u3r_chub(0, p_jar);
|
||||
c3_l mug_l = u3r_word(0, q_jar);
|
||||
u3_writ* wit_u = _pier_work_writ(pir_u, evt_d);
|
||||
@ -1535,9 +1535,9 @@ _pier_work_poke(void* vod_p,
|
||||
}
|
||||
_pier_work_complete(wit_u, mug_l, u3k(r_jar));
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_pier_apply(pir_u);
|
||||
@ -1550,7 +1550,7 @@ _pier_work_poke(void* vod_p,
|
||||
}
|
||||
}
|
||||
|
||||
/* pier_work_create(): instantiate child process.
|
||||
/* pier_work_create(): instantiate child process.
|
||||
*/
|
||||
u3_lord*
|
||||
_pier_work_create(u3_pier* pir_u)
|
||||
@ -1574,9 +1574,9 @@ _pier_work_create(u3_pier* pir_u)
|
||||
strcpy(pax_c, pir_u->pax_c);
|
||||
|
||||
sprintf(key_c, "%" PRIx64 ":%" PRIx64 ":%" PRIx64 ":%" PRIx64 "",
|
||||
pir_u->key_d[0],
|
||||
pir_u->key_d[1],
|
||||
pir_u->key_d[2],
|
||||
pir_u->key_d[0],
|
||||
pir_u->key_d[1],
|
||||
pir_u->key_d[2],
|
||||
pir_u->key_d[3]);
|
||||
|
||||
sprintf(wag_c, "%u", pir_u->wag_w);
|
||||
@ -1601,7 +1601,7 @@ _pier_work_create(u3_pier* pir_u)
|
||||
|
||||
god_u->ops_u.stdio = god_u->cod_u;
|
||||
god_u->ops_u.stdio_count = 3;
|
||||
|
||||
|
||||
god_u->ops_u.exit_cb = _pier_work_exit;
|
||||
god_u->ops_u.file = arg_c[0];
|
||||
god_u->ops_u.args = arg_c;
|
||||
@ -1615,7 +1615,7 @@ _pier_work_create(u3_pier* pir_u)
|
||||
}
|
||||
|
||||
/* start reading from proc
|
||||
*/
|
||||
*/
|
||||
{
|
||||
god_u->out_u.vod_p = pir_u;
|
||||
god_u->out_u.pok_f = _pier_work_poke;
|
||||
@ -1692,7 +1692,7 @@ u3_pier_exit(void)
|
||||
{
|
||||
if ( 0 == u3K.len_w ) {
|
||||
c3_assert(!"plan: no pier");
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_pier* pir_u = u3K.tab_u[0];
|
||||
|
||||
@ -1848,7 +1848,7 @@ _pier_loop_wake(u3_pier* pir_u)
|
||||
u3_http_io_talk();
|
||||
u3_http_ef_bake();
|
||||
u3a_lop(cod_l);
|
||||
|
||||
|
||||
cod_l = u3a_lush(c3__term);
|
||||
u3_term_io_talk();
|
||||
u3_term_ef_bake();
|
||||
@ -1871,7 +1871,7 @@ _pier_loop_exit(void)
|
||||
u3_ames_io_exit(u3_pier_stub());
|
||||
u3a_lop(cod_l);
|
||||
|
||||
cod_l = u3a_lush(c3__term);
|
||||
cod_l = u3a_lush(c3__term);
|
||||
u3_term_io_exit();
|
||||
u3a_lop(cod_l);
|
||||
|
||||
@ -1935,7 +1935,7 @@ _pier_boot_seed(u3_pier* pir_u)
|
||||
/* _pier_boot_legacy(): poorly organized legacy boot calls.
|
||||
*/
|
||||
static void
|
||||
_pier_boot_legacy(u3_pier* pir_u,
|
||||
_pier_boot_legacy(u3_pier* pir_u,
|
||||
c3_o nuu_o)
|
||||
{
|
||||
/* XX XX horrible backward compatibility hack - still used
|
||||
@ -2106,7 +2106,7 @@ u3_pier_punt(c3_l tab_l, u3_noun tac)
|
||||
u3_term_io_loja(0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else {
|
||||
u3_noun wol = u3dc("wash", u3nc(tab_l, col_l), u3k(u3h(cat)));
|
||||
|
||||
_pier_wall(wol);
|
||||
@ -2135,7 +2135,7 @@ u3_pier_stub(void)
|
||||
{
|
||||
if ( 0 == u3K.len_w ) {
|
||||
c3_assert(!"plan: no pier");
|
||||
}
|
||||
}
|
||||
else {
|
||||
return u3K.tab_u[0];
|
||||
}
|
||||
@ -2219,3 +2219,37 @@ u3_pier_stay(c3_w wag_w, u3_noun pax)
|
||||
|
||||
u3z(pax);
|
||||
}
|
||||
|
||||
/* u3_pier_mark(): mark all Loom allocations in all u3_pier structs.
|
||||
*/
|
||||
c3_w
|
||||
u3_pier_mark(FILE* fil_u)
|
||||
{
|
||||
c3_w len_w = u3K.len_w;
|
||||
c3_w tot_w = 0;
|
||||
u3_pier* pir_u;
|
||||
|
||||
while ( 0 < len_w ) {
|
||||
pir_u = u3K.tab_u[--len_w];
|
||||
fprintf(stderr, "pier: %u\r\n", len_w);
|
||||
|
||||
tot_w += u3a_maid(fil_u, " boot event", u3a_mark_noun(pir_u->bot));
|
||||
|
||||
{
|
||||
u3_writ* wit_u = pir_u->ent_u;
|
||||
c3_w wit_w = 0;
|
||||
|
||||
while ( 0 != wit_u ) {
|
||||
wit_w += u3a_mark_noun(wit_u->job);
|
||||
wit_w += u3a_mark_noun(wit_u->now);
|
||||
wit_w += u3a_mark_noun(wit_u->mat);
|
||||
wit_w += u3a_mark_noun(wit_u->act);
|
||||
wit_u = wit_u->nex_u;
|
||||
}
|
||||
|
||||
tot_w += u3a_maid(fil_u, " writs", wit_w);
|
||||
}
|
||||
}
|
||||
|
||||
return tot_w;
|
||||
}
|
||||
|
17
vere/reck.c
17
vere/reck.c
@ -131,9 +131,12 @@ _reck_kick_term(u3_pier* pir_u, u3_noun pox, c3_l tid_l, u3_noun fav)
|
||||
|
||||
case c3__mass: p_fav = u3t(fav);
|
||||
{
|
||||
// XX GC the full king state
|
||||
u3z(pox); u3z(fav);
|
||||
|
||||
// gc the kingdom
|
||||
//
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
uv_timer_start(&u3K.tim_u, (uv_timer_cb)u3_king_grab, 0, 0);
|
||||
return c3y;
|
||||
} break;
|
||||
}
|
||||
c3_assert(!"not reached"); return 0;
|
||||
@ -142,7 +145,7 @@ _reck_kick_term(u3_pier* pir_u, u3_noun pox, c3_l tid_l, u3_noun fav)
|
||||
/* _reck_kick_http(): apply http effects.
|
||||
*/
|
||||
static u3_noun
|
||||
_reck_kick_http(u3_pier* pir_u,
|
||||
_reck_kick_http(u3_pier* pir_u,
|
||||
u3_noun pox,
|
||||
c3_l sev_l,
|
||||
c3_l coq_l,
|
||||
@ -300,9 +303,9 @@ _reck_kick_spec(u3_pier* pir_u, u3_noun pox, u3_noun fav)
|
||||
u3_noun i_pox, t_pox;
|
||||
|
||||
if ( (c3n == u3r_cell(pox, &i_pox, &t_pox)) ||
|
||||
((i_pox != u3_blip) &&
|
||||
(i_pox != c3__gold) &&
|
||||
(i_pox != c3__iron) &&
|
||||
((i_pox != u3_blip) &&
|
||||
(i_pox != c3__gold) &&
|
||||
(i_pox != c3__iron) &&
|
||||
(i_pox != c3__lead)) )
|
||||
{
|
||||
u3z(pox); u3z(fav); return c3n;
|
||||
@ -458,7 +461,7 @@ u3_reck_kick(u3_pier* pir_u, u3_noun ovo)
|
||||
(c3__init == u3h(u3t(ovo))) )
|
||||
#endif
|
||||
{
|
||||
u3_pier_work(pir_u,
|
||||
u3_pier_work(pir_u,
|
||||
u3nt(u3_blip, c3__term, u3_nul),
|
||||
u3nc(c3__flog, u3k(u3t(ovo))));
|
||||
}
|
||||
|
10
vere/serf.c
10
vere/serf.c
@ -330,7 +330,7 @@ _serf_send_replace(c3_d evt_d, u3_noun ovo)
|
||||
{
|
||||
fprintf(stderr, "serf_send_replace %" PRIu64 " %s\r\n",
|
||||
evt_d,
|
||||
u3r_string(u3h(u3t(ovo))));
|
||||
u3r_string(u3h(u3t(ovo))));
|
||||
|
||||
_serf_send(u3nq(c3__work,
|
||||
u3i_chubs(1, &evt_d),
|
||||
@ -408,6 +408,8 @@ _serf_sure(u3_noun ovo, u3_noun vir, u3_noun cor)
|
||||
}
|
||||
}
|
||||
|
||||
// XX this runs on replay too
|
||||
//
|
||||
_serf_grab(sac, ovo, vir);
|
||||
_serf_send_complete(vir);
|
||||
|
||||
@ -449,7 +451,7 @@ _serf_work_live(c3_d evt_d, // event number
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
gon = u3m_soft(0, u3v_poke, u3k(ovo));
|
||||
|
||||
#ifdef U3_EVENT_TIME_DEBUG
|
||||
@ -464,7 +466,7 @@ _serf_work_live(c3_d evt_d, // event number
|
||||
clr_w = ms_w > 1000 ? 1 : ms_w < 100 ? 2 : 3; // red, green, yellow
|
||||
if (c3__belt != u3h(u3t(ovo)) || clr_w != 2) {
|
||||
uL(fprintf(uH, "\x1b[3%dm%%%s (%" PRIu64 ") %4d.%02dms\x1b[0m\n",
|
||||
clr_w, txt_c, evt_d, ms_w,
|
||||
clr_w, txt_c, evt_d, ms_w,
|
||||
(int) (d0.tv_usec % 1000) / 10));
|
||||
}
|
||||
free(txt_c);
|
||||
@ -602,7 +604,7 @@ _serf_poke_boot(u3_noun who, u3_noun fak, c3_w len_w)
|
||||
u3V.len_w = len_w;
|
||||
}
|
||||
|
||||
/* _serf_poke():
|
||||
/* _serf_poke():
|
||||
*/
|
||||
void
|
||||
_serf_poke(void* vod_p, u3_noun mat)
|
||||
|
@ -413,7 +413,7 @@ _unix_free_node(u3_pier *pir_u, u3_unod* nod_u)
|
||||
u3_noun can;
|
||||
if ( nod_u->par_u ) {
|
||||
u3_unod* don_u = nod_u->par_u->kid_u;
|
||||
|
||||
|
||||
if ( !don_u ) {
|
||||
}
|
||||
else if ( nod_u == don_u ) {
|
||||
@ -1336,7 +1336,7 @@ u3_unix_ef_look(u3_pier *pir_u, u3_noun all)
|
||||
if ( c3y == pir_u->unx_u->dyr ) {
|
||||
pir_u->unx_u->dyr = c3n;
|
||||
u3_umon* mon_u;
|
||||
|
||||
|
||||
for ( mon_u = pir_u->unx_u->mon_u; mon_u; mon_u = mon_u->nex_u ) {
|
||||
_unix_update_mount(pir_u, mon_u, all);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user