Merge branch 'release-candidate' into crypto-additions

This commit is contained in:
Fang 2018-11-06 10:32:02 -08:00
commit 91bef8d863
32 changed files with 1999 additions and 360 deletions

View File

@ -1,5 +1,20 @@
language: c
script: meson build && cd ./build && ninja
language: node_js
node_js:
- 4
script:
- meson . ./build --buildtype=debugoptimized -Dgc=true -Dprof=true
- cd ./build
- ninja
- sudo ninja install
- cd ../.travis
- ulimit -c unlimited -S
- npm install
# || true so we continue
- npm run -s test || RESULT=$?
- 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
# Uncomment me if this gets annoying
#
@ -10,8 +25,14 @@ 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 ..
addons:
apt:
@ -31,6 +52,7 @@ addons:
- re2c
- libcurl4-gnutls-dev
- unzip
- gdb
# before_deploy: "make deb" # TODO
deploy:
skip_cleanup: 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 @@
6deeb7dee9f3d47e4458fac3a0518dcde429ef73

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

@ -1,5 +1,7 @@
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]]
@ -9,7 +11,6 @@ nock(a) *a
+a 1 + a
=[a a] 0
=[a b] 1
=a =a
/[1 a] a
/[2 a b] a
@ -30,15 +31,15 @@ nock(a) *a
*[a 2 b c] *[*[a b] *[a c]]
*[a 3 b] ?*[a b]
*[a 4 b] +*[a b]
*[a 5 b] =*[a b]
*[a 5 b c] =[*[a b] *[a c]]
*[a 6 b c d] *[a 2 [0 1] 2 [1 c d] [1 0] 2 [1 2 3] [1 0] 4 4 b]
*[a 7 b c] *[a 2 b 1 c]
*[a 8 b c] *[a 7 [[7 [0 1] b] 0 1] c]
*[a 9 b c] *[a 7 c 2 [0 1] 0 b]
*[a 10 [b c] d] *[a 8 c 7 [0 3] d]
*[a 10 b c] *[a c]
*[a 12 [b c] d] #[b *[a c] *[a d]]
*[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

View File

@ -278,12 +278,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')
@ -352,9 +354,11 @@
# 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')
@ -374,6 +378,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')
@ -584,6 +589,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')
@ -801,6 +807,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')
@ -1140,6 +1147,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')

View File

@ -250,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.
**/

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

@ -26,6 +26,7 @@
u3_noun sev_l; // instance number
u3_noun sen; // instance string
u3_noun own; // owner list
u3_noun fak; // &=fake XX use c3_o?
u3_noun sac; // space profiling

View File

@ -254,9 +254,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;
@ -578,20 +580,21 @@
*/
typedef struct _u3_opts {
c3_c* arv_c; // -A, initial sync from
c3_c* dns_c; // -H, ames bootstrap domain
c3_c* gen_c; // -G, czar generator
c3_c* imp_c; // -I, czar name
c3_c* nam_c; // -n, unix hostname
c3_c* pil_c; // -B, bootstrap from
c3_c* raf_c; // -r, raft flotilla
c3_c* tic_c; // -t, ticket value
c3_c* url_c; // -u, pill url
c3_c* who_c; // -w, begin with ticket
c3_c* key_c; // -K, private key file
c3_o abo; // -a
c3_o bat; // -b, batch create
c3_o dem; // -d, daemon
c3_o dry; // -D, dry compute
c3_o fak; // -F, fake carrier
c3_c* eth_c; // -e, ethereum node url
c3_o etn; // -t, use snapshot exclusively to boot
c3_c* ets_c; // -E, eth snapshot
c3_c* fak_c; // -F, fake ship
c3_o fog; // -X, skip last event
c3_o gab; // -g, run with garbage collector
c3_o has; // -S, Skip battery hashes
@ -861,11 +864,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
@ -943,6 +941,11 @@
u3_ames_ef_send(u3_noun lan,
u3_noun pac);
/* u3_ames_ef_turf(): initialize ames I/O on domain(s).
*/
void
u3_ames_ef_turf(u3_noun tuf);
/* u3_ames_io_init(): initialize ames I/O.
*/
void

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

@ -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

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

View File

@ -148,16 +148,16 @@
}
static u3_noun
_mint_coke(u3_noun nug)
_mint_cove(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 10 == u3h(nug) ) {
return _mint_coke(u3t(u3t(nug)));
else if ( 11 == u3h(nug) ) {
return _mint_cove(u3t(u3t(nug)));
}
else {
return u3m_error("mint-coke");
return u3m_error("mint-cove");
}
}
@ -370,7 +370,7 @@
u3_noun wam = u3qfu_play(van, sut, p_gen);
u3_noun dok = u3nc(c3__wing, u3k(q_gen));
u3_noun vol = _mint_corn(van, sut, dok);
u3_noun axe = _mint_coke(vol);
u3_noun axe = _mint_cove(vol);
ret = u3nc(_mint_nice(van, gol, _mint_bean()),
u3qfu_fish(van, wam, axe));
@ -471,7 +471,7 @@
u3_noun viz = _mint_in(van, sut, c3__noun, q_gen);
ret = u3nc(u3k(u3h(nef)),
u3nt(11, u3nc(1, u3nc(151, u3k(u3h(nef)))), u3k(u3t(viz))));
u3nt(12, u3nc(1, u3nc(151, u3k(u3h(nef)))), u3k(u3t(viz))));
u3z(viz);
u3z(nef);
@ -533,7 +533,8 @@
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__iron);
u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
@ -545,7 +546,8 @@
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__zinc);
u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
@ -556,7 +558,8 @@
{
u3_noun ryd = _mint_in(van, sut, gol, p_gen);
u3_noun tyf = u3qfu_wrap(van, u3h(ryd), c3__lead);
u3_noun pro = u3nc(tyf, u3k(u3t(ryd)));
u3_noun tyn = _mint_nice(van, gol, tyf);
u3_noun pro = u3nc(tyn, u3k(u3t(ryd)));
u3z(ryd);
return pro;
@ -683,7 +686,7 @@
_mint_corn(van, sut, u3t(p_gen)));
}
ret = u3nc(u3k(u3h(hum)),
u3nt(10, bez, u3k(u3t(hum))));
u3nt(11, bez, u3k(u3t(hum))));
u3z(hum);
return ret;
@ -786,7 +789,7 @@
u3_noun hum = _mint_in(van, sut, gol, q_gen);
u3_noun bez = u3nt(c3__spot, 1, u3k(p_gen));
ret = u3nc(u3k(u3h(hum)), u3nt(10, bez, u3k(u3t(hum))));
ret = u3nc(u3k(u3h(hum)), u3nt(11, bez, u3k(u3t(hum))));
u3z(hum);
}
u3t_drop();

View File

@ -63,16 +63,16 @@
}
}
static u3_noun
_mull_coke(u3_noun nug)
_mull_cove(u3_noun nug)
{
if ( 0 == u3h(nug) ) {
return u3k(u3t(nug));
}
else if ( 10 == u3h(nug) ) {
return _mull_coke(u3t(u3t(nug)));
else if ( 11 == u3h(nug) ) {
return _mull_cove(u3t(u3t(nug)));
}
else {
return u3m_error("mull-coke");
return u3m_error("mull-cove");
}
}
@ -109,7 +109,7 @@
u3_noun gen)
{
u3_noun fug = u3qfu_mint(van, sut, c3__noun, gen);
u3_noun axe = _mull_coke(u3t(fug));
u3_noun axe = _mull_cove(u3t(fug));
u3z(fug);
return axe;

View File

@ -358,7 +358,7 @@
return pro;
}
case c3__ktpm: p_gen = u3t(gen);
case c3__ktpd: p_gen = u3t(gen);
_play_used();
{
u3_noun boc = _play_x(van, sut, p_gen);

View File

@ -41,8 +41,9 @@
if ( c3n == u3r_trel(pq_sut, &ppq_sut, &qpq_sut, &rpq_sut) ) {
return u3m_bail(c3__fail);
}
else if ( c3__gold != rpq_sut ) {
return u3m_error("wrap-gold");
else if ( (c3__gold != rpq_sut) &&
(c3__lead != yoz) ) {
return u3m_error("wrap-metal");
}
else {
return u3nt(c3__core,

View File

@ -262,6 +262,150 @@ u3i_qual(u3_noun a, u3_noun b, u3_noun c, u3_noun d)
return u3i_cell(a, u3i_trel(b, c, d));
}
static u3_noun
_edit_cat(u3_noun big, c3_l axe_l, u3_noun som)
{
if ( c3n == u3du(big) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun pro;
switch ( axe_l ) {
case 2:
pro = u3nc(som, u3k(u3t(big)));
break;
case 3:
pro = u3nc(u3k(u3h(big)), som);
break;
default: {
c3_l mor_l = u3x_mas(axe_l);
pro = ( 2 == u3x_cap(axe_l) )
? u3nc(_edit_cat(u3k(u3h(big)), mor_l, som), u3k(u3t(big)))
: u3nc(u3k(u3h(big)), _edit_cat(u3k(u3t(big)), mor_l, som));
break;
}
}
u3z(big);
return pro;
}
}
static u3_noun
_edit(u3_noun big, u3_noun axe, u3_noun som)
{
if ( c3y == u3a_is_cat(axe) ) {
return _edit_cat(big, (c3_l) axe, som);
}
else if ( c3n == u3du(big) ) {
return u3m_bail(c3__exit);
}
else {
u3_noun mor = u3qc_mas(axe),
pro = ( 2 == u3qc_cap(axe) )
? u3nc(_edit(u3k(u3h(big)), mor, som), u3k(u3t(big)))
: u3nc(u3k(u3h(big)), _edit(u3k(u3t(big)), mor, som));
u3z(mor);
u3z(big);
return pro;
}
}
static u3_noun _edit_or_mutate_cat(u3_noun, c3_l, u3_noun);
static u3_noun _edit_or_mutate(u3_noun, u3_noun, u3_noun);
static void
_mutate_cat(u3_noun big, c3_l axe_l, u3_noun som)
{
if ( c3n == u3du(big) ) {
u3m_bail(c3__exit);
}
else {
u3a_cell* cel_u = (void*) u3a_to_ptr(big);
switch ( axe_l ) {
case 2:
u3z(cel_u->hed);
cel_u->hed = som;
break;
case 3:
u3z(cel_u->tel);
cel_u->tel = som;
break;
default: {
u3_noun* tar = ( 2 == u3x_cap(axe_l) )
? &(cel_u->hed)
: &(cel_u->tel);
*tar = _edit_or_mutate_cat(*tar, u3x_mas(axe_l), som);
}
}
}
}
static void
_mutate(u3_noun big, u3_noun axe, u3_noun som)
{
if ( c3y == u3a_is_cat(axe) ) {
_mutate_cat(big, (c3_l) axe, som);
}
else if ( c3n == u3du(big) ) {
u3m_bail(c3__exit);
}
else {
u3a_cell* cel_u = (void*) u3a_to_ptr(big);
u3_noun mor = u3qc_mas(axe);
u3_noun* tar = ( 2 == u3qc_cap(axe) )
? &(cel_u->hed)
: &(cel_u->tel);
*tar = _edit_or_mutate(*tar, mor, som);
u3z(mor);
}
}
static u3_noun
_edit_or_mutate_cat(u3_noun big, c3_l axe_l, u3_noun som)
{
if ( c3y == u3a_is_mutable(u3R, big) ) {
_mutate_cat(big, axe_l, som);
return big;
}
else {
return _edit_cat(big, axe_l, som);
}
}
static u3_noun
_edit_or_mutate(u3_noun big, u3_noun axe, u3_noun som)
{
if ( c3y == u3a_is_cat(axe) ) {
return _edit_or_mutate_cat(big, (c3_l) axe, som);
}
else if ( c3y == u3a_is_mutable(u3R, big) ) {
_mutate(big, axe, som);
return big;
}
else {
return _edit(big, axe, som);
}
}
/* 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)
{
switch ( axe ) {
case 0:
return u3m_bail(c3__exit);
case 1:
u3z(big);
return som;
default:
return _edit_or_mutate(big, axe, som);
}
}
/* u3i_string():
**
** Produce an LSB-first atom from the C string `a`.

View File

@ -249,7 +249,7 @@ _cj_axis(u3_noun fol)
{
u3_noun p_fol, q_fol, r_fol;
while ( _(u3du(fol)) && (10 == u3h(fol)) )
while ( _(u3du(fol)) && (11 == u3h(fol)) )
{ fol = u3t(u3t(fol)); }
if ( !_(u3r_trel(fol, &p_fol, &q_fol, &r_fol)) ) {
@ -436,7 +436,7 @@ _cj_je_fsck(u3_noun clu)
if ( 0 == (nam_c = _cj_chum(p_clu)) ) {
u3z(clu); return u3_none;
}
while ( _(u3du(q_clu)) && (10 == u3h(q_clu)) ) {
while ( _(u3du(q_clu)) && (11 == u3h(q_clu)) ) {
q_clu = u3t(u3t(q_clu));
}
if ( !_(u3du(q_clu)) ) {
@ -1465,22 +1465,21 @@ _cj_burn(u3p(u3n_prog) pog_p, u3_noun cor)
** (no validity checks).
*/
static u3_weak
_cj_site_kick_hot(u3_noun loc, u3_noun cor, u3j_site* sit_u)
_cj_site_kick_hot(u3_noun loc, u3_noun cor, u3j_site* sit_u, c3_o lok_o)
{
u3_weak pro = u3_none;
c3_o jet_o = sit_u->jet_o;
c3_o pof_o = __(u3C.wag_w & u3o_debug_cpu);
if ( c3n == pof_o ) {
if ( c3n == jet_o ) {
pro = u3_none;
}
else {
if ( c3y == jet_o ) {
u3t_off(glu_o);
pro = _cj_kick_z(cor, sit_u->cop_u, sit_u->ham_u, sit_u->axe);
u3t_on(glu_o);
}
if ( u3_none == pro ) {
_cj_site_lock(loc, cor, sit_u);
if ( c3y == lok_o ) {
_cj_site_lock(loc, cor, sit_u);
}
}
}
else {
@ -1491,7 +1490,9 @@ _cj_site_kick_hot(u3_noun loc, u3_noun cor, u3j_site* sit_u)
u3t_on(glu_o);
}
if ( u3_none == pro ) {
_cj_site_lock(loc, cor, sit_u);
if ( c3y == lok_o ) {
_cj_site_lock(loc, cor, sit_u);
}
pro = _cj_burn(sit_u->pog_p, cor);
}
if ( c3y == pof_o ) {
@ -1513,9 +1514,7 @@ _cj_site_kick(u3_noun cor, u3j_site* sit_u)
if ( u3_none != sit_u->loc ) {
if ( c3y == _cj_fine(cor, sit_u->fin_p) ) {
loc = sit_u->loc;
if ( c3y == sit_u->jet_o ) {
pro = _cj_site_kick_hot(loc, cor, sit_u);
}
pro = _cj_site_kick_hot(loc, cor, sit_u, c3y);
}
}
@ -1537,15 +1536,9 @@ _cj_site_kick(u3_noun cor, u3j_site* sit_u)
sit_u->loc = loc;
sit_u->fin_p = _cj_cast(cor, loc);
sit_u->fon_o = c3y;
if ( c3y ==
(sit_u->jet_o = _cj_nail(loc, sit_u->axe,
&(sit_u->lab), &(sit_u->cop_u), &(sit_u->ham_u))) )
{
pro = _cj_site_kick_hot(loc, cor, sit_u);
}
else {
pro = u3_none;
}
sit_u->jet_o = _cj_nail(loc, sit_u->axe,
&(sit_u->lab), &(sit_u->cop_u), &(sit_u->ham_u));
pro = _cj_site_kick_hot(loc, cor, sit_u, c3y);
if ( u3_none != lod ) {
u3z(lod);
@ -1674,8 +1667,8 @@ u3j_gate_slam(u3j_site* sit_u, u3_noun sam)
cor = u3nt(u3k(u3h(sit_u->bat)),
sam,
u3k(u3t(u3t(sit_u->bat))));
if ( (u3_none != sit_u->loc) && (c3y == sit_u->jet_o) ) {
pro = _cj_site_kick_hot(sit_u->loc, cor, sit_u);
if ( u3_none != sit_u->loc ) {
pro = _cj_site_kick_hot(sit_u->loc, cor, sit_u, c3n);
}
if ( u3_none == pro ) {
pro = _cj_burn(sit_u->pog_p, cor);

View File

@ -526,6 +526,22 @@ _n_nock_on(u3_noun bus, u3_noun fol)
#define SLIB 70
#define SLIS 71
#define SAVE 72
// nock 10
#define MUTH 73
#define KUTH 74
#define MUTT 75
#define KUTT 76
#define MUSM 77
#define KUSM 78
#define MUTB 79
#define MUTS 80
#define MITB 81
#define MITS 82
#define KUTB 83
#define KUTS 84
#define KITB 85
#define KITS 86
#define LAST 87
/* _n_arg(): return the size (in bytes) of an opcode's argument
*/
@ -538,6 +554,7 @@ _n_arg(c3_y cod_y)
case SAMB: case SANB: case SBIP: case SBIN:
case SLIB: case SKIB: case KICB: case TICB:
case BUSH: case BAST: case BALT:
case MUTB: case KUTB: case MITB: case KITB:
return sizeof(c3_y);
case FASK: case FASL: case FISL: case FISK:
@ -545,13 +562,14 @@ _n_arg(c3_y cod_y)
case SAMS: case SANS: case SIPS: case SINS:
case SLIS: case SKIS: case KICS: case TICS:
case SUSH: case SAST: case SALT:
case MUTS: case KUTS: case MITS: case KITS:
return sizeof(c3_s);
case SWIP: case SWIN:
return sizeof(c3_l);
default:
c3_assert( cod_y <= SAVE );
c3_assert( cod_y < LAST );
return 0;
}
}
@ -657,6 +675,7 @@ _n_melt(u3_noun ops, c3_w* byc_w, c3_w* cal_w,
case BUSH: case FIBK: case FIBL:
case SANB: case LIBL: case LIBK:
case KITB: case MITB:
a_w = (*lit_w)++;
if ( a_w <= 0xFF ) {
siz_y[i_w] = 2;
@ -854,6 +873,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
/* 8-bit direct args */
case FABK: case FABL:
case LITB: case LILB:
case MUTB: case KUTB:
case SAMB:
buf_y[i_w--] = (c3_y) u3t(op);
buf_y[i_w] = (c3_y) cod;
@ -862,6 +882,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
/* 16-bit direct args */
case FASK: case FASL:
case LILS: case LITS:
case MUTS: case KUTS:
case SAMS: case SIPS: case SINS: {
c3_s off_s = u3t(op);
buf_y[i_w--] = (c3_y) (off_s >> 8);
@ -885,6 +906,7 @@ _n_prog_asm(u3_noun ops, u3n_prog* pog_u, u3_noun sip)
case FIBK: case FIBL:
case LIBK: case LIBL:
case BUSH: case SANB:
case KITB: case MITB:
_n_prog_asm_inx(buf_y, &i_w, lit_s, cod);
pog_u->lit_u.non[lit_s++] = u3k(u3t(op));
break;
@ -992,6 +1014,10 @@ static char* opcode_names[] = {
"balt", "salt",
"skib", "skis", "slib", "slis",
"save",
"muth", "kuth", "mutt", "kutt",
"musm", "kusm",
"mutb", "muts", "mitb", "mits",
"kutb", "kuts", "kitb", "kits",
};
#endif
@ -1185,8 +1211,8 @@ _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o)
u3x_cell(arg, &hed, &tel);
if ( c3n == u3du(hed) ) {
tot_w += _n_comp(ops, arg, los_o, c3n);
++tot_w; _n_emit(ops, SAMC);
u3m_bail(c3__exit);
return 0;
}
else {
c3_t hec_t, tec_t;
@ -1276,12 +1302,44 @@ _n_comp(u3_noun* ops, u3_noun fol, c3_o los_o, c3_o tel_o)
}
break;
case 10:
case 10: {
u3_noun axe, nef;
u3x_cell(arg, &hed, &tel);
u3x_cell(hed, &axe, &nef);
tot_w += _n_comp(ops, tel, c3n, c3n);
++tot_w; _n_emit(ops, SWAP);
tot_w += _n_comp(ops, nef, c3n, c3n);
++tot_w;
switch ( axe ) {
case 2:
_n_emit(ops, (c3y == los_o) ? MUTH : KUTH);
break;
case 3:
_n_emit(ops, (c3y == los_o) ? MUTT : KUTT);
break;
case u3x_sam:
_n_emit(ops, (c3y == los_o) ? MUSM : KUSM);
break;
default:
op_y = (c3y == los_o)
? (axe <= 0xFF) ? MUTB : (axe <= 0xFFFF) ? MUTS : MITB // overflows to MITS
: (axe <= 0xFF) ? KUTB : (axe <= 0xFFFF) ? KUTS : KITB; // overflows to KITS
_n_emit(ops, u3nc(op_y, u3k(axe)));
break;
}
break;
}
case 11:
u3x_cell(arg, &hed, &tel);
tot_w += _n_bint(ops, hed, tel, los_o, tel_o);
break;
case 11:
case 12:
u3x_cell(arg, &hed, &tel);
tot_w += _n_comp(ops, hed, c3n, c3n);
++tot_w; _n_emit(ops, SWAP);
@ -1573,6 +1631,10 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off)
&&do_balt, &&do_salt,
&&do_skib, &&do_skis, &&do_slib, &&do_slis,
&&do_save,
&&do_muth, &&do_kuth, &&do_mutt, &&do_kutt,
&&do_musm, &&do_kusm,
&&do_mutb, &&do_muts, &&do_mitb, &&do_mits,
&&do_kutb, &&do_kuts, &&do_kitb, &&do_kits,
};
u3j_site* sit_u;
@ -2158,6 +2220,89 @@ _n_burn(u3n_prog* pog_u, u3_noun bus, c3_ys mov, c3_ys off)
*top = x;
u3z(o);
BURN();
do_kuth:
x = _n_pep(mov, off);
top = _n_swap(mov, off);
goto muth_in;
do_muth:
x = _n_pep(mov, off);
_n_toss(mov, off);
top = _n_peek(off);
muth_in:
o = *top;
*top = u3nc(x, u3k(u3t(o)));
u3z(o);
BURN();
do_kutt:
x = _n_pep(mov, off);
top = _n_swap(mov, off);
goto mutt_in;
do_mutt:
x = _n_pep(mov, off);
_n_toss(mov, off);
top = _n_peek(off);
mutt_in:
o = *top;
*top = u3nc(u3k(u3h(o)), x);
u3z(o);
BURN();
do_kusm:
x = _n_pep(mov, off);
top = _n_swap(mov, off);
goto musm_in;
do_musm:
x = _n_pep(mov, off);
_n_toss(mov, off);
top = _n_peek(off);
musm_in:
o = *top;
*top = u3nt(u3k(u3h(o)), x, u3k(u3t(u3t(o))));
u3z(o);
BURN();
do_kitb:
x = pog_u->lit_u.non[pog[ip_w++]];
goto kut_in;
do_kits:
x = pog_u->lit_u.non[_n_resh(pog, &ip_w)];
goto kut_in;
do_kuts:
x = _n_resh(pog, &ip_w);
goto kut_in;
do_kutb:
x = pog[ip_w++];
kut_in:
o = _n_pep(mov, off);
top = _n_swap(mov, off);
goto edit_in;
do_mitb:
x = pog_u->lit_u.non[pog[ip_w++]];
goto mut_in;
do_mits:
x = pog_u->lit_u.non[_n_resh(pog, &ip_w)];
goto mut_in;
do_muts:
x = _n_resh(pog, &ip_w);
goto mut_in;
do_mutb:
x = pog[ip_w++];
mut_in:
o = _n_pep(mov, off);
_n_toss(mov, off);
top = _n_peek(off);
edit_in:
*top = u3i_edit(*top, x, o);
BURN();
}
}

View File

@ -89,33 +89,22 @@ u3v_start(u3_noun now)
u3_noun
u3v_wish(const c3_c* str_c)
{
u3_noun exp;
u3_noun txt = u3i_string(str_c);
u3_weak exp = u3kdb_get(u3k(u3A->yot), u3k(txt));
if ( u3R == &u3H->rod_u ) {
u3_noun txt = u3i_string(str_c);
exp = u3kdb_get(u3k(u3A->yot), u3k(txt));
if ( u3_none == exp ) {
exp = _cv_nock_wish(u3k(txt));
if ( u3_none == exp ) {
exp = _cv_nock_wish(u3k(txt));
// It's probably not a good idea to use u3v_wish()
// outside the top level... (as the result is uncached)
//
if ( u3R == &u3H->rod_u ) {
u3A->yot = u3kdb_put(u3A->yot, u3k(txt), u3k(exp));
}
u3z(txt);
return exp;
}
else {
// It's probably not a good idea to use u3v_wish()
// outside the top level...
//
u3_noun txt = u3i_string(str_c);
u3_noun exp = u3kdb_get(u3A->yot, u3k(txt));
if ( u3_none != exp ) {
u3z(txt);
return exp;
}
else return _cv_nock_wish(u3i_string(str_c));
}
u3z(txt);
return exp;
}
/* _cv_mung(): formula wrapper with gate and sample.

View File

@ -197,6 +197,8 @@ _ames_czar(u3_pact* pac_u, c3_c* bos_c)
return;
}
c3_assert( 0 != bos_c );
time_t now = time(0);
// backoff
@ -269,6 +271,8 @@ _ames_lane_ip(u3_noun lan, c3_s* por_s, c3_w* pip_w)
return c3n;
}
/* u3_ames_ef_bake(): notify %ames that we're live.
*/
void
u3_ames_ef_bake(void)
{
@ -303,7 +307,7 @@ u3_ames_ef_send(u3_noun lan, u3_noun pac)
if ( (0 == (pac_u->pip_w >> 16)) && (1 == (pac_u->pip_w >> 8)) ) {
pac_u->imp_y = (pac_u->pip_w & 0xff);
_ames_czar(pac_u, u3_Host.ops_u.dns_c);
_ames_czar(pac_u, u3_Host.sam_u.dns_c);
}
else if ( (c3y == u3_Host.ops_u.net) || (0x7f000001 == pac_u->pip_w) ) {
_ames_send(pac_u);
@ -326,15 +330,22 @@ static void
_ames_time_cb(uv_timer_t* tim_uo)
{
u3_ames* sam_u = &u3_Host.sam_u;
u3_lo_open();
sam_u->law_w = time(0);
{
u3v_plan
(u3nt(u3_blip, c3__ames, u3_nul),
u3nc(c3__wake, u3_nul));
// defer until started via u3_ames_ef_turf()
if ( c3n == sam_u->liv ) {
uv_timer_start(&sam_u->tim_u, _ames_time_cb, 1000, 0);
}
else {
u3_lo_open();
sam_u->law_w = time(0);
{
u3v_plan
(u3nt(u3_blip, c3__ames, u3_nul),
u3nc(c3__wake, u3_nul));
}
u3_lo_shut(c3n);
}
u3_lo_shut(c3n);
}
/* _ames_recv_cb(): receive callback.
@ -376,35 +387,31 @@ _ames_recv_cb(uv_udp_t* wax_u,
}
}
/* u3_ames_io_init(): initialize ames I/O.
/* _ames_io_start(): initialize ames I/O.
*/
void
u3_ames_io_init()
static void
_ames_io_start()
{
u3_ames* sam_u = &u3_Host.sam_u;
c3_s por_s;
c3_s por_s = u3_Host.ops_u.por_s;
u3_noun rac = u3do("clan:title", u3k(u3A->own));
por_s = u3_Host.ops_u.por_s;
if ( 0 != u3_Host.ops_u.imp_c ) {
u3_noun imp = u3i_string(u3_Host.ops_u.imp_c);
u3_noun num = u3dc("slaw", 'p', imp);
c3_y num_y;
if ( c3__czar == rac ) {
u3_noun imp = u3dc("scot", 'p', u3k(u3A->own));
c3_c* imp_c = u3r_string(imp);
c3_y num_y = u3r_byte(0, u3A->own);
if ( c3n == u3du(num) ) {
uL(fprintf(uH, "malformed emperor: %s\n", u3_Host.ops_u.imp_c));
exit(1);
}
num_y = u3r_byte(0, u3t(num));
por_s = _ames_czar_port(num_y);
if ( c3y == u3_Host.ops_u.net ) {
uL(fprintf(uH, "ames: czar: %s on %d\n", u3_Host.ops_u.imp_c, por_s));
uL(fprintf(uH, "ames: czar: %s on %d\n", imp_c, por_s));
}
else {
uL(fprintf(uH, "ames: czar: %s on %d (localhost only)\n",
u3_Host.ops_u.imp_c, por_s));
uL(fprintf(uH, "ames: czar: %s on %d (localhost only)\n", imp_c, por_s));
}
u3z(num);
u3z(imp);
free(imp_c);
}
int ret;
@ -442,10 +449,103 @@ u3_ames_io_init()
sam_u->por_s = ntohs(add_u.sin_port);
}
// Timer too.
{
uv_timer_init(u3L, &sam_u->tim_u);
// uL(fprintf(uH, "ames: on localhost, UDP %d.\n", sam_u->por_s));
uv_udp_recv_start(&sam_u->wax_u, _ames_alloc, _ames_recv_cb);
sam_u->liv = c3y;
u3z(rac);
}
/* _cttp_mcut_char(): measure/cut character.
*/
static c3_w
_cttp_mcut_char(c3_c* buf_c, c3_w len_w, c3_c chr_c)
{
if ( buf_c ) {
buf_c[len_w] = chr_c;
}
return len_w + 1;
}
/* _cttp_mcut_cord(): measure/cut cord.
*/
static c3_w
_cttp_mcut_cord(c3_c* buf_c, c3_w len_w, u3_noun san)
{
c3_w ten_w = u3r_met(3, san);
if ( buf_c ) {
u3r_bytes(0, ten_w, (c3_y *)(buf_c + len_w), san);
}
u3z(san);
return (len_w + ten_w);
}
/* _cttp_mcut_path(): measure/cut cord list.
*/
static c3_w
_cttp_mcut_path(c3_c* buf_c, c3_w len_w, c3_c sep_c, u3_noun pax)
{
u3_noun axp = pax;
while ( u3_nul != axp ) {
u3_noun h_axp = u3h(axp);
len_w = _cttp_mcut_cord(buf_c, len_w, u3k(h_axp));
axp = u3t(axp);
if ( u3_nul != axp ) {
len_w = _cttp_mcut_char(buf_c, len_w, sep_c);
}
}
u3z(pax);
return len_w;
}
/* _cttp_mcut_host(): measure/cut host.
*/
static c3_w
_cttp_mcut_host(c3_c* buf_c, c3_w len_w, u3_noun hot)
{
len_w = _cttp_mcut_path(buf_c, len_w, '.', u3kb_flop(u3k(hot)));
u3z(hot);
return len_w;
}
/* u3_ames_ef_turf(): initialize ames I/O on domain(s).
*/
void
u3_ames_ef_turf(u3_noun tuf)
{
if ( u3_nul != tuf ) {
// XX save all for fallback, not just first
u3_noun hot = u3k(u3h(tuf));
c3_w len_w = _cttp_mcut_host(0, 0, u3k(hot));
u3_Host.sam_u.dns_c = c3_malloc(1 + len_w);
_cttp_mcut_host(u3_Host.sam_u.dns_c, 0, hot);
u3_Host.sam_u.dns_c[len_w] = 0;
u3z(tuf);
}
else if ( (c3n == u3A->fak) && (0 == u3_Host.sam_u.dns_c) ) {
uL(fprintf(uH, "ames: turf: no domains\n"));
}
if ( c3n == u3_Host.sam_u.liv ) {
_ames_io_start();
}
}
/* u3_ames_io_init(): initialize ames I/O.
*/
void
u3_ames_io_init()
{
u3_ames* sam_u = &u3_Host.sam_u;
sam_u->liv = c3n;
uv_timer_init(u3L, &sam_u->tim_u);
}
/* u3_ames_io_talk(): start receiving ames traffic.
@ -453,10 +553,6 @@ u3_ames_io_init()
void
u3_ames_io_talk()
{
u3_ames* sam_u = &u3_Host.sam_u;
uL(fprintf(uH, "ames: on localhost, UDP %d.\n", sam_u->por_s));
uv_udp_recv_start(&sam_u->wax_u, _ames_alloc, _ames_recv_cb);
}
/* u3_ames_io_exit(): terminate ames I/O.
@ -466,8 +562,12 @@ u3_ames_io_exit()
{
u3_ames* sam_u = &u3_Host.sam_u;
// XX close wax_u instead
uv_close(&sam_u->had_u, 0);
uv_close((uv_handle_t*)&sam_u->tim_u, 0);
if ( c3y == sam_u->liv ) {
// XX remove had_u/wax_u union, cast and close wax_u
uv_close(&sam_u->had_u, 0);
}
}
/* u3_ames_io_poll(): update ames IO state.

View File

@ -463,7 +463,7 @@ _http_rec_accept(h2o_handler_t* han_u, h2o_req_t* rec_u)
req_u->tim_u = c3_malloc(sizeof(*req_u->tim_u));
req_u->tim_u->data = req_u;
uv_timer_init(u3L, req_u->tim_u);
uv_timer_start(req_u->tim_u, _http_req_timer_cb, 30 * 1000, 0);
uv_timer_start(req_u->tim_u, _http_req_timer_cb, 300 * 1000, 0);
_http_req_dispatch(req_u, req);
@ -1231,13 +1231,17 @@ _http_release_ports_file(c3_c *pax_c)
free(paf_c);
}
/* _http_czar_host(): galaxy hostname as (unit host:eyre)
*/
static u3_noun
_http_czar_host(void)
{
u3_noun dom = u3_nul;
return dom;
// XX revisit
#if 0
if ( (0 == u3_Host.ops_u.imp_c) || (c3n == u3_Host.ops_u.net) ) {
return dom;
}
@ -1281,6 +1285,7 @@ _http_czar_host(void)
dom = u3nc(u3i_string(u3_Host.ops_u.imp_c + 1), u3kb_flop(u3k(dom)));
return u3nt(u3_nul, c3y, u3kb_flop(u3k(dom)));
#endif
}
/* u3_http_ef_bake(): notify %eyre that we're live
@ -1401,7 +1406,7 @@ _http_serv_start_all(void)
htp_u = _http_serv_new(por_s, c3y, c3n);
htp_u->h2o_u = _http_serv_init_h2o(u3_Host.tls_u, for_u->log, for_u->red);
if ( (c3y == for_u->pro) || (c3y == u3_Host.ops_u.fak) ) {
if ( c3y == for_u->pro ) {
htp_u->rox_u = _proxy_serv_new(htp_u, 443, c3y);
}
@ -1416,7 +1421,7 @@ _http_serv_start_all(void)
htp_u = _http_serv_new(por_s, c3n, c3n);
htp_u->h2o_u = _http_serv_init_h2o(0, for_u->log, for_u->red);
if ( (c3y == for_u->pro) || (c3y == u3_Host.ops_u.fak) ) {
if ( c3y == for_u->pro ) {
htp_u->rox_u = _proxy_serv_new(htp_u, 80, c3n);
}
@ -2323,7 +2328,7 @@ _proxy_ward_start(u3_pcon* con_u, u3_noun sip)
uv_timer_init(u3L, &rev_u->tim_u);
// XX how long?
uv_timer_start(&rev_u->tim_u, _proxy_ward_timer_cb, 120 * 1000, 0);
uv_timer_start(&rev_u->tim_u, _proxy_ward_timer_cb, 300 * 1000, 0);
// XX u3_lo_shut(c3y);
}
@ -2424,12 +2429,15 @@ _proxy_ward_resolve(u3_warc* cli_u)
hin_u.ai_protocol = IPPROTO_TCP;
if ( 0 == cli_u->hot_c ) {
// XX revisit
c3_assert( 0 != u3_Host.sam_u.dns_c );
u3_noun sip = u3dc("scot", 'p', u3k(cli_u->sip));
c3_c* sip_c = u3r_string(sip);
c3_w len_w = 1 + strlen(sip_c) + strlen(u3_Host.ops_u.dns_c);
c3_w len_w = 1 + strlen(sip_c) + strlen(u3_Host.sam_u.dns_c);
cli_u->hot_c = c3_malloc(len_w);
// incremented to skip '~'
snprintf(cli_u->hot_c, len_w, "%s.%s", sip_c + 1, u3_Host.ops_u.dns_c);
snprintf(cli_u->hot_c, len_w, "%s.%s", sip_c + 1, u3_Host.sam_u.dns_c);
free(sip_c);
u3z(sip);
@ -2541,11 +2549,14 @@ _proxy_parse_ship(c3_c* hot_c)
return sip;
}
// XX revisit
c3_assert( 0 != u3_Host.sam_u.dns_c );
c3_w dif_w = dom_c - hot_c;
c3_w dns_w = strlen(u3_Host.ops_u.dns_c);
c3_w dns_w = strlen(u3_Host.sam_u.dns_c);
if ( (dns_w != strlen(hot_c) - (dif_w + 1)) ||
(0 != strncmp(dom_c + 1, u3_Host.ops_u.dns_c, dns_w)) ) {
(0 != strncmp(dom_c + 1, u3_Host.sam_u.dns_c, dns_w)) ) {
return sip;
}
@ -2571,25 +2582,16 @@ _proxy_dest(u3_pcon* con_u, u3_noun sip)
_proxy_loop_connect(con_u);
}
else {
u3_noun hip = u3k(u3t(sip));
u3_noun own = u3A->own;
c3_o our = c3n;
u3_noun hip = u3t(sip);
while ( u3_nul != own ) {
if ( c3y == u3r_sing(hip, u3h(own)) ) {
our = c3y;
break;
}
own = u3t(own);
}
if ( c3y == our ) {
if ( c3y == u3r_sing(u3A->own, hip) ) {
_proxy_loop_connect(con_u);
}
else {
// XX check if (sein:title sip) == our
// XX check will
_proxy_ward_start(con_u, hip);
// XX extract bytes from hip, this could leak
_proxy_ward_start(con_u, u3k(hip));
}
}
@ -2852,6 +2854,7 @@ u3_http_ef_that(u3_noun tat)
return;
}
// XX extract bytes from sip, this could leak
cli_u = _proxy_warc_new(htp_u, (u3_atom)sip, (c3_s)por, (c3_o)sec);
// XX add to constructor

View File

@ -667,6 +667,10 @@ u3_lo_lead(void)
// Further server configuration.
//
{
if ( c3n == u3_Host.ops_u.nuu ) {
u3_ames_ef_bake();
}
u3_http_ef_bake();
}
@ -685,9 +689,6 @@ u3_lo_lead(void)
#endif
if ( c3y == u3_Host.ops_u.nuu ) {
if ( u3_Host.ops_u.who_c ) {
u3_term_ef_ticket(u3_Host.ops_u.who_c, u3_Host.ops_u.tic_c);
}
u3_term_ef_boil(1);
}

View File

@ -77,7 +77,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.bat = c3n;
u3_Host.ops_u.dem = c3n;
u3_Host.ops_u.dry = c3n;
u3_Host.ops_u.fak = c3n;
u3_Host.ops_u.etn = c3n;
u3_Host.ops_u.fog = c3n;
u3_Host.ops_u.gab = c3n;
u3_Host.ops_u.git = c3n;
@ -92,7 +92,7 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.veb = c3n;
u3_Host.ops_u.kno_w = DefaultKernel;
while ( (ch_i=getopt(argc, argv,"G:B:A:H:I:w:u:t:f:k:l:n:p:r:NabcdgqsvxFMPDXRS")) != -1 ) {
while ( (ch_i=getopt(argc, argv,"G:B:K:A:w:u:e:E:f:F:k:l:n:p:r:NabcdgqstvxMPDXRS")) != -1 ) {
switch ( ch_i ) {
case 'M': {
u3_Host.ops_u.mem = c3y;
@ -110,12 +110,16 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.arv_c = strdup(optarg);
break;
}
case 'H': {
u3_Host.ops_u.dns_c = strdup(optarg);
case 'e': {
u3_Host.ops_u.eth_c = strdup(optarg);
break;
}
case 'I': {
u3_Host.ops_u.imp_c = _main_presig(optarg);
case 'E': {
u3_Host.ops_u.ets_c = strdup(optarg);
break;
}
case 'F': {
u3_Host.ops_u.fak_c = _main_presig(optarg);
break;
}
case 'w': {
@ -127,10 +131,6 @@ _main_getopt(c3_i argc, c3_c** argv)
u3_Host.ops_u.url_c = strdup(optarg);
break;
}
case 't': {
u3_Host.ops_u.tic_c = _main_presig(optarg);
break;
}
case 'x': {
u3_Host.ops_u.tex = c3y;
break;
@ -145,12 +145,16 @@ _main_getopt(c3_i argc, c3_c** argv)
}
break;
}
case 'k': {
case 'K': {
if ( c3n == _main_readw(optarg, 256, &u3_Host.ops_u.kno_w) ) {
return c3n;
}
break;
}
case 'k': {
u3_Host.ops_u.key_c = strdup(optarg);
break;
}
case 'l': {
if ( c3n == _main_readw(optarg, 65536, &arg_w) ) {
return c3n;
@ -176,7 +180,6 @@ _main_getopt(c3_i argc, c3_c** argv)
return c3y;
}
case 'N': { u3_Host.ops_u.net = c3y; break; }
case 'F': { u3_Host.ops_u.fak = c3y; break; }
case 'a': { u3_Host.ops_u.abo = c3y; break; }
case 'b': { u3_Host.ops_u.bat = c3y; break; }
case 'c': { u3_Host.ops_u.nuu = c3y; break; }
@ -188,42 +191,66 @@ _main_getopt(c3_i argc, c3_c** argv)
case 'v': { u3_Host.ops_u.veb = c3y; break; }
case 's': { u3_Host.ops_u.git = c3y; break; }
case 'S': { u3_Host.ops_u.has = c3y; break; }
case 't': { u3_Host.ops_u.etn = c3y; break; }
case '?': default: {
return c3n;
}
}
}
if ( u3_Host.ops_u.fak == c3n && u3_Host.ops_u.net == c3y ) {
fprintf(stderr, "-N only makes sense with -F\n");
if ( 0 != u3_Host.ops_u.fak_c ) {
if ( 28 < strlen(u3_Host.ops_u.fak_c) ) {
fprintf(stderr, "fake comets are disallowed\r\n");
return c3n;
}
u3_Host.ops_u.who_c = strdup(u3_Host.ops_u.fak_c);
}
c3_t imp_t = ( (0 != u3_Host.ops_u.who_c) && (4 == strlen(u3_Host.ops_u.who_c)) );
if ( (0 != u3_Host.ops_u.fak_c) && (c3n == u3_Host.ops_u.nuu) ) {
fprintf(stderr, "-F only makes sense on initial boot\n");
return c3n;
} else if ( u3_Host.ops_u.fak == c3n && u3_Host.ops_u.net == c3n ) {
}
// XX revisit
if ( (0 == u3_Host.ops_u.fak_c) && (c3y == u3_Host.ops_u.net) ) {
// fprintf(stderr, "-N only makes sense with -F\n");
u3_Host.ops_u.net = c3n;
} else if ( (0 == u3_Host.ops_u.fak_c) && (c3n == u3_Host.ops_u.net) ) {
u3_Host.ops_u.net = c3y; /* remote networking is always on in real mode. */
}
if ( u3_Host.ops_u.arv_c != 0 && ( u3_Host.ops_u.imp_c == 0 ||
u3_Host.ops_u.nuu == c3n ) ) {
if ( 0 != u3_Host.ops_u.fak_c ) {
u3_Host.ops_u.has = c3y; /* no battery hashing on fake ships. */
}
if ( u3_Host.ops_u.arv_c != 0 && !imp_t ) {
fprintf(stderr, "-A only makes sense when creating a new galaxy\n");
return c3n;
}
if ( u3_Host.ops_u.imp_c != 0 &&
u3_Host.ops_u.arv_c == 0 &&
u3_Host.ops_u.nuu == c3y ) {
if ( u3_Host.ops_u.ets_c == 0 && c3y == u3_Host.ops_u.etn ) {
fprintf(stderr, "can't trust Ethereum snapshot without specifying "
"snapshot with -E\n");
return c3n;
}
if ( (0 == u3_Host.ops_u.fak_c) && (0 == u3_Host.ops_u.eth_c) && imp_t ) {
fprintf(stderr, "can't create a new galaxy without specifying "
"the Ethereum gateway with -e\n");
return c3n;
}
if ( u3_Host.ops_u.arv_c == 0 && imp_t ) {
fprintf(stderr, "can't create a new galaxy without specifying "
"the initial sync path with -A\n");
return c3n;
}
if ( u3_Host.ops_u.gen_c != 0 && ( u3_Host.ops_u.imp_c == 0 ||
u3_Host.ops_u.nuu == c3n ) ) {
fprintf(stderr, "-G only makes sense when creating a new galaxy\n");
return c3n;
}
if ( u3_Host.ops_u.tic_c != 0 && ( u3_Host.ops_u.imp_c != 0 ||
u3_Host.ops_u.nuu == c3n ) ) {
fprintf(stderr, "-t only makes sense when creating a new non-galaxy\n");
if ( u3_Host.ops_u.gen_c != 0 && u3_Host.ops_u.nuu == c3n ) {
fprintf(stderr, "-G only makes sense when bootstrapping a new instance\n");
return c3n;
}
@ -232,13 +259,6 @@ _main_getopt(c3_i argc, c3_c** argv)
return c3n;
}
if ( u3_Host.ops_u.tic_c == 0 && u3_Host.ops_u.who_c != 0 ) {
c3_c tic_c[29];
printf("your ticket: ~");
scanf("%28s",tic_c);
u3_Host.ops_u.tic_c = _main_presig(tic_c);
}
if ( c3y == u3_Host.ops_u.bat ) {
u3_Host.ops_u.dem = c3y;
u3_Host.ops_u.nuu = c3y;
@ -249,6 +269,11 @@ _main_getopt(c3_i argc, c3_c** argv)
return c3n;
}
if ( u3_Host.ops_u.nuu != c3y && u3_Host.ops_u.key_c != 0) {
fprintf(stderr, "-k only makes sense when bootstrapping a new instance\n");
return c3n;
}
if ( u3_Host.ops_u.nuu != c3y && u3_Host.ops_u.url_c != 0 ) {
fprintf(stderr, "-u only makes sense when bootstrapping a new instance\n");
return c3n;
@ -267,10 +292,6 @@ _main_getopt(c3_i argc, c3_c** argv)
return c3n;
}
if ( u3_Host.ops_u.dns_c == 0 ) {
u3_Host.ops_u.dns_c = "urbit.org";
}
if ( u3_Host.ops_u.pil_c != 0 ) {
struct stat s;
if ( stat(u3_Host.ops_u.pil_c, &s) != 0 ) {
@ -279,6 +300,14 @@ _main_getopt(c3_i argc, c3_c** argv)
}
}
if ( u3_Host.ops_u.key_c != 0 ) {
struct stat s;
if ( stat(u3_Host.ops_u.key_c, &s) != 0 ) {
fprintf(stderr, "keyfile %s not found\n", u3_Host.ops_u.key_c);
return c3n;
}
}
if ( u3_Host.ops_u.nam_c == 0 ) {
u3_Host.ops_u.nam_c = getenv("HOSTNAME");
if ( u3_Host.ops_u.nam_c == 0 ) {
@ -332,32 +361,32 @@ u3_ve_usage(c3_i argc, c3_c** argv)
"-c pier Create a new urbit in pier/\n",
"-d Daemon mode\n",
"-D Recompute from events\n",
"-F Fake keys; also disables networking\n",
"-e url Ethereum gateway\n",
"-F ship Fake keys; also disables networking\n",
"-f Fuzz testing\n",
"-g Set GC flag\n",
"-H domain Set ames bootstrap domain (default urbit.org)\n",
"-I galaxy Start as ~galaxy\n",
"-k stage Start at Hoon kernel version stage\n",
"-K stage Start at Hoon kernel version stage\n",
"-k keys Private key file\n",
"-l port Initial peer port\n",
"-M Memory madness\n",
"-n host Set unix hostname\n",
"-N Enable networking in fake mode (-F)\n",
"-p ames_port Set the HTTP port to bind to\n",
"-p ames_port Set the ames port to bind to\n",
"-P Profiling\n",
"-q Quiet\n",
"-r host Initial peer address\n",
"-R Report urbit build info\n",
"-s Pill URL from arvo git hash\n",
"-t ticket Use ~ticket automatically\n",
"-S Disable battery hashing\n",
"-u url URL from which to download pill\n",
"-v Verbose\n",
"-w name Immediately upgrade to ~name\n",
"-w name Boot as ~name\n",
"-x Exit immediately\n",
"-Xwtf Skip last event\n",
"\n",
"Development Usage:\n",
" To create a development ship, use a fakezod:\n",
" %s -FI zod -A /path/to/arvo/folder -B /path/to/pill -c zod\n",
" %s -F zod -A /path/to/arvo/folder -B /path/to/pill -c zod\n",
"\n",
" For more information about developing on urbit, see:\n",
" https://github.com/urbit/urbit/blob/master/CONTRIBUTING.md\n",

View File

@ -100,13 +100,9 @@ _reck_kick_term(u3_noun pox, c3_l tid_l, u3_noun fav)
case c3__init: p_fav = u3t(fav);
{
u3A->own = u3nc(u3k(p_fav), u3A->own);
c3_assert( c3y == u3r_sing(u3A->own, p_fav) );
u3_noun hox = u3dc("scot", 'p', u3k(p_fav));
c3_c* nam_c = u3r_string(hox);
// uL(fprintf(uH, "kick: init: %s\n", nam_c));
free(nam_c); u3z(pox); u3z(hox); u3z(fav); return c3y;
u3z(pox); u3z(fav); return c3y;
} break;
case c3__mass: p_fav = u3t(fav);
@ -199,6 +195,8 @@ _reck_kick_sync(u3_noun pox, u3_noun fav)
u3z(pox); u3z(fav); return c3n;
}
/* _reck_kick_newt(): apply packet network outputs.
*/
static u3_noun
_reck_kick_newt(u3_noun pox, u3_noun fav)
{
@ -211,24 +209,9 @@ _reck_kick_newt(u3_noun pox, u3_noun fav)
u3_ames_ef_send(lan, pac);
u3z(pox); u3z(fav); return c3y;
} break;
}
u3z(pox); u3z(fav); return c3n;
}
/* _reck_kick_ames(): apply packet network outputs.
*/
static u3_noun
_reck_kick_ames(u3_noun pox, u3_noun fav)
{
u3_noun p_fav;
switch ( u3h(fav) ) {
default: break;
case c3__init: p_fav = u3t(fav);
{
u3A->own = u3nc(u3k(p_fav), u3A->own);
// uL(fprintf(uH, "kick: init: %d\n", p_fav));
case c3__turf: {
u3_ames_ef_turf(u3k(u3t(fav)));
u3z(pox); u3z(fav); return c3y;
} break;
}
@ -304,23 +287,6 @@ _reck_kick_spec(u3_noun pox, u3_noun fav)
return _reck_kick_newt(pox, fav);
} break;
case c3__ames: {
if ( (u3_nul != tt_pox) ) {
u3z(pox); u3z(fav); return c3n;
}
else {
return _reck_kick_ames(pox, fav);
}
} break;
case c3__init: p_fav = u3t(fav);
{
u3A->own = u3nc(u3k(p_fav), u3A->own);
// uL(fprintf(uH, "kick: init: %d\n", p_fav));
u3z(pox); u3z(fav); return c3y;
} break;
case c3__term: {
u3_noun pud = tt_pox;
u3_noun p_pud, q_pud;

View File

@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <curl/curl.h>
#include <uv.h>
#include "all.h"
@ -260,9 +261,12 @@ _sist_sing(u3_noun ovo)
u3_noun fex = u3h(vir);
u3_noun fav = u3t(fex);
if ( (c3__init == u3h(fav)) || (c3__inuk == u3h(fav)) ) {
u3A->own = u3nc(u3k(u3t(fav)), u3A->own);
if ( c3__init == u3h(fav) ) {
u3A->own = u3k(u3t(fav));
// note: c3__boot == u3h(u3t(ovo))
u3A->fak = ( c3__fake == u3h(u3t(u3t(ovo))) ) ? c3y : c3n;
}
vir = u3t(vir);
}
u3z(nug);
@ -273,21 +277,6 @@ _sist_sing(u3_noun ovo)
}
}
/* _sist_home(): remains of "create ship directory" after refactor to u3m_boot().
*/
static void
_sist_home()
{
#if 1
// Copy zod files, if we're generating a carrier.
//
if ( u3_Host.ops_u.imp_c ) {
u3_unix_ef_initial_into();
}
#endif
}
/* _sist_cask(): ask for a passcode.
*/
static u3_noun
@ -295,14 +284,28 @@ _sist_cask(c3_c* dir_c, u3_noun nun)
{
c3_c paw_c[60];
u3_noun key;
u3_utty* uty_u = calloc(1, sizeof(u3_utty));
uty_u->fid_i = 0;
uH;
// disable terminal echo when typing in passcode
if ( 0 != tcgetattr(uty_u->fid_i, &uty_u->bak_u) ) {
c3_assert(!"init-tcgetattr");
}
uty_u->raw_u = uty_u->bak_u;
uty_u->raw_u.c_lflag &= ~ECHO;
if ( 0 != tcsetattr(uty_u->fid_i, TCSADRAIN, &uty_u->raw_u) ) {
c3_assert(!"init-tcsetattr");
}
while ( 1 ) {
printf("passcode for %s%s? ~", dir_c, (c3y == nun) ? " [none]" : "");
paw_c[0] = 0;
c3_fpurge(stdin);
fgets(paw_c, 59, stdin);
printf("\n");
if ( '\n' == paw_c[0] ) {
if ( c3y == nun ) {
@ -334,6 +337,10 @@ _sist_cask(c3_c* dir_c, u3_noun nun)
break;
}
}
if ( 0 != tcsetattr(uty_u->fid_i, TCSADRAIN, &uty_u->bak_u) ) {
c3_assert(!"init-tcsetattr");
}
free(uty_u);
uL(0);
return key;
}
@ -514,10 +521,6 @@ _sist_zest()
c3_c ful_c[8193];
c3_l sal_l;
// Create the ship directory.
//
_sist_home();
// Create the record file.
{
c3_i pig_i = O_CREAT | O_WRONLY | O_EXCL;
@ -593,23 +596,6 @@ _sist_zest()
u3_raft_work();
}
/* _sist_make(): boot from scratch.
*/
static void
_sist_make(u3_noun fav)
{
// Initialize ames
u3_ames_ef_bake();
// Authenticate and initialize terminal.
//
u3_term_ef_bake(fav);
// Create the ship directory.
//
_sist_zest();
}
/* _sist_rest_nuu(): upgrade log from previous format.
*/
static void
@ -1061,7 +1047,7 @@ _sist_rest()
}
u3z(rou);
}
uL(fprintf(stderr, "\n---------------- playback complete----------------\n"));
uL(fprintf(stderr, "\n---------------- playback complete----------------\r\n"));
#if 0
// If you see this error, your record is totally fscking broken!
@ -1154,10 +1140,343 @@ _sist_rest()
}
}
/* _sist_curl_alloc(): allocate a response buffer for curl
*/
static size_t
_sist_curl_alloc(void* dat_v, size_t uni_t, size_t mem_t, uv_buf_t* buf_u)
{
size_t siz_t = uni_t * mem_t;
buf_u->base = realloc(buf_u->base, 1 + siz_t + buf_u->len);
if ( 0 == buf_u->base ) {
fprintf(stderr, "out of memory\n");
u3_lo_bail();
}
memcpy(buf_u->base + buf_u->len, dat_v, siz_t);
buf_u->len += siz_t;
buf_u->base[buf_u->len] = 0;
return siz_t;
}
/* _sist_post_json(): POST JSON to url_c
*/
static uv_buf_t
_sist_post_json(c3_c* url_c, uv_buf_t lod_u)
{
CURL *curl;
CURLcode result;
long cod_l;
struct curl_slist* hed_u = 0;
uv_buf_t buf_u = uv_buf_init(c3_malloc(1), 0);
if ( !(curl = curl_easy_init()) ) {
fprintf(stderr, "failed to initialize libcurl\n");
u3_lo_bail();
}
hed_u = curl_slist_append(hed_u, "Accept: application/json");
hed_u = curl_slist_append(hed_u, "Content-Type: application/json");
hed_u = curl_slist_append(hed_u, "charsets: utf-8");
// XX require TLS, pin default cert?
curl_easy_setopt(curl, CURLOPT_URL, url_c);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, _sist_curl_alloc);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&buf_u);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, hed_u);
// note: must be terminated!
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, lod_u.base);
result = curl_easy_perform(curl);
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &cod_l);
// XX retry?
if ( CURLE_OK != result ) {
fprintf(stderr, "failed to fetch %s: %s\n",
url_c, curl_easy_strerror(result));
u3_lo_bail();
}
if ( 300 <= cod_l ) {
fprintf(stderr, "error fetching %s: HTTP %ld\n", url_c, cod_l);
u3_lo_bail();
}
curl_easy_cleanup(curl);
curl_slist_free_all(hed_u);
return buf_u;
}
/* _sist_oct_to_buf(): +octs to uv_buf_t
*/
static uv_buf_t
_sist_oct_to_buf(u3_noun oct)
{
if ( c3n == u3a_is_cat(u3h(oct)) ) {
u3_lo_bail();
}
c3_w len_w = u3h(oct);
c3_y* buf_y = c3_malloc(1 + len_w);
buf_y[len_w] = 0;
u3r_bytes(0, len_w, buf_y, u3t(oct));
u3z(oct);
return uv_buf_init((void*)buf_y, len_w);
}
/* _sist_buf_to_oct(): uv_buf_t to +octs
*/
static u3_noun
_sist_buf_to_oct(uv_buf_t buf_u)
{
u3_noun len = u3i_words(1, (c3_w*)&buf_u.len);
if ( c3n == u3a_is_cat(len) ) {
u3_lo_bail();
}
return u3nc(len, u3i_bytes(buf_u.len, (const c3_y*)buf_u.base));
}
/* _sist_eth_rpc(): ethereum JSON RPC with request/response as +octs
*/
static u3_noun
_sist_eth_rpc(c3_c* url_c, u3_noun oct)
{
return _sist_buf_to_oct(_sist_post_json(url_c, _sist_oct_to_buf(oct)));
}
/* _sist_dawn_fail(): pre-boot validation failed
*/
static void
_sist_dawn_fail(u3_noun who, u3_noun rac, u3_noun sas)
{
u3_noun how = u3dc("scot", 'p', u3k(who));
c3_c* how_c = u3r_string(u3k(how));
c3_c* rac_c;
switch (rac) {
default: c3_assert(0);
case c3__czar: {
rac_c = "galaxy";
break;
}
case c3__king: {
rac_c = "star";
break;
}
case c3__duke: {
rac_c = "planet";
break;
}
case c3__earl: {
rac_c = "moon";
break;
}
case c3__pawn: {
rac_c = "comet";
break;
}
}
fprintf(stderr, "dawn: invalid keys for %s '%s'\r\n", rac_c, how_c);
// XX deconstruct sas, print helpful error messages
u3m_p("pre-boot error", u3t(sas));
u3z(how);
free(how_c);
u3_lo_bail();
}
/* _sist_dawn(): produce %dawn boot card - validate keys and query contract
*/
static u3_noun
_sist_dawn(u3_noun sed)
{
u3_noun url, bok, pon, zar, tuf, sap;
u3_noun who = u3h(sed);
u3_noun rac = u3do("clan:title", u3k(who));
// load snapshot if exists
if ( 0 != u3_Host.ops_u.ets_c ) {
fprintf(stderr, "boot: loading ethereum snapshot\r\n");
u3_noun raw_snap = u3ke_cue(u3m_file(u3_Host.ops_u.ets_c));
sap = u3nc(u3_nul, raw_snap);
}
else {
sap = u3_nul;
}
// ethereum gateway as (unit purl)
if ( 0 == u3_Host.ops_u.eth_c ) {
if ( c3__czar == rac ) {
fprintf(stderr, "boot: galaxy requires ethereum gateway via -e\r\n");
// bails, won't return
u3_lo_bail();
return u3_none;
}
url = u3_nul;
}
else {
u3_noun par = u3v_wish("auru:de-purl:html");
u3_noun lur = u3i_string(u3_Host.ops_u.eth_c);
u3_noun rul = u3dc("rush", u3k(lur), u3k(par));
if ( u3_nul == rul ) {
if ( c3__czar == rac ) {
fprintf(stderr, "boot: galaxy requires ethereum gateway via -e\r\n");
// bails, won't return
u3_lo_bail();
return u3_none;
}
url = u3_nul;
}
else {
// auru:de-purl:html parses to (pair user purl)
// we need (unit purl)
// (we're using it to avoid the +hoke weirdness)
// XX revisit upon merging with release-candidate
url = u3nc(u3_nul, u3k(u3t(u3t(rul))));
}
u3z(par); u3z(lur); u3z(rul);
}
// XX require https?
c3_c* url_c = ( 0 != u3_Host.ops_u.eth_c ) ?
u3_Host.ops_u.eth_c :
"https://ropsten.infura.io/v3/196a7f37c7d54211b4a07904ec73ad87";
{
fprintf(stderr, "boot: retrieving latest block\r\n");
if ( c3y == u3_Host.ops_u.etn ) {
bok = u3do("bloq:snap:dawn", u3k(u3t(sap)));
}
else {
// @ud: block number
u3_noun oct = u3v_wish("bloq:give:dawn");
u3_noun kob = _sist_eth_rpc(url_c, u3k(oct));
bok = u3do("bloq:take:dawn", u3k(kob));
u3z(oct); u3z(kob);
}
}
{
// +hull:constitution:ethe: on-chain state
u3_noun hul;
if ( c3y == u3_Host.ops_u.etn ) {
hul = u3dc("hull:snap:dawn", u3k(who), u3k(u3t(sap)));
}
else {
if ( c3__pawn == rac ) {
// irrelevant, just bunt +hull
hul = u3v_wish("*hull:constitution:ethe");
}
else {
u3_noun oct;
if ( c3__earl == rac ) {
u3_noun seg = u3do("^sein:title", u3k(who));
u3_noun ges = u3dc("scot", 'p', u3k(seg));
c3_c* seg_c = u3r_string(ges);
fprintf(stderr, "boot: retrieving %s's public keys (for %s)\r\n",
seg_c, u3_Host.ops_u.who_c);
oct = u3dc("hull:give:dawn", u3k(bok), u3k(seg));
free(seg_c);
u3z(seg); u3z(ges);
}
else {
fprintf(stderr, "boot: retrieving %s's public keys\r\n",
u3_Host.ops_u.who_c);
oct = u3dc("hull:give:dawn", u3k(bok), u3k(who));
}
u3_noun luh = _sist_eth_rpc(url_c, u3k(oct));
hul = u3dc("hull:take:dawn", u3k(who), u3k(luh));
u3z(oct); u3z(luh);
}
}
// +live:dawn: network state
// XX actually make request
// u3_noun liv = _sist_get_json(parent, /some/url)
u3_noun liv = u3_nul;
fprintf(stderr, "boot: verifying keys\r\n");
// (each sponsor=(unit ship) error=@tas)
u3_noun sas = u3dt("veri:dawn", u3k(sed), u3k(hul), u3k(liv));
if ( c3n == u3h(sas) ) {
// bails, won't return
_sist_dawn_fail(who, rac, sas);
return u3_none;
}
// (unit ship): sponsor
// produced by +veri:dawn to avoid coupling to +hull structure
pon = u3k(u3t(sas));
u3z(hul); u3z(liv); u3z(sas);
}
{
if ( c3y == u3_Host.ops_u.etn ) {
zar = u3do("czar:snap:dawn", u3k(u3t(sap)));
tuf = u3do("turf:snap:dawn", u3k(u3t(sap)));
}
else {
{
fprintf(stderr, "boot: retrieving galaxy table\r\n");
// (map ship [=life =pass]): galaxy table
u3_noun oct = u3do("czar:give:dawn", u3k(bok));
u3_noun raz = _sist_eth_rpc(url_c, u3k(oct));
zar = u3do("czar:take:dawn", u3k(raz));
u3z(oct); u3z(raz);
}
{
fprintf(stderr, "boot: retrieving network domains\r\n");
// (list turf): ames domains
u3_noun oct = u3do("turf:give:dawn", u3k(bok));
u3_noun fut = _sist_eth_rpc(url_c, u3k(oct));
tuf = u3do("turf:take:dawn", u3k(fut));
u3z(oct); u3z(fut);
}
}
}
u3z(rac);
// [%dawn seed sponsor galaxies domains block eth-url snap]
return u3nc(c3__dawn, u3nq(sed, pon, zar, u3nq(tuf, bok, url, sap)));
}
/* _sist_zen(): get OS entropy.
*/
static u3_noun
_sist_zen()
_sist_zen(void)
{
c3_w rad_w[16];
@ -1165,62 +1484,186 @@ _sist_zen()
return u3i_words(16, rad_w);
}
/* _sist_come(): mine a comet.
*/
static u3_noun
_sist_come(void)
{
u3_noun tar, eny, sed;
// XX choose from list, at random, &c
tar = u3dc("slav", 'p', u3i_string("~marzod"));
eny = _sist_zen();
{
u3_noun sar = u3dc("scot", 'p', u3k(tar));
c3_c* tar_c = u3r_string(sar);
fprintf(stderr, "boot: mining a comet under %s\r\n", tar_c);
free(tar_c);
u3z(sar);
}
sed = u3dc("come:dawn", u3k(tar), u3k(eny));
{
u3_noun who = u3dc("scot", 'p', u3k(u3h(sed)));
c3_c* who_c = u3r_string(who);
fprintf(stderr, "boot: found comet %s\r\n", who_c);
free(who_c);
u3z(who);
}
u3z(tar); u3z(eny);
return sed;
}
/* sist_key(): parse a private key-file.
*/
static u3_noun
sist_key(u3_noun des)
{
u3_noun sed, who;
u3_noun eds = u3dc("slaw", c3__uw, u3k(des));
if ( u3_nul == eds ) {
c3_c* sed_c = u3r_string(des);
fprintf(stderr, "dawn: invalid private keys: %s\r\n", sed_c);
free(sed_c);
u3_lo_bail();
}
if ( 0 == u3_Host.ops_u.who_c ) {
fprintf(stderr, "dawn: -w required\r\n");
u3_lo_bail();
}
u3_noun woh = u3i_string(u3_Host.ops_u.who_c);
u3_noun whu = u3dc("slaw", 'p', u3k(woh));
if ( u3_nul == whu ) {
fprintf(stderr, "dawn: invalid ship specificed with -w %s\r\n",
u3_Host.ops_u.who_c);
u3_lo_bail();
}
// +seed:able:jael: private key file
sed = u3ke_cue(u3k(u3t(eds)));
who = u3h(sed);
if ( c3n == u3r_sing(who, u3t(whu)) ) {
u3_noun how = u3dc("scot", 'p', u3k(who));
c3_c* how_c = u3r_string(u3k(how));
fprintf(stderr, "dawn: mismatch between -w %s and -K %s\r\n",
u3_Host.ops_u.who_c, how_c);
u3z(how);
free(how_c);
u3_lo_bail();
}
u3z(woh); u3z(whu); u3z(des); u3z(eds);
return sed;
}
/* u3_sist_boot(): restore or create.
*/
void
u3_sist_boot(void)
{
// uL(fprintf(uH, "sist: booting\n"));
if ( c3n == u3_Host.ops_u.nuu ) {
_sist_rest();
if ( c3y == u3_Host.ops_u.nuu ) {
u3_noun pig = u3_none;
if ( c3y == u3A->fak ) {
c3_c* who_c = u3r_string(u3dc("scot", 'p', u3k(u3A->own)));
fprintf(stderr, "fake: %s\r\n", who_c);
free(who_c);
if ( 0 == u3_Host.ops_u.imp_c ) {
u3_noun ten = _sist_zen();
uL(fprintf(uH, "generating curve25519 key pair...\n"));
pig = u3nq(c3__make, u3_nul, 11, u3nc(ten, u3_Host.ops_u.fak));
// XX make conditional
u3_Host.ops_u.net = c3n;
}
else {
u3_noun imp = u3i_string(u3_Host.ops_u.imp_c);
u3_noun whu = u3dc("slaw", 'p', u3k(imp));
}
else {
u3_noun pig, who;
if ( 0 != u3_Host.ops_u.fak_c ) {
u3_noun whu = u3dc("slaw", 'p', u3i_string(u3_Host.ops_u.fak_c));
if ( (u3_nul == whu) ) {
fprintf(stderr, "czar: incorrect format\r\n");
fprintf(stderr, "fake: invalid ship: %s\r\n", u3_Host.ops_u.fak_c);
u3_lo_bail();
}
else {
u3_noun gen = u3_nul;
u3_noun gun = u3_nul;
if (c3n == u3_Host.ops_u.fak) {
if ( 0 != u3_Host.ops_u.gen_c) {
gen = u3i_string(u3_Host.ops_u.gen_c);
}
else {
gen = _sist_text("generator"); // XX move to main.c
}
gun = u3dc("slaw", c3__uw, gen);
u3_noun rac = u3do("clan:title", u3k(u3t(whu)));
if ( u3_nul == gun ) {
fprintf(stderr, "czar: incorrect format\r\n");
u3_lo_bail();
}
if ( c3__pawn == rac ) {
fprintf(stderr, "fake comets are disallowed\r\n");
u3_lo_bail();
}
else {
gun = u3nc(u3_nul, u3_nul);
}
pig = u3nq(c3__sith,
u3k(u3t(whu)),
u3k(u3t(gun)),
u3_Host.ops_u.fak);
u3z(whu); u3z(gun);
u3z(rac);
}
u3z(imp);
fprintf(stderr, "fake: %s\r\n", u3_Host.ops_u.fak_c);
u3A->fak = c3y;
who = u3k(u3t(whu));
pig = u3nc(c3__fake, u3k(who));
u3z(whu);
}
_sist_make(pig);
}
else {
_sist_rest();
else {
u3_noun sed;
if ( 0 != u3_Host.ops_u.key_c ) {
u3_noun des = u3m_file(u3_Host.ops_u.key_c);
sed = sist_key(des);
}
else if ( 0 != u3_Host.ops_u.gen_c ) {
u3_noun des = u3i_string(u3_Host.ops_u.gen_c);
sed = sist_key(des);
}
else {
sed = _sist_come();
}
u3A->fak = c3n;
pig = _sist_dawn(u3k(sed));
who = u3k(u3h(u3h(u3t(pig))));
u3z(sed);
}
u3A->own = who;
// initialize ames
{
u3_noun tuf = (c3y == u3A->fak) ? u3_nul : u3h(u3t(u3t(u3t(u3t(pig)))));
// with a fake event to bring up listeners and configure domains
u3_ames_ef_turf(u3k(tuf));
// and real effect to set the output duct
u3_ames_ef_bake();
}
// Authenticate and initialize terminal.
u3_term_ef_bake(pig);
// queue initial galaxy sync
{
u3_noun rac = u3do("clan:title", u3k(u3A->own));
if ( c3__czar == rac ) {
u3_unix_ef_initial_into();
}
u3z(rac);
}
// Create the event log
_sist_zest();
}
}

View File

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