Merge branch 'test' into do

Conflicts:
	urb/urbit.pill
	urb/zod/base/arvo/  --  took --theirs
	urb/zod/base/fap/talk/core.hook
This commit is contained in:
Anton Dyudin 2015-05-20 11:45:37 -07:00
commit 345713edac
33 changed files with 1559 additions and 168 deletions

View File

@ -354,7 +354,7 @@ LIBCOMMONMARK=outside/commonmark/build/src/libcmark.a
LIBSCRYPT=outside/scrypt/scrypt.a
all: vere
all: urbit
.MAKEFILE-VERSION: Makefile .make.conf
@echo "Makefile update."
@ -363,7 +363,7 @@ all: vere
.make.conf:
@echo "# Set custom configuration here, please!" > ".make.conf"
vere: $(BIN)/vere
urbit: $(BIN)/urbit
meme: $(BIN)/meme
$(LIBUV_MAKEFILE) $(LIBUV_MAKEFILE2):
@ -393,14 +393,14 @@ $(CRE2_OFILES): outside/cre2/src/src/cre2.cpp outside/cre2/src/src/cre2.h $(LIBR
$(V_OFILES): i/v/vere.h
ifdef NO_SILENT_RULES
$(BIN)/vere: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT)
$(BIN)/urbit: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT)
mkdir -p $(BIN)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/vere $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT)
$(CLD) $(CLDOSFLAGS) -o $(BIN)/urbit $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT)
else
$(BIN)/vere: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT)
@echo " CCLD $(BIN)/vere"
$(BIN)/urbit: $(LIBCRE) $(LIBCOMMONMARK) $(VERE_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT)
@echo " CCLD $(BIN)/urbit"
@mkdir -p $(BIN)
@$(CLD) $(CLDOSFLAGS) -o $(BIN)/vere $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT)
@$(CLD) $(CLDOSFLAGS) -o $(BIN)/urbit $(VERE_OFILES) $(LIBUV) $(LIBCRE) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBS) $(LIBCOMMONMARK) $(LIBSCRYPT)
endif
$(BIN)/meme: $(LIBCRE) $(LIBCOMMONMARK) $(MEME_OFILES) $(LIBUV) $(LIBRE2) $(LIBED25519) $(LIBANACHRONISM) $(LIBSCRYPT)
@ -416,24 +416,24 @@ etags:
osxpackage:
$(RM) -r inst
$(MAKE) distclean
$(MAKE) $(BIN)/vere LIB=/usr/local/lib/urb STATIC=yes
$(MAKE) $(BIN)/urbit LIB=/usr/local/lib/urb STATIC=yes
mkdir -p inst/usr/local/lib/urb inst/usr/local/bin
cp $(BIN)/vere inst/usr/local/bin
cp $(BIN)/urbit inst/usr/local/bin
cp urb/urbit.pill inst/usr/local/lib/urb
cp -R urb/zod inst/usr/local/lib/urb
pkgbuild --root inst --identifier org.urbit.vere --version 0.2 vere.pkg
pkgbuild --root inst --identifier org.urbit.urbit --version 0.2 urbit.pkg
debbuild:
$(MAKE) $(BIN)/vere LIB=/usr/share/urb
$(MAKE) $(BIN)/urbit LIB=/usr/share/urb
debinstall:
mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/share/urb
install -m755 $(BIN)/vere $(DESTDIR)/usr/bin
install -m755 $(BIN)/urbit $(DESTDIR)/usr/bin
cp urb/urbit.pill $(DESTDIR)/usr/share/urb
cp -R urb/zod $(DESTDIR)/usr/share/urb
clean:
$(RM) $(VERE_OFILES) $(BIN)/vere vere.pkg $(VERE_DFILES)
$(RM) $(VERE_OFILES) $(BIN)/urbit urbit.pkg $(VERE_DFILES)
distclean: clean $(LIBUV_MAKEFILE)
$(MAKE) -C outside/libuv_0.11 distclean

View File

@ -1,8 +1,6 @@
Urbit
=====
[![Build Status](https://travis-ci.org/urbit/urbit.png?branch=master)](https://travis-ci.org/urbit/urbit)
> Tlön is surely a labyrinth, but it is
> a labyrinth devised by men, a labyrinth
> destined to be deciphered by men.
@ -12,7 +10,8 @@ Urbit is a new programming and execution environment designed from scratch. Any
resemblance to existing languages or operating systems is coincidental,
cosmetic, or inevitable.
All of the source code is entirely in the public domain.
All of the source code is distributed under the MIT license, but is for all
intents and purposes in the public domain.
Install
-------------------
@ -92,37 +91,54 @@ Run `bin/vere -c mypier` in the urbit directory, where `mypier` is a directory t
A _pier_ is an Urbit virtual machine that hosts one or more Urbit identities,
or _ships_. When you run `bin/vere -c`, it automatically creates a 128-bit ship, or `submarine`. Your name (a hash of a randomly-generated public key) will look something like:
~machec-binnev-dordeb-sogduc--dosmul-sarrum-faplec-nidted
~hinfet-rovler-labheb-laddev--ladner-pillur-divmun-tamfur
First you'll see a string of messages like:
vere: urbit home is /Users/cyarvin/Documents/src/u3/urb
loom: mapped 1024MB
time: ~2013.9.1..03.57.11..4935
ames: on localhost, UDP 63908.
vere: urbit home is mypier
vere: hostname is cyarvin
loom: mapped 2048MB
boot: installed 190 jets
boot: loading /home/cyarvin/urbit/urb/urbit.pill
cv_make: loaded pill /home/cyarvin/urbit/urb/urbit.pill, as 8ddffb8
cv_make: kernel 12e1ffdf, core 23b73cd
cv_jack: activating kernel 12e1ffdf
%post-start
cv_jack: activated
cv_start: time: ~2015.5.9..18.03.32..ba77
Next vere will generate a 2048 RSA key that will be used as your identity:
generating 2048-bit RSA pair...
and then it'll pause a little, 'cause this is slow, and then
saving passcode in /Users/cyarvin/.urbit/~magsut-hopful.txt
saving passcode in mypier/.urb/code.~malmel-ridnep
(for real security, write it down and delete the file...)
and, then, if the network gods are happy, your submarine will start pulling
down Arvo files:
+ /~machec-binnev-dordeb-sogduc--dosmul-sarrum-faplec-nidted/main/1/bin/ticket/hoon
+ /~machec-binnev-dordeb-sogduc--dosmul-sarrum-faplec-nidted/main/1/bin/reset/hoon
+ /~machec-binnev-dordeb-sogduc--dosmul-sarrum-faplec-nidted/main/1/bin/ye/hoon
+ /~machec-binnev-dordeb-sogduc--dosmul-sarrum-faplec-nidted/main/1/bin/ls/hoon
[%bos ~zod ~hinfet-rovler-labheb-laddev--ladner-pillur-divmun-tamfur]
[%behn-init ~hinfet-rovler-labheb-laddev--ladner-pillur-divmun-tamfur]
ames: czar zod.urbit.org: ip .192.241.195.84
kick: init: ~hinfet-rovler-labheb-laddev--ladner-pillur-divmun-tamfur
ames: on localhost, UDP 55659.
http: live (insecure) on 8081
http: live ("secure") on 8444
term: live on 10024
; ~zod |Tianming| is your neighbor
; ~zod |Tianming| is your neighbor
<sole>
and the like. You'll see a couple pages of this stuff. Don't worry too much
about the details right now. Finally, you'll get the Arvo shell prompt (which
is also a Hoon REPL):
You will probably be stuck here for a while as your local submarine copies all of its files from the master carrier, `~zod`. This is normal.
~machec-binnev-dordeb-sogduc--dosmul-sarrum-faplec-nidted/try=>
Once that is finished, you will be dropped into the main application, the `:dojo` shell (which is coincidentally also a Hoon REPL):
~hinfet-rovler-labheb-laddev--ladner-pillur-divmun-tamfur:dojo>
If you would like to safely bring this ship back into port (End the Unix process),
just enter Control-D.
just enter Control-V to switch to the task manager, then Control-D.
To re-launch your pier after creation run `bin/vere mypier` (exclude the `-c`)
@ -151,19 +167,18 @@ Let's say one of your ships is `~waclux-tomwyc` and its ticket is
rendered in Hoon's syllabic base, `@p`.)
A new life awaits you on the off-world colonies! To begin, just
type at the submarine prompt:
type at the `:dojo` prompt:
:begin ~waclux-tomwyc
:helm?begin
and follow the directions. When the script completes, hit return
and you'll be the `~waclux-tomwyc` you wanted to be. Now, when other user's see you in chat or look at your
Urbit social profile (a fasplan), they can learn whatever information you gave the :begin process.
and enter your ship name and ticket when prompted. When the script completes, hit return
and you'll begin re-cloning the files from `~zod` needed to boot the destroyer, after which you will become the `~waclux-tomwyc` you wanted to be.
###5. Play with Arvo
If all went well, you now have a nice short prompt:
~waclux-tomwyc/try=>
~waclux-tomwyc:dojo>
If all did not go well (send us another email), or you're just
too impatient to wait for your destroyer, you have a big long
@ -175,29 +190,30 @@ exercises will still work.
Let's try a few quick things to stretch your fingers. Type these
command lines and you should see the matching results:
~waclux-tomwyc/try=> "hello, world"
~waclux-tomwyc:dojo> "hello, world"
"hello, world"
~waclux-tomwyc/try=> (add 2 2)
~waclux-tomwyc:dojo> (add 2 2)
4
~waclux-tomwyc/try=> :hello %world
"hello, world."
~waclux-tomwyc:dojo> +hello %world
'hello, dlrow'
~waclux-tomwyc/try=> :cat /=main=/bin/hello/hoon
~waclux-tomwyc:dojo> +cat /=home=/cat/hello/gate/hook :: XX make this work
::
:: /=main=/bin/hello/hoon
:::: /hook/gate/hello/cat
::
/? 314
::
|= *
|= [planet=@ta ~]
^- bowl
:_ ~ :_ ~
:- %%
!>("hello, {(trip planet)}.")
::::
!:
|= [* [[txt=@tas ~] ~]]
:- %noun
(crip (weld "hello, " (flop (trip txt))))
What did you just do?
One, you used Arvo as a Hoon REPL to print the constant `"hello,
One, you used the Hoon REPL to print the constant `"hello,
world"`, which is a fancy way to write the Nock noun
[104 101 108 108 111 44 32 119 111 114 108 100 0]
@ -205,7 +221,7 @@ world"`, which is a fancy way to write the Nock noun
Two, you called the Hoon `add` function to see that two plus two
is four. Math seems to work the same on the off-world colonies.
Three, you ran the Arvo application `:hello` with the argument
Three, you ran the `:dojo` application `+hello` with the argument
`%world`, which is just a fancy way to write the atom
`431.316.168.567` (or, for non-Germans, `431,316,168,567`). You
might recognize it better as `0x64.6c72.6f77` - the ASCII
@ -214,18 +230,18 @@ characters in LSB first order.
(Is Urbit German? Sadly, no. But all our noun print formats are
URL-safe, which dot is and comma isn't.)
And you (4) used the Arvo application :cat to print the Hoon file
And you (4) used the `:dojo` application `+cat` to print the Hoon file
/=main=/bin/hello/hoon
/=home=/cat/hello/gate/hook
which, supposing your current date is
~2013.9.1..04.38.31..f259
~2015.5.9..18.03.32..ba77
(ie, September 1, 2013 at 4:38:31 GMT/LS25 plus 0xf259/65536
seconds), is equivalent to the global path
(ie, May 9, 2015 at 18:03:32 GMT/LS25 plus 0xba77/47735 seconds), is
equivalent to the global path
/~waclux-tomwyc/main/~2013.8.23..04.38.31..f259/bin/hello/hoon
/~waclux-tomwyc/home/~2015.5.9..18.03.32..ba77/cat/hello/gate/hook
which anyone in Urbit can, see and even use - but we're getting
ahead of ourselves.
@ -259,20 +275,31 @@ There are also some special control keys specific to Arvo. It's
a good idea to learn these first so that you feel in, um,
control.
First, we'll quit out of an infinite loop with `^C`:
First off, Arvo has a simple task manager interface, allowing you see the
running commands, along with being able to spawn or kill programs.
~waclux-tomwyc/try=> :infinite
Hitting `^V` will bring you to this interface, and running `-prog`
will kill that program while `+prog` will spawn a new one.
If you ever end up with a broken program that is spouting errors
and wish to restart it, do it from this interface. Even our shell
and REPL `:dojo` is just another program in this list!
This is the base view from Arvo as well. If you kill all your running
programs, it will drop you into this interface.
Next, we'll show you how we can quit out of an infinite loop with `^C`:
~waclux-tomwyc:dojo> |-($)
When you hit return at the end of this line, Arvo will appear to
hang. Do not be alarmed! This is not a bug - it means that
we've started running our infinite loop before printing the next
console prompt. Simply hit `^C`, and you'll see
! intr
~waclux-tomwyc/try=> :infinite
(There may be some stacktrace stuff before the `! intr`, depending
on whether your kernel was compiled with debugging.)
recover: dig: intr
intr
[various stack traces]
~waclux-tomwyc:dojo> |-($)
Hit `^U` to delete the line and escape from infinity. Arvo is a
deterministic OS; you interrupted it while processing an event
@ -296,40 +323,38 @@ current character - as in Unix.
Try this by running
~waclux-tomwyc/try=> :begin
~waclux-tomwyc:dojo> +helm?begin
Do you have a ship and a ticket? yes
~waclux-tomwyc:dojo: your ship: ~
Then hit `^D` and you'll be back to the command prompt (which,
unlike in Unix, is not a task itself, but part of the OS).
Then hit `^D` and you'll kill the current task, the command prompt `:dojo`.
We don't always want to kill the prompting task. We often want
to switch between tasks, or between tasks and the command line.
Sort of like switching between windows, except in a command line.
We do this with `^X`. Try
We do this with `^X`.
~waclux-tomwyc/try=> :begin
Let's try an example: First, make sure you
have two apps running, like `:dojo` and `:talk`. Then, try:
Do you have a ship and a ticket? yes
~waclux-tomwyc:dojo> :helm?begin
But hit `^X` instead of `^D`. You'll get a prompt again. Use
~waclux-tomwyc:dojo: your ship: ~
But hit `^X` instead of `^D`. You'll get switched to the next app in line, in this case `:talk`. Use
it:
~waclux-tomwyc/try=> :begin
~waclux-tomwyc:dojo> :helm?begin
~waclux-tomwyc/try=> :hello %world
"hello, world."
~waclux-tomwyc/try=>
~waclux-tomwyc:talk() hello, world!
Hit `^X` again:
~waclux-tomwyc/try=> :begin
~waclux-tomwyc:dojo> :helm?begin
~waclux-tomwyc/try=> :hello %world
"hello, world."
Do you have a ship and a ticket? yes
~waclux-tomwyc:dojo: your ship: ~
And finally, hit `^C` to kill the task.
And finally, hit `^D` to kill the task.
Lastly, Arvo is a single-level store. Since it's not the '70s
anymore and disk is cheap, everything you do is saved for ever.
@ -337,29 +362,40 @@ anymore and disk is cheap, everything you do is saved for ever.
log - so you, or the government if they haz your filez, can
repeat every computation you've ever performed.)
If the current prompt is just the shell prompt, `^D` on an empty
If the current prompt is the task manager, `^D` on an empty
line will log out - as in Unix:
~waclux-tomwyc/try=>
oxford:~/urbit; pwd
/Users/cyarvin/urbit
oxford:~/urbit; echo "hello, world"
~waclux-tomwyc:dojo, talk#
cyarvin:~/urbit; pwd
/home/cyarvin/urbit
cyarvin:~/urbit; echo "hello, world"
hello, world
oxford:~/urbit;
cyarvin:~/urbit;
Then you can restart and be right back where you were - just
run `bin/vere` without `-c`:
oxford:~/urbit; bin/vere mypier
vere: urbit home is /Users/cyarvin/urb
loom: loaded 9MB
time: ~2013.9.1..17.23.05..0cc1
ames: on localhost, UDP 60342.
http: live on 8080
rest: checkpoint to event 383
rest: old 0v1c.gkr1o, new 0v10.m4gdu
cyarvin:~/urbit; bin/vere mypier
vere: urbit home is mypier
vere: hostname is cyarvin
loom: mapped 2048MB
protected loom
live: loaded: MB/172.933.120
boot: installed 190 jets
cv_start: time: ~2015.5.9..19.03.45..a758
raft: single-instance mode
raft: -> lead
sist: booting
rest: checkpoint to event 23.630
rest: old 0vt.3iqg5, new 0v1j.moa0t
loaded passcode from mypier/.urb/code.~lacsep-bonnyr
---------------- playback complete----------------
waclux-tomwyc/try=>
ames: on localhost, UDP 46404.
http: live (insecure) on 8080
http: live ("secure") on 8443
term: live on 10023
~waclux-tomwyc:dojo, talk#
Use your arrow keys and you'll see your history is still there.
Arvo is indestructible and can be shut down however you like
@ -370,34 +406,18 @@ But don't try to operate the same ship on two Unix hosts at the
same time. This will confuse everyone, including yourself.
####System administration
Sometimes we make changes to Hoon or Arvo (we never make changes
to Nock) and you need to update your ship.
There are two steps to updating. You need to get the new files,
and you need to install them. To get them:
Luckily, Arvo has some special sauce that allows the same carrier
you initially pulled your files from to push kernel update over-the-air.
You may notice this happening automatically from time to time through mysterious messages
such as:
~waclux-tomwyc/try=> :update
: /~waclux-tomwyc/arvo/2/hoon/hoon
: /~waclux-tomwyc/arvo/2/dill/hoon
: /~waclux-tomwyc/arvo/2/batz/hoon
['merge succeeded' {}]
To install them (the simplest, slowest, most general way):
~waclux-tomwyc/try=> :reset
%reset-start
%reset-parsed
%reset-compiled
%hoon-load
[%tang /~waclux-tomwyc/arvo/~2013.11.26..20.29.15..090f/zuse ~tirnux-latwex]
[%vane %a /~waclux-tomwyc/arvo/~2013.11.26..20.29.15..090f/ames ~tolryn-watret]
[%vane %b /~waclux-tomwyc/arvo/~2013.11.26..20.29.15..090f/batz ~donfex-ladsem]
[%vane %c /~waclux-tomwyc/arvo/~2013.11.26..20.29.15..090f/clay ~picsug-mitref]
[%vane %d /~waclux-tomwyc/arvo/~2013.11.26..20.29.15..090f/dill ~dilpex-laptug]
[%vane %e /~waclux-tomwyc/arvo/~2013.11.26..20.29.15..090f/eyre ~forbur-disben]
All of your state, including running tasks, will be unchanged.
These updates will be applied without having to restart Arvo or any of its
`%vanes`. All of your state, including running tasks, will be unchanged.
Sometimes the interpreter, called `vere` gets updated. In your urbit directory, back in Unixland, run:
@ -407,20 +427,22 @@ every so often to get the latest Urbit source code. You'll need to run:
make clean; make
before executing `bin/vere pier` again.
before executing `bin/vere mypier` again.
###6. Chat
###6. Talk
Okay, fine. You're a long way from being an Arvo ninja. But -
you're ready for the two most important uses of Urbit right now.
One, coding. Two, chatting.
To start chatting, simply type
To start chatting, simply press `^X` to switch to the `:talk` app
(If you accidently killed it, no worries: start a new one by typing
`+talk` from the `^V` menu)
~waclux-tomwyc/try=> :chat
~waclux-tomwyc:talk()
and type `?` for the list of commands once `:chat` is running.
and type `;join /urbit-meta` to join our main chat room.
Most of us are hanging out on `:chat` regularly. We can answer any questions you might have and help you get oriented in this new environment.
Most of us are hanging out on `:talk` regularly. We can answer any questions you might have and help you get oriented in this new environment.

135
demo/commands.txt Normal file
View File

@ -0,0 +1,135 @@
Commands
[from URL bar]
***TBD - Galen/Anton please fill in
[from unix]
For A, to build and boot:
git clone https://github.com/urbit/urbit
cd urbit
make
bin/urbit -T $A -c $A
For A, to kill and restart from checkpoint:
[in new terminal] killall -9 urbit
[in old terminal] urbit $A
For A, to kill, delete checkpoint, and rerun events:
[in new terminal] killall -9 urbit; rm -rf $A/.urb/chk
[in old terminal] urbit $A
For B, to edit /foo/bar/hoon:
*** Philip/anyone, add directions to install vim style
vim urbit/$B/$B/in/$DEMO/foo/bar.hoon
[from talk]
For A, to private-message B (who defaults to talking back):
;~B
To create a channel '%foobar':
;create channel %foobar 'channel description'
[from hood, #]
For A or B, to start tictactoe:
*demo/tictactoe
For A or B, to log in to X's tictactoe:
+~X/tictactoe
To log out:
-~X/tictactoe
[from dojo]
For B, to create a %demo desk for this project:
:+merge %demo ~B %home
For A, to sync and follow B's demo desk:
:+sync %demo ~B %demo
*** - put bitcoin instructions here
[files in script, clay and unix]
The tictactoe app, all three versions:
/=demo=/ape/tictactoe/core/hook
urbit/$X/$X/in/$DEMO/ape/tictactoe/core/hook
version 1 (centralized):
$DEMO/files/1-ape-tictactoe.hoon
version 2 (distributed):
$DEMO/files/2-ape-tictactoe.hoon
version 3 (webified)
$DEMO/files/3-ape-tictactoe.hoon
Helper files needed for version 2:
The %tictactoe-game mark, for game update diffs:
/=demo=/mar/tictactoe-game/door/hook
urbit/$X/$X/in/$DEMO/mar/tictactoe-game/door.hook
$DEMO/files/mar-tictactoe-game.hoon
Helper files needed for version 3:
The %tictactoe-move mark, for moves from the web:
/=demo=/mar/tictactoe-move/door/hook
urbit/$X/$X/in/$DEMO/mar/tictactoe-move/door.hook
$DEMO/files/mar-tictactoe-move.hoon
The HTML generator:
/=demo=/pub/tictactoe/fab/hymn/hook
urbit/$X/$X/in/$DEMO/pub/tictactoe/fab/hymn.hook
$DEMO/files/pub-tictactoe-hymn.hoon
The CSS:
/=demo=/pub/tictactoe/src/main/css
urbit/$X/$X/in/$DEMO/pub/tictactoe/src/main.css
$DEMO/files/pub-tictactoe-main.css
The JS:
/=demo=/pub/tictactoe/src/main/js
urbit/$X/$X/in/$DEMO/pub/tictactoe/src/main.js
$DEMO/files/pub-tictactoe-main.js
[from tictactoe]
To move:
X/Y where X is row, Y is column.
To connect to a remote server (in versions 2 and 3),
specifying the side you will play:
~X x
~X o
To disconnect from a remote server (versions 2 and 3)
~ *** - not well tested
[scripts, to run from branch root directory]
$DEMO/install1.sh - copy in all version 1 (centralized) files
$DEMO/install2.sh - copy in all version 2 (distributed) files
$DEMO/install3.sh - copy in all version 3 (webby) files

View File

@ -0,0 +1,123 @@
:: :: ::
:::: /hook/core/acto/ape :: :: dependencies
:: :: ::
/- *sole :: structure
/+ sole :: library
:: :: ::
:::: :: :: structures
!: :: ::
=> |% :: board logic
++ board ,@ :: one-player bitfield
++ point ,[x=@ y=@] :: coordinate
++ game ,[who=? box=board boo=board] :: game state
++ icon |=(? ?:(+< 'X' 'O')) :: display at
++ bo :: per board
|_ bud=board ::
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: get point
++ off |=(point (add x (mul 3 y))) :: bitfield address
++ set |=(point (con bud (bex (off +<)))) :: set point
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) ::
-- ::
:: :: ::
:::: :: :: semantics
:: :: ::
++ go :: per game
|_ game ::
++ at |_ point :: per point
++ g +>+< :: game
++ k !|(x o) :: ok move
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
++ o (~(get bo boo) +<) :: old at o
++ p .(boo (~(set bo boo) +<)) :: play at o
++ t .(who !who) :: take turn
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
++ x (~(get bo box) +<) :: old at x
++ y .(box (~(set bo box) +<)) :: play at x
-- ::
++ res ?: ~(win bo box) `"{~[(icon &)]} wins" :: result
?: ~(win bo boo) `"{~[(icon |)]} wins" ::
?: =(511 (con boo box)) `"tie :-(" ~ ::
++ row |= y=@ :~ (add y '1') :: print row
' ' ~(v at y 0) ::
' ' ~(v at y 1) ::
' ' ~(v at y 2) ::
== ::
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
-- ::
-- ::
:: :: ::
:::: :: :: server
:: :: ::
=> |% :: arvo structures
++ axle ,[%0 eye=face gam=game] :: agent state
++ card ,[%diff lime] :: update
++ face (pair (list ,@c) (map bone sole-share)) :: interface
++ lime ,[%sole-effect sole-effect] :: console update
++ move (pair bone card) :: cause and action
-- ::
=> |% :: parsers
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
-- ::
|_ [hid=hide moz=(list move) axle] :: per agent
++ et ::
|_ [from say=sole-share] :: per console
++ abet +>(q.eye (~(put by q.eye) ost say)) :: continue
++ amok +>(q.eye (~(del by q.eye) ost)) :: discontinue
++ beep (emit %bel ~) :: bad user
++ delt |= cal=sole-change :: input line change
=^ cul say (remit:sole cal good) ::
?~ cul (park:abet(p.eye buf.say) | ~) ::
abet:beep:(emit det/u.cul) ::
++ emit |= fec=sole-effect ^+ +> :: send effect
+>(moz [[ost %diff %sole-effect fec] moz]) ::
++ emil |= fex=(list sole-effect) :: send effects
?~(fex +> $(fex t.fex, +> (emit i.fex))) ::
++ good |=((list ,@c) -:(rose (tufa +<) come)) :: valid input
++ kick |= point :: move command
=^ dud gam ~(m ~(at go gam) +<) ::
?. dud abet:beep =+ mus=~(res go gam) ::
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
++ line =^ cal say (transmit:sole set/p.eye) :: update command
(emit %det cal) ::
++ make =+ dur=(rust (tufa p.eye) come) ::
?~ dur abet:beep ::
(kick:line(p.eye ~) +.dur) ::
++ mean |=((unit tape) ?~(+< +> (emit txt/+<+))) :: optional message
++ play |= lev=?(%0 %1 %2) :: update by level
?-(lev %0 +>, %1 line, %2 line:show:prom) ::
++ plow |= [lev=?(%0 %1 %2) mus=(unit tape)] :: complete print
abet:(mean:(play lev) mus) ::
++ prom %^ emit %pro %& :- %acto :: update prompt
": {~[(icon who.gam)]} to move (row/col): " ::
++ rend (turn `wall`~(tab go gam) |=(tape txt/+<)) :: table print
++ show (emit %mor rend) :: update board
++ sole ~(. cs say) :: console library
++ work |= act=sole-action :: console input
?:(?=(%det -.act) (delt +.act) make) ::
-- ::
++ abet [(flop moz) .(moz ~)] :: resolve core
++ flet |=(from ~(. et +< (~(got by q.eye) ost))) :: in old client
++ fret |=(from ~(. et +< *sole-share)) :: in new client
++ pals %+ turn (pale hid (prix /sole)) |= sink :: per console
[[p=p.+< q=q.+<] r=(~(got by q.eye) p.+<)] ::
++ park |= [lev=?(%0 %1 %2) mus=(unit tape)] :: general update
=+ pals |- ^+ +>.^$ ?~ +< +>.^$ ::
$(+< t.+<, +>.^$ (~(plow et i.+<) lev mus)) ::
:: :: ::
:::: :: :: events
:: :: ::
++ peer-sole :: console subscribe
|= [from *] =< abet ::
(plow:(fret +<-) %2 ~) ::
++ poke-sole-action :: console input
|= [from act=sole-action] =< abet ::
(work:(flet +<-) act) ::
++ prep |= [from old=(unit ,[(list move) axle])] :: initialize
=< abet ?~ old +> =< (park %2 ~) ::
+>(+<+ u.old) ::
++ pull-sole :: disconnect console
|= [from *] =< abet ::
amok:(flet +<-) ::
--

View File

@ -0,0 +1,174 @@
:: :: ::
:::: /hook/core/acto/ape :: :: dependencies
:: :: ::
/- *sole :: structures
/+ sole :: libraries
:: :: ::
:::: :: :: structures
!: :: ::
=> |% :: board logic
++ board ,@ :: one-player bitfield
++ point ,[x=@ y=@] :: coordinate
++ game ,[who=? box=board boo=board] :: game state
++ icon |=(? ?:(+< 'X' 'O')) :: display at
++ bo :: per board
|_ bud=board ::
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: get point
++ off |=(point (add x (mul 3 y))) :: bitfield address
++ set |=(point (con bud (bex (off +<)))) :: set point
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
-- ::
++ go :: per game
|_ game ::
++ at |_ point :: per point
++ g +>+< :: game
++ k !|(x o) :: ok move
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
++ o (~(get bo boo) +<) :: old at o
++ p .(boo (~(set bo boo) +<)) :: play at o
++ t .(who !who) :: take turn
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
++ x (~(get bo box) +<) :: old at x
++ y .(box (~(set bo box) +<)) :: play at x
-- ::
++ res ?: ~(win bo box) `"{~[(icon &)]} wins" :: result
?: ~(win bo boo) `"{~[(icon |)]} wins" ::
?: =(511 (con boo box)) `"tie :-(" ~ ::
++ row |= y=@ :~ (add y '1') :: print row
' ' ~(v at y 0) ::
' ' ~(v at y 1) ::
' ' ~(v at y 2) ::
== ::
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
-- ::
-- ::
:: :: ::
:::: :: :: server
:: :: ::
=> |% :: arvo structures
++ axle ,[%1 eye=face but=tube gam=game] :: agent state
++ axon $?(axle [%0 eye=face gam=game]) :: historical state
++ card $% [%diff lime] :: update
[%quit ~] :: cancel
[%peer wire dock path] :: subscribe
[%pull wire dock ~]
== ::
++ face (pair (list ,@c) (map bone sole-share)) :: interface
++ lime $% [%sole-effect sole-effect] :: :sole update
[%octo-game game] :: :octo update
== ::
++ move (pair bone card) :: cause and action
++ mote (pair ship ,?) :: remote binding
++ tube (unit (pair ,? mote)) :: alive, remote
-- ::
=> |% :: parsers
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
++ comb (pick come ;~(pfix sig (punt comp))) :: all command input
++ comp ;~(plug fed:ag ;~(pfix ace (flag %x %o))) :: login command
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
-- ::
|_ [hid=hide moz=(list move) axle] :: per agent
++ et ::
|_ [from say=sole-share] :: per console client
++ abet +>(q.eye (~(put by q.eye) ost say)) :: continue
++ amok +>(q.eye (~(del by q.eye) ost)) :: discontinue
++ beep (emit %bel ~) :: bad user
++ cusp (cope wait) :: parsing rule
++ delt |= cal=sole-change :: input line change
=^ cul say (remit:sole cal good) ::
?~ cul (park:abet(p.eye buf.say) | ~) ::
abet:beep:(emit det/u.cul) ::
++ emit |= fec=sole-effect ^+ +> :: send effect
+>(moz [[ost %diff %sole-effect fec] moz]) ::
++ emil |= fex=(list sole-effect) :: send effects
?~(fex +> $(fex t.fex, +> (emit i.fex))) ::
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: valid input
++ kick |= point :: move command
=^ dud gam ~(m ~(at go gam) +<) ::
?. dud abet:beep =+ mus=~(res go gam) ::
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
++ line =^ cal say (transmit:sole set/p.eye) :: update command
(emit %det cal) ::
++ make =+ dur=(rust (tufa p.eye) comb) ::
?~ dur abet:beep ::
=. + line(p.eye ~) ::
?-(+<.dur & (kick +>.dur), | (plan +>.dur)) ::
++ mean |=((unit tape) ?~(+< +> (emit txt/+<+))) :: optional message
++ play |= lev=?(%0 %1 %2) :: update by level
?-(lev %0 +>, %1 line, %2 line:show:prom) ::
++ plow |= [lev=?(%0 %1 %2) mus=(unit tape)] :: complete print
abet:(mean:(play lev) mus) ::
++ prom %^ emit %pro %& :- %octo :: update prompt
?: wait "(their turn) " ::
": {~[(icon who.gam)]} to move (row/col): " ::
++ plan |= mut=(unit mote) :: peer command
?~ mut ?~(but abet:beep stop:abet) ::
?^(but abet:beep (link:abet u.mut)) ::
++ rend (turn `wall`~(tab go gam) |=(tape txt/+<)) :: table print
++ show (emit %mor rend) :: update board
++ sole ~(. cs say) :: console library
++ wait &(?=(^ but) !=(q.q.u.but who.gam)) :: waiting turn
++ work |= act=sole-action :: console input
?:(?=(%det -.act) (delt +.act) make) ::
-- ::
++ abet [(flop moz) .(moz ~)] :: resolve core
++ dump |=(mov=move %_(+> moz [mov moz])) :: send move
++ dish |=(cad=card (dump 0 cad)) :: forward move
++ flet |=(from ~(. et +< (~(got by q.eye) ost))) :: in old client
++ fret |=(from ~(. et +< *sole-share)) :: in new client
++ like |=(xir=ship |*(* [/octo [xir %octo] +<])) :: to friend
++ link |= mot=mote %+ dish(but `[| mot]) %peer :: subscribe to friend
((like p.mot) /octo/net/[?:(q.mot %x %o)]) ::
++ pals %+ turn (pale hid (prix /sole)) |= sink :: per console
[[p=p.+< q=q.+<] r=(~(got by q.eye) p.+<)] ::
++ park |= [lev=?(%0 %1 %2) mus=(unit tape)] :: update all
=. +> ?:(=(%2 lev) push +>) ::
=+ pals ::
|- ^+ +>.^$ ?~ +< +>.^$ ::
$(+< t.+<, +>.^$ (~(plow et i.+<) lev mus)) ::
++ push =+ pey=(pale hid (prix /octo)) |- ^+ +> :: update friends
?~(pey +> $(pey t.pey, +> (sell p.i.pey))) ::
++ sell |=(ost=bone (dump ost %diff %octo-game gam)) :: update friend
++ stop (dish(but ~) pull/((like +>-.but) ~)) :: cancel subscribe
:: :::::::::::::::
:::: :: :: :: hooks
:: :::::::::::::::
++ diff-octo-game :: friend update
|= [then gam=game] =< abet ::
?. &(?=([~ %& *] but) =(src p.q.u.but)) +> ::
?: =(^gam gam) +> ::
(park(gam gam) %2 ~) ::
++ peer-octo-net :: urbit peer
|= [from pax=path] =< abet ::
=+ who==(%x -.pax) ::
?^ but (park %2 ~) ::
(park:(link src !who) %2 `"net from {<src>}") ::
++ peer-sole :: console subscribe
|= [from pax=path] =< abet ::
(plow:(fret +<-) %2 ~) ::
++ poke-sole-action :: console input
|= [from act=sole-action] =< abet ::
(work:(flet +<-) act) ::
++ prep |= [from old=(unit ,[(list move) axon])] :: initialize
=< abet ?~ old +> ::
=< (park %2 ~) ::
?- -.+>.old ::
%1 +>(+<+ u.old) ::
%0 +>(eye.+< eye.+>.old, gam.+< gam.+>.old)::
== ::
++ pull-octo ::
|= [from *] =< abet ::
(park(but ~) %2 `"dropped") ::
++ pull-sole :: disconnect console
|= [from *] =< abet ::
amok:(flet +<-) ::
++ quit-octo :: unlinked by friend
|=([then ~] abet:(park(but ~) %0 `"removed")) ::
++ reap-octo :: linked to friend
|= [then saw=(unit tang)] =< abet ::
?> ?=([~ %| *] but) ::
?^ saw (park:stop %0 `"fail to {<src>}") ::
(park(p.u.but %&) %0 `"link to {<src>}") ::
--

View File

@ -0,0 +1,185 @@
:: :: ::
:::: /hook/core/acto/ape :: :: dependencies
:: :: ::
/- *sole :: structures
/+ sole :: libraries
:: :: ::
:::: :: :: structures
!: :: ::
=> |% :: board logic
++ board ,@ :: one-player bitfield
++ point ,[x=@ y=@] :: coordinate
++ game ,[who=? box=board boo=board] :: game state
++ icon |=(? ?:(+< 'X' 'O')) :: display at
++ bo :: per board
|_ bud=board ::
++ get |=(point =(1 (cut 0 [(off +<) 1] bud))) :: get point
++ off |=(point (add x (mul 3 y))) :: bitfield address
++ set |=(point (con bud (bex (off +<)))) :: set point
++ win %- lien :_ |=(a=@ =(a (dis a bud))) :: test for win
(rip 4 0wl04h0.4A0Aw.4A00s.0e070) :: with bitmasks
-- ::
++ go :: per game
|_ game ::
++ at |_ point :: per point
++ g +>+< :: game
++ k !|(x o) :: ok move
++ m ?.(k [| g] [& g:t:?:(who y p)]) :: move
++ o (~(get bo boo) +<) :: old at o
++ p .(boo (~(set bo boo) +<)) :: play at o
++ t .(who !who) :: take turn
++ v ?:(x (icon &) ?:(o (icon |) '.')) :: view
++ x (~(get bo box) +<) :: old at x
++ y .(box (~(set bo box) +<)) :: play at x
-- ::
++ res ?: ~(win bo box) `"{~[(icon &)]} wins" :: result
?: ~(win bo boo) `"{~[(icon |)]} wins" ::
?: =(511 (con boo box)) `"tie :-(" ~ ::
++ row |= y=@ :~ (add y '1') :: print row
' ' ~(v at y 0) ::
' ' ~(v at y 1) ::
' ' ~(v at y 2) ::
== ::
++ tab ~["+ 1 2 3" (row 0) (row 1) (row 2)] :: print table
-- ::
-- ::
:: :: ::
:::: :: :: server
:: :: ::
=> |% :: arvo structures
++ axle ,[%1 eye=face but=tube gam=game] :: agent state
++ axon $?(axle [%0 eye=face gam=game]) :: historical state
++ card $% [%diff lime] :: update
[%quit ~] :: cancel
[%peer wire dock path] :: subscribe
[%pull wire dock ~]
== ::
++ face (pair (list ,@c) (map bone sole-share)) :: interface
++ lime $% [%sole-effect sole-effect] :: :sole update
[%octo-game game] :: :octo update
== ::
++ move (pair bone card) :: cause and action
++ mote (pair ship ,?) :: remote binding
++ tube (unit (pair ,? mote)) :: alive, remote
-- ::
=> |% :: parsers
++ colm (cook |=(a=@ (sub a '1')) (shim '1' '3')) :: row or column
++ come ;~(plug colm ;~(pfix fas colm)) :: coordinate
++ comb (pick come ;~(pfix sig (punt comp))) :: all command input
++ comp ;~(plug fed:ag ;~(pfix ace (flag %x %o))) :: login command
++ cope |=(? ?:(+< (stag %| (cold ~ sig)) comb)) :: with wait mode
-- ::
|_ [hid=hide moz=(list move) axle] :: per agent
++ et ::
|_ [from say=sole-share] :: per console client
++ abet +>(q.eye (~(put by q.eye) ost say)) :: continue
++ amok +>(q.eye (~(del by q.eye) ost)) :: discontinue
++ beep (emit %bel ~) :: bad user
++ cusp (cope wait) :: parsing rule
++ delt |= cal=sole-change :: input line change
=^ cul say (remit:sole cal good) ::
?~ cul (park:abet(p.eye buf.say) | ~) ::
abet:beep:(emit det/u.cul) ::
++ emit |= fec=sole-effect ^+ +> :: send effect
+>(moz [[ost %diff %sole-effect fec] moz]) ::
++ emil |= fex=(list sole-effect) :: send effects
?~(fex +> $(fex t.fex, +> (emit i.fex))) ::
++ good |=((list ,@c) -:(rose (tufa +<) cusp)) :: valid input
++ kick |= point :: move command
=^ dud gam ~(m ~(at go gam) +<) ::
?. dud abet:beep =+ mus=~(res go gam) ::
(park:abet(gam ?^(mus *game gam)) %2 mus) ::
++ line =^ cal say (transmit:sole set/p.eye) :: update command
(emit %det cal) ::
++ make =+ dur=(rust (tufa p.eye) comb) ::
?~ dur abet:beep ::
=. + line(p.eye ~) ::
?-(+<.dur & (kick +>.dur), | (plan +>.dur)) ::
++ mean |=((unit tape) ?~(+< +> (emit txt/+<+))) :: optional message
++ play |= lev=?(%0 %1 %2) :: update by level
?-(lev %0 +>, %1 line, %2 line:show:prom) ::
++ plow |= [lev=?(%0 %1 %2) mus=(unit tape)] :: complete print
abet:(mean:(play lev) mus) ::
++ prom %^ emit %pro %& :- %octo :: update prompt
?: wait "(their turn) " ::
": {~[(icon who.gam)]} to move (row/col): " ::
++ plan |= mut=(unit mote) :: peer command
?~ mut ?~(but abet:beep stop:abet) ::
?^(but abet:beep (link:abet u.mut)) ::
++ rend (turn `wall`~(tab go gam) |=(tape txt/+<)) :: table print
++ show (emit %mor rend) :: update board
++ sole ~(. cs say) :: console library
++ wait &(?=(^ but) !=(q.q.u.but who.gam)) :: waiting turn
++ work |= act=sole-action :: console input
?:(?=(%det -.act) (delt +.act) make) ::
-- ::
++ abet [(flop moz) .(moz ~)] :: resolve core
++ dump |=(mov=move %_(+> moz [mov moz])) :: send move
++ dish |=(cad=card (dump 0 cad)) :: forward move
++ flet |=(from ~(. et +< (~(got by q.eye) ost))) :: in old client
++ fret |=(from ~(. et +< *sole-share)) :: in new client
++ like |=(xir=ship |*(* [/octo [xir %octo] +<])) :: to friend
++ link |= mot=mote %+ dish(but `[| mot]) %peer :: subscribe to friend
((like p.mot) /octo/net/[?:(q.mot %x %o)]) ::
++ pals %+ turn (pale hid (prix /sole)) |= sink :: per console
[[p=p.+< q=q.+<] r=(~(got by q.eye) p.+<)] ::
++ park |= [lev=?(%0 %1 %2) mus=(unit tape)] :: update all
=. +> ?:(=(%2 lev) push +>) ::
=+ pals ::
|- ^+ +>.^$ ?~ +< +>.^$ ::
$(+< t.+<, +>.^$ (~(plow et i.+<) lev mus)) ::
++ push =+ pey=(pale hid (prix /octo)) |- ^+ +> :: update friends
?~(pey +> $(pey t.pey, +> (sell p.i.pey))) ::
++ sell |=(ost=bone (dump ost %diff %octo-game gam)) :: update friend
++ stop (dish(but ~) pull/((like +>-.but) ~)) :: cancel subscribe
:: :::::::::::::::
:::: :: :: :: hooks
:: :::::::::::::::
++ diff-octo-game :: friend update
|= [then gam=game] =< abet ::
?. &(?=([~ %& *] but) =(src p.q.u.but)) +> ::
?: =(^gam gam) +> ::
(park(gam gam) %2 ~) ::
++ peer-octo-net :: urbit peer
|= [from pax=path] =< abet ::
=+ who==(%x -.pax) ::
?^ but (park %2 ~) ::
(park:(link src !who) %2 `"net from {<src>}") ::
++ peer-octo-web :: web peer
|= [from pax=path] =< abet ::
~& [%peer-web +<] ::
?^ but (park %2 ~) ::
%+ park(but `[%& src !who.gam]) %2 ::
`"web from {<src>}" ::
++ peer-sole :: console subscribe
|= [from pax=path] =< abet ::
(plow:(fret +<-) %2 ~) ::
++ poke-sole-action :: console input
|= [from act=sole-action] =< abet ::
(work:(flet +<-) act) ::
++ poke-octo-move ::
|= [from wha=point] =< abet ::
=^ dud gam ~(m ~(at go gam) wha) ::
?> dud =+ mus=~(res go gam) ::
(park(gam ?^(mus *game gam)) %2 mus) ::
++ prep |= [from old=(unit ,[(list move) axon])] :: initialize
=< abet ?~ old +> ::
=< (park %2 ~) ::
?- -.+>.old ::
%1 +>(+<+ u.old) ::
%0 +>(eye.+< eye.+>.old, gam.+< gam.+>.old)::
== ::
++ pull-octo ::
|= [from *] =< abet ::
(park(but ~) %2 `"dropped") ::
++ pull-sole :: disconnect console
|= [from *] =< abet ::
amok:(flet +<-) ::
++ quit-octo :: unlinked by friend
|=([then ~] abet:(park(but ~) %0 `"removed")) ::
++ reap-octo :: linked to friend
|= [then saw=(unit tang)] =< abet ::
?> ?=([~ %| *] but) ::
?^ saw (park:stop %0 `"fail to {<src>}") ::
(park(p.u.but %&) %0 `"link to {<src>}") ::
--

View File

@ -0,0 +1,26 @@
::
:::: /hook/door/octo-game/mar
::
/? 310
!:
|%
++ rip9
=+ b=0
|= a=@ ^- (list ,@A)
?: =(b 9) ~
[(cut 0 [b 1] a) $(b +(b))]
--
!:
|_ cod=[who=? box=@ boo=@] :: game state
::
++ grab :: convert from
|%
++ noun ,[who=? box=@ boo=@] :: clam from %noun
--
++ grow
|%
++ json ^- ^json
=> |=(bor=@ `^json`a/(turn (rip9 bor) |=(a=@A [%b =(1 a)])))
(jobe who/s/?:(who.cod %x %o) box/(. box.cod) boo/(. boo.cod) ~)
--
--

View File

@ -0,0 +1,16 @@
::
:::: /hook/door/octo-move/mar
::
/? 314
!:
::::
::
=+ point=,[x=@ y=@]
|_ point
::
++ grab :: convert from
|%
++ json (corl need (at ni ni ~):jo) :: reparse from %json
++ noun point :: clam from %noun
--
--

View File

@ -0,0 +1,32 @@
::
::
:::: /hook/hymn/fab/octo/pub/
::
^- manx
;html
;head
;meta(charset "utf-8");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js");
;script(type "text/javascript", src "/~/at/base/lib/urb.js");
;link(type "text/css", rel "stylesheet", href "/home/lib/base.css");
;link(type "text/css", rel "stylesheet", href "/home/pub/octo/src/main.css");
;title: :octo
==
;body
;div#what
;div#ship
;div.sig: ~
;div.ship;
;div.as;
==
;div#vs: vs
;div#user
;div.sig: ~
;div.ship;
;div.as;
==
==
;div#bord;
;script(type "text/javascript", src "/home/pub/octo/src/main.js");
==
==

View File

@ -0,0 +1,102 @@
#what,
#bord {
width: 600px;
text-align: center;
position: absolute;
left: 50%;
margin-left: -300px;
}
#what {
height: 36px;
top: 18px;
}
#bord {
height: 600px;
position: absolute;
top: 111px;
opacity: .6;
}
.turn #bord {
opacity: 1;
}
#what {
font-family: "bau";
}
#what div {
display: inline-block;
}
#what .ship {
font-weight: 400;
letter-spacing: 1px;
text-transform: uppercase;
}
.turn #what #ship,
#what #user {
border: 2px solid #fff;
}
#what #ship,
.turn #what #user {
border: 2px solid red;
}
#what #ship,
#what #user {
padding: .6rem;
}
#what .as {
width: 1.6rem;
}
#vs {
margin: 0 1rem;
padding: .3rem;
color: #fff;
background-color: #000;
}
.spac {
font-size: 100px;
line-height: 200px;
}
.spac {
width: 198px;
height: 198px;
border: 1px solid #000;
text-align: center;
float: left;
cursor: pointer;
}
.spac[data-index="0-0"],
.spac[data-index="1-0"],
.spac[data-index="2-0"] {
border-left: 0;
}
.spac[data-index="0-0"],
.spac[data-index="0-1"],
.spac[data-index="0-2"] {
border-top: 0;
}
.spac[data-index="2-0"],
.spac[data-index="2-1"],
.spac[data-index="2-2"] {
border-bottom: 0;
}
.spac[data-index="0-2"],
.spac[data-index="1-2"],
.spac[data-index="2-2"] {
border-right: 0;
}

View File

@ -0,0 +1,62 @@
$(function() {
$bord = $('#bord')
$whom = $('#whom')
lett = ["x","o"]
symb = [" ","✕","◯"]
draw = function(state) {
space = function(_state,y,x) {
return "<div class='spac' data-index='"+y+"-"+x+
"'>"+symb[_state]+"</div>"
}
s = ""
x = 0
y = 0
for(i=0;i<9;i++) {
j = [0,3,6,1,4,7,2,5,8][i] // XX math
s += space((state.box[j] ? 1 : 0)+(state.boo[j] ? 2 : 0),y,x)
x++
if((i+1)%3 == 0) {
y++
x=0
}
}
$bord.html(s)
turn(state.who)
}
which = null
turn = function(who) {
$('body').toggleClass('turn',(who == which))
}
assign = function(who) {
which = who
turn(who)
$('#ship .as').text(symb[Number(!lett.indexOf(who))+1])
$('#user .as').text(symb[lett.indexOf(who)+1])
}
urb.appl = 'octo'
urb.bind('/octo/web', function(err,res) {
if(which == null) { assign(res.data.who) }
draw(res.data)
})
// draw({
// box:[false,false,false,false,false,false,false,false,false],
// boo:[false,false,false,false,false,false,false,false,false]
// })
$bord.on('click', function(e) {
if(!$('body').hasClass('turn')) { return false }
$t = $(e.target).closest('.spac')
data = $.map(
$t.attr('data-index').split('-'),
function(i) { return Number(i); })
urb.send({mark:'octo-move',data:data})
})
$('#ship .ship').text(window.urb.ship)
$('#user .ship').text(window.urb.user)
})

9
demo/install1.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
#
X=$1
DEMO=demo
COLD=$DEMO/files
DESK=urbit/$X/$X/in/$DEMO
echo "cp -f $COLD/1-ape-tictactoe.hoon $DESK/ape/tictactoe/core/hook"
cp -f $COLD/1-ape-tictactoe.hoon $DESK/ape/tictactoe/core/hook

12
demo/install2.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
#
X=$1
DEMO=demo
COLD=$DEMO/files
DESK=urbit/$X/$X/in/$DEMO
echo "cp -f $COLD/2-ape-tictactoe.hoon $DESK/ape/tictactoe/core/hook"
cp -f $COLD/1-ape-tictactoe.hoon $DESK/ape/tictactoe/core/hook
echo "cp -f $COLD/mar-tictactoe-game.hoon $DESK/mar/tictactoe-game/door.hook"
cp -f $COLD/mar-tictactoe-game.hoon $DESK/mar/tictactoe-game/door.hook

21
demo/install3.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/sh
#
X=$1
DEMO=demo
COLD=$DEMO/files
DESK=urbit/$X/$X/in/$DEMO
echo "cp -f $COLD/3-ape-tictactoe.hoon $DESK/ape/tictactoe/core/hook"
cp -f $COLD/3-ape-tictactoe.hoon $DESK/ape/tictactoe/core/hook
echo "cp -f $COLD/mar-tictactoe-game.hoon $DESK/mar/tictactoe-game/door.hook"
cp -f $COLD/mar-tictactoe-game.hoon $DESK/mar/tictactoe-game/door.hook
echo "cp -f $COLD/pub-tictactoe-hymn.hoon $DESK/pub/tictactoe/fab/hymn.hook"
cp -f $COLD/pub-tictactoe-hymn.hoon $DESK/pub/tictactoe/fab/hymn.hook
echo "cp -f $COLD/pub-tictactoe-main.css $DESK/pub/tictactoe/src/main.css"
cp -f $COLD/pub-tictactoe-main.css $DESK/pub/tictactoe/src/main.css
echo "cp -f $COLD/pub-tictactoe-main.js $DESK/pub/tictactoe/src/main.js"
cp -f $COLD/pub-tictactoe-main.js $DESK/pub/tictactoe/src/main.js

27
demo/script-1.txt Normal file
View File

@ -0,0 +1,27 @@
script:
~tasfyn-partyv and ~talsur-todres decide to build a tic-tac-toe game
tasfyn-partyv: would you like to play a game of thermonuclear war?
talsur-todres: no. how about some tic-tac-toe?
tasfyn-partyv: sure. but wait, do we have a server?
talsur-todres:
features of the game:
(0) we build one-computer two-player TTT
(1) we build console tic-tac-toe
(2) we install it over the network
+ 1 2 3
1 X X
2 O O
3 X O X
? 1/3
(3) we update it to change the characters
(4) maybe cheating with some pretyped assets, we make a web view
(5)

147
demo/script-2.txt Normal file
View File

@ -0,0 +1,147 @@
A == ~tasfyn-partyv
B == ~talsur-todres
A and B, on unix terminals on different machines, clone and
build urbit from scratch, cutting over the build.
Each screen is divided into two logical columns. A's
screen is filled with two shells. B's screen has a shell
on the left and is empty on the right.
At the unix prompt, both run
urbit -c myship
type in an invisible ticket, and begin their ships. All
diagnostic messages are suppressed. Both users land
initially in :talk.
A: is this thing on?
B: who am i? why am i here?
A: would you like to play a game of global thermonuclear war?
B: wouldn't you prefer tic-tac-toe?
A: sure, but i'll have to write it. hang on...
A switches to :dojo and runs
:+merge %tic-tac-a ~tasfyn-partyv %home
In the other window, A runs vim and edits, occasionally
hitting :w to save the file:
demo/file1.txt -> A/in/base/ape/tictactoe/core.hook
After ++bo,
A: the board state is a bitfield
A: btw, you can watch me code at <URL>.
B opens a browser and points it at <URL>, showing the
tree with live update every time A saves.
After ++go:
A: game semantics are not that complex...
After ++move:
A: basic console io, kinda boilerplaty
After ++come:
A: if you can infer the type of the product
A: of a combinator parser, you are probably
A: a typed functional language even if you
A: leave category theory to the real math nerds...
After ++park:
A: a fairly vanilla console server. probably some
A: of this should be sucked out into a library -
A: you can never completely beat the boilerplate.
A: also note that this is a two-way console with
A: operational transformation that cancels syntax
A: errors as you type, just like how :talk violates
A: your human rights by lowercasing your capitals.
A: finally, while the style is perfectly readable
A: for a hoon programmer, we don't normally go in
A: for this kind of mildly contrived topiary.
After ++pull-sole:
A: those were the event hooks where arvo calls us,
A: expecting a new state and a list of actions.
A: anyway, this should work - let's try it.
A: do this:
:+sync %tic-tac-a ~tasfyn-partyv %tic-tac-a
:+start %tic-tac-a %tictactoe
B does this. it puts him straight into TTT.
A: now hang on, I'll join you.
A uses ^V to pop the hood and types +~B/
A: bear in mind, this is a very crude shared space.
A: your server is just exporting a console interface
A: which we both can access. so essentially i'm
A: ssh-ed into your game world.
They play a couple of moves.
A: it's important to note that your urbit is also
A: in a sense, a database. try this from unix:
killall -9 urbit
urbit myship
B does this, comes back and plays a move.
B: we don't seem to have lost any data.
A: we didn't even come close to losing data,
A: so let's come a little closer:
killall -9 vere
rm -rf $checkpoint
urbit myship
B does this, comes back and plays a move.
B: whoa, that was heavy.
A: yeah, your life flashed before your eyes. or at least,
A: your event history. this system of checkpoint
A: and transaction log is actually how normal dbs work,
A: though urbit is designed as a personal computer and
A: hardly up for a normal db workload.
B: it's a little odd that either of us could play X or O.
A: or even have an edit war in the command line.
They have an edit war in the command line.
B: it might be right for some things. not tictactoe.
A: then we'll have to change it! often when someone
A: installs your software, later you find out it's not
A: perfect and sometimes actually needs to be changed.
B: i've had that experience a number of times.
A: but it's always tricky to operate on a beating heart,
A: so let's try it in a small way first...
A edits the source file and changes X to Z, or
maybe to a Unicode symbol. When he saves, the
change propagates to both consoles and also the
tree view on B's screen, even to the prompt UI.
B: i've seen that sort of thing before.
A: really? in any case, let's do it for real. the next
A: version is a genuine distributed tictactoe with
A: its own peer-to-peer move protocol. surely this
A: is some fancy technology...
A edits the source file into

163
demo/script-3.txt Normal file
View File

@ -0,0 +1,163 @@
For dialogue: start with dialogue ad-libbed by whoever is
doing the production. Later, copy it into a script and
edit that script.
For operation details, see commands.txt. Fill in the script
with literal operations *only once you have tested them
yourself*.
A: build and boot A
...
""
A: private-message B
...
""
B: create demo desk
...
""
B: vim in application version 1, just typing, very fast
...
""
A: sync A's demo desk to B
...
""
B: log in to A's tictactoe (intentionally reversed)
...
""
A: start tictactoe on A
A/B: play ONE full game of tictactoe, moves interleaved with
these subdemos:
B changes X to Z in the source, then changes it back
...
""
A or B enters an invalid move, beep sound is heard
...
""
A kills and restarts the vere process:
...
""
A kills the vere process, deletes the checkpoint, restarts:
...
""
A or B enters an invalid move, beep sound is heard:
...
""
A and B tussle humorously over weird shared command line
...
""
B edits version 1 into version 2, automagically upgrading A
...
""
B logs out of A's tictactoe
...
""
B starts local tictactoe
...
""
B connects local tictactoe to A's server
...
""
B edits in version 3 ape, with web support
...
""
A: watch editing of application
...
""
B edits in mar, pub (very fast)
...
""
A: logs in to game url
...
""
A: brings up web talk
...
""
B: creates a local channel to talk about TTT
...
""
A: subscribes from the web UI to B's channel
...
""
C, D, and E: join the channel and give humorous advice
...
""
A: loses the game
...
""
B: sends bitcoin payment to A
...
""
A: points browser at blockchain.info, shows real payment
...
""
close:
credit screen 1:
*everyone who has ever worked/for at Tlon, in alphabetical
order*,
credit screen 2:
*every non Tlon github uid that has contributed to our repository*
credit screen 3:
~, huge

View File

@ -1121,6 +1121,7 @@
# define c3__veer c3_s4('v','e','e','r')
# define c3__vega c3_s4('v','e','g','a')
# define c3__velt c3_s4('v','e','l','t')
# define c3__verb c3_s4('v','e','r','b')
# define c3__vern c3_s4('v','e','r','n')
# define c3__very c3_s4('v','e','r','y')
# define c3__view c3_s4('v','i','e','w')

View File

@ -104,11 +104,9 @@
/* u3a_road: contiguous allocation and execution context.
*/
typedef struct _u3a_road {
struct _u3a_road* par_u; // parent road
struct _u3a_road* kid_u; // child road list
struct _u3a_road* nex_u; // sibling road
struct _u3a_road* now_u; // current road pointer
u3p(struct _u3a_road) par_p; // parent road
u3p(struct _u3a_road) kid_p; // child road list
u3p(struct _u3a_road) nex_p; // sibling road
u3p(c3_w) cap_p; // top of transient region
u3p(c3_w) hat_p; // top of durable region

View File

@ -23,7 +23,8 @@
u3o_check_corrupt = 0x4, // check: gc memory
u3o_check_fatal = 0x8, // check: unrecoverable
u3o_verbose = 0x10, // be remarkably wordy
u3o_dryrun = 0x20 // don't touch checkpoint
u3o_dryrun = 0x20, // don't touch checkpoint
u3o_quiet = 0x40 // disable ~&
};
/** Globals.

View File

@ -104,5 +104,6 @@
/* u3to(), u3of(): offset/pointer conversion.
*/
# define u3to(type, x) ((type *) u3a_into(x))
# define u3tn(type, x) (x == 0) ? (void *)0 : ((type *) u3a_into(x))
# define u3of(type, x) (u3a_outa((type *)x))

View File

@ -521,6 +521,8 @@
c3_c* imp_c; // -I, czar name
c3_c* nam_c; // -n, unix hostname
c3_c* raf_c; // -r, raft flotilla
c3_c* who_c; // -T, begin with ticket
c3_c* tic_c; // -T, ticket value
c3_w kno_w; // -k, kernel version
c3_w fuz_w; // -f, fuzz testing
c3_s por_s; // -p, ames port
@ -536,7 +538,8 @@
c3_o pro; // -P, profile
c3_o veb; // -v, verbose (inverse of -q)
c3_o nuu; // -c, new pier
c3_o vno; // -V
c3_o qui; // -q, quiet
c3_o vno; // -V, turn on +verb
c3_o mem; // -M, memory madness
} u3_opts;
@ -791,6 +794,16 @@
void
u3_term_ef_boil();
/* u3_term_ef_ticket(): initial effects for new ticket.
*/
void
u3_term_ef_ticket(c3_c* who_c, c3_c* tic_c);
/* u3_term_ef_verb(): initial effects for verbose events.
*/
void
u3_term_ef_verb(void);
/* u3_term_ef_winc(): window change.
*/
void

4
n/a.c
View File

@ -967,11 +967,11 @@ _me_copy_south(u3_noun dog)
u3a_cell* new_u = (u3a_cell*)(void *)new_w;
// printf("south: cell %p to %p\r\n", old_u, new_u);
#if 0
if ( old_u->mug_w == 0x730e66cc ) {
fprintf(stderr, "BAD: take %p\r\n", new_u);
}
#endif
new_u->mug_w = old_u->mug_w;
// new_u->mug_w = 0;
new_u->hed = _me_copy_south_in(old_u->hed);

4
n/j.c
View File

@ -209,8 +209,8 @@ u3j_find(u3_noun bat)
return jaw;
}
if ( rod_u->par_u ) {
rod_u = rod_u->par_u;
if ( rod_u->par_p ) {
rod_u = u3to(u3_road, rod_u->par_p);
}
else return u3_none;
}

36
n/m.c
View File

@ -144,7 +144,7 @@ _cm_signal_handle_term(int x)
{
// Ignore if we are using base memory from work memory, very rare.
//
if ( (0 != u3H->rod_u.kid_u) && (&(u3H->rod_u) == u3R) ) {
if ( (0 != u3H->rod_u.kid_p) && (&(u3H->rod_u) == u3R) ) {
_cm_emergency("ignored", c3__term);
}
else {
@ -179,7 +179,7 @@ _cm_signal_reset(void)
u3R = &u3H->rod_u;
u3R->cap_p = u3R->mat_p;
u3R->ear_p = 0;
u3R->kid_u = 0;
u3R->kid_p = 0;
}
/* _cm_stack_recover(): recover stack trace, with lacunae.
@ -271,13 +271,13 @@ _cm_signal_recover(c3_l sig_l, u3_noun arg)
u3R = &(u3H->rod_u);
rod_u = u3R;
while ( rod_u->kid_u ) {
while ( rod_u->kid_p ) {
#if 0
fprintf(stderr, "collecting %d frames\r\n",
u3kb_lent(rod_u->kid_u->bug.tax));
u3kb_lent((u3to(u3_road, rod_u->kid_p)->bug.tax));
#endif
tax = u3kb_weld(_cm_stack_recover(rod_u->kid_u), tax);
rod_u = rod_u->kid_u;
tax = u3kb_weld(_cm_stack_recover(u3to(u3_road, rod_u->kid_p)), tax);
rod_u = u3to(u3_road, rod_u->kid_p);
}
}
@ -709,9 +709,9 @@ u3m_leap(c3_w pad_w)
/* Attach the new road to its parents.
*/
{
c3_assert(0 == u3R->kid_u);
rod_u->par_u = u3R;
u3R->kid_u = rod_u;
c3_assert(0 == u3R->kid_p);
rod_u->par_p = u3of(u3_road, u3R);
u3R->kid_p = u3of(u3_road, rod_u);
}
/* Set up the new road.
@ -727,26 +727,26 @@ u3m_leap(c3_w pad_w)
void
u3m_fall()
{
c3_assert(0 != u3R->par_u);
c3_assert(0 != u3R->par_p);
#if 0
fprintf(stderr, "fall: from %s %p, to %s %p (cap %p, was %p)\r\n",
_(u3a_is_north(u3R)) ? "north" : "south",
u3R,
_(u3a_is_north(u3R)) ? "north" : "south",
u3R->par_u,
u3to(u3_road, u3R->par_p),
u3R->hat_w,
u3R->rut_w);
#endif
/* The new cap is the old hat - it's as simple as that.
*/
u3R->par_u->cap_p = u3R->hat_p;
u3to(u3_road, u3R->par_p)->cap_p = u3R->hat_p;
/* And, we're back home.
*/
u3R = u3R->par_u;
u3R->kid_u = 0;
u3R = u3to(u3_road, u3R->par_p);
u3R->kid_p = 0;
}
/* u3m_hate(): new, integrated leap mechanism (enter).
@ -948,8 +948,8 @@ u3m_soft_run(u3_noun fly,
/* Configure the new road.
*/
{
u3R->ski.flu = u3nc(fly, u3R->par_u->ski.flu);
u3R->pro.don = u3R->par_u->pro.don;
u3R->ski.flu = u3nc(fly, u3to(u3_road, u3R->par_p)->ski.flu);
u3R->pro.don = u3to(u3_road, u3R->par_p)->pro.don;
u3R->bug.tax = 0;
}
u3t_on(coy_o);
@ -1036,8 +1036,8 @@ u3m_soft_esc(u3_noun sam)
/* Configure the new road.
*/
{
u3R->ski.flu = u3t(u3R->par_u->ski.flu);
u3R->pro.don = u3R->par_u->pro.don;
u3R->ski.flu = u3t(u3to(u3_road, u3R->par_p)->ski.flu);
u3R->pro.don = u3to(u3_road, u3R->par_p)->pro.don;
u3R->bug.tax = 0;
}

13
n/n.c
View File

@ -46,9 +46,11 @@ _n_hint(u3_noun zep,
}
case c3__slog: {
u3t_off(noc_o);
u3t_slog(hod);
u3t_on(noc_o);
if ( !(u3C.wag_w & u3o_quiet) ) {
u3t_off(noc_o);
u3t_slog(hod);
u3t_on(noc_o);
}
return _n_nock_on(bus, nex);
}
@ -86,7 +88,10 @@ _n_hint(u3_noun zep,
}
pro = _n_nock_on(u3k(bus), u3k(nex));
u3z_save_2(c3__nock, bus, nex, pro);
if ( u3R != &(u3H->rod_u) ) {
u3z_save_2(c3__nock, bus, nex, pro);
}
u3z(bus); u3z(nex);
return pro;

6
n/t.c
View File

@ -113,8 +113,8 @@ _t_jet_label(u3a_road* rod_u, u3_noun bat)
return u3h(u3t(u3t(u3h(cax))));
}
if ( rod_u->par_u ) {
rod_u = rod_u->par_u;
if ( rod_u->par_p ) {
rod_u = u3to(u3_road, rod_u->par_p);
}
else return u3_none;
}
@ -175,7 +175,7 @@ _t_samp_process(u3_road* rod_u)
}
don = u3t(don);
}
rod_u = rod_u->par_u;
rod_u = u3tn(u3_road, rod_u->par_p);
}
u3z(muf);

View File

@ -67,6 +67,7 @@ _ames_czar(c3_y imp_y, c3_s* por_s)
snprintf(dns_c, 64, "%s.urbit.org", nam_c + 1);
// uL(fprintf(uH, "czar %s, dns %s\n", nam_c, dns_c));
free(nam_c);
u3z(nam);

View File

@ -691,9 +691,16 @@ u3_lo_lead(void)
#endif
if ( c3y == u3_Host.ops_u.nuu ) {
if ( u3_Host.ops_u.who_c ) {
u3_term_ef_ticket(u3_Host.ops_u.who_c, u3_Host.ops_u.tic_c);
}
u3_term_ef_boil(1);
}
if ( c3y == u3_Host.ops_u.veb ) {
u3_term_ef_verb();
}
#if 1
_lo_slow();
#endif

View File

@ -40,6 +40,22 @@ _main_readw(const c3_c* str_c, c3_w max_w, c3_w* out_w)
static c3_c hostbuf[2048]; // kill me
/* _main_presig(): prefix optional sig.
*/
c3_c*
_main_presig(c3_c* txt_c)
{
c3_c* new_c = malloc(2 + strlen(txt_c));
if ( '~' == *txt_c ) {
strcpy(new_c, txt_c);
} else {
new_c[0] = '~';
strcpy(new_c + 1, txt_c);
}
return new_c;
}
/* _main_getopt(): extract option map from command line.
*/
static u3_noun
@ -57,12 +73,13 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.fak = c3n;
u3_Host.ops_u.pro = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.veb = c3y;
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.qui = c3n;
u3_Host.ops_u.nuu = c3n;
u3_Host.ops_u.mem = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i = getopt(argc, argv, "I:X:f:k:l:n:p:r:LabcdgqvFMPD")) != -1 ) {
while ( (ch_i = getopt(argc, argv, "I:T:X:f:k:l:n:p:r:LabcdgqvFMPD")) != -1 ) {
switch ( ch_i ) {
case 'M': {
u3_Host.ops_u.mem = c3y;
@ -72,6 +89,11 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.imp_c = strdup(optarg);
break;
}
case 'T': {
u3_Host.ops_u.who_c = _main_presig(optarg);
u3_Host.ops_u.tic_c = _main_presig(getpass("your ticket: ~"));
break;
}
case 'X': {
if ( 0 != strcmp("wtf", optarg) ) {
return c3n;
@ -123,7 +145,7 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'g': { u3_Host.ops_u.gab = c3y; break; }
case 'P': { u3_Host.ops_u.pro = c3y; break; }
case 'D': { u3_Host.ops_u.dry = c3y; break; }
case 'q': { u3_Host.ops_u.veb = c3n; break; }
case 'q': { u3_Host.ops_u.qui = c3y; break; }
case 'v': { u3_Host.ops_u.veb = c3y; break; }
case '?': default: {
return c3n;
@ -329,6 +351,12 @@ main(c3_i argc,
if ( _(u3_Host.ops_u.veb) ) {
u3C.wag_w |= u3o_verbose;
}
/* Set quiet flag.
*/
if ( _(u3_Host.ops_u.qui) ) {
u3C.wag_w |= u3o_quiet;
}
/* Set dry-run flag.
*/
@ -363,6 +391,7 @@ main(c3_i argc,
}
// u3e_grab("main", u3_none);
//
u3_lo_loop();
return 0;

View File

@ -1855,7 +1855,11 @@ static void
_raft_grab(u3_noun ova)
{
if ( u3_nul != u3A->sac ) {
c3_w usr_w = 0, ova_w = 0, sac_w = 0, utv_w = 0, utm_w = 0, wep_w = 0;
c3_w usr_w = 0, ova_w = 0, sac_w = 0, utv_w = 0, utm_w = 0, wep_w = 0,
har_w = 0, das_w = 0, flu_w = 0, tax_w = 0, mer_w = 0, don_w = 0,
day_w = 0, car_w = 0;
c3_assert( u3R == &(u3H->rod_u) );
fprintf(stderr, "\r\n");
usr_w = _raft_prof(u3_nul, 0, u3A->sac);
@ -1874,8 +1878,40 @@ _raft_grab(u3_noun ova)
fprintf(stderr, "arvo stuff: ");
_raft_print_memory(utv_w);
utm_w = u3m_mark();
fprintf(stderr, "road stuff: ");
har_w = u3h_mark(u3R->jed.har_p);
fprintf(stderr, " warm jet state: ");
_raft_print_memory(har_w);
das_w = u3a_mark_noun(u3R->jed.das);
fprintf(stderr, " cold jet state: ");
_raft_print_memory(das_w);
flu_w = u3a_mark_noun(u3R->ski.flu);
fprintf(stderr, " namespace: ");
_raft_print_memory(flu_w);
tax_w = u3a_mark_noun(u3R->bug.tax);
fprintf(stderr, " trace stack list: ");
_raft_print_memory(tax_w);
mer_w = u3a_mark_noun(u3R->bug.mer);
fprintf(stderr, " trace stack buffer: ");
_raft_print_memory(mer_w);
don_w = u3a_mark_noun(u3R->pro.don);
fprintf(stderr, " profile battery list: ");
_raft_print_memory(don_w);
day_w = u3a_mark_noun(u3R->pro.day);
fprintf(stderr, " profile doss: ");
_raft_print_memory(day_w);
car_w = u3h_mark(u3R->cax.har_p);
fprintf(stderr, " memoization: ");
_raft_print_memory(car_w);
utm_w = har_w + das_w + flu_w + tax_w + mer_w + don_w + day_w + car_w;
fprintf(stderr, "total road stuff: ");
_raft_print_memory(utm_w);
fprintf(stderr, "total marked: ");
@ -1885,6 +1921,9 @@ _raft_grab(u3_noun ova)
fprintf(stderr, "sweep: ");
_raft_print_memory(wep_w);
u3h_free(u3R->cax.har_p);
u3R->cax.har_p = u3h_new();
u3z(u3A->sac);
u3A->sac = u3_nul;
}

View File

@ -222,9 +222,13 @@ _sist_suck(u3_noun ovo, u3_noun gon)
u3_lo_punt(2, u3kb_flop(u3k(u3t(gon))));
// u3_loom_exit();
#if 1
u3_lo_exit();
exit(1);
#else
u3z(ovo); u3z(gon);
#endif
}
/* _sist_sing(): replay ovum from the past, time already set.

View File

@ -1012,6 +1012,42 @@ u3_term_ef_boil(void)
}
}
/* u3_term_ef_verb(): initial effects for verbose events
*/
void
u3_term_ef_verb(void)
{
u3_noun pax = u3nq(u3_blip, c3__term, '1', u3_nul);
u3v_plan(pax, u3nc(c3__verb, u3_nul));
}
/* u3_term_ef_ticket(): initial effects for new ticket.
*/
void
u3_term_ef_ticket(c3_c* who_c, c3_c* tic_c)
{
u3_noun pax = u3nq(u3_blip, c3__term, '1', u3_nul);
u3_noun who, tic;
u3_noun whu, tuc;
whu = u3dc("slaw", 'p', u3i_string(who_c));
if ( u3_nul == whu ) {
fprintf(stderr, "ticket: invalid planet '%s'\r\n", who_c);
exit(1);
}
else { who = u3k(u3t(whu)); u3z(whu); }
tuc = u3dc("slaw", 'p', u3i_string(tic_c));
if ( u3_nul == tuc ) {
fprintf(stderr, "ticket: invalid secret '%s'\r\n", tic_c);
exit(1);
}
else { tic = u3k(u3t(tuc)); u3z(tuc); }
u3v_plan(pax, u3nt(c3__tick, who, tic));
}
/* u3_term_ef_bake(): initial effects for new terminal.
*/
void