Merge branch 'release-candidate' into cc-release-rc-merge

* release-candidate: (742 commits)
  reap call sites before reaping the warm dashboard
  refines -F argument handling
  alphabetizes u3_opts and usage instructions
  replaces -N (enable fake networking) with -L (disable networking)
  removes the option to set -l, -n, and -r (raft options)
  removes -X ("skip last event")
  removes -M ("memory madness")
  Use Ed25519 u3a_malloc in the ed25519 jet.
  Fix README build instructions
  properly zero-initialize u3_wcon linked-list pointer
  removes second staging copy of compiler jets
  [CI] Point to latest release-candidate arvo
  De-duplicate dependency list
  Make small stylistic improvements to crypto jets
  meson v0.44.1
  Use fetchGit instead of fetchTarball to get nixpkgs.
  Revert change to libh2o for now -- Breaks the nix build, but unbreaks the normal build.
  Minor Cleanup
  Make list indentation consistent in Meson file.
  Use latest urbit/argon2
  ...
This commit is contained in:
Joe Bryan 2018-11-21 16:45:07 -05:00
commit 63b58f4c29
155 changed files with 16149 additions and 6352 deletions

1
.d/.gitignore vendored
View File

@ -1 +0,0 @@
**.d

View File

View File

View File

View File

View File

View File

View File

0
.d/noun/.gitignore vendored
View File

View File

View File

0
.d/vere/.gitignore vendored
View File

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
# subrepositories, downloaded pills
/arvo/
/debian/
*.pill
# autoconf
/.MAKEFILE-VERSION
@ -30,5 +29,5 @@ node_modules/
# ??
/inst
cscope.*
build/
TAGS
build/

15
.gitmodules vendored
View File

@ -16,6 +16,15 @@
[submodule "subprojects/libuv"]
path = subprojects/libuv
url = https://github.com/urbit/libuv.git
[submodule "subprojects/http-parser"]
path = subprojects/http-parser
url = https://github.com/urbit/http-parser-legacy
[submodule "subprojects/h2o"]
path = subprojects/libh2o
url = https://github.com/urbit/h2o.git
[submodule "subprojects/argon2"]
path = subprojects/argon2
url = https://github.com/urbit/argon2.git
[submodule "subprojects/secp256k1"]
path = subprojects/secp256k1
url = https://github.com/urbit/secp256k1.git
[submodule "subprojects/libsni"]
path = subprojects/libsni
url = https://github.com/urbit/sniproxy

View File

@ -1,29 +1,63 @@
language: c
script: make && make test # no ./configure
language: node_js
node_js:
- 4
# Uncomment me if this gets annoying
#
# notifications:
# email: false
# notifications:
# email: false
before_install:
- wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
- unzip ninja-linux.zip
- sudo mv ninja /usr/bin/
install:
# pwd: ~/urbit
- pip3 install --user -I meson==0.44.1
- git clone https://github.com/urbit/arvo
- cd ./arvo
- git checkout $(cat ../.travis/pin-arvo-commit.txt)
- cd ..
script:
- meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true
- cd ./build
- ninja
- ninja test
- sudo ninja install
- cd ../.travis
- npm install
- ulimit -c unlimited -S
- npm run -s test; bash print-core-backtrace.sh $?
addons:
apt:
sources:
# precise, which is the default, doesn't have an official libuv1 package
- sourceline: 'deb http://us.archive.ubuntu.com/ubuntu/ xenial universe'
#
packages:
- python3
- python3-pip
- libgmp3-dev
- libsigsegv-dev
- openssl
- libssl-dev
- libncurses5-dev
- automake
- autoconf
- make
- exuberant-ctags
- libuv1-dev
- libtool
- g++
- ragel
- cmake
- re2c
- libcurl4-gnutls-dev
- python
- unzip
- gdb
# before_deploy: "make deb" # TODO
deploy:
skip_cleanup: true
provider: releases
prerelease: true # turn this off for official releases
api_key:
secure: V4E7784ECSS3MO6ZIRtang9XwibDyvDYGb0MoSaP2CTlmzIAhdokr4KJFM0qM4KRaaajCdQuqi0lojgOjwdxs7e0GkAwScb33LFxQ7Chj/QkFOY7V1AnSRLR5OsXnazB0nur5aSwvcvnggQ2XW3OeF7zIvGfs9aR97SEz/xCrVE=
file: ./build/urbit # TODO upload package from before_deploy
on:
repo: urbit/urbit
tags: true

2
.travis/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Don't show in diffs or auto-merge
package-lock.json binary

1
.travis/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/

753
.travis/package-lock.json generated Normal file
View File

@ -0,0 +1,753 @@
{
"name": "vere-tests",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ajv": {
"version": "5.5.2",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
"integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
"requires": {
"co": "^4.6.0",
"fast-deep-equal": "^1.0.0",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.3.0"
}
},
"array-differ": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz",
"integrity": "sha1-7/UuN1gknTO+QCuLuOVkuytdQDE="
},
"array-union": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz",
"integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=",
"requires": {
"array-uniq": "^1.0.1"
}
},
"array-uniq": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz",
"integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY="
},
"arrify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
},
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
},
"asn1": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
"requires": {
"safer-buffer": "~2.1.0"
}
},
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
},
"aws4": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ=="
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
"requires": {
"tweetnacl": "^0.14.3"
}
},
"bluebird": {
"version": "2.11.0",
"resolved": "http://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
"integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
},
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
},
"colors": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/colors/-/colors-1.3.2.tgz",
"integrity": "sha512-rhP0JSBGYvpcNQj4s5AdShMeE5ahMop96cTeDl/v9qQQm2fYClE2QXZRi8wLzc+GmXSxdIqqbOIAhyObEXDbfQ=="
},
"combined-stream": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
"integrity": "sha512-brWl9y6vOB1xYPZcpZde3N9zDByXTosAeMDo4p1wzo6UMOX4vumB+TP1RZ76sfE6Md68Q0NJSrE/gbezd4Ul+w==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"core-js": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
"integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw=="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"requires": {
"assert-plus": "^1.0.0"
}
},
"del": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz",
"integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=",
"requires": {
"globby": "^5.0.0",
"is-path-cwd": "^1.0.0",
"is-path-in-cwd": "^1.0.0",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0",
"rimraf": "^2.2.8"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
"requires": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
}
},
"emitter-mixin": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/emitter-mixin/-/emitter-mixin-0.0.3.tgz",
"integrity": "sha1-WUjLKG8uSO3DslGnz8H3iDOW1lw="
},
"errno": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==",
"requires": {
"prr": "~1.0.1"
}
},
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"extend": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/extend/-/extend-1.2.1.tgz",
"integrity": "sha1-oPX9bPyDpf5J72mNYOyKYk3UV2w="
},
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
},
"fast-deep-equal": {
"version": "1.1.0",
"resolved": "http://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
"integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
},
"fast-json-stable-stringify": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
"integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
},
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
},
"form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
},
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"requires": {
"assert-plus": "^1.0.0"
}
},
"glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
"integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"globby": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz",
"integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=",
"requires": {
"array-union": "^1.0.1",
"arrify": "^1.0.0",
"glob": "^7.0.3",
"object-assign": "^4.0.1",
"pify": "^2.0.0",
"pinkie-promise": "^2.0.0"
}
},
"graceful-fs": {
"version": "4.1.15",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz",
"integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA=="
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
},
"har-validator": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.0.tgz",
"integrity": "sha512-+qnmNjI4OfH2ipQ9VQOw23bBd/ibtfbVdK2fYbY4acTDqKTW/YDp9McimZdDbG8iV9fZizUqQMD5xvriB146TA==",
"requires": {
"ajv": "^5.3.0",
"har-schema": "^2.0.0"
}
},
"hoek": {
"version": "4.2.1",
"resolved": "http://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"requires": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
}
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
"requires": {
"once": "^1.3.0",
"wrappy": "1"
}
},
"inherits": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
},
"is-path-cwd": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz",
"integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0="
},
"is-path-in-cwd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz",
"integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==",
"requires": {
"is-path-inside": "^1.0.0"
}
},
"is-path-inside": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz",
"integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=",
"requires": {
"path-is-inside": "^1.0.1"
}
},
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
},
"isemail": {
"version": "2.2.1",
"resolved": "http://registry.npmjs.org/isemail/-/isemail-2.2.1.tgz",
"integrity": "sha1-A1PT2aYpUQgMJiwqoKQrjqjp4qY="
},
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
},
"items": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/items/-/items-2.1.1.tgz",
"integrity": "sha1-i9FtnIOxlSneWuoyGsqtp4NkoZg="
},
"joi": {
"version": "9.2.0",
"resolved": "http://registry.npmjs.org/joi/-/joi-9.2.0.tgz",
"integrity": "sha1-M4WseQGSEwy+Iw6ALsAskhW7/to=",
"requires": {
"hoek": "4.x.x",
"isemail": "2.x.x",
"items": "2.x.x",
"moment": "2.x.x",
"topo": "2.x.x"
}
},
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
},
"json-schema-traverse": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
"integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"verror": "1.10.0"
}
},
"junk": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/junk/-/junk-1.0.3.tgz",
"integrity": "sha1-h75jSIZJy9ym9Tqzm+yczSNH9ZI="
},
"maximatch": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/maximatch/-/maximatch-0.1.0.tgz",
"integrity": "sha1-hs2NawTJ8wfAWmuUGZBtA2D7E6I=",
"requires": {
"array-differ": "^1.0.0",
"array-union": "^1.0.1",
"arrify": "^1.0.0",
"minimatch": "^3.0.0"
}
},
"mime-db": {
"version": "1.37.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.37.0.tgz",
"integrity": "sha512-R3C4db6bgQhlIhPU48fUtdVmKnflq+hRdad7IyKhtFj06VPNVdk2RhiYL3UjQIlso8L+YxAtFkobT0VK+S/ybg=="
},
"mime-types": {
"version": "2.1.21",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.21.tgz",
"integrity": "sha512-3iL6DbwpyLzjR3xHSFNFeb9Nz/M8WDkX33t1GFQnFOllWk8pOrh/LSrB5OXlnlW5P9LH73X6loW/eogc+F5lJg==",
"requires": {
"mime-db": "~1.37.0"
}
},
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"minimist": {
"version": "0.0.8",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
},
"mkdirp": {
"version": "0.5.1",
"resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"requires": {
"minimist": "0.0.8"
}
},
"moment": {
"version": "2.22.2",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz",
"integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y="
},
"nan": {
"version": "2.3.5",
"resolved": "http://registry.npmjs.org/nan/-/nan-2.3.5.tgz",
"integrity": "sha1-gioNwmYpDOTNOhIoLKPn42Rmigg="
},
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
"requires": {
"wrappy": "1"
}
},
"path-is-absolute": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
},
"path-is-inside": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz",
"integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM="
},
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
},
"pify": {
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
},
"pinkie": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
"integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
},
"pinkie-promise": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
"integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
"requires": {
"pinkie": "^2.0.0"
}
},
"promise": {
"version": "7.3.1",
"resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz",
"integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==",
"requires": {
"asap": "~2.0.3"
}
},
"promise-streams": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/promise-streams/-/promise-streams-2.1.1.tgz",
"integrity": "sha1-cwnx02mDMOp/rasZIvE5iSKayFo=",
"requires": {
"bluebird": "^2.10.2"
}
},
"prr": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
"integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY="
},
"psl": {
"version": "1.1.29",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz",
"integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ=="
},
"pty.js": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/pty.js/-/pty.js-0.3.1.tgz",
"integrity": "sha1-gfW+0zLW5eeraFaI0boDc0ENUbU=",
"requires": {
"extend": "~1.2.1",
"nan": "2.3.5"
}
},
"punycode": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
"integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
},
"qs": {
"version": "6.5.2",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
"integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
},
"recursive-copy": {
"version": "2.0.9",
"resolved": "https://registry.npmjs.org/recursive-copy/-/recursive-copy-2.0.9.tgz",
"integrity": "sha512-0AkHV+QtfS/1jW01z3m2t/TRTW56Fpc+xYbsoa/bqn8BCYPwmsaNjlYmUU/dyGg9w8MmGoUWihU5W+s+qjxvBQ==",
"requires": {
"del": "^2.2.0",
"emitter-mixin": "0.0.3",
"errno": "^0.1.2",
"graceful-fs": "^4.1.4",
"junk": "^1.0.1",
"maximatch": "^0.1.0",
"mkdirp": "^0.5.1",
"pify": "^2.3.0",
"promise": "^7.0.1",
"slash": "^1.0.0"
}
},
"request": {
"version": "2.88.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.0",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
},
"dependencies": {
"extend": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
}
}
},
"rimraf": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz",
"integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==",
"requires": {
"glob": "^7.0.5"
}
},
"rx": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz",
"integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I="
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
},
"safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU="
},
"split": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
"integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
"requires": {
"through": "2"
}
},
"sshpk": {
"version": "1.15.2",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.15.2.tgz",
"integrity": "sha512-Ra/OXQtuh0/enyl4ETZAfTaeksa6BXks5ZcjpSUNrjBr0DvrJKX+1fsKDPpT9TBXgHAFsa4510aNVgI8g/+SzA==",
"requires": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
}
},
"stream-snitch": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/stream-snitch/-/stream-snitch-0.0.3.tgz",
"integrity": "sha1-iXp48TonFPqESqd74VR3qJbYUqk="
},
"through": {
"version": "2.3.8",
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
},
"topo": {
"version": "2.0.2",
"resolved": "http://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
"integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=",
"requires": {
"hoek": "4.x.x"
}
},
"tough-cookie": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
"requires": {
"psl": "^1.1.24",
"punycode": "^1.4.1"
}
},
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"requires": {
"safe-buffer": "^5.0.1"
}
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
},
"urbit-runner": {
"version": "github:urbit/runner-js#ee2455015dc4ea243d0e0ec623975632c9249c4e",
"from": "github:urbit/runner-js#ee24550",
"requires": {
"colors": "^1.1.2",
"escape-string-regexp": "^1.0.5",
"once": "^1.4.0",
"promise-streams": "^2.1.1",
"pty.js": "^0.3.1",
"recursive-copy": "^2.0.7",
"split": "^1.0.1",
"stream-snitch": "0.0.3",
"wait-on": "^2.0.2"
}
},
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
"integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA=="
},
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"requires": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
}
},
"wait-on": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/wait-on/-/wait-on-2.1.2.tgz",
"integrity": "sha512-Jm6pzZkbswtcRUXohxY1Ek5MrL16AwHj83drgW2FTQuglHuhZhVMyBLPIYG0rL1wvr5rdC1uzRuU/7Bc+B9Pwg==",
"requires": {
"core-js": "^2.4.1",
"joi": "^9.2.0",
"minimist": "^1.2.0",
"request": "^2.78.0",
"rx": "^4.1.0"
},
"dependencies": {
"minimist": {
"version": "1.2.0",
"resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
}
}
},
"wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}
}
}

14
.travis/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "vere-tests",
"version": "1.0.0",
"description": "Test harness for the Urbit runtime",
"scripts": {
"test": "node test.js"
},
"private": true,
"author": "~fyr",
"license": "MIT",
"dependencies": {
"urbit-runner": "github:urbit/runner-js#ee24550"
}
}

View File

@ -0,0 +1 @@
97b340675934ce196878a569d4fa1b78e26a0d33

View File

@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail
set -x
RESULT=$1
if [[ ${RESULT} -eq 0 ]]; then
exit 0
else
for i in $(find ./ -maxdepth 1 -name 'core*' -print)
do
gdb urbit core* -ex "thread apply all bt" -ex "set pagination 0" -batch
done
fi
echo "build failed with status code $RESULT"
exit $RESULT

35
.travis/test.js Normal file
View File

@ -0,0 +1,35 @@
'use strict';
var runner = require('urbit-runner')
var Urbit = runner.Urbit;
var ERROR = runner.ERROR;
var actions = runner.actions
var args = ['-A', '../arvo', '-csgPSF', 'zod', 'zod'];
var urbit = new Urbit(args);
// vere hangs (always?) with run in travis-ci with -P
// so we send ^Z if we hang for ~s30
function exit() {
setTimeout(function(){
urbit.pty.write('\x1a');
urbit.pty.on('exit', function(code, signal){
process.exit(0);
})
}, 30 * 1000);
return urbit.exit(0);
}
Promise.resolve(urbit)
.then(actions.safeBoot)
.then(actions.test)
.then(exit)
.catch(function(err){
// we still exit 0, Arvo errors are not our fault ...
return urbit.waitSilent()
.then(function(){
return urbit.warn("Arvo test aborted:", err);
})
.then(exit);
});

View File

@ -24,12 +24,11 @@ path you specify on the command line with the `-A` option.
To start a fake `~zod`, the command is:
$ urbit -c -F -I zod -A [arvo checkout] [pier directory]
$ urbit -c -F zod -A [arvo checkout] [pier directory]
To resume one that was already created, just as on the live network,
remove `-c` and `-A [arvo checkout]` (but leave the rest of the options
there). `-F` uses the fake network, and `-I` starts an "imperial"
instance - that is, an 8-bit galaxy.
there). `-F` uses the fake network.
## Kernel development

View File

@ -9,22 +9,20 @@ If you're doing development on Urbit, keep reading.
# Build instructions
[![Build Status](https://travis-ci.org/urbit/urbit.svg?branch=master)](https://travis-ci.org/urbit/urbit)
[![Build Status](https://travis-ci.org/urbit/urbit.svg?branch=maint-0.4)](https://travis-ci.org/urbit/urbit)
## External dependencies
`vere`, the Urbit virtual machine, depends on the following:
- C compiler ([gcc](https://gcc.gnu.org) or [clang](http://clang.llvm.org))
- [GNU Make](https://www.gnu.org/software/make/)
- [Meson](http://mesonbuild.com/)
- [GMP](https://gmplib.org)
- [CMake](https://cmake.org)
- [libuv](https://libuv.org) 1.x
- [OpenSSL](https://www.openssl.org)
- [libsigsegv](https://www.gnu.org/software/libsigsegv/)
- [libcurl](https://curl.haxx.se/libcurl/)
- [libuv](http://libuv.org)
- curses implementation (ncurses on Linux distributions, OS curses otherwise)
- [Ragel](https://www.colm.net/open-source/ragel/)
- [re2c](http://re2c.org)
Most of these dependencies are unfortunate; we aim to drastically shrink the
@ -34,16 +32,66 @@ for future unbundling or removal wherever possible.
## Building
Our Makefile should handle the build smoothly on all supported platforms. It's
just a simple Makefile, written by hand for GNU Make, and the most complicated
parts of its internal machinery have to do with the varied build systems of the
bundled libraries.
Urbit uses Meson build system.
Useful targets are the default `all`, `clean`, and `distclean`. The last may not
produce an entirely clean distribution directory, and runs a bundled library's
configure script; `git clean` may be a better option.
Some libraries which are not found in major distributions:
- ed25519
- http-parser legacy version 0.1.0
- murmur3
- softfloat3
- urbit-scrypt
- commonmark legacy version 0.12.0
The `vere` binary is produced in `bin/urbit`.
are included as git submodules. To build urbit from source, perform the following steps:
## Configuration & compilation
(For instructions for legacy meson, also see below)
1. Install all required dependencies.
2. Run `./scripts/bootstrap`
3. Run `./scripts/build`
4. The executable should appear in `./build` directory.
### Using meson & ninja
To configure the project, enter the build directory and enter
`meson configure -Dbuildtype=release`. To compile a debug build of urbit, use
`meson configure -Dbuildtype=debug`.
To set a prefix for installation use
`meson configure -Dprefix=/usr`.
## Configuration & compilation for legacy meson
The syntax for legacy meson (Version `0.29`) is a bit different.
1. Manually create `build` directory and invoke meson as `meson . ./build`
2. If you want to set options, this is done in one step.
Use `meson -D [options] . ./build` to prepare customized build.
Once the project is configured, use `ninja` to build it.
To install it into the default prefix, use `ninja install`.
If you want to specify custom `DESTDIR`, use `DESTDIR=... ninja install`.
## Building the Debian Package
To build a .deb file for installation on Debian platforms, perform the
following steps:
+ Run `sudo apt install devscripts` to install the `debuild` utility.
+ Update the `debian/changelog` to reflect the changes in this release.
+ If necessary, update the year of the copyright in `debian/copyright`.
+ Clean any build artifacts: Run `make clean` and delete the `bin` directory,
if it exists.
+ Run `tar -xcvf ../urbit-x.y.z.orig.tar.gz .` from the top-level folder in
the repo. This command will create an archive in the directory above the
current directory, which will be used in packaging.
+ Run `debuild -us -uc`, also from the top-level folder in the repo. This
creates a .deb file in the folder above the current directory.
The resulting .deb file should now exist in the folder above the current
directory. To test that the .deb file works properly, you can perform the
following steps:
+ Uninstall urbit: `sudo apt remove urbit`.
+ Run `sudo dpkg -i ../urbit-x.y.z_amd64.deb` to install the new version.
+ Boot up a ship using the `urbit` command.
## Contact

45
Spec/nock/4.txt Normal file
View File

@ -0,0 +1,45 @@
A noun is an atom or a cell. An atom is a natural number. A cell is an ordered pair of nouns.
Reduce by the first matching pattern; variables match any noun.
nock(a) *a
[a b c] [a [b c]]
?[a b] 0
?a 1
+[a b] +[a b]
+a 1 + a
=[a a] 0
=[a b] 1
/[1 a] a
/[2 a b] a
/[3 a b] b
/[(a + a) b] /[2 /[a b]]
/[(a + a + 1) b] /[3 /[a b]]
/a /a
#[1 a b] a
#[(a + a) b c] #[a [b /[(a + a + 1) c]] c]
#[(a + a + 1) b c] #[a [/[(a + a) c] b] c]
#a #a
*[a [b c] d] [*[a b c] *[a d]]
*[a 0 b] /[b a]
*[a 1 b] b
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] +*[a b]
*[a 5 b c] =[*[a b] *[a c]]
*[a 6 b c d] *[a *[[c d] 0 *[[2 3] 0 *[a 4 4 b]]]]
*[a 7 b c] *[*[a b] c]
*[a 8 b c] *[[*[a b] a] c]
*[a 9 b c] *[*[a c] 2 [0 1] 0 b]
*[a 10 [b c] d] #[b *[a c] *[a d]]
*[a 11 [b c] d] *[[*[a c] *[a d]] 0 3]
*[a 11 b c] *[a c]
*a *a

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
urbit (0.6-0) unstable; urgency=high
* Memory-allocation bug fix in _box_slot in Vere. Breaking change.
-- Keaton Dunsford <keaton@tlon.io> Fri, 8 Jun 2018 14:31:08 -0700

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
10

12
debian/control vendored Normal file
View File

@ -0,0 +1,12 @@
Source: urbit
Section: net
Priority: extra
Maintainer: Ted Blackman <ted@tlon.io>
Build-Depends: debhelper (>= 9), libgmp3-dev, libsigsegv-dev, openssl, libssl-dev,libtool, meson, re2c, libcurl4-gnutls-dev
Standards-Version: 3.9.5
Homepage: http://urbit.org
Package: urbit
Architecture: any
Depends: libgmp3-dev, libsigsegv-dev, openssl, libcurl4-gnutls-dev
Description: An operating function

27
debian/copyright vendored Normal file
View File

@ -0,0 +1,27 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: urbit
Source: <http://urbit.org>
Files: *
License: MIT
The MIT License (MIT)
.
Copyright (c) 2017 Urbit
.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

1
debian/debhelper-build-stamp vendored Normal file
View File

@ -0,0 +1 @@
urbit

2
debian/docs vendored Normal file
View File

@ -0,0 +1,2 @@
LICENSE.txt
README.md

1
debian/install vendored Normal file
View File

@ -0,0 +1 @@
bin/urbit usr/bin

5
debian/rules vendored Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_install:

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

37
default.nix Normal file
View File

@ -0,0 +1,37 @@
let
pkgs =
builtins.fetchGit {
name = "nixpkgs-2018-11-13";
url = https://github.com/nixos/nixpkgs/;
rev = "695a3d4254545968fc3015142c5299c0da5ca0a9";
};
in
with (import pkgs {});
let
osxdeps = lib.optionals stdenv.isDarwin (
with darwin.apple_sdk.frameworks;
[ Cocoa CoreServices ]);
deps = [ cmark curl gcc gmp libsigsegv meson ncurses ninja pkgconfig zlib
re2c openssl ];
isGitDir = (path: type: type != "directory" || baseNameOf path != ".git");
in
stdenv.mkDerivation {
name = "urbit";
src = builtins.filterSource isGitDir ./.;
buildInputs = osxdeps ++ deps;
mesonFlags = "-Dnix=true";
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-framework CoreServices";
}

4
gdb-test-hash Normal file
View File

@ -0,0 +1,4 @@
file bin/test_hash
handle SIGSEGV nostop noprint
start

View File

@ -12,7 +12,7 @@
/** u3: noun environment.
**/
# include "noun/aliases.h" // general u3
# include "noun/aliases.h" // general u3
# include "noun/allocate.h" // u3a: allocation
# include "noun/events.h" // u3e: persistence
@ -24,10 +24,31 @@
# include "noun/options.h" // u3o: config options
# include "noun/retrieve.h" // u3r: noun access (error returns)
# include "noun/trace.h" // u3t: profiling / tracing
# include "noun/xtract.h" // u3x: noun access (error crashes)
# include "noun/xtract.h" // u3x: noun access (error crashes)
# include "noun/vortex.h" // u3v: arvo kernel
# include "noun/zave.h" // u3z: memoization
# include "jets/k.h" // u3k: jets (transfer, args)
# include "jets/q.h" // u3q: jets (retain, args)
# include "jets/w.h" // u3w: jets (retain, core)
/** u3_term: log output dependencies.
**/
extern FILE*
u3_term_io_hija(void);
extern void
u3_term_io_loja(int x);
extern void
u3_term_tape(u3_noun tep);
extern void
u3_term_wall(u3_noun wol);
/* uL, uH: wrap hijack/lojack around fprintf.
**
** uL(fprintf(uH, ...));
*/
# define uH u3_term_io_hija()
# define uL(x) u3_term_io_loja(x)

View File

@ -92,3 +92,10 @@
rut;})
#define c3_free(s) free(s)
#define c3_realloc(s, l) realloc(s, l)
/* c3_calloc(): asserting calloc
*/
#define c3_calloc(s) ({ \
void* rut = c3_malloc(s); \
memset(rut, 0, s); \
rut;})

View File

@ -51,6 +51,7 @@
# define c3__bccb c3_s4('b','c','c','b')
# define c3__bccn c3_s4('b','c','c','n')
# define c3__bcdg c3_s4('b','c','d','g')
# define c3__bcdt c3_s4('b','c','d','t')
# define c3__bckt c3_s4('b','c','k','t')
# define c3__bclc c3_s4('b','c','l','c')
# define c3__bcmt c3_s4('b','c','m','t')
@ -86,6 +87,7 @@
# define c3__blog c3_s4('b','l','o','g')
# define c3__bloq c3_s4('b','l','o','q')
# define c3__blot c3_s4('b','l','o','t')
# define c3__blow c3_s4('b','l','o','w')
# define c3__blue c3_s4('b','l','u','e')
# define c3__blur c3_s4('b','l','u','r')
# define c3__bndl c3_s4('b','n','d','l')
@ -141,6 +143,7 @@
# define c3__brtg c3_s4('b','r','t','g')
# define c3__brtr c3_s4('b','r','t','r')
# define c3__brts c3_s4('b','r','t','s')
# define c3__brvt c3_s4('b','r','v','t')
# define c3__brwt c3_s4('b','r','w','t')
# define c3__brzp c3_s4('b','r','z','p')
# define c3__bud c3_s3('b','u','d')
@ -148,8 +151,9 @@
# define c3__bump c3_s4('b','u','m','p')
# define c3__bund c3_s4('b','u','n','d')
# define c3__bung c3_s4('b','u','n','g')
# define c3__bunt c3_s4('b','u','n','t')
# define c3__bunk c3_s4('b','u','n','k')
# define c3__bunt c3_s4('b','u','n','t')
# define c3__bunx c3_s4('b','u','n','x')
# define c3__burn c3_s4('b','u','r','n')
# define c3__busk c3_s4('b','u','s','k')
# define c3__bust c3_s4('b','u','s','t')
@ -232,10 +236,12 @@
# define c3__con c3_s3('c','o','n')
# define c3__cone c3_s4('c','o','n','e')
# define c3__cong c3_s4('c','o','n','g')
# define c3__conn c3_s4('c','o','n','n')
# define c3__cons c3_s4('c','o','n','s')
# define c3__cook c3_s4('c','o','o','k')
# define c3__cool c3_s4('c','o','o','l')
# define c3__core c3_s4('c','o','r','e')
# define c3__corp c3_s4('c','o','r','p')
# define c3__corm c3_s4('c','o','r','m')
# define c3__corp c3_s4('c','o','r','p')
# define c3__cow c3_s3('c','o','w')
@ -274,12 +280,14 @@
# define c3__ctl c3_s3('c','t','l')
# define c3__cut c3_s3('c','u','t')
# define c3__cyl c3_s3('c','y','l')
# define c3__czar c3_s4('c','z','a','r')
# define c3__d c3_s1('d')
# define c3__da c3_s2('d','a')
# define c3__dago c3_s4('d','a','g','o')
# define c3__dant c3_s4('d','a','n','t')
# define c3__dast c3_s4('d','a','s','t')
# define c3__data c3_s4('d','a','t','a')
# define c3__dawn c3_s4('d','a','w','n')
# define c3__dbug c3_s4('d','b','u','g')
# define c3__dec c3_s3('d','e','c')
# define c3__deem c3_s4('d','e','e','m')
@ -311,6 +319,7 @@
# define c3__dmal c3_s4('d','m','a','l')
# define c3__do c3_s2('d','o')
# define c3__doc c3_s3('d','o','c')
# define c3__docs c3_s4('d','o','c','s')
# define c3__dogo c3_s4('d','o','g','o')
# define c3__dojo c3_s4('d','o','j','o')
# define c3__dome c3_s4('d','o','m','e')
@ -346,11 +355,14 @@
# define c3__dtwt c3_s4('d','t','w','t')
# define c3__dtzy c3_s4('d','t','z','y')
# define c3__dtzz c3_s4('d','t','z','z')
# define c3__dxkt c3_s4('d','x','k','t')
# define c3__dub c3_s3('d','u','b')
# define c3__duct c3_s4('d','u','c','t')
# define c3__duke c3_s4('d','u','k','e')
# define c3__dumb c3_s4('d','u','m','b')
# define c3__dump c3_s4('d','u','m','p')
# define c3__dust c3_s4('d','u','s','t')
# define c3__earl c3_s4('e','a','r','l')
# define c3__east c3_s4('e','a','s','t')
# define c3__echo c3_s4('e','c','h','o')
# define c3__edge c3_s4('e','d','g','e')
@ -370,6 +382,7 @@
# define c3__face c3_s4('f','a','c','e')
# define c3__fail c3_s4('f','a','i','l')
# define c3__fair c3_s4('f','a','i','r')
# define c3__fake c3_s4('f','a','k','e')
# define c3__fan c3_s3('f','a','n')
# define c3__farg c3_s4('f','a','r','g')
# define c3__fast c3_s4('f','a','s','t')
@ -412,6 +425,7 @@
# define c3__forb c3_s4('f','o','r','b')
# define c3__fore c3_s4('f','o','r','e')
# define c3__fork c3_s4('f','o','r','k')
# define c3__form c3_s4('f','o','r','m')
# define c3__forq c3_s4('f','o','r','q')
# define c3__foul c3_s4('f','o','u','l')
# define c3__frag c3_s4('f','r','a','g')
@ -423,8 +437,8 @@
# define c3__fron c3_s4('f','r','o','n')
# define c3__fry c3_s3('f','r','y')
# define c3__fuge c3_s4('f','u','g','e')
# define c3__fume c3_s4('f','u','l','l')
# define c3__full c3_s4('f','u','m','e')
# define c3__fume c3_s4('f','u','m','e')
# define c3__full c3_s4('f','u','l','l')
# define c3__fun c3_s3('f','u','n')
# define c3__fund c3_s4('f','u','n','d')
# define c3__fung c3_s4('f','u','n','g')
@ -553,6 +567,8 @@
# define c3__i c3_s1('i')
# define c3__ic c3_s2('i','c')
# define c3__ice c3_s3('i','c','e')
# define c3__iced c3_s4('i','c','e','d')
# define c3__id c3_s2('i','d')
# define c3__if c3_s2('i','f')
# define c3__ifix c3_s4('i','f','i','x')
# define c3__in c3_s2('i','n')
@ -577,6 +593,7 @@
# define c3__kern c3_s4('k','e','r','n')
# define c3__kgo c3_s3('k','g','o')
# define c3__kick c3_s4('k','i','c','k')
# define c3__king c3_s4('k','i','n','g')
# define c3__kit c3_s3('k','i','t')
# define c3__knit c3_s4('k','n','i','t')
# define c3__kno c3_s3('k','n','o')
@ -775,6 +792,7 @@
# define c3__oops c3_s4('o','o','p','s')
# define c3__op c3_s2('o','p')
# define c3__open c3_s4('o','p','e','n')
# define c3__opts c3_s4('o','p','t','s')
# define c3__or c3_s2('o','r')
# define c3__ord c3_s3('o','r','d')
# define c3__orth c3_s4('o','r','t','h')
@ -794,6 +812,7 @@
# define c3__part c3_s4('p','a','r','t')
# define c3__pass c3_s4('p','a','s','s')
# define c3__past c3_s4('p','a','s','t')
# define c3__pawn c3_s4('p','a','w','n')
# define c3__peek c3_s4('p','e','e','k')
# define c3__peep c3_s4('p','e','e','p')
# define c3__peft c3_s4('p','e','f','t')
@ -1060,6 +1079,7 @@
# define c3__term c3_s4('t','e','r','m')
# define c3__test c3_s4('t','e','s','t')
# define c3__text c3_s4('t','e','x','t')
# define c3__that c3_s4('t','h','a','t')
# define c3__this c3_s4('t','h','i','s')
# define c3__thin c3_s4('t','h','i','n')
# define c3__thud c3_s4('t','h','u','d')
@ -1114,6 +1134,7 @@
# define c3__trop c3_s4('t','r','o','p')
# define c3__trup c3_s4('t','r','u','p')
# define c3__try c3_s3('t','r','y')
# define c3__tsbn c3_s4('t','s','b','n')
# define c3__tsbr c3_s4('t','s','b','r')
# define c3__tscl c3_s4('t','s','c','l')
# define c3__tscm c3_s4('t','s','c','m')
@ -1134,6 +1155,7 @@
# define c3__tung c3_s4('t','u','n','g')
# define c3__tupl c3_s4('t','u','p','l')
# define c3__turd c3_s4('t','u','r','d')
# define c3__turf c3_s4('t','u','r','f')
# define c3__turn c3_s4('t','u','r','n')
# define c3__twig c3_s4('t','w','i','g')
# define c3__twix c3_s4('t','w','i','x')
@ -1184,6 +1206,7 @@
# define c3__watt c3_s4('w','a','t','t')
# define c3__weak c3_s4('w','e','a','k')
# define c3__web c3_s3('w','e','b')
# define c3__wet c3_s3('w','e','t')
# define c3__werp c3_s4('w','e','r','p')
# define c3__west c3_s4('w','e','s','t')
# define c3__what c3_s4('w','h','a','t')
@ -1191,6 +1214,7 @@
# define c3__wild c3_s4('w','i','l','d')
# define c3__win c3_s3('w','i','n')
# define c3__wipe c3_s4('w','i','p','e')
# define c3__wise c3_s4('w','i','s','e')
# define c3__wish c3_s4('w','i','s','h')
# define c3__with c3_s4('w','i','t','h')
# define c3__wnut c3_s4('w','n','u','t')
@ -1244,13 +1268,16 @@
# define c3__zphs c3_s4('z','p','h','x')
# define c3__zphx c3_s4('z','p','h','x')
# define c3__zplc c3_s4('z','p','l','c')
# define c3__zpmc c3_s4('z','p','m','c')
# define c3__zpmt c3_s4('z','p','m','t')
# define c3__zpsg c3_s4('z','p','s','g')
# define c3__zpsk c3_s4('z','p','s','k')
# define c3__zpsm c3_s4('z','p','s','m')
# define c3__zptc c3_s4('z','p','t','c')
# define c3__zptm c3_s4('z','p','t','m')
# define c3__zpts c3_s4('z','p','t','s')
# define c3__zpvn c3_s4('z','p','v','n')
# define c3__zpvt c3_s4('z','p','v','t')
# define c3__zpzp c3_s4('z','p','z','p')
# define c3__zuse c3_s4('z','u','s','e')
# define c3__zush c3_s4('z','u','s','h')

View File

@ -4,10 +4,15 @@
*/
/** Must be compiled on gcc with C99 support.
**/
#include "config.h"
# ifndef __GNUC__
# error "port me"
# endif
# ifndef _GNU_SOURCE
# define _GNU_SOURCE
# endif
/** System include files.
@ -194,3 +199,10 @@
# else
# define DEVRANDOM "/dev/random"
# endif
/* Static assertion
*/
#define ASSERT_CONCAT_(a, b) a##b
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
#define STATIC_ASSERT(e,m) \
;enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) }

View File

@ -10,4 +10,7 @@
#mesondefine U3_OS_ENDIAN_little
#mesondefine U3_OS_ENDIAN_big
#mesondefine U3_MEMORY_DEBUG
#mesondefine U3_CPU_DEBUG
#endif /*CONFIG_H*/

265
include/jets/g.h Normal file
View File

@ -0,0 +1,265 @@
/* include/f/qjet.h
**
** This file is in the public domain.
*/
/** Tier 1.
**/
u3_noun u3ga_add(u3_atom, u3_atom);
u3_noun u3ga_dec(u3_atom);
u3_noun u3ga_div(u3_atom, u3_atom);
u3_noun u3ga_gte(u3_atom, u3_atom);
u3_noun u3ga_gth(u3_atom, u3_atom);
u3_noun u3ga_inc(u3_atom);
u3_noun u3ga_lte(u3_atom, u3_atom);
u3_noun u3ga_lth(u3_atom, u3_atom);
u3_noun u3ga_mod(u3_atom, u3_atom);
u3_noun u3ga_mul(u3_atom, u3_atom);
u3_noun u3ga_sub(u3_atom, u3_atom);
/** Tier 2.
**/
u3_noun u3gb_bind(u3_noun, u3_noun);
u3_noun u3gb_clap(u3_noun, u3_noun, u3_noun);
u3_noun u3gb_drop(u3_noun);
u3_noun u3gb_flop(u3_noun);
u3_noun u3gb_lent(u3_noun);
u3_noun u3gb_levy(u3_noun, u3_noun);
u3_noun u3gb_lien(u3_noun, u3_noun);
u3_noun u3gb_murn(u3_noun, u3_noun);
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_skid(u3_noun, u3_noun);
u3_noun u3gb_skim(u3_noun, u3_noun);
u3_noun u3gb_skip(u3_noun, u3_noun);
u3_noun u3gb_scag(u3_atom, u3_noun);
u3_noun u3gb_slag(u3_atom, u3_noun);
u3_noun u3gb_snag(u3_atom, u3_noun);
u3_noun u3gb_sort(u3_noun, u3_noun);
u3_noun u3gb_turn(u3_noun, u3_noun);
u3_noun u3gb_weld(u3_noun, u3_noun);
/** Tier 3.
**/
u3_noun u3gc_bex(u3_atom);
u3_noun u3gc_xeb(u3_atom);
u3_noun u3gc_can(u3_atom, u3_noun);
u3_noun u3gc_cap(u3_atom);
u3_noun u3gc_cat(u3_atom, u3_atom, u3_atom);
u3_noun u3gc_con(u3_atom, u3_atom);
u3_noun u3gc_cut(u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3gc_dis(u3_atom, u3_atom);
u3_noun u3gc_dor(u3_atom, u3_atom);
u3_noun u3gc_dvr(u3_atom, u3_atom);
u3_noun u3gc_end(u3_atom, u3_atom, u3_atom);
u3_noun u3gc_gor(u3_atom, u3_atom);
u3_noun u3gc_hor(u3_atom, u3_atom);
u3_noun u3gc_lsh(u3_atom, u3_atom, u3_atom);
u3_noun u3gc_mas(u3_atom);
u3_noun u3gc_met(u3_atom, u3_atom);
u3_noun u3gc_mix(u3_atom, u3_atom);
u3_noun u3gc_muk(u3_atom, u3_atom, u3_atom);
u3_noun u3gc_peg(u3_atom, u3_atom);
u3_noun u3gc_pow(u3_atom, u3_atom);
u3_noun u3gc_rap(u3_atom, u3_noun);
u3_noun u3gc_rep(u3_atom, u3_noun);
u3_noun u3gc_rip(u3_atom, u3_atom);
u3_noun u3gc_rsh(u3_atom, u3_atom, u3_atom);
u3_noun u3gc_sqt(u3_atom);
u3_noun u3gc_vor(u3_atom, u3_atom);
/** Tier 4.
**/
u3_noun u3gdb_bif(u3_noun, u3_noun);
u3_noun u3gdb_dif(u3_noun, u3_noun);
u3_noun u3gdb_gas(u3_noun, u3_noun);
u3_noun u3gdb_get(u3_noun, u3_noun);
u3_noun u3gdb_has(u3_noun, u3_noun);
u3_noun u3gdb_int(u3_noun, u3_noun);
u3_noun u3gdb_put(u3_noun, u3_noun, u3_noun);
# define u3gdb_tap u3gdi_tap
u3_noun u3gdb_uni(u3_noun, u3_noun);
u3_noun u3gdi_bif(u3_noun, u3_noun);
u3_noun u3gdi_dif(u3_noun, u3_noun);
u3_noun u3gdi_gas(u3_noun, u3_noun);
u3_noun u3gdi_has(u3_noun, u3_noun);
u3_noun u3gdi_int(u3_noun, u3_noun);
u3_noun u3gdi_mer(u3_noun, u3_noun);
u3_noun u3gdi_put(u3_noun, u3_noun);
u3_noun u3gdi_tap(u3_noun);
u3_noun u3gdi_uni(u3_noun, u3_noun);
u3_noun u3gdi_wyt(u3_noun);
/** Tier 5.
**/
u3_noun u3ge_cue(u3_atom);
u3_noun u3ge_jam(u3_atom);
u3_noun u3ge_mat(u3_atom);
u3_noun u3ge_rub(u3_atom, u3_atom);
u3_noun u3ge_lore(u3_atom);
u3_noun u3ge_loss(u3_noun, u3_noun);
u3_noun u3ge_lune(u3_atom);
u3_noun u3ge_repg(u3_noun, u3_noun, u3_noun);
u3_noun u3ge_rexp(u3_noun, u3_noun);
u3_noun u3ge_trip(u3_atom);
u3_noun u3gea_ecba_en(u3_atom, u3_atom);
u3_noun u3gea_ecba_de(u3_atom, u3_atom);
u3_noun u3gea_ecbb_en(u3_atom, u3_atom);
u3_noun u3gea_ecbb_de(u3_atom, u3_atom);
u3_noun u3gea_ecbc_en(u3_atom, u3_atom);
u3_noun u3gea_ecbc_de(u3_atom, u3_atom);
u3_noun u3gea_cbca_en(u3_atom, u3_atom, u3_atom);
u3_noun u3gea_cbca_de(u3_atom, u3_atom, u3_atom);
u3_noun u3gea_cbcb_en(u3_atom, u3_atom, u3_atom);
u3_noun u3gea_cbcb_de(u3_atom, u3_atom, u3_atom);
u3_noun u3gea_cbcc_en(u3_atom, u3_atom, u3_atom);
u3_noun u3gea_cbcc_de(u3_atom, u3_atom, u3_atom);
u3_noun u3gea_de(u3_atom, u3_atom);
u3_noun u3gea_en(u3_atom, u3_atom);
u3_noun u3ges_hsh(u3_atom, u3_atom, u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3ges_hsl(u3_atom, u3_atom, u3_atom, u3_atom, u3_atom,
u3_atom, u3_atom, u3_atom);
u3_noun u3ges_pbk(u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3ges_pbl(u3_atom, u3_atom, u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3ge_shax(u3_atom);
u3_noun u3ge_shay(u3_atom, u3_atom);
u3_noun u3ge_shas(u3_atom, u3_atom);
u3_noun u3ge_shal(u3_atom, u3_atom);
u3_noun u3geo_raw(u3_atom, u3_atom);
u3_noun u3gef_drg(u3_noun, u3_atom);
u3_noun u3gef_lug(u3_noun, u3_noun, u3_atom, u3_atom);
u3_noun u3ger_add(u3_atom, u3_atom, u3_atom);
u3_noun u3ger_sub(u3_atom, u3_atom, u3_atom);
u3_noun u3ger_mul(u3_atom, u3_atom, u3_atom);
u3_noun u3ger_div(u3_atom, u3_atom, u3_atom);
u3_noun u3ger_sqt(u3_atom, u3_atom);
u3_noun u3ger_fma(u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3ger_lth(u3_atom, u3_atom);
u3_noun u3ger_lte(u3_atom, u3_atom);
u3_noun u3ger_equ(u3_atom, u3_atom);
u3_noun u3ger_gte(u3_atom, u3_atom);
u3_noun u3ger_gth(u3_atom, u3_atom);
u3_noun u3get_add(u3_atom, u3_atom, u3_atom);
u3_noun u3get_sub(u3_atom, u3_atom, u3_atom);
u3_noun u3get_mul(u3_atom, u3_atom, u3_atom);
u3_noun u3get_div(u3_atom, u3_atom, u3_atom);
u3_noun u3get_sqt(u3_atom, u3_atom);
u3_noun u3get_fma(u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3get_lth(u3_atom, u3_atom);
u3_noun u3get_lte(u3_atom, u3_atom);
u3_noun u3get_equ(u3_atom, u3_atom);
u3_noun u3get_gte(u3_atom, u3_atom);
u3_noun u3get_gth(u3_atom, u3_atom);
u3_noun u3geq_add(u3_atom, u3_atom, u3_atom);
u3_noun u3geq_sub(u3_atom, u3_atom, u3_atom);
u3_noun u3geq_mul(u3_atom, u3_atom, u3_atom);
u3_noun u3geq_div(u3_atom, u3_atom, u3_atom);
u3_noun u3geq_sqt(u3_atom, u3_atom);
u3_noun u3geq_fma(u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3geq_lth(u3_atom, u3_atom);
u3_noun u3geq_lte(u3_atom, u3_atom);
u3_noun u3geq_equ(u3_atom, u3_atom);
u3_noun u3geq_gte(u3_atom, u3_atom);
u3_noun u3geq_gth(u3_atom, u3_atom);
u3_noun u3ges_add(u3_atom, u3_atom, u3_atom);
u3_noun u3ges_sub(u3_atom, u3_atom, u3_atom);
u3_noun u3ges_mul(u3_atom, u3_atom, u3_atom);
u3_noun u3ges_div(u3_atom, u3_atom, u3_atom);
u3_noun u3ges_sqt(u3_atom, u3_atom);
u3_noun u3ges_fma(u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3ges_lth(u3_atom, u3_atom);
u3_noun u3ges_lte(u3_atom, u3_atom);
u3_noun u3ges_equ(u3_atom, u3_atom);
u3_noun u3ges_gte(u3_atom, u3_atom);
u3_noun u3ges_gth(u3_atom, u3_atom);
/** Tier 6.
**/
u3_noun u3gf_bull(u3_noun, u3_noun);
u3_noun u3gf_cell(u3_noun, u3_noun);
u3_noun u3gf_comb(u3_noun, u3_noun);
u3_noun u3gf_cons(u3_noun, u3_noun);
u3_noun u3gf_core(u3_noun, u3_noun);
u3_noun u3gf_cube(u3_noun, u3_noun);
u3_noun u3gf_face(u3_noun, u3_noun);
u3_noun u3gf_fine(u3_noun, u3_noun, u3_noun);
u3_noun u3gf_fitz(u3_noun, u3_noun);
u3_noun u3gf_flan(u3_noun, u3_noun);
u3_noun u3gf_flay(u3_noun);
u3_noun u3gf_flip(u3_noun);
u3_noun u3gf_flor(u3_noun, u3_noun);
u3_noun u3gf_forq(u3_noun, u3_noun);
u3_noun u3gf_fork(u3_noun);
u3_noun u3gf_grof(u3_noun);
u3_noun u3gf_help(u3_noun, u3_noun);
u3_noun u3gf_hike(u3_noun, u3_noun);
u3_noun u3gf_look(u3_noun, u3_noun);
u3_noun u3gf_loot(u3_noun, u3_noun);
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_whip(u3_noun, u3_noun, u3_noun);
u3_noun u3gfp_hack(u3_noun, u3_noun);
u3_noun u3gfp_late(u3_noun);
u3_noun u3gfp_open(u3_noun, u3_noun);
u3_noun u3gfp_rake(u3_noun);
# define u3gfu_van_fan 28
# define u3gfu_van_rib 58
# define u3gfu_van_vrf 59
# define u3gfu_van_vet 118
# define u3gfu_van_fab 119
u3_noun u3gfu_burn(u3_noun, u3_noun);
u3_noun u3gfu_busk(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_buss(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_bust(u3_noun, u3_noun, u3_noun);
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_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);
u3_noun u3gfu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_fire(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_firm(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_fish(u3_noun, u3_noun, u3_atom);
u3_noun u3gfu_fuse(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_gain(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_heal(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_lose(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_mint(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_mull(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_nest(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_nost(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_orth(u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_peek(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_peel(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_play(u3_noun, u3_noun, u3_noun);
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_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);
u3_noun u3gfu_toss(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3gfu_wrap(u3_noun, u3_noun, u3_noun);

View File

@ -18,6 +18,11 @@
/* u3kc: tier 3 functions
*/
/* u3kc_mix(): binary xor.
*/
u3_noun
u3kc_mix(u3_atom a, u3_atom b);
/* u3kc_lsh(): left shift.
*/
u3_noun
@ -28,6 +33,26 @@
u3_noun
u3kc_rsh(u3_noun a, u3_noun b, u3_noun c);
/* u3kc_rep(): assemble single.
*/
u3_noun
u3kc_rep(u3_atom a, u3_noun b);
/* u3kc_rip(): disassemble.
*/
u3_noun
u3kc_rip(u3_atom a, u3_atom b);
/* u3kc_rev(): reverse block order, accounting for leading zeroes.
*/
u3_noun
u3kc_rev(u3_atom boz, u3_atom len, u3_atom dat);
/* u3kc_swp(): reverse block order.
*/
u3_noun
u3kc_swp(u3_atom a, u3_atom b);
/* u3kd: tier 4 functions
*/
/* u3kdb_get(): map get for key `b` in map `a` with u3_none.

115
include/jets/l.h Normal file
View File

@ -0,0 +1,115 @@
/* include/f/kjet.h
**
** This file is in the public domain.
*/
/** Tier 1.
**/
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);
u3_noun u3la_lte(u3_noun a, u3_noun b);
/** Tier 2.
**/
u3_noun u3lb_lent(u3_noun a);
u3_noun u3lb_weld(u3_noun a, u3_noun b);
u3_noun u3lb_flop(u3_noun a);
/* u3lc: tier 3 functions
*/
/* u3lc_lsh(): left shift.
*/
u3_noun
u3lc_lsh(u3_noun a, u3_noun b, u3_noun c);
/* u3lc_rsh(): right shift.
*/
u3_noun
u3lc_rsh(u3_noun a, u3_noun b, u3_noun c);
/* u3ld: tier 4 functions
*/
/* u3ldb_get(): map get for key `b` in map `a` with u3_none.
*/
u3_weak
u3ldb_get(u3_noun a, u3_noun b);
/* u3ldb_got(): map get for key `b` in map `a` with bail.
*/
u3_noun
u3ldb_got(u3_noun a, u3_noun b);
/* u3ldb_put(): map put for key `b`, value `c` in map `a`.
*/
u3_weak
u3ldb_put(u3_noun a, u3_noun b, u3_noun c);
/* u3ldb_has(): test for get.
*/
u3_noun
u3ldb_has(u3_noun a, u3_noun b);
/* u3ldb_gas(): list to map.
*/
u3_noun
u3ldb_gas(u3_noun a, u3_noun b);
/* u3ldi_gas(): list to map.
*/
u3_noun
u3ldi_gas(u3_noun a, u3_noun b);
/* u3ldi_has(): test for presence.
*/
u3_noun
u3ldi_has(u3_noun a, u3_noun b);
/* u3ldi_tap(): map/set convert to list. (solves by_tap also.)
*/
u3_noun
u3ldi_tap(u3_noun a);
/* u3ldi_put(): put in set.
*/
u3_weak
u3ldi_put(u3_noun a, u3_noun b);
/* u3ldi_uni(): set union.
*/
u3_noun
u3ldi_uni(u3_noun a, u3_noun b);
# define u3ldb_tap(a) u3ldi_tap(a)
/* u3le: tier 5 functions
*/
/* u3le_cue(): expand saved pill.
*/
u3_noun
u3le_cue(u3_atom a);
/* u3le_jam(): pack noun as atom.
*/
u3_atom
u3le_jam(u3_noun a);
/* u3le_trip(): atom to tape.
*/
u3_noun
u3le_trip(u3_noun a);
/* u3lf_fork(): build %fork span.
*/
u3_noun
u3lf_fork(u3_noun yed);
/* u3kz_fork(): build %fork span.
*/
u3_noun
u3kz_fork(u3_noun yed);
/* u3lfu_repo():
*/
u3_noun
u3lfu_repo(u3_noun, u3_noun);

View File

@ -64,8 +64,10 @@
u3_noun u3qc_pow(u3_atom, u3_atom);
u3_noun u3qc_rap(u3_atom, u3_noun);
u3_noun u3qc_rep(u3_atom, u3_noun);
u3_noun u3qc_rev(u3_atom, u3_atom, u3_atom);
u3_noun u3qc_rip(u3_atom, u3_atom);
u3_noun u3qc_rsh(u3_atom, u3_atom, u3_atom);
u3_noun u3qc_swp(u3_atom, u3_atom);
u3_noun u3qc_sqt(u3_atom);
u3_noun u3qc_vor(u3_atom, u3_atom);
@ -132,6 +134,25 @@
u3_noun u3qe_shay(u3_atom, u3_atom);
u3_noun u3qe_shas(u3_atom, u3_atom);
u3_noun u3qe_shal(u3_atom, u3_atom);
u3_noun u3qe_sha1(u3_atom, u3_atom);
u3_noun u3qe_hmac(u3_noun, u3_atom, u3_atom,
u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3qe_argon2(u3_atom, u3_atom, u3_atom,
u3_atom, u3_atom, u3_atom,
u3_atom, u3_atom, u3_atom, u3_atom,
u3_atom, u3_atom, u3_atom, u3_atom);
u3_noun u3qe_blake(u3_atom wid, u3_atom dat,
u3_atom wik, u3_atom dak, u3_atom out);
u3_noun u3qe_ripe(u3_atom wid, u3_atom dat);
u3_noun u3qe_make(u3_atom has, u3_atom prv);
u3_noun u3qe_reco(u3_atom has, u3_atom sig_v, u3_atom sig_r, u3_atom sig_s);
u3_noun u3qe_sign(u3_atom has, u3_atom prv);
u3_noun u3qeo_raw(u3_atom, u3_atom);
@ -204,7 +225,7 @@
u3_noun u3qf_forq(u3_noun, u3_noun);
u3_noun u3qf_fork(u3_noun);
u3_noun u3qf_grof(u3_noun);
u3_noun u3qf_help(u3_noun, u3_noun);
u3_noun u3qf_hint(u3_noun, u3_noun);
u3_noun u3qf_hike(u3_noun, u3_noun);
u3_noun u3qf_look(u3_noun, u3_noun);
u3_noun u3qf_loot(u3_noun, u3_noun);
@ -214,9 +235,12 @@
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);
u3_noun u3qfp_hack(u3_noun, u3_noun);
u3_noun u3qfp_late(u3_noun);
u3_noun u3qfp_open(u3_noun, u3_noun);
u3_noun u3qfp_open(u3_noun, u3_noun, u3_noun);
u3_noun u3qfp_nepo(u3_noun, u3_noun);
u3_noun u3qfp_rake(u3_noun);
# define u3qfu_van_fan 28
@ -237,6 +261,7 @@
u3_noun u3qfu_dunq(u3_noun, const c3_c*, u3_noun);
void u3qfu_dump(u3_noun, const c3_c*, u3_noun);
u3_noun u3qfu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_find(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_fire(u3_noun, u3_noun, u3_noun);
@ -264,80 +289,4 @@
u3_noun u3qfu_toss(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_wrap(u3_noun, u3_noun, u3_noun);
u3_noun u3qz_bull(u3_noun, u3_noun);
u3_noun u3qz_cell(u3_noun, u3_noun);
u3_noun u3qz_comb(u3_noun, u3_noun);
u3_noun u3qz_cons(u3_noun, u3_noun);
u3_noun u3qz_core(u3_noun, u3_noun);
u3_noun u3qz_cube(u3_noun, u3_noun);
u3_noun u3qz_face(u3_noun, u3_noun);
u3_noun u3qz_fine(u3_noun, u3_noun, u3_noun);
u3_noun u3qz_fitz(u3_noun, u3_noun);
u3_noun u3qz_flan(u3_noun, u3_noun);
u3_noun u3qz_flay(u3_noun);
u3_noun u3qz_flip(u3_noun);
u3_noun u3qz_flor(u3_noun, u3_noun);
u3_noun u3qz_forq(u3_noun, u3_noun);
u3_noun u3qz_fork(u3_noun);
u3_noun u3qz_grof(u3_noun);
u3_noun u3qz_help(u3_noun, u3_noun);
u3_noun u3qz_hike(u3_noun, u3_noun);
u3_noun u3qz_look(u3_noun, u3_noun);
u3_noun u3qz_loot(u3_noun, u3_noun);
u3_noun u3qz_slot(u3_atom, u3_noun);
u3_noun u3qz_type(u3_noun);
u3_noun u3qzl_bunt(u3_noun, u3_noun);
u3_noun u3qzl_whip(u3_noun, u3_noun, u3_noun);
u3_noun u3qzp_hack(u3_noun, u3_noun);
u3_noun u3qzp_late(u3_noun);
u3_noun u3qzp_open(u3_noun, u3_noun);
u3_noun u3qzp_rake(u3_noun);
# define u3qzu_van_fan 28
# define u3qzu_van_rib 58
# define u3qzu_van_vrf 59
# define u3qzu_van_vet 118
# define u3qzu_van_fab 119
u3_noun u3qzu_burn(u3_noun, u3_noun);
u3_noun u3qzu_busk(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_buss(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_bust(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_conk(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_crop(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_cull(u3_noun, u3_noun, u3_noun, u3_atom, u3_noun);
u3_noun u3qzu_duck(u3_noun, u3_noun);
u3_noun u3qzu_dung(u3_noun, u3_noun cap, u3_noun);
u3_noun u3qzu_dunq(u3_noun, const c3_c*, u3_noun);
void u3qzu_dump(u3_noun, const c3_c*, u3_noun);
u3_noun u3qzu_fond(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_finc(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_fink(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_fire(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_firm(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_fish(u3_noun, u3_noun, u3_atom);
u3_noun u3qzu_fuse(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_gain(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_heal(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_lose(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_mint(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_mull(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_nest(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_nost(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_orth(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_peek(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_peel(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_play(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_repo(u3_noun, u3_noun);
u3_noun u3qzu_rest(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_shep(u3_noun, const c3_c*, u3_noun, u3_noun);
u3_noun u3qzu_shew(u3_noun, u3_noun);
u3_noun u3qzu_sift(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_snub(u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_tack(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_toss(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qzu_wrap(u3_noun, u3_noun, u3_noun);
void u3qf_test(const c3_c*, u3_noun);

View File

@ -64,8 +64,10 @@
u3_noun u3wc_pow(u3_noun);
u3_noun u3wc_rap(u3_noun);
u3_noun u3wc_rep(u3_noun);
u3_noun u3wc_rev(u3_noun);
u3_noun u3wc_rip(u3_noun);
u3_noun u3wc_rsh(u3_noun);
u3_noun u3wc_swp(u3_noun);
u3_noun u3wc_sqt(u3_noun);
u3_noun u3wc_vor(u3_noun);
@ -143,6 +145,7 @@
u3_noun u3we_shay(u3_noun);
u3_noun u3we_shas(u3_noun);
u3_noun u3we_shal(u3_noun);
u3_noun u3we_sha1(u3_noun);
u3_noun u3weo_raw(u3_noun);
@ -151,6 +154,19 @@
u3_noun u3wee_veri(u3_noun);
u3_noun u3wee_shar(u3_noun);
u3_noun u3we_hmac(u3_noun);
u3_noun u3we_argon2(u3_noun);
u3_noun u3we_blake(u3_noun);
u3_noun u3we_ripe(u3_noun);
u3_noun u3we_make(u3_noun);
u3_noun u3we_sign(u3_noun);
u3_noun u3we_reco(u3_noun);
u3_noun u3we_bend_fun(u3_noun);
u3_noun u3we_cold_fun(u3_noun);
u3_noun u3we_cook_fun(u3_noun);
@ -233,7 +249,7 @@
u3_noun u3wf_flor(u3_noun);
u3_noun u3wf_forq(u3_noun);
u3_noun u3wf_fork(u3_noun);
u3_noun u3wf_help(u3_noun);
u3_noun u3wf_hint(u3_noun);
u3_noun u3wf_hike(u3_noun);
u3_noun u3wf_look(u3_noun);
u3_noun u3wf_loot(u3_noun);
@ -273,61 +289,6 @@
u3_noun u3wfu_toss(u3_noun);
u3_noun u3wfu_wrap(u3_noun);
u3_noun u3wz_bull(u3_noun);
u3_noun u3wz_cell(u3_noun);
u3_noun u3wz_comb(u3_noun);
u3_noun u3wz_cons(u3_noun);
u3_noun u3wz_core(u3_noun);
u3_noun u3wz_cube(u3_noun);
u3_noun u3wz_face(u3_noun);
u3_noun u3wz_fine(u3_noun);
u3_noun u3wz_fitz(u3_noun);
u3_noun u3wz_flan(u3_noun);
u3_noun u3wz_flay(u3_noun);
u3_noun u3wz_flip(u3_noun);
u3_noun u3wz_flor(u3_noun);
u3_noun u3wz_forq(u3_noun);
u3_noun u3wz_fork(u3_noun);
u3_noun u3wz_help(u3_noun);
u3_noun u3wz_hike(u3_noun);
u3_noun u3wz_look(u3_noun);
u3_noun u3wz_loot(u3_noun);
u3_noun u3wzl_bunt(u3_noun);
u3_noun u3wzl_whip(u3_noun);
u3_noun u3wzp_hack(u3_noun);
u3_noun u3wzp_late(u3_noun);
u3_noun u3wzp_open(u3_noun);
u3_noun u3wzp_rake(u3_noun);
u3_noun u3wzu_burn(u3_noun);
u3_noun u3wzu_busk(u3_noun);
u3_noun u3wzu_bust(u3_noun);
u3_noun u3wzu_conk(u3_noun);
u3_noun u3wzu_crop(u3_noun);
u3_noun u3wzu_cull(u3_noun);
u3_noun u3wzu_duck(u3_noun);
u3_noun u3wzu_find(u3_noun);
u3_noun u3wzu_fond(u3_noun);
u3_noun u3wzu_fink(u3_noun);
u3_noun u3wzu_fire(u3_noun);
u3_noun u3wzu_firm(u3_noun);
u3_noun u3wzu_fish(u3_noun);
u3_noun u3wzu_fuse(u3_noun);
u3_noun u3wzu_heal(u3_noun);
u3_noun u3wzu_mint(u3_noun);
u3_noun u3wzu_mull(u3_noun);
u3_noun u3wzu_nest(u3_noun);
u3_noun u3wzu_peek(u3_noun);
u3_noun u3wzu_peel(u3_noun);
u3_noun u3wzu_play(u3_noun);
u3_noun u3wzu_repo(u3_noun);
u3_noun u3wzu_rest(u3_noun);
u3_noun u3wzu_snub(u3_noun);
u3_noun u3wzu_toss(u3_noun);
u3_noun u3wzu_wrap(u3_noun);
/** Tier 7.
**/
u3_noun u3wg_down(u3_noun);

333
include/jets/y.h Normal file
View File

@ -0,0 +1,333 @@
/* include/f/qjet.h
**
** This file is in the public domain.
*/
/** Tier 1.
**/
u3_noun u3ya_add(u3_noun);
u3_noun u3ya_dec(u3_noun);
u3_noun u3ya_div(u3_noun);
u3_noun u3ya_gte(u3_noun);
u3_noun u3ya_gth(u3_noun);
u3_noun u3ya_lte(u3_noun);
u3_noun u3ya_lth(u3_noun);
u3_noun u3ya_mod(u3_noun);
u3_noun u3ya_mul(u3_noun);
u3_noun u3ya_sub(u3_noun);
/** Tier 2.
**/
u3_noun u3yb_bind(u3_noun);
u3_noun u3yb_clap(u3_noun);
u3_noun u3yb_drop(u3_noun);
u3_noun u3yb_flop(u3_noun);
u3_noun u3yb_lent(u3_noun);
u3_noun u3yb_levy(u3_noun);
u3_noun u3yb_lien(u3_noun);
u3_noun u3yb_murn(u3_noun);
u3_noun u3yb_need(u3_noun);
u3_noun u3yb_reap(u3_noun);
u3_noun u3yb_reel(u3_noun);
u3_noun u3yb_roll(u3_noun);
u3_noun u3yb_skid(u3_noun);
u3_noun u3yb_skim(u3_noun);
u3_noun u3yb_skip(u3_noun);
u3_noun u3yb_scag(u3_noun);
u3_noun u3yb_slag(u3_noun);
u3_noun u3yb_snag(u3_noun);
u3_noun u3yb_sort(u3_noun);
u3_noun u3yb_turn(u3_noun);
u3_noun u3yb_weld(u3_noun);
/** Tier 3.
**/
u3_noun u3yc_bex(u3_noun);
u3_noun u3yc_xeb(u3_noun);
u3_noun u3yc_can(u3_noun);
u3_noun u3yc_cap(u3_noun);
u3_noun u3yc_cat(u3_noun);
u3_noun u3yc_con(u3_noun);
u3_noun u3yc_cut(u3_noun);
u3_noun u3yc_dis(u3_noun);
u3_noun u3yc_dor(u3_noun);
u3_noun u3yc_dvr(u3_noun);
u3_noun u3yc_end(u3_noun);
u3_noun u3yc_gor(u3_noun);
u3_noun u3yc_hor(u3_noun);
u3_noun u3yc_lsh(u3_noun);
u3_noun u3yc_mas(u3_noun);
u3_noun u3yc_met(u3_noun);
u3_noun u3yc_mix(u3_noun);
u3_noun u3yc_mug(u3_noun);
u3_noun u3yc_muk(u3_noun);
u3_noun u3yc_peg(u3_noun);
u3_noun u3yc_pow(u3_noun);
u3_noun u3yc_rap(u3_noun);
u3_noun u3yc_rep(u3_noun);
u3_noun u3yc_rip(u3_noun);
u3_noun u3yc_rsh(u3_noun);
u3_noun u3yc_sqt(u3_noun);
u3_noun u3yc_vor(u3_noun);
u3_noun u3ycp_ins(u3_noun);
u3_noun u3ycp_ind(u3_noun);
u3_noun u3ycp_tos(u3_noun);
u3_noun u3ycp_tod(u3_noun);
/** Tier 4.
**/
u3_noun u3ydb_bif(u3_noun);
u3_noun u3ydb_dif(u3_noun);
u3_noun u3ydb_gas(u3_noun);
u3_noun u3ydb_get(u3_noun);
u3_noun u3ydb_has(u3_noun);
u3_noun u3ydb_int(u3_noun);
u3_noun u3ydb_put(u3_noun);
# define u3ydb_tap u3ydi_tap
u3_noun u3ydb_uni(u3_noun);
u3_noun u3ydi_bif(u3_noun);
u3_noun u3ydi_dif(u3_noun);
u3_noun u3ydi_gas(u3_noun);
u3_noun u3ydi_has(u3_noun);
u3_noun u3ydi_int(u3_noun);
u3_noun u3ydi_mer(u3_noun);
u3_noun u3ydi_put(u3_noun);
u3_noun u3ydi_tap(u3_noun);
u3_noun u3ydi_uni(u3_noun);
u3_noun u3ydi_wyt(u3_noun);
/** Tier 5.
**/
u3_noun u3ye_cue(u3_noun);
u3_noun u3ye_jam(u3_noun);
u3_noun u3ye_mat(u3_noun);
u3_noun u3ye_rub(u3_noun);
u3_noun u3ye_lore(u3_noun);
u3_noun u3ye_loss(u3_noun);
u3_noun u3ye_lune(u3_noun);
u3_noun u3ye_mink(u3_noun);
u3_noun u3ye_mule(u3_noun);
u3_noun u3ye_repg(u3_noun);
u3_noun u3ye_rexp(u3_noun);
u3_noun u3ye_trip(u3_noun);
u3_noun u3ye_pfix(u3_noun);
u3_noun u3ye_plug(u3_noun);
u3_noun u3ye_pose(u3_noun);
u3_noun u3ye_sfix(u3_noun);
u3_noun u3yea_ecba_en(u3_noun);
u3_noun u3yea_ecba_de(u3_noun);
u3_noun u3yea_ecbb_en(u3_noun);
u3_noun u3yea_ecbb_de(u3_noun);
u3_noun u3yea_ecbc_en(u3_noun);
u3_noun u3yea_ecbc_de(u3_noun);
u3_noun u3yea_cbca_en(u3_noun);
u3_noun u3yea_cbca_de(u3_noun);
u3_noun u3yea_cbcb_en(u3_noun);
u3_noun u3yea_cbcb_de(u3_noun);
u3_noun u3yea_cbcc_en(u3_noun);
u3_noun u3yea_cbcc_de(u3_noun);
u3_noun u3yea_de(u3_noun);
u3_noun u3yea_en(u3_noun);
u3_noun u3yes_hsh(u3_noun);
u3_noun u3yes_hsl(u3_noun);
u3_noun u3yes_pbk(u3_noun);
u3_noun u3yes_pbl(u3_noun);
u3_noun u3ye_shax(u3_noun);
u3_noun u3ye_shay(u3_noun);
u3_noun u3ye_shas(u3_noun);
u3_noun u3ye_shal(u3_noun);
u3_noun u3yeo_raw(u3_noun);
u3_noun u3yee_puck(u3_noun);
u3_noun u3yee_sign(u3_noun);
u3_noun u3yee_veri(u3_noun);
u3_noun u3yee_shar(u3_noun);
u3_noun u3ye_bend_fun(u3_noun);
u3_noun u3ye_cold_fun(u3_noun);
u3_noun u3ye_cook_fun(u3_noun);
u3_noun u3ye_comp_fun(u3_noun);
u3_noun u3ye_easy_fun(u3_noun);
u3_noun u3ye_glue_fun(u3_noun);
u3_noun u3ye_here_fun(u3_noun);
u3_noun u3ye_just_fun(u3_noun);
u3_noun u3ye_mask_fun(u3_noun);
u3_noun u3ye_shim_fun(u3_noun);
u3_noun u3ye_stag_fun(u3_noun);
u3_noun u3ye_stew_fun(u3_noun);
u3_noun u3ye_stir_fun(u3_noun);
u3_noun u3yef_drg(u3_noun);
u3_noun u3yef_lug(u3_noun);
u3_noun u3yer_add(u3_noun);
u3_noun u3yer_sub(u3_noun);
u3_noun u3yer_mul(u3_noun);
u3_noun u3yer_div(u3_noun);
u3_noun u3yer_sqt(u3_noun);
u3_noun u3yer_fma(u3_noun);
u3_noun u3yer_lth(u3_noun);
u3_noun u3yer_lte(u3_noun);
u3_noun u3yer_equ(u3_noun);
u3_noun u3yer_gte(u3_noun);
u3_noun u3yer_gth(u3_noun);
u3_noun u3yet_add(u3_noun);
u3_noun u3yet_sub(u3_noun);
u3_noun u3yet_mul(u3_noun);
u3_noun u3yet_div(u3_noun);
u3_noun u3yet_sqt(u3_noun);
u3_noun u3yet_fma(u3_noun);
u3_noun u3yet_lth(u3_noun);
u3_noun u3yet_lte(u3_noun);
u3_noun u3yet_equ(u3_noun);
u3_noun u3yet_gte(u3_noun);
u3_noun u3yet_gth(u3_noun);
u3_noun u3yeq_add(u3_noun);
u3_noun u3yeq_sub(u3_noun);
u3_noun u3yeq_mul(u3_noun);
u3_noun u3yeq_div(u3_noun);
u3_noun u3yeq_sqt(u3_noun);
u3_noun u3yeq_fma(u3_noun);
u3_noun u3yeq_lth(u3_noun);
u3_noun u3yeq_lte(u3_noun);
u3_noun u3yeq_equ(u3_noun);
u3_noun u3yeq_gte(u3_noun);
u3_noun u3yeq_gth(u3_noun);
u3_noun u3yes_add(u3_noun);
u3_noun u3yes_sub(u3_noun);
u3_noun u3yes_mul(u3_noun);
u3_noun u3yes_div(u3_noun);
u3_noun u3yes_sqt(u3_noun);
u3_noun u3yes_fma(u3_noun);
u3_noun u3yes_lth(u3_noun);
u3_noun u3yes_lte(u3_noun);
u3_noun u3yes_equ(u3_noun);
u3_noun u3yes_gte(u3_noun);
u3_noun u3yes_gth(u3_noun);
/** Tier 6.
**/
u3_noun u3yf_bull(u3_noun);
u3_noun u3yf_cell(u3_noun);
u3_noun u3yf_comb(u3_noun);
u3_noun u3yf_cons(u3_noun);
u3_noun u3yf_core(u3_noun);
u3_noun u3yf_cube(u3_noun);
u3_noun u3yf_face(u3_noun);
u3_noun u3yf_fine(u3_noun);
u3_noun u3yf_fitz(u3_noun);
u3_noun u3yf_flan(u3_noun);
u3_noun u3yf_flay(u3_noun);
u3_noun u3yf_flip(u3_noun);
u3_noun u3yf_flor(u3_noun);
u3_noun u3yf_forq(u3_noun);
u3_noun u3yf_fork(u3_noun);
u3_noun u3yf_help(u3_noun);
u3_noun u3yf_hike(u3_noun);
u3_noun u3yf_look(u3_noun);
u3_noun u3yf_loot(u3_noun);
u3_noun u3yfl_bunt(u3_noun);
u3_noun u3yfl_whip(u3_noun);
u3_noun u3yfp_hack(u3_noun);
u3_noun u3yfp_late(u3_noun);
u3_noun u3yfp_open(u3_noun);
u3_noun u3yfp_rake(u3_noun);
u3_noun u3yfu_burn(u3_noun);
u3_noun u3yfu_busk(u3_noun);
u3_noun u3yfu_bust(u3_noun);
u3_noun u3yfu_conk(u3_noun);
u3_noun u3yfu_crop(u3_noun);
u3_noun u3yfu_cull(u3_noun);
u3_noun u3yfu_duck(u3_noun);
u3_noun u3yfu_find(u3_noun);
u3_noun u3yfu_fond(u3_noun);
u3_noun u3yfu_fink(u3_noun);
u3_noun u3yfu_fire(u3_noun);
u3_noun u3yfu_firm(u3_noun);
u3_noun u3yfu_fish(u3_noun);
u3_noun u3yfu_fuse(u3_noun);
u3_noun u3yfu_heal(u3_noun);
u3_noun u3yfu_mint(u3_noun);
u3_noun u3yfu_mull(u3_noun);
u3_noun u3yfu_nest(u3_noun);
u3_noun u3yfu_peek(u3_noun);
u3_noun u3yfu_peel(u3_noun);
u3_noun u3yfu_play(u3_noun);
u3_noun u3yfu_repo(u3_noun);
u3_noun u3yfu_rest(u3_noun);
u3_noun u3yfu_snub(u3_noun);
u3_noun u3yfu_toss(u3_noun);
u3_noun u3yfu_wrap(u3_noun);
u3_noun u3wz_bull(u3_noun);
u3_noun u3wz_cell(u3_noun);
u3_noun u3wz_comb(u3_noun);
u3_noun u3wz_cons(u3_noun);
u3_noun u3wz_core(u3_noun);
u3_noun u3wz_cube(u3_noun);
u3_noun u3wz_face(u3_noun);
u3_noun u3wz_fine(u3_noun);
u3_noun u3wz_fitz(u3_noun);
u3_noun u3wz_flan(u3_noun);
u3_noun u3wz_flay(u3_noun);
u3_noun u3wz_flip(u3_noun);
u3_noun u3wz_flor(u3_noun);
u3_noun u3wz_forq(u3_noun);
u3_noun u3wz_fork(u3_noun);
u3_noun u3wz_help(u3_noun);
u3_noun u3wz_hike(u3_noun);
u3_noun u3wz_look(u3_noun);
u3_noun u3wz_loot(u3_noun);
u3_noun u3wzl_bunt(u3_noun);
u3_noun u3wzl_whip(u3_noun);
u3_noun u3wzp_hack(u3_noun);
u3_noun u3wzp_late(u3_noun);
u3_noun u3wzp_open(u3_noun);
u3_noun u3wzp_rake(u3_noun);
u3_noun u3wzu_burn(u3_noun);
u3_noun u3wzu_busk(u3_noun);
u3_noun u3wzu_bust(u3_noun);
u3_noun u3wzu_conk(u3_noun);
u3_noun u3wzu_crop(u3_noun);
u3_noun u3wzu_cull(u3_noun);
u3_noun u3wzu_duck(u3_noun);
u3_noun u3wzu_find(u3_noun);
u3_noun u3wzu_fond(u3_noun);
u3_noun u3wzu_fink(u3_noun);
u3_noun u3wzu_fire(u3_noun);
u3_noun u3wzu_firm(u3_noun);
u3_noun u3wzu_fish(u3_noun);
u3_noun u3wzu_fuse(u3_noun);
u3_noun u3wzu_heal(u3_noun);
u3_noun u3wzu_mint(u3_noun);
u3_noun u3wzu_mull(u3_noun);
u3_noun u3wzu_nest(u3_noun);
u3_noun u3wzu_peek(u3_noun);
u3_noun u3wzu_peel(u3_noun);
u3_noun u3wzu_play(u3_noun);
u3_noun u3wzu_repo(u3_noun);
u3_noun u3wzu_rest(u3_noun);
u3_noun u3wzu_snub(u3_noun);
u3_noun u3wzu_toss(u3_noun);
u3_noun u3wzu_wrap(u3_noun);
/** Tier 7.
**/
u3_noun u3yg_down(u3_noun);

View File

@ -2,23 +2,6 @@
**
** This file is in the public domain.
*/
/** Options.
**/
/* U3_MEMORY_DEBUG: add debugging information to heap. Breaks image.
*/
# undef U3_MEMORY_DEBUG
/* U3_CELLOC_TOGGLE: enable toggling of the custom cell allocator
* via -g. This slightly slows down the cell allocator even when
* it's on. Note that toggling -g breaks (maybe?) the image. If
* U3_MEMORY_DEBUG is on, this should generally be on as well.
*/
# undef U3_CELLOC_TOGGLE
/* U3_PRINT_WATERMARK: print watermark information for each road
*/
# undef U3_PRINT_WATERMARK
/** Constants.
**/
/* u3a_bits: number of bits in word-addressed pointer. 29 == 2GB.
@ -135,16 +118,21 @@
u3p(u3a_fbox) fre_p[u3a_fbox_no]; // heap by node size log
u3p(u3a_fbox) cel_p; // custom cell allocator
c3_w fre_w; // number of free words
#ifdef U3_MEMORY_DEBUG
c3_w max_w; // maximum allocated
#endif
} all;
struct { // jet dashboard
u3p(u3h_root) har_p; // warm state
u3_noun das; // cold state
u3p(u3h_root) hot_p; // hot state (home road only)
u3p(u3h_root) war_p; // warm state
u3p(u3h_root) cod_p; // cold state
u3p(u3h_root) han_p; // hank cache
u3p(u3h_root) bas_p; // battery hashes
} jed;
struct { // bytecode state
u3p(u3h_root) har_p; // formula->post of bytecode
} byc;
struct { // namespace
u3_noun gul; // (list $+(* (unit (unit)))) now
} ski;
@ -156,6 +144,7 @@
struct { // profile stack
c3_d nox_d; // nock steps
c3_d cel_d; // cell allocations
u3_noun don; // (list batt)
u3_noun day; // doss, only in u3H (moveme)
} pro;
@ -261,6 +250,15 @@
? u3a_north_is_senior(r, som) \
: u3a_south_is_senior(r, som) )
# define u3a_is_mutable(r, som) \
( _(u3a_is_atom(som)) \
? c3n \
: _(u3a_is_senior(r, som)) \
? c3n \
: _(u3a_is_junior(r, som)) \
? c3n \
: (u3a_botox(u3a_to_ptr(som))->use_w == 1) \
? c3y : c3n )
/** Globals.
**/
@ -303,6 +301,22 @@
void*
u3a_wealloc(void* lag_v, c3_w len_w);
/* u3a_push(): allocate space on the road stack
*/
void*
u3a_push(c3_w len_w);
/* u3a_pop(): deallocate space on the road stack
*/
void
u3a_pop(c3_w len_w);
/* u3a_peek(): examine the top of the road stack
*/
void*
u3a_peek(c3_w len_w);
/* C-style aligned allocation - *not* compatible with above.
*/
/* u3a_malloc(): aligned storage measured in bytes.
@ -412,6 +426,11 @@
void
u3a_print_memory(c3_c* cap_c, c3_w wor_w);
/* u3a_deadbeef(): write 0xdeadbeef from hat to cap.
*/
void
u3a_deadbeef(void);
/* Atoms from proto-atoms.
*/
/* u3a_slab(): create a length-bounded proto-atom.

View File

@ -7,9 +7,12 @@
/** Straightforward implementation of the classic Bagwell
*** HAMT (hash array mapped trie), using a mug hash.
***
*** Because a mug is 31 bits, the root table is 64 wide.
*** Thereupon 5 bits each are warm for each layer. The
*** final leaf is simply a linear search.
*** Because a mug is 31 bits, the root table has 64 slots.
*** The 31 bits of a mug are divided into the first lookup,
*** which is 6 bits (corresponding to the 64 entries in the
*** root table), followed by 5 more branchings of 5 bits each,
*** corresponding to the 32-slot nodes for everything under
*** the root node.
***
*** We store an extra "freshly warm" bit for a simple
*** clock-algorithm reclamation policy, not yet implemented.
@ -17,9 +20,9 @@
**/
/* u3h_slot: map slot.
**
** Either a key-value cell or a loom offset, decoded as a pointer
** to a u3h_node. Matches the u3_noun format - coordinate with
** meme.h. The top two bits are:
** 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
** format - coordinate with allocate.h. The top two bits are:
**
** 00 - empty (in the root table only)
** 01 - table
@ -31,22 +34,28 @@
/* u3h_node: map node.
*/
typedef struct {
c3_w map_w;
c3_w map_w;
u3h_slot sot_w[0];
} u3h_node;
/* u3h_root: hash root table, with future-proof clock.
/* u3h_root: hash root table
*/
typedef struct {
c3_w clk_w;
u3h_slot sot_w[64];
c3_w max_w; // number of cache lines (0 for no trimming)
c3_w use_w; // number of lines currently filled
struct {
c3_w mug_w; // current hash
c3_w inx_w; // index into current hash bucket iff buc_o
c3_o buc_o; // yes if in middle of hash bucket
} arm_u; // clock arm
u3h_slot sot_w[64]; // slots
} u3h_root;
/* u3h_buck: bottom bucket.
*/
typedef struct {
c3_w len_w;
u3_noun kev[0];
u3h_slot sot_w[0];
} u3h_buck;
/** HAMT macros.
@ -61,6 +70,8 @@
** u3h_node_to_slot(): node pointer to slot
** u3h_slot_to_noun(): slot to cell
** u3h_noun_to_slot(): cell to slot
** u3h_noun_be_warm(): warm mutant
** u3h_noun_be_cold(): cold mutant
*/
# define u3h_slot_is_null(sot) ((0 == ((sot) >> 30)) ? c3y : c3n)
# define u3h_slot_is_node(sot) ((1 == ((sot) >> 30)) ? c3y : c3n)
@ -68,16 +79,20 @@
# define u3h_slot_is_warm(sot) (((sot) & 0x40000000) ? c3y : c3n)
# define u3h_slot_to_node(sot) (u3a_into((sot) & 0x3fffffff))
# define u3h_node_to_slot(ptr) (u3a_outa(ptr) | 0x40000000)
# define u3h_slot_to_noun(sot) (0x40000000 | (sot))
# define u3h_noun_to_slot(som) (som)
# define u3h_noun_be_warm(sot) ((sot) | 0x40000000)
# define u3h_noun_be_cold(sot) ((sot) & ~0x40000000)
# define u3h_slot_to_noun(sot) (0x40000000 | (sot))
# define u3h_noun_to_slot(som) (u3h_noun_be_warm(som))
/** Functions.
***
*** Needs: delete and merge functions; clock reclamation function.
**/
/* u3h_new_cache(): create hashtable with bounded size.
*/
u3p(u3h_root)
u3h_new_cache(c3_w clk_w);
/* u3h_new(): create hashtable.
*/
u3p(u3h_root)
@ -111,6 +126,11 @@
u3_weak
u3h_gut(u3p(u3h_root) har_p, u3_noun key);
/* u3h_trim_to(): trim to n key-value pairs
*/
void
u3h_trim_to(u3p(u3h_root) har_p, c3_w n_w);
/* u3h_free(): free hashtable.
*/
void
@ -121,7 +141,15 @@
c3_w
u3h_mark(u3p(u3h_root) har_p);
/* u3h_walk(): traverse hashtable with key, value fn; RETAINS.
/* u3h_walk_with(): traverse hashtable with key, value fn and data
* argument; RETAINS.
*/
void
u3h_walk_with(u3p(u3h_root) har_p,
void (*fun_f)(u3_noun, void*),
void* wit);
/* u3h_walk(): u3h_walk_with, but with no data argument
*/
void
u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun));

View File

@ -55,6 +55,14 @@
u3_noun
u3i_qual(u3_noun a, u3_noun b, u3_noun c, u3_noun d);
/* u3i_edit():
**
** Mutate `big` at axis `axe` with new value `som`
** `axe` is RETAINED.
*/
u3_noun
u3i_edit(u3_noun big, u3_noun axe, u3_noun som);
/* u3i_string():
**
** Produce an LSB-first atom from the C string `a`.

View File

@ -5,23 +5,32 @@
/** Noun semantics.
**/
#if 0
++ bane ,@tas :: battery name
++ bash ,@uvH :: label hash
++ bosh ,@uvH :: battery hash
++ batt ,* :: battery
++ calf ::
$: jax=,@ud :: hot core index
hap=(map ,@ud ,@ud) :: axis/hot arm index
lab=path :: label as path
jit=* :: arbitrary data
== ::
++ calx (trel calf (pair bash cope) club) :: cached by battery
++ clog (pair cope (map batt club)) :: label record
++ club (pair corp (map term nock)) :: battery pattern
++ cope (trel bane axis (each bash noun)) :: core pattern
++ core ,*
++ corp (each core batt) :: parent or static
++ dash (map bash clog) :: jet system
+= location $: pattern=(each static dynamic)
name=term
hooks=(map term axis)
==
+= static (each payload=* parent=location)
+= dynamic [where=axis parent=location]
::
+= registry [roots=(map * location) parents=(list parent)]
+= parent (pair axis (map location location))
::
+= activation $: hot-index=@ud
drivers=(map axis @ud)
label=path
jit=* :: FIXME: should probably be (map battery *)
:: since there can be multiple batteries per location
==
+= hot-info $: reg=registry
hot-index=@ud
drivers=(map axis @ud)
label=path
==
+= bash @ :: battery hash (sha-256 based)
::
+= hot (map bash hot-info)
+= cold (map battery=^ (pair bash registry))
+= warm (map location activation)
#endif
/** Data structures.
@ -41,26 +50,77 @@
struct _u3j_core* cop_u; // containing core
} u3j_harm;
/* u3j_hood: hook description.
*/
typedef struct _u3j_hood {
c3_c* nam_c; // hook name
c3_l axe_l; // hook axis (XX: direct)
c3_o kic_o; // hook is kick (vs. fragment)
c3_l sax_l; // hook subject axis (XX: direct)
} u3j_hood;
/* u3j_core: driver definition.
*/
typedef struct _u3j_core {
c3_c* cos_c; // control string
c3_l axe_l; // axis to parent
struct _u3j_harm* arm_u; // blank-terminated static list
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
c3_l axe_l; // axis to parent
c3_l jax_l; // index in global dashboard
} u3j_core;
/* u3e_dash, u3_Dash, u3D: jet dashboard singleton
*/
typedef struct _u3e_dash {
u3j_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length
c3_l all_l; // allocated length
u3j_core* ray_u; // dynamic array by axis
u3j_core* dev_u; // null-terminated static list
c3_l len_l; // dynamic array length
c3_l all_l; // allocated length
u3j_core* ray_u; // dynamic array by axis
} u3j_dash;
/* u3j_fist: a single step in a fine check.
*/
typedef struct {
u3_noun bat; // battery
u3_noun pax; // parent axis
} u3j_fist;
/* u3j_fink: (fine check) enough data to verify a located core.
*/
typedef struct {
c3_w len_w; // number of fists
u3_noun sat; // static noun at end of check
u3j_fist fis_u[0]; // fists
} u3j_fink;
/* u3j_rite: site of a %fast, used to skip re-mining.
*/
typedef struct {
c3_o own_o; // rite owns fink?
u3_weak clu; // cached product of clue formula
u3p(u3j_fink) fin_p; // fine check
} u3j_rite;
/* u3j_site: site of a kick (nock 9), used to cache call target.
*/
struct _u3n_prog;
typedef struct {
u3p(struct _u3n_prog) pog_p; // program for formula
u3_noun axe; // axis
u3_weak bat; // battery (for verification)
u3_weak bas; // hash of battery (for hot find)
u3_weak loc; // location (for reaming)
c3_o jet_o; // have jet driver?
c3_o fon_o; // site owns fink?
u3_weak lab; // label (for tracing)
u3j_core* cop_u; // jet core
u3j_harm* ham_u; // jet arm
u3p(u3j_fink) fin_p; // fine check
} u3j_site;
/** Globals.
**/
/* u3_Dash: jet dashboard.
@ -73,20 +133,29 @@
/* u3j_boot(): initialize jet system.
*/
void
u3j_boot(void);
u3j_boot(c3_o nuu_o);
/* u3j_clear(): clear jet table to re-register.
*/
void
u3j_clear(void);
/* u3j_cook():
**
** Execute hook from core, call site cached by arbitrary c string
*/
u3_noun
u3j_cook(const c3_c* key_c,
u3_noun cor,
const c3_c* tam_c);
/* u3j_hook():
**
** Execute hook from core.
*/
u3_noun
u3j_hook(u3_noun cor,
const c3_c* tam_c);
const c3_c* tam_c);
/* u3j_soft():
**
@ -94,12 +163,7 @@
*/
u3_noun
u3j_soft(u3_noun cor,
const c3_c* tam_c);
/* u3j_find(): in warm state, return u3_none or calx. RETAINS.
*/
u3_weak
u3j_find(u3_noun bat);
const c3_c* tam_c);
/* u3j_kick(): try to kick by jet. If no kick, produce u3_none.
**
@ -114,7 +178,7 @@
u3_noun
u3j_kink(u3_noun cor,
u3_noun axe);
/* u3j_mine(): register core for jets.
*/
void
@ -129,4 +193,76 @@
/* u3j_reap(): promote jet state. RETAINS.
*/
void
u3j_reap(u3_noun das, u3p(u3h_root) har_p);
u3j_reap(u3p(u3h_root) cod_p, u3p(u3h_root) war_p, u3p(u3h_root) han_p, u3p(u3h_root) bas_p);
/* u3j_rite_mine(): mine cor with clu, using u3j_rite for caching
*/
void
u3j_rite_mine(u3j_rite* rit_u, u3_noun clu, u3_noun cor);
/* u3j_rite_copy(): copy rite references from src_u to dst_u,
** losing old references if los_o is yes
*/
void
u3j_rite_copy(u3j_rite* dst_u, u3j_rite* src_u, c3_o los_o);
/* u3j_site_copy(): copy site references from src_u to dst_u,
** losing old references if los_o is yes
*/
void
u3j_site_copy(u3j_site* dst_u, u3j_site* src_u, c3_o los_o);
/* u3j_site_ream(): refresh u3j_site after restoring from checkpoint
*/
void
u3j_site_ream(u3j_site* sit_u);
/* u3j_site_kick(): kick a core with a u3j_site cache.
*/
u3_weak
u3j_site_kick(u3_noun cor, u3j_site* sit_u);
/* u3j_gate_prep(): prepare a locally cached gate to call repeatedly.
*/
void
u3j_gate_prep(u3j_site* sit_u, u3_noun cor);
/* u3j_gate_slam(): slam a site prepared by u3j_gate_find() with sample.
*/
u3_noun
u3j_gate_slam(u3j_site* sit_u, u3_noun sam);
/* u3j_gate_lose(): clean up site prepared by u3j_gate_find().
*/
void
u3j_gate_lose(u3j_site* sit_u);
/* u3j_rite_mark(): mark u3j_rite for gc.
*/
c3_w
u3j_rite_mark(u3j_rite* rit_u);
/* u3j_rite_lose(): lose references of u3j_rite (but do not free).
*/
void
u3j_rite_lose(u3j_rite* rit_u);
/* u3j_site_lose(): lose references of u3j_site (but do not free).
*/
void
u3j_site_lose(u3j_site* sit_u);
/* u3j_site_mark(): mark u3j_site for gc.
*/
c3_w
u3j_site_mark(u3j_site* sit_u);
/* u3j_mark(): mark jet state for gc.
*/
c3_w
u3j_mark(void);
/* u3j_free(): free jet state.
*/
void
u3j_free(void);

View File

@ -7,7 +7,7 @@
/* u3m_boot(): start the u3 system.
*/
void
u3m_boot(c3_o nuu_o, c3_c* dir_c, c3_c *pil_c);
u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c, c3_c *pil_c, c3_c *url_c, c3_c *arv_c);
/* u3m_boot_new(): start the u3 system (new). return next event,
** starting from 1.
@ -37,6 +37,16 @@
c3_i
u3m_bail(c3_m how_m) __attribute__((noreturn));
/* u3m_init(): start the environment, with/without checkpointing.
*/
void
u3m_init(c3_o chk_o);
/* u3m_pave(): instantiate or activate image.
*/
void
u3m_pave(c3_o nuu_o, c3_o bug_o);
/* u3m_file(): load file, as atom, or bail.
*/
u3_noun

View File

@ -2,6 +2,43 @@
**
** This file is in the public domain.
*/
/** Data structures.
***
**/
/* u3n_memo: %memo hint space
*/
typedef struct {
c3_l sip_l;
u3_noun key;
} u3n_memo;
/* u3n_prog: program compiled from nock
*/
typedef struct _u3n_prog {
struct {
c3_o own_o; // program owns ops_y?
c3_w len_w; // length of bytecode (bytes)
c3_y* ops_y; // actual array of bytes
} byc_u; // bytecode
struct {
c3_w len_w; // number of literals
u3_noun* non; // array of literals
} lit_u; // literals
struct {
c3_w len_w; // number of memo slots
u3n_memo* sot_u; // array of memo slots
} mem_u; // memo slot data
struct {
c3_w len_w; // number of calls sites
u3j_site* sit_u; // array of sites
} cal_u; // call site data
struct {
c3_w len_w; // number of registration sites
u3j_rite* rit_u; // array of sites
} reg_u; // registration site data
} u3n_prog;
/** Functions.
**/
/* u3n_nock_on(): produce .*(bus fol).
@ -9,6 +46,17 @@
u3_noun
u3n_nock_on(u3_noun bus, u3_noun fol);
/* u3n_find(): return prog for given formula,
* split by key (u3_nul for none). RETAIN.
*/
u3p(u3n_prog)
u3n_find(u3_noun key, u3_noun fol);
/* u3n_burn(): execute u3n_prog with bus as subject.
*/
u3_noun
u3n_burn(u3p(u3n_prog) pog_p, u3_noun bus);
/* u3n_slam_on(): produce (gat sam).
*/
u3_noun
@ -53,3 +101,23 @@
*/
u3_noun
u3n_nock_an(u3_noun bus, u3_noun fol);
/* u3n_reap(): promote bytecode state.
*/
void
u3n_reap(u3p(u3h_root) har_p);
/* u3n_mark(): mark bytecode cache.
*/
c3_w
u3n_mark(void);
/* u3n_free(): free bytecode cache.
*/
void
u3n_free(void);
/* u3n_ream(): refresh after restoring from checkpoint.
*/
void
u3n_ream(void);

View File

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

View File

@ -2,12 +2,6 @@
**
** This file is in the public domain.
*/
/** Options.
**/
/* U3_CPU_DEBUG: activate profiling.
*/
# define U3_CPU_DEBUG
/** Data structures.
**/
/* u3t_trace: fast execution flags.

View File

@ -19,6 +19,8 @@
# define u3x_sam_7 27
# define u3x_sam_14 54
# define u3x_sam_15 55
# define u3x_sam_30 110
# define u3x_sam_31 111
# define u3x_con 7 // context
# define u3x_con_2 14 // context
# define u3x_con_3 15 // context

View File

@ -2,6 +2,9 @@
**
** This file is in the public domain.
*/
#include "h2o.h"
/** Quasi-tunable parameters.
**/
/* First kernel this executable can boot.
@ -13,13 +16,14 @@
/** Data types.
**/
struct _u3_http;
/* u3_hhed: http header.
*/
typedef struct _u3_hhed {
struct _u3_hhed* nex_u;
c3_w nam_w;
c3_c* nam_c;
c3_w val_w;
c3_c* val_c;
} u3_hhed;
@ -31,101 +35,159 @@
c3_y hun_y[0];
} u3_hbod;
/* u3_hrat: http parser state.
/* u3_rsat: http request state.
*/
typedef enum {
u3_hreq_non,
u3_hreq_nam,
u3_hreq_val
} u3_hrat;
/* u3_csat: client connection state.
*/
typedef enum {
u3_csat_dead = 0, // connection dead
u3_csat_addr = 1, // connection addressed
u3_csat_clyr = 2, // connection open in cleartext
u3_csat_crop = 3, // connection open, ssl needs hs
u3_csat_sing = 4, // connection handshaking ssl
u3_csat_cryp = 5, // connection open, ssl open
} u3_csat;
/* u3_hmet: http method. Matches jhttp encoding.
*/
typedef enum {
u3_hmet_delete,
u3_hmet_get,
u3_hmet_head,
u3_hmet_post,
u3_hmet_put,
u3_hmet_nop, // virtual method
u3_hmet_other // ie, unsupported
} u3_hmet;
u3_rsat_init = 0, // initialized
u3_rsat_plan = 1, // planned
u3_rsat_ripe = 2 // responded
} u3_rsat;
/* u3_hreq: incoming http request.
*/
typedef struct _u3_hreq {
struct _u3_hcon* hon_u; // connection
h2o_req_t* rec_u; // h2o request
c3_w seq_l; // sequence within connection
u3_hmet met_e; // method
u3_hrat rat_e; // parser state
c3_c* url_c; // url
c3_w ipf_w; // ipv4
c3_o liv; // keepalive
c3_o end; // all responses added
u3_hhed* hed_u; // headers
u3_hbod* bod_u; // body parts (exit)
u3_hbod* dob_u; // body parts (entry)
struct _u3_hreq* nex_u; // next in request queue
u3_hbod* rub_u; // exit of write queue
u3_hbod* bur_u; // entry of write queue
u3_rsat sat_e; // request state
uv_timer_t* tim_u; // timeout
struct _u3_hcon* hon_u; // connection backlink
struct _u3_hreq* nex_u; // next in connection's list
struct _u3_hreq* pre_u; // next in connection's list
} u3_hreq;
/* u3_hrep: outgoing http response.
*/
typedef struct _u3_hrep {
c3_w sev_l; // server number
c3_w coq_l; // connection number
c3_w seq_l; // request number
c3_w sas_w; // status
u3_hhed* hed_u; // headers
u3_hbod* bod_u; // body (one part)
} u3_hrep;
/* u3_hcon: incoming http connection.
*/
typedef struct _u3_hcon {
uv_tcp_t wax_u; // event handler state
uv_tcp_t wax_u; // client stream handler
h2o_conn_t* con_u; // h2o connection
h2o_socket_t* sok_u; // h2o connection socket
c3_w ipf_w; // client ipv4
c3_w coq_l; // connection number
c3_w seq_l; // next request number
struct _u3_http* htp_u; // backlink to server
struct _u3_http* htp_u; // server backlink
struct _u3_hreq* req_u; // request list
struct _u3_hcon* nex_u; // next in server's list
struct _u3_hreq* ruc_u; // request under construction
struct _u3_hreq* req_u; // exit of request queue
struct _u3_hreq* qer_u; // entry of request queue
void* par_u; // struct http_parser *
struct _u3_hcon* pre_u; // next in server's list
} u3_hcon;
/* u3_http: http server.
*/
typedef struct _u3_http {
uv_tcp_t wax_u; // event handler state
uv_tcp_t wax_u; // server stream handler
void* h2o_u; // libh2o configuration
struct _u3_prox* rox_u; // maybe proxied
c3_w sev_l; // server number
c3_w coq_l; // next connection number
c3_w por_w; // running port
c3_s por_s; // running port
c3_o sec; // logically secure
c3_o lop; // loopback-only
c3_o liv; // c3n == shutdown
struct _u3_hcon* hon_u; // connection list
struct _u3_http* nex_u; // next in list
} u3_http;
/* u3_form: http config from %eyre
*/
typedef struct _u3_form {
c3_o pro; // proxy
c3_o log; // keep access log
c3_o red; // redirect to HTTPS
uv_buf_t key_u; // PEM RSA private key
uv_buf_t cer_u; // PEM certificate chain
} u3_form;
/* u3_hfig: general http configuration
*/
typedef struct _u3_hfig {
u3_form* for_u; // config from %eyre
struct _u3_warc* cli_u; // rev proxy clients
struct _u3_pcon* con_u; // cli_u connections
} u3_hfig;
/* u3_proxy_type: proxy connection downstream type
*/
typedef enum {
u3_ptyp_prox = 0, // connected to us
u3_ptyp_ward = 1 // we connected back to
} u3_proxy_type;
/* u3_pcon: established proxy connection
*/
typedef struct _u3_pcon {
uv_tcp_t don_u; // downstream handle
uv_tcp_t* upt_u; // upstream handle
uv_buf_t buf_u; // pending buffer
c3_o sec; // yes == https
u3_proxy_type typ_e; // tagged
union { // union
struct _u3_warc* cli_u; // typ_e == ward
struct _u3_prox* lis_u; // typ_e == prox
} src_u; // connection source
struct _u3_pcon* nex_u; // next in list
struct _u3_pcon* pre_u; // previous in list
} u3_pcon;
/* u3_warc: server connecting back to u3_ward as client
*/
typedef struct _u3_warc {
c3_w ipf_w; // ward ip
c3_s por_s; // ward port
c3_o sec; // secure connection
u3_atom sip; // ward ship
c3_c* hot_c; // ward hostname
uv_buf_t non_u; // nonce
struct _u3_http* htp_u; // local server backlink
struct _u3_warc* nex_u; // next in list
struct _u3_warc* pre_u; // previous in list
} u3_warc;
/* u3_wcon: candidate u3_ward upstream connection
*/
typedef struct _u3_wcon {
uv_tcp_t upt_u; // connection handle
struct _u3_ward* rev_u; // connecting to ward
struct _u3_wcon* nex_u; // next in list
} u3_wcon;
/* u3_ward: reverse, reverse TCP proxy (ship-specific listener)
*/
typedef struct _u3_ward {
uv_tcp_t tcp_u; // listener handle
uv_timer_t tim_u; // expiration timer
u3_atom sip; // reverse proxy for ship
c3_s por_s; // listening on port
uv_buf_t non_u; // nonce
struct _u3_wcon* won_u; // candidate upstream connections
struct _u3_pcon* con_u; // initiating connection
struct _u3_ward* nex_u; // next in list
struct _u3_ward* pre_u; // previous in list
} u3_ward;
/* u3_prox: reverse TCP proxy server
*/
typedef struct _u3_prox {
uv_tcp_t sev_u; // server handle
c3_s por_s; // listening on port
c3_o sec; // yes == https
struct _u3_http* htp_u; // local server backlink
struct _u3_pcon* con_u; // active connection list
struct _u3_ward* rev_u; // active reverse listeners
} u3_prox;
/* u3_csat: client connection state.
*/
typedef enum {
u3_csat_init = 0, // initialized
u3_csat_addr = 1, // address resolution begun
u3_csat_quit = 2, // cancellation requested
u3_csat_ripe = 3 // passed to libh2o
} u3_csat;
/* u3_cres: response to http client.
*/
typedef struct _u3_cres {
u3_hrat rat_e; // parser state
void* par_u; // struct http_parser *
c3_w sas_w; // status code
u3_hhed* hed_u; // headers
u3_noun hed; // headers
u3_hbod* bod_u; // exit of body queue
u3_hbod* dob_u; // entry of body queue
} u3_cres;
@ -134,70 +196,55 @@
*/
typedef struct _u3_creq { // client request
c3_l num_l; // request number
h2o_http1client_t* cli_u; // h2o client
u3_csat sat_e; // connection state
c3_o sec; // yes == https
c3_w ipf_w; // IP
c3_c* ipf_c; // IP (string)
c3_c* hot_c; // host
c3_s por_s; // port
c3_c* por_c; // port (string)
c3_m met_m; // method
c3_c* url_c; // url
c3_o sec; // yes == https
u3_hmet met_e; // method
u3_hhed* hed_u; // headers
u3_hbod* bod_u; // body
u3_cres* res_u; // nascent response
struct _u3_ccon* coc_u; // parent connection
struct _u3_creq* nex_u; // next in queue
} u3_creq;
/* u3_sslx: per-connection ssl context.
*/
typedef struct _u3_sslx {
void* ssl_u; // struct SSL*
void* rio_u; // struct BIO* for read
void* wio_u; // struct BIO* for write
} u3_sslx;
/* u3_ccon: outgoing http connection.
*/
typedef struct _u3_ccon { // client connection
uv_tcp_t wax_u; // i/o handler state
uv_connect_t cot_u; // connection handler state
uv_getaddrinfo_t adr_u; // resolver state
u3_sslx ssl; // ssl state
u3_csat sat_e; // connection state
c3_c* hot_c; // hostname
c3_s por_s; // port
c3_w ipf_w; // IP
c3_o sec; // yes == https
u3_hbod* rub_u; // exit of send queue
u3_hbod* bur_u; // entry of send queue
u3_creq* ceq_u; // exit of request queue
u3_creq* qec_u; // entry of request queue
struct _u3_ccon* pre_u; // previous in list
struct _u3_ccon* nex_u; // next in list
} u3_ccon;
h2o_iovec_t* vec_u; // send-buffer array
u3_cres* res_u; // nascent response
struct _u3_creq* nex_u; // next in list
struct _u3_creq* pre_u; // previous in list
} u3_creq;
/* u3_chot: foreign host (not yet used).
*/
typedef struct _u3_chot {
c3_w ipf_w; // ip address (or 0)
c3_c* hot_c; // hostname (no port) (or 0)
struct _u3_ccon* ins_u; // insecure connection (or 0)
struct _u3_ccon* sec_u; // secure connection (or 0)
void* ins_u; // insecure connection (or 0)
void* sec_u; // secure connection (or 0)
} u3_chot;
/* u3_cttp: http client.
*/
typedef struct _u3_cttp {
struct _u3_ccon* coc_u; // connection list
u3_creq* ceq_u; // request list
h2o_http1client_ctx_t* //
ctx_u; // h2o client ctx
void* tls_u; // client SSL_CTX*
} u3_cttp;
/* u3_apac: ames packet, coming or going.
/* u3_pact: ames packet, coming or going.
*/
typedef struct _u3_apac {
struct _u3_apac* nex_u; // next in queue
c3_w pip_w; // IPv4 address, to
c3_s por_s; // IPv4 port, to
typedef struct _u3_pact {
uv_udp_send_t snd_u; // udp send request
c3_w pip_w; // target IPv4 address
c3_s por_s; // target port
c3_w len_w; // length in bytes
c3_y hun_y[0]; // data
} u3_apac;
c3_y* hun_y; // packet buffer
c3_y imp_y; // galaxy number (optional)
c3_c* dns_c; // galaxy fqdn (optional)
} u3_pact;
/* u3_poke: poke callback function.
*/
@ -291,9 +338,11 @@
uv_handle_t had_u;
};
uv_timer_t tim_u; // network timer
c3_o liv; // listener on
c3_o alm; // alarm on
c3_w law_w; // last wakeup, unix time
c3_s por_s; // public IPv4 port
c3_c* dns_c; // domain XX multiple/fallback
c3_w imp_w[256]; // imperial IPs
time_t imp_t[256]; // imperial IP timestamps
} u3_ames;
@ -491,22 +540,36 @@
/* u3_opts: command line configuration.
*/
typedef struct _u3_opts {
// XX find a way to re-enable -A (fastboot)
// c3_c* arv_c; // -A, initial sync from
c3_o abo; // -a, abort aggressively
c3_c* pil_c; // -B, bootstrap from
c3_o bat; // -b, batch create
c3_o nuu; // -c, new pier
c3_o dry; // -D, dry compute, no checkpoint
c3_o dem; // -d, daemon
c3_c* ets_c; // -E, eth snapshot
c3_c* eth_c; // -e, ethereum node url
// XX temporary for compiling, remove
c3_o fak; // -F, fake carrier
c3_c* fak_c; // -F, fake ship
c3_w fuz_w; // -f, fuzz testing
c3_c* gen_c; // -G, czar generator
c3_o gab; // -g, test garbage collection
c3_c* dns_c; // -H, ames bootstrap domain
c3_c* lit_c; // -J, ivory (fastboot) kernel
c3_w kno_w; // -K, kernel version
c3_c* key_c; // -k, private key file
c3_o net; // -L, local-only networking
c3_o pro; // -P, profile
c3_s por_s; // -p, ames port
c3_o qui; // -q, quiet
c3_o rep; // -R, report build info
c3_o has; // -S, Skip battery hashes
// XX find a way to re-enable -s (auto-pill)
// c3_o git; // -s, pill url from arvo git hash
c3_o etn; // -t, use snapshot exclusively to boot
c3_c* url_c; // -u, pill url
c3_o vno; // -V, replay without reboots
c3_o veb; // -v, verbose (inverse of -q)
c3_c* who_c; // -w, begin with ticket
@ -521,13 +584,14 @@
c3_d now_d; // event tick
uv_loop_t* lup_u; // libuv event loop
u3_usig* sig_u; // signal list
u3_hfig fig_u; // http configuration
u3_http* htp_u; // http servers
u3_cttp ctp_u; // http clients
u3_utty* uty_u; // linked terminal list
u3_opts ops_u; // commandline options
c3_o liv; // if u3_no, shut down
c3_i xit_i; // exit code for shutdown
void* ssl_u; // struct SSL_CTX*
void* tls_u; // server SSL_CTX*
} u3_host; // host == computer == process
/** New pier system.
@ -627,7 +691,6 @@
# define u3L u3_Host.lup_u // global event loop
# define u3Z (&(u3_Raft))
# define u3S u3_Host.ssl_u
# define u3K u3_King
/** Global variables.
@ -723,7 +786,7 @@
/* u3_walk_save(): save file or bail.
*/
void
u3_walk_save(c3_c* pas_c, u3_noun tim, u3_atom pad);
u3_walk_save(c3_c* pas_c, u3_noun tim, u3_atom pad, c3_c* bas_c, u3_noun pax);
/* u3_sync_reck(): traverse filesystem for changes -> lamb
*/
@ -858,11 +921,6 @@
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
@ -941,6 +999,12 @@
u3_noun lan,
u3_noun pac);
/* u3_ames_ef_turf(): initialize ames I/O on domain(s).
*/
void
u3_ames_ef_turf(u3_pier* pir_u,
u3_noun tuf);
/* u3_ames_io_init(): initialize ames I/O.
*/
void
@ -1081,6 +1145,16 @@
/** HTTP server.
**/
/* u3_http_ef_form: send %from effect to http.
*/
void
u3_http_ef_form(u3_noun fig);
/* u3_http_ef_that: send %that effect to http.
*/
void
u3_http_ef_that(u3_noun tat);
/* u3_http_ef_thou(): send %thou effect to http.
*/
void

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_levy(u3_noun a,
u3_noun b)
static u3_noun
_levy_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return c3y;
@ -18,14 +14,28 @@
if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else switch ( (loz = u3n_slam_on(u3k(b), u3k(u3h(a)))) ) {
case c3y: return u3qb_levy(u3t(a), b);
else switch ( (loz = u3j_gate_slam(sit_u, u3k(u3h(a)))) ) {
case c3y: return _levy_in(sit_u, u3t(a));
case c3n: return c3n;
default: u3z(loz);
return u3m_bail(c3__exit);
}
}
}
/* functions
*/
u3_noun
u3qb_levy(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _levy_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_levy(u3_noun cor)
{

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_lien(u3_noun a,
u3_noun b)
static u3_noun
_lien_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return c3n;
@ -18,14 +14,28 @@
if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else switch ( (loz = u3n_slam_on(u3k(b), u3k(u3h(a)))) ) {
else switch ( (loz = u3j_gate_slam(sit_u, u3k(u3h(a)))) ) {
case c3y: return c3y;
case c3n: return u3qb_lien(u3t(a), b);
case c3n: return _lien_in(sit_u, u3t(a));
default: u3z(loz);
return u3m_bail(c3__exit);
}
}
}
/* functions
*/
u3_noun
u3qb_lien(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _lien_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_lien(u3_noun cor)
{

View File

@ -3,11 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_murn(u3_noun a, u3_noun b)
_murn_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return a;
@ -16,8 +13,8 @@
return u3m_bail(c3__exit);
}
else {
u3_noun one = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun two = u3qb_murn(u3t(a), b);
u3_noun one = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun two = _murn_in(sit_u, u3t(a));
u3_noun nex;
switch ( u3ud(one) ) {
@ -32,6 +29,19 @@
}
}
}
/* functions
*/
u3_noun
u3qb_murn(u3_noun a, u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _murn_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_murn(u3_noun cor)
{

View File

@ -3,6 +3,22 @@
*/
#include "all.h"
static u3_noun
_reel_in(u3j_site* sit_u, u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return b;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun gim = u3k(u3h(a));
u3_noun hur = _reel_in(sit_u, u3t(a), b);
return u3j_gate_slam(sit_u, u3nc(gim, hur));
}
}
/* functions
*/
@ -10,18 +26,12 @@
u3qb_reel(u3_noun a,
u3_noun b)
{
if ( 0 == a ) {
return u3k(u3r_at(u3x_sam_3, b));
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun gim = u3k(u3h(a));
u3_noun hur = u3qb_reel(u3t(a), b);
return u3n_slam_on(u3k(b), u3nc(gim, hur));
}
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _reel_in(&sit_u, a, u3k(u3x_at(u3x_sam_3, b)));
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_reel(u3_noun cor)

View File

@ -3,6 +3,20 @@
*/
#include "all.h"
static u3_noun
_roll_in(u3j_site* sit_u, u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return b;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
b = u3j_gate_slam(sit_u, u3nc(u3k(u3h(a)), b));
return _roll_in(sit_u, u3t(a), b);
}
}
/* functions
*/
@ -10,27 +24,12 @@
u3qb_roll(u3_noun a,
u3_noun b)
{
if ( 0 == a ) {
return u3k(u3r_at(u3x_sam_3, b));
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun gim = u3k(u3h(a));
u3_noun zor = u3k(u3r_at(u3x_sam_3, b));
u3_noun daz = u3n_slam_on(u3k(b), u3nc(gim, zor));
u3_noun vel = u3i_molt(u3k(b), u3x_sam_3, daz, 0);
if ( u3_none == vel ) {
return u3m_bail(c3__exit);
} else {
u3_noun hox = u3qb_roll(u3t(a), vel);
u3z(vel);
return hox;
}
}
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _roll_in(&sit_u, a, u3k(u3x_at(u3x_sam_3, b)));
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_roll(u3_noun cor)

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skid(u3_noun a,
u3_noun b)
static u3_noun
_skid_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return u3nc(u3_nul, u3_nul);
@ -16,21 +12,36 @@
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
} else {
u3_noun acc = u3qb_skid(u3t(a), b);
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun acc = _skid_in(sit_u, u3t(a));
u3_noun hoz = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun nex;
switch ( hoz ) {
case c3y: acc = u3nc(u3nc(u3k(u3h(a)), u3h(acc)), u3t(acc));
break;
case c3n: acc = u3nc(u3h(acc), u3nc(u3k(u3h(a)), u3t(acc)));
break;
default: u3z(hoz);
return u3m_bail(c3__exit);
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))));
}
u3z(hoz);
return acc;
u3z(acc);
return nex;
}
}
/* functions
*/
u3_noun
u3qb_skid(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _skid_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_skid(u3_noun cor)
{

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skim(u3_noun a,
u3_noun b)
static u3_noun
_skim_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return a;
@ -16,8 +12,8 @@
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
} else {
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun vyr = u3qb_skim(u3t(a), b);
u3_noun hoz = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun vyr = _skim_in(sit_u, u3t(a));
switch ( hoz ) {
case c3y: return u3nc(u3k(u3h(a)), vyr);
@ -28,9 +24,22 @@
}
}
}
/* functions
*/
u3_noun
u3wb_skim(
u3_noun cor)
u3qb_skim(u3_noun a,
u3_noun b)
{
u3_noun pro;
u3j_site sit_u;
u3j_gate_prep(&sit_u, u3k(b));
pro = _skim_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_skim(u3_noun cor)
{
u3_noun a, b;

View File

@ -3,12 +3,8 @@
*/
#include "all.h"
/* functions
*/
u3_noun
u3qb_skip(u3_noun a,
u3_noun b)
static u3_noun
_skip_in(u3j_site* sit_u, u3_noun a)
{
if ( 0 == a ) {
return a;
@ -16,8 +12,8 @@
else if ( c3n == u3du(a) ) {
return u3_none;
} else {
u3_noun hoz = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun vyr = u3qb_skip(u3t(a), b);
u3_noun hoz = u3j_gate_slam(sit_u, u3k(u3h(a)));
u3_noun vyr = _skip_in(sit_u, u3t(a));
switch ( hoz ) {
case c3y: return vyr;
@ -28,6 +24,20 @@
}
}
}
/* functions
*/
u3_noun
u3qb_skip(u3_noun a,
u3_noun b)
{
u3j_site sit_u;
u3_noun pro;
u3j_gate_prep(&sit_u, u3k(b));
pro = _skip_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_skip(u3_noun cor)
{

View File

@ -3,25 +3,33 @@
*/
#include "all.h"
static u3_noun
_turn_in(u3j_site* sit_u, u3_noun a)
{
if ( u3_nul == a ) {
return u3_nul;
}
else {
return u3nc(
u3j_gate_slam(sit_u, u3k(u3h(a))),
_turn_in(sit_u, u3t(a)));
}
}
/* functions
*/
u3_noun
u3qb_turn(u3_noun a, u3_noun b)
{
if ( 0 == a ) {
return a;
}
else if ( c3n == u3du(a) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun one = u3n_slam_on(u3k(b), u3k(u3h(a)));
u3_noun two = u3qb_turn(u3t(a), b);
u3_noun pro;
u3j_site sit_u;
return u3nc(one, two);
}
u3j_gate_prep(&sit_u, u3k(b));
pro = _turn_in(&sit_u, a);
u3j_gate_lose(&sit_u);
return pro;
}
u3_noun
u3wb_turn(u3_noun cor)
{

View File

@ -22,7 +22,7 @@
if ( !_(u3a_is_cat(met_w)) ) {
return u3i_words(1, &met_w);
}
else return u3r_met(a, b);
else return met_w;
}
}
u3_noun

View File

@ -48,4 +48,11 @@
return u3qc_mix(a, b);
}
}
u3_noun
u3kc_mix(u3_atom a,
u3_atom b)
{
u3_noun res = u3qc_mix(a, b);
u3z(a); u3z(b);
return res;
}

View File

@ -84,4 +84,11 @@
return pro;
}
}
u3_noun
u3kc_rep(u3_atom a,
u3_noun b)
{
u3_noun res = u3qc_rep(a, b);
u3z(a); u3z(b);
return res;
}

50
jets/c/rev.c Normal file
View File

@ -0,0 +1,50 @@
/* j/3/rev.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qc_rev(u3_atom boz,
u3_atom len,
u3_atom dat)
{
if ( !_(u3a_is_cat(boz)) || (boz >= 32) ||
!_(u3a_is_cat(len)) ) {
return u3m_bail(c3__fail);
}
dat = u3qc_end(boz, len, dat);
c3_w met = u3r_met(boz, dat);
return u3kc_lsh(boz, (len - met), u3kc_swp(boz, dat));
}
u3_noun
u3wc_rev(u3_noun cor)
{
u3_noun boz, len, dat;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &boz,
u3x_sam_6, &len,
u3x_sam_7, &dat, 0)) ||
(c3n == u3ud(boz)) ||
(c3n == u3ud(len)) ||
(c3n == u3ud(dat)) )
{
return u3m_bail(c3__exit);
} else {
return u3qc_rev(boz, len, dat);
}
}
u3_noun
u3kc_rev(u3_atom boz,
u3_atom len,
u3_atom dat)
{
u3_noun res = u3qc_rev(boz, len, dat);
u3z(boz); u3z(len); u3z(dat);
return res;
}

View File

@ -81,3 +81,12 @@
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;
}

39
jets/c/swp.c Normal file
View File

@ -0,0 +1,39 @@
/* j/3/swp.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qc_swp(u3_atom a,
u3_atom b)
{
//XX write a proper c-style swp, maybe
return u3kc_rep(u3k(a), u3kb_flop(u3qc_rip(a, b)));
}
u3_noun
u3wc_swp(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_swp(a, b);
}
}
u3_noun
u3kc_swp(u3_atom a,
u3_atom b)
{
u3_noun res = u3qc_swp(a, b);
u3z(a); u3z(b);
return res;
}

View File

@ -9,22 +9,12 @@
u3_noun
u3qc_xeb(u3_atom a)
{
mpz_t a_mp;
c3_w met_w = u3r_met(0, a);
if ( __(u3a_is_dog(a)) ) {
u3r_mp(a_mp, a);
c3_d x = mpz_sizeinbase(a_mp, 2);
mpz_t b_mp;
mpz_init_set_ui(b_mp, x);
return u3i_mp(b_mp);
}
else {
mpz_init_set_ui(a_mp, a);
c3_d x = mpz_sizeinbase(a_mp, 2);
mpz_t b_mp;
mpz_init_set_ui(b_mp, x);
return u3i_mp(b_mp);
if ( !_(u3a_is_cat(met_w)) ) {
return u3i_words(1, &met_w);
}
else return met_w;
}
u3_noun
u3wc_xeb(u3_noun cor)

View File

@ -5,6 +5,7 @@
/* internal functions
*/
static
u3_noun _b_bif_putroot(u3_noun a,
u3_noun b)
{

View File

@ -5,6 +5,7 @@
/* internal functions
*/
static
u3_noun _b_dif_join(u3_noun d,
u3_noun e)
{

View File

@ -5,6 +5,7 @@
/* internal functions
*/
static
u3_noun _i_bif_putroot(u3_noun a,
u3_noun b)
{

View File

@ -5,6 +5,7 @@
/* internal functions
*/
static
u3_noun _i_dif_join(u3_noun d,
u3_noun e)
{

146
jets/e/argon2.c Normal file
View File

@ -0,0 +1,146 @@
/* j/5/argon2.c
**
*/
#include "all.h"
#include <argon2.h>
/* helpers
*/
int argon2_alloc(uint8_t** output, size_t bytes)
{
*output = u3a_malloc(bytes);
return (NULL != output);
}
void argon2_free(uint8_t* memory, size_t bytes)
{
u3a_free(memory);
}
/* functions
*/
u3_noun
u3qe_argon2( // configuration params,
u3_atom out, u3_atom type, u3_atom version,
u3_atom threads, u3_atom mem_cost, u3_atom time_cost,
u3_atom wik, u3_atom key, u3_atom wix, u3_atom extra,
// input params
u3_atom wid, u3_atom dat, u3_atom wis, u3_atom sat )
{
c3_assert( _(u3a_is_cat(out)) && _(u3a_is_cat(type)) &&
_(u3a_is_cat(version)) && _(u3a_is_cat(threads)) &&
_(u3a_is_cat(mem_cost)) && _(u3a_is_cat(time_cost)) &&
_(u3a_is_cat(wik)) && _(u3a_is_cat(wix)) &&
_(u3a_is_cat(wid)) && _(u3a_is_cat(wis)) );
// flip endianness for argon2
key = u3qc_rev(3, wik, key);
extra = u3qc_rev(3, wix, extra);
dat = u3qc_rev(3, wid, dat);
sat = u3qc_rev(3, wis, sat);
// atoms to byte arrays
c3_y bytes_key[wik];
u3r_bytes(0, wik, bytes_key, key);
c3_y bytes_extra[wix];
u3r_bytes(0, wix, bytes_extra, extra);
c3_y bytes_dat[wid];
u3r_bytes(0, wid, bytes_dat, dat);
c3_y bytes_sat[wis];
u3r_bytes(0, wis, bytes_sat, sat);
c3_y outhash[out];
argon2_context context = {
outhash, // output array, at least [digest length] in size
out, // digest length
bytes_dat, // password array
wid, // password length
bytes_sat, // salt array
wis, // salt length
bytes_key, wik, // optional secret data
bytes_extra, wix, // optional associated data
time_cost, mem_cost, threads, threads, // performance cost configuration
version, // algorithm version
argon2_alloc, // custom memory allocation function
argon2_free, // custom memory deallocation function
ARGON2_DEFAULT_FLAGS // by default only internal memory is cleared
};
int argon_res;
switch ( type ) {
default:
fprintf(stderr, "\nunjetted argon2 variant %i\n", type);
u3m_bail(c3__exit);
break;
//
case c3__d:
argon_res = argon2d_ctx(&context);
break;
//
case c3__i:
argon_res = argon2i_ctx(&context);
break;
//
case c3__id:
argon_res = argon2id_ctx(&context);
break;
//
case c3__u:
argon_res = argon2u_ctx(&context);
break;
}
if ( ARGON2_OK != argon_res ) {
fprintf(stderr, "\nargon2 error: %s\n", argon2_error_message(argon_res));
u3m_bail(c3__exit);
}
u3z(key); u3z(extra); u3z(dat); u3z(sat);
return u3kc_rev(3, out, u3i_bytes(out, outhash));
}
u3_noun
u3we_argon2(u3_noun cor)
{
u3_noun // configuration params
out, type, version,
threads, mem_cost, time_cost,
wik, key, wix, extra,
// input params
wid, dat, wis, sat,
// for use during unpacking
wmsg, wsat, arg, brg, wkey, wext;
// the hoon code for argon2 takes configuration parameters,
// and then produces a gate. we jet that inner gate.
// this does mean that the config params have gotten buried
// pretty deep in the subject, hence the +510.
if ( c3n == u3r_mean(cor, u3x_sam_2, &wmsg,
u3x_sam_3, &wsat,
510, &arg, 0) ||
u3r_cell(wmsg, &wid, &dat) || u3ud(wid) || u3ud(dat) ||
u3r_cell(wsat, &wis, &sat) || u3ud(wis) || u3ud(sat) ||
//
u3r_qual(arg, &out, &type, &version, &brg) ||
u3ud(out) || u3ud(type) || u3ud(version) ||
//
u3r_qual(brg, &threads, &mem_cost, &time_cost, &arg) ||
u3ud(threads) || u3ud(mem_cost) || u3ud(time_cost) ||
//
u3r_cell(arg, &wkey, &wext) ||
u3r_cell(wkey, &wik, &key) || u3ud(wik) || u3ud(key) ||
u3r_cell(wext, &wix, &extra) || u3ud(wix) || u3ud(extra)
)
{
return u3m_bail(c3__exit);
}
else {
return u3qe_argon2(out, type, version,
threads, mem_cost, time_cost,
wik, key, wix, extra,
wid, dat, wis, sat);
}
}

72
jets/e/blake.c Normal file
View File

@ -0,0 +1,72 @@
/* j/5/blake.c
**
*/
#include "all.h"
#include <argon2.h>
#include "../src/blake2/blake2.h"
/* functions
*/
u3_noun
u3qe_blake(u3_atom wid, u3_atom dat,
u3_atom wik, u3_atom dak,
u3_atom out)
{
c3_assert(_(u3a_is_cat(wid)) && _(u3a_is_cat(wik)) && _(u3a_is_cat(out)));
// flip endianness for the internal blake2b function
dat = u3qc_rev(3, wid, dat);
dak = u3qc_rev(3, wik, dak);
c3_y* dat_y = (c3_y*)u3a_malloc(wid);
u3r_bytes(0, wid, (void*)dat_y, dat);
c3_y* dak_y = (c3_y*)u3a_malloc(wik);
u3r_bytes(0, wik, (void*)dak_y, dak);
int ret;
c3_y out_y[64];
ret = blake2b(out_y, // OUT: output
out, // IN: max output size
dat_y, // IN: msg body
wid, // IN: msg len
dak_y, // IN: key body
wik); // IN: key len
/* free() BEFORE checking error code;
we don't want to leak memory if we return early
*/
u3a_free(dat_y);
u3a_free(dak_y);
if ( 0 != ret )
{
fprintf(stderr, "\rblake jet: cryto lib error\n");
return u3m_bail(c3__exit);
}
return u3kc_rev(3, out, u3i_bytes(out, out_y));
}
u3_noun
u3we_blake(u3_noun cor)
{
u3_noun msg, key, out, // arguments
wid, dat, // destructured msg
wik, dak; // destructured key
if ( c3n == u3r_mean(cor, u3x_sam_2, &msg,
u3x_sam_6, &key,
u3x_sam_7, &out, 0) ||
u3r_cell(msg, &wid, &dat) || u3ud(wid) || u3ud(dat) ||
u3r_cell(key, &wik, &dak) || u3ud(wik) || u3ud(dak) ||
u3ud(out) )
{
fprintf(stderr, "\rblake jet: arguments error\n");
return u3m_bail(c3__exit);
} else {
return u3qe_blake(wid, dat, wik, dak, out);
}
}

View File

@ -27,14 +27,14 @@
memset(pub_y, 0, 64);
memset(sec_y, 0, 64);
mes_y = malloc(mesm_w);
mes_y = u3a_malloc(mesm_w);
u3r_bytes(0, mesm_w, mes_y, a);
u3r_bytes(0, mess_w, sed_y, b);
ed25519_create_keypair(pub_y, sec_y, sed_y);
ed25519_sign(sig_y, mes_y, mesm_w, pub_y, sec_y);
free(mes_y);
u3a_free(mes_y);
return u3i_bytes(64, sig_y);
}

88
jets/e/hmac.c Normal file
View File

@ -0,0 +1,88 @@
/* j/5/hmac.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qe_hmac(u3_noun haj,
u3_atom boq,
u3_atom out,
u3_atom wik,
u3_atom key,
u3_atom wid,
u3_atom dat)
{
c3_assert(_(u3a_is_cat(boq)) && _(u3a_is_cat(wik)) && _(u3a_is_cat(wid)));
// ensure key and message fit signaled lengths
key = u3qc_end(3, wik, key);
dat = u3qc_end(3, wid, dat);
// keys longer than block size are shortened by hashing
if (wik > boq) {
key = u3n_slam_on(u3k(haj), u3nc(wik, key));
wik = out;
}
// keys shorter than block size are right-padded
if (wik < boq) {
key = u3kc_lsh(3, (boq - wik), key);
}
// pad key, inner and outer
c3_y trail = (boq % 4);
c3_y padwords = (boq / 4) + (trail == 0 ? 0 : 1);
c3_w innpad[padwords], outpad[padwords];
memset(innpad, 0x36, padwords * 4);
memset(outpad, 0x5c, padwords * 4);
if ( trail > 0 ) {
innpad[padwords-1] = 0x36363636 >> (8 * (4 - trail));
outpad[padwords-1] = 0x5c5c5c5c >> (8 * (4 - trail));
}
u3_atom innkey = u3kc_mix(u3k(key), u3i_words(padwords, innpad));
u3_atom outkey = u3kc_mix( key , u3i_words(padwords, outpad));
// append inner padding to message, then hash
u3_atom innmsg = u3ka_add(u3kc_lsh(3, wid, innkey), u3k(dat));
u3_atom innhaj = u3n_slam_on(u3k(haj), u3nc((wid + boq), innmsg));
// prepend outer padding to result, hash again
u3_atom outmsg = u3ka_add(u3kc_lsh(3, out, outkey), innhaj);
u3_atom outhaj = u3n_slam_on(u3k(haj), u3nc((out + boq), outmsg));
return outhaj;
}
u3_noun
u3we_hmac(u3_noun cor)
{
u3_noun haj, boq, out, wik, key, wid, dat;
// sample is [[haj boq out] [wik key] [wid dat]]
if ( (c3n == u3r_mean(cor, u3x_sam_4, &haj,
50, &boq, // +<->-
51, &out, // +<->+
u3x_sam_12, &wik,
u3x_sam_13, &key,
u3x_sam_14, &wid,
u3x_sam_15, &dat, 0)) ||
(c3n == u3ud(boq)) ||
(c3n == u3a_is_cat(boq)) ||
(c3n == u3ud(out)) ||
(c3n == u3a_is_cat(out)) ||
(c3n == u3ud(wik)) ||
(c3n == u3a_is_cat(wik)) ||
(c3n == u3ud(key)) ||
(c3n == u3ud(wid)) ||
(c3n == u3a_is_cat(wid)) ||
(c3n == u3ud(dat)) )
{
return u3m_bail(c3__exit);
}
else {
return u3qe_hmac(haj, boq, out, wik, key, wid, dat);
}
}

View File

@ -3,123 +3,166 @@
*/
#include "all.h"
typedef struct {
c3_w a_w;
c3_w b_w;
c3_w bit_w;
c3_w* wor_w;
} _jam_buf;
static void
_jam_buf_grow(_jam_buf* buf_u, c3_w mor_w)
{
c3_w wan_w = buf_u->bit_w + mor_w;
if ( wan_w < mor_w ) {
// overflowed c3_w bits
u3m_bail(c3__fail);
}
if ( wan_w > buf_u->a_w ) {
c3_w old_w, new_w, c_w = 0;
old_w = buf_u->a_w >> 5;
if ( (old_w << 5) != buf_u->a_w ) {
++old_w;
}
// fibonacci growth
while ( c_w < wan_w ) {
c_w = buf_u->a_w + buf_u->b_w;
buf_u->b_w = buf_u->a_w;
buf_u->a_w = c_w;
}
new_w = c_w >> 5;
if ( (new_w << 5) != c_w ) {
++new_w;
}
buf_u->wor_w = u3a_wealloc(buf_u->wor_w, new_w);
memset(buf_u->wor_w + old_w, 0, (new_w - old_w) * sizeof(c3_w));
}
}
static void
_jam_buf_chop(_jam_buf* buf_u, c3_w met_w, u3_noun a)
{
c3_w bit_w = buf_u->bit_w;
_jam_buf_grow(buf_u, met_w);
u3r_chop(0, 0, met_w, bit_w, buf_u->wor_w, a);
buf_u->bit_w += met_w;
}
static void
_jam_buf_atom(_jam_buf* buf_u, u3_noun a)
{
if ( 0 == a ) {
_jam_buf_chop(buf_u, 1, 1);
}
else {
c3_w b_w = u3r_met(0, a),
c_w = u3r_met(0, b_w);
c3_assert(c_w <= 32);
_jam_buf_chop(buf_u, c_w+1, 1 << c_w);
_jam_buf_chop(buf_u, c_w-1, b_w & ((1 << (c_w-1)) - 1));
_jam_buf_chop(buf_u, b_w, a);
}
}
/* functions
*/
static u3_noun
_jam_in(u3p(u3h_root) har_p, u3_atom, u3_atom, u3_noun);
static u3_noun
_jam_in_pair(u3p(u3h_root) har_p,
u3_atom h_a,
u3_atom t_a,
u3_atom b,
u3_noun l)
/* u3qe_jam_buf(): jam without atom allocation. returns
* atom-suitable words, and *bit_w will
* have the length (in bits). return should
* be freed with u3a_wfree().
*/
c3_w*
u3qe_jam_buf(u3_noun a, c3_w* bit_w)
{
u3_noun w = u3nc(u3nc(2, 1), u3k(l));
u3_noun x = u3qa_add(2, b);
u3_noun d = _jam_in(har_p, h_a, x, w);
u3_noun p_d, q_d, r_d;
u3_noun r;
u3p(u3h_root) har_p = u3h_new();
c3_o nor_o = u3a_is_north(u3R);
c3_y wis_y = c3_wiseof(u3_noun);
c3_ys mov = ( c3y == nor_o ? -wis_y : wis_y );
c3_ys off = ( c3y == nor_o ? 0 : -wis_y );
u3_noun* top, *don = u3to(u3_noun, u3R->cap_p + off);
u3_weak c;
c3_o cel_o;
c3_w len_w;
_jam_buf buf_u;
u3r_trel(d, &p_d, &q_d, &r_d);
{
u3_noun y = u3qa_add(x, p_d);
u3_noun e = _jam_in(har_p, t_a, y, q_d);
u3_noun p_e, q_e, r_e;
u3r_trel(e, &p_e, &q_e, &r_e);
{
u3_noun z = u3qa_add(p_d, p_e);
r = u3nt(u3qa_add(2, z), u3k(q_e), 0);
u3z(z);
}
u3z(e);
u3z(y);
buf_u.a_w = 144; // fib(12) is small enough to be reasonably fast to allocate.
buf_u.b_w = 89; // fib(11) is needed to get fib(13).
len_w = buf_u.a_w >> 5;
if ( (len_w << 5) != buf_u.a_w ) {
++len_w;
}
u3z(d);
u3z(x);
u3z(w);
buf_u.wor_w = u3a_walloc(len_w);
buf_u.bit_w = 0;
memset(buf_u.wor_w, 0, len_w * sizeof(c3_w));
return r;
}
u3R->cap_p += mov;
top = u3to(u3_noun, u3R->cap_p + off);
*top = a;
static u3_noun
_jam_in_flat(u3p(u3h_root) har_p,
u3_atom a,
u3_noun l)
{
u3_noun d = u3qe_mat(a);
u3_noun x = u3qa_add(1, u3h(d));
u3_noun y = u3nt
(u3k(x), u3nc(u3nc(x, u3qc_lsh(0, 1, u3t(d))), u3k(l)), 0);
u3z(d);
return y;
}
static u3_noun
_jam_in_ptr(u3p(u3h_root) har_p,
u3_atom u_c,
u3_noun l)
{
u3_noun d = u3qe_mat(u_c);
u3_atom x = u3qc_lsh(0, 2, u3t(d));
u3_atom y = u3qa_add(2, u3h(d));
u3_noun z = u3nt
(u3k(y), u3nc(u3nc(y, u3qc_mix(3, x)), u3k(l)), 0);
u3z(d);
u3z(x);
return z;
}
static u3_noun
_jam_in(u3p(u3h_root) har_p,
u3_noun a,
u3_atom b,
u3_noun l)
{
u3_noun c = u3h_get(har_p, a);
u3_noun x;
if ( u3_none == c ) {
u3h_put(har_p, a, u3k(b));
if ( c3y == u3ud(a) ) {
x = _jam_in_flat(har_p, a, l);
} else {
x = _jam_in_pair(har_p, u3h(a), u3t(a), b, l);
}
}
else {
if ( c3y == u3ud(a) && u3r_met(0, a) <= u3r_met(0, c) ) {
x = _jam_in_flat(har_p, a, l);
while ( top != don ) {
a = *top;
cel_o = u3du(a);
c = u3h_git(har_p, a);
if ( u3_none != c ) {
if ( c3y == cel_o ) {
_jam_buf_chop(&buf_u, 2, 3);
_jam_buf_atom(&buf_u, c);
}
else {
if ( u3r_met(0, a) <= u3r_met(0, c) ) {
_jam_buf_chop(&buf_u, 1, 0);
_jam_buf_atom(&buf_u, a);
}
else {
_jam_buf_chop(&buf_u, 2, 3);
_jam_buf_atom(&buf_u, c);
}
}
u3R->cap_p -= mov;
top = u3to(u3_noun, u3R->cap_p + off);
}
else {
x = _jam_in_ptr(har_p, c, l);
u3h_put(har_p, a, buf_u.bit_w);
if ( c3n == cel_o ) {
_jam_buf_chop(&buf_u, 1, 0);
_jam_buf_atom(&buf_u, a);
u3R->cap_p -= mov;
top = u3to(u3_noun, u3R->cap_p + off);
}
else {
_jam_buf_chop(&buf_u, 2, 1);
*top = u3t(a);
u3R->cap_p += mov;
top = u3to(u3_noun, u3R->cap_p + off);
*top = u3h(a);
}
}
}
return x;
}
*bit_w = buf_u.bit_w;
u3h_free(har_p);
return buf_u.wor_w;
}
u3_noun
u3qe_jam(u3_atom a)
{
u3p(u3h_root) har_p = u3h_new();
u3_noun x = _jam_in(har_p, a, 0, u3_nul);
u3_noun q = u3qb_flop(u3h(u3t(x)));
u3_noun r = u3qc_can(0, q);
u3z(x);
u3z(q);
u3h_free(har_p);
return r;
c3_w bit_w, *sal_w;
c3_w* wor_w = u3qe_jam_buf(a, &bit_w);
c3_w len_w = bit_w >> 5;
if ( (len_w << 5) != bit_w ) {
++len_w;
}
sal_w = u3a_slab(len_w);
memcpy(sal_w, wor_w, len_w*sizeof(c3_w));
u3a_wfree(wor_w);
return u3a_moot(sal_w);
}
u3_noun
u3we_jam(u3_noun cor)

View File

@ -12,7 +12,7 @@
return u3m_bail(c3__exit);
}
else {
u3_noun hok = u3j_hook(u3k(cor), "mute");
u3_noun hok = u3j_cook("u3we_mule-mute", u3k(cor), "mute");
/* this takes advantage of the fact that mute's result, at the typeless
* C/Nock level, is identical to what a typed mule would produce,

View File

@ -78,7 +78,7 @@
/* bend
*/
u3_noun
static u3_noun
_cqe_bend_fun(u3_noun raq,
u3_noun vex,
u3_noun sab)
@ -148,7 +148,7 @@
/* cold
*/
u3_noun
static u3_noun
_cqe_cold_fun(u3_noun cus,
u3_noun sef,
u3_noun tub)
@ -193,7 +193,7 @@
/* cook
*/
u3_noun
static u3_noun
_cqe_cook_fun(u3_noun poq,
u3_noun sef,
u3_noun tub)
@ -240,7 +240,7 @@
/* comp
*/
u3_noun
static u3_noun
_cqe_comp_fun(u3_noun raq,
u3_noun vex,
u3_noun sab)
@ -301,7 +301,7 @@
/* easy
*/
u3_noun
static u3_noun
_cqe_easy_fun(u3_noun huf,
u3_noun tub)
{
@ -313,8 +313,9 @@
u3k(huf),
u3k(tub));
}
u3_noun
u3we_easy_fun(u3_noun cor)
u3we_easy_fun(u3_noun cor)
{
u3_noun van, huf, tub;
@ -329,7 +330,7 @@ u3we_easy_fun(u3_noun cor)
/* glue
*/
u3_noun
static u3_noun
_cqe_glue_fun(u3_noun bus,
u3_noun vex,
u3_noun sab)
@ -406,7 +407,7 @@ u3we_easy_fun(u3_noun cor)
/* here
*/
u3_noun
static u3_noun
_cqe_here_fun(u3_noun hez,
u3_noun sef,
u3_noun tub)
@ -462,7 +463,7 @@ u3we_easy_fun(u3_noun cor)
/* just
*/
u3_noun
static u3_noun
_cqe_just_fun(u3_noun daf,
u3_noun tub)
{
@ -498,7 +499,7 @@ u3we_easy_fun(u3_noun cor)
/* mask
*/
u3_noun
static u3_noun
_cqe_mask_fun(u3_noun bud,
u3_noun tub)
{
@ -536,7 +537,7 @@ u3we_easy_fun(u3_noun cor)
}
/* pfix
*/
u3_noun
static u3_noun
_cqe_pfix(u3_noun vex,
u3_noun sab)
{
@ -577,7 +578,7 @@ u3we_easy_fun(u3_noun cor)
/* plug
*/
u3_noun
static u3_noun
_cqe_plug(u3_noun vex,
u3_noun sab)
{
@ -668,7 +669,7 @@ u3we_easy_fun(u3_noun cor)
/* sfix
*/
u3_noun
static u3_noun
_cqe_sfix(u3_noun vex,
u3_noun sab)
{
@ -722,7 +723,7 @@ u3we_easy_fun(u3_noun cor)
/* shim
*/
u3_noun
static u3_noun
_cqe_shim_fun(u3_noun zep,
u3_noun tub)
{
@ -768,7 +769,7 @@ u3we_easy_fun(u3_noun cor)
/* stag
*/
u3_noun
static u3_noun
_cqe_stag_fun(u3_noun gob,
u3_noun sef,
u3_noun tub)
@ -840,7 +841,7 @@ u3we_easy_fun(u3_noun cor)
}
}
u3_noun
static u3_noun
_cqe_stew_fun(u3_noun hel,
u3_noun tub)
{
@ -911,7 +912,7 @@ u3we_easy_fun(u3_noun cor)
/* stir
*/
u3_noun
static u3_noun
_cqe_stir_fun(u3_noun rud,
u3_noun raq,
u3_noun fel,

View File

@ -2,7 +2,7 @@
**
*/
#include "all.h"
#include "softfloat.h"
#include <softfloat.h>
#define DOUBNAN 0x7ff8000000000000

View File

@ -2,7 +2,7 @@
**
*/
#include "all.h"
#include "softfloat.h"
#include <softfloat.h>
#define HALFNAN 0x7e00
@ -151,8 +151,8 @@
/* div
*/
u3_noun
u3qes_div(u3_atom a,
u3_atom b,
u3qes_div(u3_atom a,
u3_atom b,
u3_atom r)
{
union half c, d, e;
@ -183,7 +183,7 @@
/* sqt
*/
u3_noun
u3qes_sqt(u3_atom a,
u3qes_sqt(u3_atom a,
u3_atom r)
{
union half c, d;

80
jets/e/ripe.c Normal file
View File

@ -0,0 +1,80 @@
/* j/5/ripe.c
**
*/
#include "all.h"
#include <openssl/evp.h>
/* functions
*/
u3_noun
u3qe_ripe(u3_atom wid, u3_atom dat)
{
c3_assert(_(u3a_is_cat(wid)));
dat = u3qc_rev(3, wid, dat);
c3_y* dat_y = (c3_y*)u3a_malloc(wid); // msg body
u3r_bytes(0, wid, (void*)dat_y, dat);
const EVP_MD* rip_u = EVP_ripemd160(); // ripem algorithm
static EVP_MD_CTX* con_u = NULL; // context
/* build library context object
we do this once (and only once)
*/
if (NULL == con_u) {
con_u = EVP_MD_CTX_create();
}
/* perform signature
*/
c3_y sib_y[20]; // signature body
c3_w sil_w; // signature length
c3_w ret_w; // return code
ret_w = EVP_DigestInit_ex(con_u, rip_u, NULL);
if ( 1 != ret_w ) {
u3a_free(dat_y);
fprintf(stderr, "\rripe jet: crypto library fail 1\n");
return u3m_bail(c3__exit);
}
ret_w = EVP_DigestUpdate(con_u, (void*)dat_y, wid);
u3a_free(dat_y);
if (1 != ret_w) {
fprintf(stderr, "\rripe jet: crypto library fail 2\n");
return u3m_bail(c3__exit);
}
ret_w = EVP_DigestFinal_ex(con_u, sib_y, &sil_w);
if ( 1 != ret_w ) {
fprintf(stderr, "\rripe jet: crypto library fail 3\n");
return u3m_bail(c3__exit);
}
/* endian conversion;
turn into noun for return
*/
return u3kc_rev(3, sil_w, u3i_bytes(sil_w, sib_y));
}
u3_noun
u3we_ripe(u3_noun cor)
{
u3_noun wid, dat;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid,
u3x_sam_3, &dat, 0) ||
u3ud(wid) || u3ud(dat))
)
{
fprintf(stderr, "\rripe jet: argument error\n");
return u3m_bail(c3__exit);
}
else {
return u3qe_ripe(wid, dat);
}
}

View File

@ -2,7 +2,7 @@
**
*/
#include "all.h"
#include "softfloat.h"
#include <softfloat.h>
#define QUADNAN 0x7fff800000000000

View File

@ -2,7 +2,7 @@
**
*/
#include "all.h"
#include "softfloat.h"
#include <softfloat.h>
#define SINGNAN 0x7fc00000
@ -151,8 +151,8 @@
/* div
*/
u3_noun
u3qet_div(u3_atom a,
u3_atom b,
u3qet_div(u3_atom a,
u3_atom b,
u3_atom r)
{
union sing c, d, e;
@ -183,7 +183,7 @@
/* sqt
*/
u3_noun
u3qet_sqt(u3_atom a,
u3qet_sqt(u3_atom a,
u3_atom r)
{
union sing c, d;

315
jets/e/secp.c Normal file
View File

@ -0,0 +1,315 @@
/* j/5/secp.c
**
*/
#include "all.h"
#include "../include/secp256k1.h"
#include "../include/secp256k1_recovery.h"
/* util funcs
*/
/* no guarantees if 'in' and 'out' overlap / are the same */
static void byte_reverse(c3_y *i_y, /* in */
c3_y *o_y, /* out */
c3_w n_w) /* size */
{
c3_w j_w;
for (j_w = 0; j_w < n_w; j_w++){
o_y[n_w - 1 - j_w] = i_y[j_w];
}
return;
}
/* 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.
*/
static void u3r_bytes_reverse(c3_w a_w,
c3_w b_w,
c3_y* c_y, /* out */
u3_atom d) /* in */
{
u3r_bytes(a_w, b_w, c_y, d);
c3_w i_w;
for (i_w = 0; i_w < ((b_w - a_w) / 2) ; i_w++) {
c3_y lo = c_y[i_w];
c3_y hi = c_y[b_w - i_w - 1];
c_y[i_w] = hi;
c_y[b_w - i_w - 1] = lo;
}
return;
}
/* sign hash with priv key
*/
u3_noun
u3we_sign(u3_noun cor)
{
u3_noun has, prv;
if ( (c3n == u3r_mean(cor,
u3x_sam_2, &has,
u3x_sam_3, &prv,
0)) ||
(c3n == u3ud(has)) ||
(c3n == u3ud(prv))) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
} else {
return (u3qe_sign(has, prv));
}
}
u3_noun
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 */
c3_y prv_y[32]; /* private key */
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(),
but must use secp256k1_ecdsa_sign_recoverable() */
c3_ws ret;
secp256k1_ecdsa_recoverable_signature sig_u;
ret = secp256k1_ecdsa_sign_recoverable(ctx_u, /* IN: context object */
& sig_u, /* OUT: signature */
(const c3_y *) has_y, /* IN: 32 byte hash to be signed */
(const c3_y *) prv_y, /* IN: 32 byte secret key */
(secp256k1_nonce_function) NULL, /* IN: nonce-function ptr ; NULL = default */
(const void *) NULL); /* IN: data for nonce function; not used */
if (1 != ret) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
}
/* convert opaque 65 byte signature into v + [r + s]
convert endianness while we're at it */
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) */
& v, /* OUT: v */
& sig_u); /* IN: 65 byte sig */
if (1 != ret) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
}
c3_y s_y[32];
c3_y r_y[32];
byte_reverse(rec_y, r_y, 32);
byte_reverse(rec_y + 32, s_y, 32);
/* package s,r,v signature for return */
u3_noun s = u3i_words(8, (const c3_w*) s_y);
u3_noun r = u3i_words(8, (const c3_w*) r_y);
return (u3nt(v, r, s));
}
/* recover pubkey from signature (which is how we verify signatures)
*/
u3_noun
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,
u3x_sam_14, &sir,
u3x_sam_15, &sis,
0)) ||
(c3n == u3ud(has)) ||
(c3n == u3ud(siv)) ||
(c3n == u3ud(sir)) ||
(c3n == u3ud(sis)) )
{
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
} else {
return u3qe_reco(has, siv, sir, sis);
}
}
u3_noun
u3qe_reco(u3_atom has,
u3_atom siv, /* signature: v */
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];
c3_y sir_y[32];
c3_y sis_y[32];
c3_y siv_y[1];
u3r_bytes_reverse(0, 32, has_y, has);
u3r_bytes_reverse(0, 32, sir_y, sir);
u3r_bytes_reverse(0, 32, sis_y, sis);
u3r_bytes_reverse(0, 1, siv_y, siv);
/* build the signature object */
c3_y ras_y[64]; /* priv key: r and s components */
c3_ws i_ws;
for (i_ws = 0; i_ws < 32; i_ws++) {
ras_y[i_ws] = sir_y[i_ws] ;
}
for (i_ws = 0; i_ws < 32; i_ws++) {
ras_y[i_ws + 32] = sis_y[i_ws] ;
}
c3_ws siv_ws = siv_y[0];
secp256k1_ecdsa_recoverable_signature sig_u;
memset( (void *) & sig_u, 0, sizeof(secp256k1_ecdsa_recoverable_signature) );
c3_ws ret = secp256k1_ecdsa_recoverable_signature_parse_compact(ctx_u, /* IN: context */
& sig_u, /* OUT: sig */
ras_y, /* IN: r/s */
siv_ws); /* IN: v */
if (1 != ret) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
}
/* turn sign into puk_u */
secp256k1_pubkey puk_u;
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 */
(const c3_y *) & has); /* IN: message has */
if (1 != ret) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
}
/* 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);
ret = secp256k1_ec_pubkey_serialize( ctx_u, /* IN: */
puk_y, /* OUT: */
& outputlen, /* OUT: */
& puk_u, /* IN: */
SECP256K1_EC_UNCOMPRESSED); /* IN: flags */
if (1 != ret) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
}
/* in file
subprojects/secp256k1/src/eckey_impl.h
func
secp256k1_eckey_puk_u_parse()
we can see
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];
}
u3_noun x = u3i_bytes(32, x_y);
c3_y y_y[32];
for (i_ws = 0; i_ws < 32; i_ws++) {
y_y[i_ws] = puk_y[64 - i_ws];
}
u3_noun y = u3i_bytes(32, y_y);
/* returns x,y */
return(u3nc(x, y));
}
u3_noun
u3we_make(u3_noun cor)
{
u3_noun has, prv;
if ( (c3n == u3r_mean(cor,
u3x_sam_2, &has,
u3x_sam_3, &prv,
0)) ||
(c3n == u3ud(has)) ||
(c3n == u3ud(prv)) )
{
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
} else {
return u3qe_make(has, prv);
}
}
u3_noun
u3qe_make(u3_atom has,
u3_atom prv)
{
c3_y hel_y[32]; /* hash, little endian */
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 */
(const c3_y *) heb_y, /* IN: message / hash */
(const c3_y *) peb_y, /* IN: key32 */
NULL, /* IN: algorithm (NULL == ECDSA) */
(void *) NULL, /* IN: arbitrary data pointer (unused) */
0); /* IN: attempt number (0 == normal) */
if (1 != ret_ws) {
fprintf(stderr, "\rsecp jet: crypto package error\n");
return u3m_bail(c3__exit);
}
c3_y nel_y[32];
byte_reverse(neb_y, nel_y, 32);
u3_noun non = u3i_words(8, (const c3_w*) nel_y);
return(non);
}

59
jets/e/sha1.c Normal file
View File

@ -0,0 +1,59 @@
/* j/5/sha1.c
**
*/
#include "all.h"
#if defined(U3_OS_osx)
#include <CommonCrypto/CommonDigest.h>
#else
#include <openssl/sha.h>
#endif
/* functions
*/
u3_noun
u3qe_sha1(u3_atom wid, u3_atom dat)
{
c3_assert(_(u3a_is_cat(wid)));
dat = u3qc_rev(3, wid, dat);
c3_y* fat_y = u3a_malloc(wid + 1);
u3r_bytes(0, wid, fat_y, dat);
{
c3_y dig_y[32];
#if defined(U3_OS_osx)
CC_SHA1_CTX ctx_h;
CC_SHA1_Init(&ctx_h);
CC_SHA1_Update(&ctx_h, fat_y, wid);
CC_SHA1_Final(dig_y, &ctx_h);
#else
SHA_CTX ctx_h;
SHA1_Init(&ctx_h);
SHA1_Update(&ctx_h, fat_y, wid);
SHA1_Final(dig_y, &ctx_h);
#endif
u3a_free(fat_y);
u3z(dat);
return u3kc_rev(3, 20, u3i_bytes(20, dig_y));
}
}
u3_noun
u3we_sha1(u3_noun cor)
{
u3_noun wid, dat;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &wid, u3x_sam_3, &dat, 0)) ||
(c3n == u3ud(wid)) ||
(c3n == u3a_is_cat(wid)) ||
(c3n == u3ud(dat)) )
{
return u3m_bail(c3__exit);
}
else {
return u3qe_sha1(wid, dat);
}
}

View File

@ -18,7 +18,7 @@
u3_atom b)
{
c3_assert(_(u3a_is_cat(a)));
c3_y* fat_y = c3_malloc(a + 1);
c3_y* fat_y = u3a_malloc(a + 1);
u3r_bytes(0, a, fat_y, b);
{
@ -36,7 +36,7 @@
SHA256_Update(&ctx_h, fat_y, a);
SHA256_Final(dig_y, &ctx_h);
#endif
free(fat_y);
u3a_free(fat_y);
return u3i_bytes(32, dig_y);
}
}
@ -53,7 +53,7 @@ u3_noun
u3qe_shax(u3_atom a)
{
c3_w met_w = u3r_met(3, a);
c3_y* fat_y = c3_malloc(met_w + 1);
c3_y* fat_y = u3a_malloc(met_w + 1);
u3r_bytes(0, met_w, fat_y, a);
{
@ -71,7 +71,7 @@ u3_noun
SHA256_Update(&ctx_h, fat_y, met_w);
SHA256_Final(dig_y, &ctx_h);
#endif
free(fat_y);
u3a_free(fat_y);
return u3i_bytes(32, dig_y);
}
}
@ -83,7 +83,7 @@ u3_noun
u3_atom b)
{
c3_assert(_(u3a_is_cat(a)));
c3_y* fat_y = c3_malloc(a + 1);
c3_y* fat_y = u3a_malloc(a + 1);
u3r_bytes(0, a, fat_y, b);
{
@ -101,7 +101,7 @@ u3_noun
SHA512_Update(&ctx_h, fat_y, a);
SHA512_Final(dig_y, &ctx_h);
#endif
free(fat_y);
u3a_free(fat_y);
return u3i_bytes(64, dig_y);
}
}

View File

@ -1,41 +0,0 @@
/* j/6/al.c
**
*/
#include "all.h"
/* ~(. al gen)
*/
static u3_noun
_al_core(u3_noun van,
u3_noun gen)
{
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun gat = u3j_hook(u3k(ter), "al");
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
}
/* ~(bunt al gen)
*/
u3_noun
u3qfl_bunt(u3_noun van,
u3_noun gen)
{
u3_noun cor = _al_core(van, gen);
return u3j_hook(cor, "bunt");
}
/* ~(whip al gen)
*/
u3_noun
u3qfl_whip(u3_noun van,
u3_noun gen,
u3_noun axe) //
{
u3_noun cor = _al_core(van, gen);
u3_noun gat = u3j_hook(u3k(cor), "whip");
return u3n_slam_on(gat, u3k(axe));
}

View File

@ -11,7 +11,7 @@
u3_noun u3wfp_hack(u3_noun);
static u3_noun
_ap_open_l(u3_noun, u3_noun);
_ap_open_l(u3_noun, u3_noun, u3_noun);
// make sure these match the array below!
//
@ -19,9 +19,9 @@
# define _ap_jet_rake 1
# define _ap_jet_hack 2
#if 0
static u3_noun
_open_in(u3_noun ter, u3_noun gen);
#if 0
/* ~(. al gen)
*/
static u3_noun
@ -32,7 +32,6 @@
return u3i_molt(gat, u3x_sam, u3nc(c3__herb, u3k(gen)), 0);
}
#endif
/* ~(. al gen)
*/
static u3_noun
@ -512,6 +511,7 @@
u3qdb_put(q_gen, u3_blip, diz)),
u3nc(c3__cnzy, u3_blip));
c3_assert(0);
u3z(diz);
return ret;
}
@ -984,6 +984,7 @@
return u3qfp_hack(ter, gen);
}
}
#endif
/* boilerplate
*/
@ -991,25 +992,59 @@
_ap_core(u3_noun ter,
u3_noun gen)
{
u3_noun gat = u3j_hook(u3k(ter), "ap");
u3_noun gat = u3j_cook("_ap_core-ap", u3k(ter), "ap");
return u3i_molt(gat, u3x_sam, u3k(gen), 0);
}
static u3_noun
_ar_core(u3_noun van,
u3_noun ref,
u3_noun syn)
{
u3_noun gat = u3j_hook(u3k(van), "ar");
return u3i_molt(gat, u3x_sam, u3nc(u3k(ref), u3k(syn)), 0);
}
/* fish
*/
u3_noun
u3qfr_fish(u3_noun van,
u3_noun ref,
u3_noun syn,
u3_noun axe)
{
u3_noun gat = u3j_soft(_ar_core(van, ref, syn), "fish");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(axe),
0));
}
/* open
*/
static u3_noun
_ap_open_n(u3_noun ter,
u3_noun fab,
u3_noun gen)
{
u3_noun cor = _ap_core(ter, gen);
#if 1
if ( c3n == fab ) {
cor = u3i_molt(cor, 14, c3n, 0);
}
#endif
return u3j_soft(cor, "open");
}
static u3_noun
_ap_open_l(u3_noun ter,
u3_noun fab,
u3_noun gen)
{
#if 0
u3_noun pro = _open_in(ter, gen);
if ( u3_none != pro ) {
@ -1017,13 +1052,17 @@
} else {
return _ap_open_n(ter, gen);
}
#else
return _ap_open_n(ter, fab, gen);
#endif
}
u3_noun
u3qfp_open(u3_noun ter,
u3_noun fab,
u3_noun gen)
{
return _ap_open_l(ter, gen);
return _ap_open_l(ter, fab, gen);
}
u3_noun
@ -1036,6 +1075,7 @@
} else {
u3_noun ter = u3r_at(u3x_con, cor);
return u3qfp_open(ter, gen);
return u3qfp_open(ter, c3y, gen);
}
}

View File

@ -18,6 +18,7 @@
u3k(p_vur),
u3k(p_sed));
}
#if 0
else if ( c3y == u3r_p(vur, 0, &p_vur) &&
c3y == u3r_p(sed, 0, &p_sed) &&
!(c3y == u3r_sing(1, p_vur)) &&
@ -37,6 +38,7 @@
u3z(nof);
}
}
#endif
return u3nc(u3k(vur), u3k(sed));
}
u3_noun

View File

@ -13,6 +13,19 @@
if ( (c3__void == pac) ) {
return c3__void;
} else {
{
u3_noun p_con, q_con, r_con, hr_con, tr_con;
u3r_trel(con, &p_con, &q_con, &r_con);
u3r_cell(r_con, &hr_con, &tr_con);
if ( (c3y == u3du(hr_con)) &&
(u3_nul == u3h(hr_con)) &&
(u3_nul == u3t(hr_con)) )
{
fprintf(stderr, "old core\r\n");
abort();
}
}
return u3nt(c3__core, u3k(pac), u3k(con));
}
}
@ -27,3 +40,79 @@
return u3qf_core(pac, con);
}
}
#if 0
static void
_fork_test(const c3_c *lab_c, u3_noun set)
{
if ( u3_nul == set ) {
return;
} else {
u3_noun n_set, l_set, r_set;
u3x_trel(set, &n_set, &l_set, &r_set);
u3qf_test(lab_c, n_set);
_fork_test(lab_c, l_set);
_fork_test(lab_c, r_set);
}
}
void
u3qf_test(const c3_c* lab_c, u3_noun sut)
{
u3_noun p_sut, q_sut;
if ( c3n == u3du(sut) ) switch ( sut ) {
default: u3m_bail(c3__fail); return;
case c3__noun:
{
return;
}
case c3__void:
{
return;
}
}
else switch ( u3h(sut) ) {
default: u3m_bail(c3__fail); return;
case c3__atom: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
return;
}
case c3__cell: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, p_sut);
u3qf_test(lab_c, q_sut);
return;
}
case c3__core: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, p_sut);
return;
}
case c3__face: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, q_sut);
return;
}
case c3__fork: p_sut = u3t(sut);
{
_fork_test(lab_c, p_sut);
return;
}
case c3__hint: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, q_sut);
u3qf_test(lab_c, u3h(p_sut));
return;
}
case c3__hold: u3x_cell(u3t(sut), &p_sut, &q_sut);
{
u3qf_test(lab_c, p_sut);
return;
}
}
}
#endif

View File

@ -10,6 +10,9 @@
u3qf_flan(u3_noun bos,
u3_noun nif)
{
if ( c3y == u3r_sing(bos, nif) ) {
return u3k(bos);
}
if ( c3y == u3r_sing(1, u3h(bos)) ) {
if ( (u3_nul == u3t(bos)) ) {
return u3k(nif);

View File

@ -10,6 +10,9 @@
u3qf_flor(u3_noun bos,
u3_noun nif)
{
if ( c3y == u3r_sing(bos, nif) ) {
return u3k(bos);
}
if ( c3y == u3r_sing(1, u3h(bos)) ) {
if ( (u3_nul == u3t(bos)) ) {
return u3k(bos);

View File

@ -89,6 +89,7 @@
u3qf_hike(u3_noun axe,
u3_noun pac)
{
c3_assert(0);
if ( (u3_nul == pac) ) {
return u3nc(0, u3k(axe));
}

32
jets/f/hint.c Normal file
View File

@ -0,0 +1,32 @@
/* j/6/help.c
**
*/
#include "all.h"
/* functions
*/
u3_noun
u3qf_hint(u3_noun sag,
u3_noun tip)
{
if ( c3__void == tip ) {
return c3__void;
}
if ( c3__noun == tip ) {
return c3__noun;
}
else return u3nt(c3__hint, u3k(sag), u3k(tip));
}
u3_noun
u3wf_hint(u3_noun cor)
{
u3_noun sag, tip;
if ( c3n == u3r_mean(cor, u3x_sam_2, &sag, u3x_sam_3, &tip, 0) ) {
return u3m_bail(c3__fail);
} else {
return u3qf_hint(sag, tip);
}
}

Some files were not shown because too many files have changed in this diff Show More