mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-21 05:41:43 +03:00
Merge remote-tracking branch 'origin/release-candidate' into lighter-than-eyre
This commit is contained in:
commit
e0ea15f158
26
.travis.yml
26
.travis.yml
@ -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
2
.travis/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Don't show in diffs or auto-merge
|
||||
package-lock.json binary
|
1
.travis/.gitignore
vendored
Normal file
1
.travis/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules/
|
753
.travis/package-lock.json
generated
Normal file
753
.travis/package-lock.json
generated
Normal 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
14
.travis/package.json
Normal 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"
|
||||
}
|
||||
}
|
1
.travis/pin-arvo-commit.txt
Normal file
1
.travis/pin-arvo-commit.txt
Normal file
@ -0,0 +1 @@
|
||||
6deeb7dee9f3d47e4458fac3a0518dcde429ef73
|
35
.travis/test.js
Normal file
35
.travis/test.js
Normal 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);
|
||||
});
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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')
|
||||
|
@ -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*/
|
||||
|
@ -2,12 +2,6 @@
|
||||
**
|
||||
** This file is in the public domain.
|
||||
*/
|
||||
/** Options.
|
||||
**/
|
||||
/* U3_MEMORY_DEBUG: add debugging information to heap. Breaks image.
|
||||
*/
|
||||
# undef U3_MEMORY_DEBUG
|
||||
|
||||
/** Constants.
|
||||
**/
|
||||
/* u3a_bits: number of bits in word-addressed pointer. 29 == 2GB.
|
||||
@ -128,10 +122,17 @@
|
||||
} 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;
|
||||
@ -249,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.
|
||||
**/
|
||||
|
@ -141,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));
|
||||
|
@ -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`.
|
||||
|
@ -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,14 +50,25 @@
|
||||
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;
|
||||
|
||||
@ -61,6 +81,46 @@
|
||||
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,13 +133,22 @@
|
||||
/* 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.
|
||||
@ -96,11 +165,6 @@
|
||||
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);
|
||||
|
||||
/* u3j_kick(): try to kick by jet. If no kick, produce u3_none.
|
||||
**
|
||||
** `axe` is RETAINED by the caller; `cor` is RETAINED iff there
|
||||
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -2,12 +2,6 @@
|
||||
**
|
||||
** This file is in the public domain.
|
||||
*/
|
||||
/** Options.
|
||||
**/
|
||||
/* U3_CPU_DEBUG: activate profiling.
|
||||
*/
|
||||
# undef U3_CPU_DEBUG
|
||||
|
||||
/** Data structures.
|
||||
**/
|
||||
/* u3t_trace: fast execution flags.
|
||||
|
@ -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
|
||||
|
||||
|
@ -255,9 +255,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;
|
||||
@ -579,22 +581,24 @@
|
||||
*/
|
||||
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
|
||||
c3_o git; // -s, pill url from arvo git hash
|
||||
c3_o mem; // -M, memory madness
|
||||
c3_o net; // -N, remote networking in -F mode
|
||||
@ -861,11 +865,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 +942,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
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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,32 +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 = u3r_at(u3x_sam, b);
|
||||
|
||||
if ( c3n == u3du(zor) ) {
|
||||
return u3m_bail(c3__exit);
|
||||
}
|
||||
|
||||
u3_noun daz = u3n_slam_on(u3k(b), u3nc(gim, u3k(u3t(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)
|
||||
|
@ -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,8 +12,8 @@
|
||||
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;
|
||||
|
||||
if ( c3y == hoz ) {
|
||||
@ -32,6 +28,20 @@
|
||||
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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
18
jets/c/xeb.c
18
jets/c/xeb.c
@ -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)
|
||||
|
287
jets/e/jam.c
287
jets/e/jam.c
@ -3,185 +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_pair(u3_noun x, u3_noun d, u3_noun e)
|
||||
/* 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 r, p_d, q_d, r_d;
|
||||
u3x_trel(d, &p_d, &q_d, &r_d);
|
||||
{
|
||||
u3_noun y = u3qa_add(x, p_d);
|
||||
u3_noun p_e, q_e, r_e;
|
||||
|
||||
u3x_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(y);
|
||||
}
|
||||
u3z(x);
|
||||
u3z(d);
|
||||
u3z(e);
|
||||
return r;
|
||||
}
|
||||
|
||||
static u3_noun
|
||||
_jam_flat(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);
|
||||
u3z(l);
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
static u3_noun
|
||||
_jam_ptr(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);
|
||||
u3z(l);
|
||||
|
||||
return z;
|
||||
}
|
||||
|
||||
#define JAM_NONE 0
|
||||
#define JAM_HEAD 1
|
||||
#define JAM_TAIL 2
|
||||
|
||||
typedef struct {
|
||||
c3_y sat_y;
|
||||
u3_noun nun;
|
||||
u3_noun len;
|
||||
u3_noun lis;
|
||||
u3_noun hed;
|
||||
} jamframe;
|
||||
|
||||
static inline jamframe*
|
||||
_jam_push(c3_ys mov, c3_ys off)
|
||||
{
|
||||
u3R->cap_p += mov;
|
||||
return u3to(jamframe, u3R->cap_p + off);
|
||||
}
|
||||
|
||||
static inline jamframe*
|
||||
_jam_pop(c3_ys mov, c3_ys off)
|
||||
{
|
||||
u3R->cap_p -= mov;
|
||||
return u3to(jamframe, u3R->cap_p + off);
|
||||
}
|
||||
|
||||
static u3_noun
|
||||
_jam_cap(u3_atom a)
|
||||
{
|
||||
u3p(jamframe) empty = u3R->cap_p;
|
||||
u3p(u3h_root) har_p = u3h_new();
|
||||
c3_o nor_o = u3a_is_north(u3R);
|
||||
c3_y wis_y = c3_wiseof(jamframe);
|
||||
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 );
|
||||
jamframe* fam = _jam_push(mov, off);
|
||||
jamframe* don = u3to(jamframe, empty + off);
|
||||
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;
|
||||
|
||||
fam->sat_y = JAM_NONE;
|
||||
fam->nun = a;
|
||||
fam->len = 0;
|
||||
fam->lis = u3_nul;
|
||||
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;
|
||||
}
|
||||
buf_u.wor_w = u3a_walloc(len_w);
|
||||
buf_u.bit_w = 0;
|
||||
memset(buf_u.wor_w, 0, len_w * sizeof(c3_w));
|
||||
|
||||
u3_noun q, r = u3_none;
|
||||
u3R->cap_p += mov;
|
||||
top = u3to(u3_noun, u3R->cap_p + off);
|
||||
*top = a;
|
||||
|
||||
while ( don != fam ) {
|
||||
switch ( fam->sat_y ) {
|
||||
case JAM_NONE: {
|
||||
u3_noun nun = fam->nun;
|
||||
u3_noun len = fam->len;
|
||||
u3_noun lis = fam->lis;
|
||||
u3_weak got = u3h_get(har_p, nun);
|
||||
|
||||
if ( u3_none == got ) {
|
||||
u3h_put(har_p, nun, u3k(len));
|
||||
if ( c3n == u3du(nun) ) {
|
||||
r = _jam_flat(nun, lis);
|
||||
fam = _jam_pop(mov, off);
|
||||
u3z(len);
|
||||
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 {
|
||||
fam->sat_y = JAM_HEAD;
|
||||
fam = _jam_push(mov, off);
|
||||
fam->sat_y = JAM_NONE;
|
||||
fam->nun = u3h(nun);
|
||||
fam->len = u3qa_add(2, len);
|
||||
fam->lis = u3nc(u3nc(2, 1), lis);
|
||||
}
|
||||
if ( u3r_met(0, a) <= u3r_met(0, c) ) {
|
||||
_jam_buf_chop(&buf_u, 1, 0);
|
||||
_jam_buf_atom(&buf_u, a);
|
||||
}
|
||||
else {
|
||||
if ( c3y == u3ud(nun) && (u3r_met(0, nun) <= u3r_met(0, got)) ) {
|
||||
r = _jam_flat(nun, lis);
|
||||
_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 {
|
||||
r = _jam_ptr(got, lis);
|
||||
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);
|
||||
}
|
||||
fam = _jam_pop(mov, off);
|
||||
u3z(len);
|
||||
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);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case JAM_HEAD: {
|
||||
u3_noun p_r, q_r, r_r;
|
||||
u3x_trel(r, &p_r, &q_r, &r_r);
|
||||
u3_noun nun = fam->nun;
|
||||
fam->sat_y = JAM_TAIL;
|
||||
fam->hed = r;
|
||||
u3_noun z = u3qa_add(2, fam->len);
|
||||
fam = _jam_push(mov, off);
|
||||
fam->sat_y = JAM_NONE;
|
||||
fam->nun = u3t(nun);
|
||||
fam->len = u3qa_add(z, p_r);
|
||||
fam->lis = u3k(q_r);
|
||||
u3z(z);
|
||||
break;
|
||||
}
|
||||
case JAM_TAIL: {
|
||||
u3_noun len = fam->len;
|
||||
r = _jam_pair(u3qa_add(2, len), fam->hed, r);
|
||||
fam = _jam_pop(mov, off);
|
||||
u3z(len);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
c3_assert(0);
|
||||
return u3_none;
|
||||
}
|
||||
}
|
||||
|
||||
q = u3qb_flop(u3h(u3t(r)));
|
||||
u3z(r);
|
||||
r = u3qc_can(0, q);
|
||||
u3z(q);
|
||||
*bit_w = buf_u.bit_w;
|
||||
u3h_free(har_p);
|
||||
return r;
|
||||
return buf_u.wor_w;
|
||||
}
|
||||
|
||||
u3_noun
|
||||
u3qe_jam(u3_atom a)
|
||||
{
|
||||
return _jam_cap(a);
|
||||
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)
|
||||
|
@ -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,
|
||||
|
@ -992,7 +992,7 @@
|
||||
_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);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@
|
||||
u3qf_hike(u3_noun axe,
|
||||
u3_noun pac)
|
||||
{
|
||||
c3_assert(0);
|
||||
if ( (u3_nul == pac) ) {
|
||||
return u3nc(0, u3k(axe));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
u3_noun typ)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
|
||||
u3_noun ret = u3j_hook(u3k(von), "dune");
|
||||
u3_noun ret = u3j_cook("u3qfu_duck-dune", u3k(von), "dune");
|
||||
|
||||
u3z(von);
|
||||
return ret;
|
||||
@ -28,7 +28,7 @@
|
||||
u3_noun typ)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
|
||||
u3_noun duq = u3j_hook(u3k(von), "dunk");
|
||||
u3_noun duq = u3j_cook("u3qfu_dung-dunk", u3k(von), "dunk");
|
||||
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
|
||||
|
||||
u3z(duq);
|
||||
@ -44,7 +44,7 @@
|
||||
u3_noun typ)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(typ), 0);
|
||||
u3_noun duq = u3j_hook(u3k(von), "dunk");
|
||||
u3_noun duq = u3j_cook("u3qfu_dunq-dunk", u3k(von), "dunk");
|
||||
u3_noun paz = u3i_string(paz_c);
|
||||
u3_noun ret = u3i_molt(u3k(duq), u3x_sam, u3k(paz), 0);
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
u3qfu_shew(u3_noun van,
|
||||
u3_noun mol)
|
||||
{
|
||||
u3_noun sho = u3j_hook(u3k(van), "show");
|
||||
u3_noun sho = u3j_cook("u3qfu_shew-show", u3k(van), "show");
|
||||
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
|
||||
|
||||
u3z(sho);
|
||||
|
@ -13,7 +13,7 @@
|
||||
u3_noun gen)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "buss");
|
||||
u3_noun gat = u3j_cook("_cqfu_buss-buss", von, "buss");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
@ -29,7 +29,7 @@
|
||||
u3_noun gen)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "busk");
|
||||
u3_noun gat = u3j_cook("_cqfu_busk-busk", von, "busk");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
|
@ -19,7 +19,7 @@
|
||||
u3_noun lap)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "felt");
|
||||
u3_noun gat = u3j_cook("u3qfu_felt-felt", von, "felt");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
@ -34,7 +34,7 @@
|
||||
u3_noun gen)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "fund");
|
||||
u3_noun gat = u3j_cook("u3qfu_fund-fund", von, "fund");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
@ -50,7 +50,7 @@
|
||||
u3_noun tor)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "fine");
|
||||
u3_noun gat = u3j_cook("u3qfu_fine-fine", von, "fine");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam,
|
||||
|
@ -10,7 +10,7 @@
|
||||
u3_noun gen)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "gain");
|
||||
u3_noun gat = u3j_cook("u3qfu_gain-gain", von, "gain");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
u3_noun gen)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "lose");
|
||||
u3_noun gat = u3j_cook("u3qfu_lose-lose", von, "lose");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat, u3x_sam, u3k(gen), 0));
|
||||
}
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@
|
||||
u3_noun loc)
|
||||
{
|
||||
u3_noun mol = u3nc('o', u3k(loc));
|
||||
u3_noun sho = u3j_hook(u3k(van), "show");
|
||||
u3_noun sho = u3j_cook("_mint_loc-show", u3k(van), "show");
|
||||
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
|
||||
|
||||
u3z(mol);
|
||||
@ -206,7 +206,7 @@
|
||||
u3_noun rig)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "emin");
|
||||
u3_noun gat = u3j_cook("_mint_cnts-emin", von, "emin");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
@ -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;
|
||||
@ -756,7 +759,7 @@
|
||||
}
|
||||
else {
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "blow");
|
||||
u3_noun gat = u3j_cook("_mint_in-blow", von, "blow");
|
||||
u3_noun pro;
|
||||
|
||||
pro = u3n_kick_on(u3i_molt(gat,
|
||||
@ -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();
|
||||
|
@ -21,7 +21,7 @@
|
||||
u3_noun loc)
|
||||
{
|
||||
u3_noun mol = u3nc('o', u3k(loc));
|
||||
u3_noun sho = u3j_hook(u3k(van), "show");
|
||||
u3_noun sho = u3j_cook("_mull_loc-show", u3k(van), "show");
|
||||
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
|
||||
|
||||
u3z(mol);
|
||||
@ -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;
|
||||
@ -176,7 +176,7 @@
|
||||
u3_noun rig)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "emul");
|
||||
u3_noun gat = u3j_cook("_mull_cnts-emul", von, "emul");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
|
@ -70,7 +70,7 @@
|
||||
u3_noun loc)
|
||||
{
|
||||
u3_noun mol = u3nc('o', u3k(loc));
|
||||
u3_noun sho = u3j_hook(u3k(van), "show");
|
||||
u3_noun sho = u3j_cook("_play_loc-show", u3k(van), "show");
|
||||
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
|
||||
|
||||
u3z(mol);
|
||||
@ -121,7 +121,7 @@
|
||||
u3_noun rig)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "epla");
|
||||
u3_noun gat = u3j_cook("_play_cnts-epla", von, "epla");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
@ -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);
|
||||
|
@ -10,7 +10,7 @@
|
||||
u3_noun mur)
|
||||
{
|
||||
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
|
||||
u3_noun gat = u3j_hook(von, "tack");
|
||||
u3_noun gat = u3j_cook("u3qfu_tack-tack", von, "tack");
|
||||
|
||||
return u3n_kick_on(u3i_molt(gat,
|
||||
u3x_sam_2,
|
||||
|
@ -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,
|
||||
|
1487
jets/tree.c
1487
jets/tree.c
File diff suppressed because it is too large
Load Diff
@ -264,6 +264,8 @@ incdir = include_directories('include/')
|
||||
|
||||
conf_data = configuration_data()
|
||||
conf_data.set('URBIT_VERSION', '"0.6.0"')
|
||||
conf_data.set('U3_MEMORY_DEBUG', get_option('gc'))
|
||||
conf_data.set('U3_CPU_DEBUG', get_option('prof'))
|
||||
|
||||
osdet = build_machine.system()
|
||||
os_c_flags = ['-funsigned-char','-ffast-math']
|
||||
|
4
meson_options.txt
Normal file
4
meson_options.txt
Normal file
@ -0,0 +1,4 @@
|
||||
option('gc', type : 'boolean', value : false,
|
||||
description : 'Add debugging information to heap. Run with -g. Breaks image.')
|
||||
option('prof', type : 'boolean', value : false,
|
||||
description : 'Activate profiling. Run with -P.')
|
@ -767,19 +767,19 @@ u3h_free(u3p(u3h_root) har_p)
|
||||
/* _ch_walk_buck(): walk bucket for gc.
|
||||
*/
|
||||
static void
|
||||
_ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun))
|
||||
_ch_walk_buck(u3h_buck* hab_u, void (*fun_f)(u3_noun, void*), void* wit)
|
||||
{
|
||||
c3_w i_w;
|
||||
|
||||
for ( i_w = 0; i_w < hab_u->len_w; i_w++ ) {
|
||||
fun_f(u3h_slot_to_noun(hab_u->sot_w[i_w]));
|
||||
fun_f(u3h_slot_to_noun(hab_u->sot_w[i_w]), wit);
|
||||
}
|
||||
}
|
||||
|
||||
/* _ch_walk_node(): walk node for gc.
|
||||
*/
|
||||
static void
|
||||
_ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
|
||||
_ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun, void*), void* wit)
|
||||
{
|
||||
c3_w len_w = _ch_popcount(han_u->map_w);
|
||||
c3_w i_w;
|
||||
@ -792,24 +792,27 @@ _ch_walk_node(u3h_node* han_u, c3_w lef_w, void (*fun_f)(u3_noun))
|
||||
if ( _(u3h_slot_is_noun(sot_w)) ) {
|
||||
u3_noun kev = u3h_slot_to_noun(sot_w);
|
||||
|
||||
fun_f(kev);
|
||||
fun_f(kev, wit);
|
||||
}
|
||||
else {
|
||||
void* hav_v = u3h_slot_to_node(sot_w);
|
||||
|
||||
if ( 0 == lef_w ) {
|
||||
_ch_walk_buck(hav_v, fun_f);
|
||||
_ch_walk_buck(hav_v, fun_f, wit);
|
||||
} else {
|
||||
_ch_walk_node(hav_v, lef_w, fun_f);
|
||||
_ch_walk_node(hav_v, lef_w, fun_f, wit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* u3h_walk(): walk hashtable for gc.
|
||||
/* u3h_walk_with(): traverse hashtable with key, value fn and data
|
||||
* argument; RETAINS.
|
||||
*/
|
||||
void
|
||||
u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
|
||||
u3h_walk_with(u3p(u3h_root) har_p,
|
||||
void (*fun_f)(u3_noun, void*),
|
||||
void* wit)
|
||||
{
|
||||
u3h_root* har_u = u3to(u3h_root, har_p);
|
||||
c3_w i_w;
|
||||
@ -820,16 +823,32 @@ u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
|
||||
if ( _(u3h_slot_is_noun(sot_w)) ) {
|
||||
u3_noun kev = u3h_slot_to_noun(sot_w);
|
||||
|
||||
fun_f(kev);
|
||||
fun_f(kev, wit);
|
||||
}
|
||||
else if ( _(u3h_slot_is_node(sot_w)) ) {
|
||||
u3h_node* han_u = u3h_slot_to_node(sot_w);
|
||||
|
||||
_ch_walk_node(han_u, 25, fun_f);
|
||||
_ch_walk_node(han_u, 25, fun_f, wit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* _ch_walk_plain(): use plain u3_noun fun_f for each node
|
||||
*/
|
||||
static void
|
||||
_ch_walk_plain(u3_noun kev, void* wit)
|
||||
{
|
||||
void (*fun_f)(u3_noun) = wit;
|
||||
fun_f(kev);
|
||||
}
|
||||
|
||||
/* u3h_walk(): u3h_walk_with, but with no data argument
|
||||
*/
|
||||
void
|
||||
u3h_walk(u3p(u3h_root) har_p, void (*fun_f)(u3_noun))
|
||||
{
|
||||
u3h_walk_with(har_p, _ch_walk_plain, fun_f);
|
||||
}
|
||||
|
||||
/* _ch_mark_buck(): mark bucket for gc.
|
||||
*/
|
||||
|
144
noun/imprison.c
144
noun/imprison.c
@ -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`.
|
||||
|
2236
noun/jets.c
2236
noun/jets.c
File diff suppressed because it is too large
Load Diff
@ -481,8 +481,11 @@ static void
|
||||
_pave_parts(void)
|
||||
{
|
||||
u3R->cax.har_p = u3h_new();
|
||||
u3R->jed.har_p = u3h_new();
|
||||
u3R->jed.das = u3_nul;
|
||||
u3R->jed.war_p = u3h_new();
|
||||
u3R->jed.cod_p = u3h_new();
|
||||
u3R->jed.han_p = u3h_new();
|
||||
u3R->jed.bas_p = u3h_new();
|
||||
u3R->byc.har_p = u3h_new();
|
||||
}
|
||||
|
||||
/* u3m_mark(): mark all nouns in the road.
|
||||
@ -491,8 +494,8 @@ c3_w
|
||||
u3m_mark(void)
|
||||
{
|
||||
c3_w tot_w = 0;
|
||||
tot_w += u3h_mark(u3R->jed.har_p);
|
||||
tot_w += u3a_mark_noun(u3R->jed.das);
|
||||
tot_w += u3j_mark();
|
||||
tot_w += u3n_mark();
|
||||
tot_w += u3a_mark_noun(u3R->ski.gul);
|
||||
tot_w += u3a_mark_noun(u3R->bug.tax);
|
||||
tot_w += u3a_mark_noun(u3R->bug.mer);
|
||||
@ -530,8 +533,8 @@ void
|
||||
u3m_clear(void)
|
||||
{
|
||||
u3h_free(u3R->cax.har_p);
|
||||
u3h_free(u3R->jed.har_p);
|
||||
u3a_lose(u3R->jed.das);
|
||||
u3j_free();
|
||||
u3n_free();
|
||||
}
|
||||
|
||||
void
|
||||
@ -817,14 +820,18 @@ u3_noun
|
||||
u3m_love(u3_noun pro)
|
||||
{
|
||||
{
|
||||
u3_noun das = u3R->jed.das;
|
||||
u3p(u3h_root) har_p = u3R->jed.har_p;
|
||||
u3p(u3h_root) cod_p = u3R->jed.cod_p;
|
||||
u3p(u3h_root) war_p = u3R->jed.war_p;
|
||||
u3p(u3h_root) han_p = u3R->jed.han_p;
|
||||
u3p(u3h_root) bas_p = u3R->jed.bas_p;
|
||||
u3p(u3h_root) byc_p = u3R->byc.har_p;
|
||||
|
||||
u3m_fall();
|
||||
|
||||
pro = u3a_take(pro);
|
||||
|
||||
u3j_reap(das, har_p);
|
||||
u3j_reap(cod_p, war_p, han_p, bas_p);
|
||||
u3n_reap(byc_p);
|
||||
|
||||
u3R->cap_p = u3R->ear_p;
|
||||
u3R->ear_p = 0;
|
||||
@ -1689,7 +1696,7 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
|
||||
|
||||
/* Initialize the jet system.
|
||||
*/
|
||||
u3j_boot();
|
||||
u3j_boot(nuu_o);
|
||||
|
||||
/* Install or reactivate the kernel.
|
||||
*/
|
||||
@ -1708,5 +1715,6 @@ u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c,
|
||||
else {
|
||||
u3v_hose();
|
||||
u3j_ream();
|
||||
u3n_ream();
|
||||
}
|
||||
}
|
||||
|
2211
noun/nock.c
2211
noun/nock.c
File diff suppressed because it is too large
Load Diff
69
noun/trace.c
69
noun/trace.c
@ -5,6 +5,8 @@
|
||||
#include "all.h"
|
||||
#include <pthread.h>
|
||||
|
||||
static c3_o _ct_lop_o;
|
||||
|
||||
/* u3t_push(): push on trace stack.
|
||||
*/
|
||||
void
|
||||
@ -110,24 +112,17 @@ u3t_heck(u3_atom cog)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* _t_jet_label():
|
||||
*/
|
||||
u3_weak
|
||||
_t_jet_label(u3a_road* rod_u, u3_noun bat)
|
||||
#if 0
|
||||
static void
|
||||
_ct_sane(u3_noun lab)
|
||||
{
|
||||
while ( 1 ) {
|
||||
u3_weak cax = u3h_git(rod_u->jed.har_p, bat);
|
||||
|
||||
if ( u3_none != cax ) {
|
||||
return u3h(u3t(u3t(u3h(cax))));
|
||||
}
|
||||
|
||||
if ( rod_u->par_p ) {
|
||||
rod_u = u3to(u3_road, rod_u->par_p);
|
||||
}
|
||||
else return u3_none;
|
||||
if ( u3_nul != lab ) {
|
||||
c3_assert(c3y == u3du(lab));
|
||||
c3_assert(c3y == u3ud(u3h(lab)));
|
||||
_ct_sane(u3t(lab));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
/* _t_samp_process(): process raw sample data from live road.
|
||||
@ -145,22 +140,13 @@ _t_samp_process(u3_road* rod_u)
|
||||
u3_noun don = rod_u->pro.don;
|
||||
|
||||
while ( u3_nul != don ) {
|
||||
u3_noun bat = u3h(don);
|
||||
u3_noun lab;
|
||||
|
||||
// Find the label from this battery, surface allocated.
|
||||
// Get surface allocated label
|
||||
//
|
||||
{
|
||||
u3_noun laj = _t_jet_label(rod_u, bat);
|
||||
// u3_noun lab = u3nc(u3i_string("foobar"), 0);
|
||||
u3_noun laj = u3h(don),
|
||||
lab = u3a_take(laj);
|
||||
u3a_wash(laj);
|
||||
|
||||
if ( u3_none == laj ) {
|
||||
don = u3t(don);
|
||||
continue;
|
||||
}
|
||||
|
||||
// lab = u3nc(u3i_string("foobar"), u3_nul);
|
||||
lab = u3a_take(laj); u3a_wash(laj);
|
||||
}
|
||||
// Add the label to the traced label stack, trimming recursion.
|
||||
//
|
||||
{
|
||||
@ -218,6 +204,12 @@ _t_samp_process(u3_road* rod_u)
|
||||
void
|
||||
u3t_samp(void)
|
||||
{
|
||||
if ( c3y == _ct_lop_o ) {
|
||||
// _ct_lop_o here is a mutex for modifying pro.don. we
|
||||
// do not want to sample in the middle of doing that, as
|
||||
// it can cause memory errors.
|
||||
return;
|
||||
}
|
||||
u3C.wag_w &= ~u3o_debug_cpu;
|
||||
|
||||
static int home = 0;
|
||||
@ -279,10 +271,13 @@ u3t_samp(void)
|
||||
/* u3t_come(): push on profile stack; return yes if active push. RETAIN.
|
||||
*/
|
||||
c3_o
|
||||
u3t_come(u3_noun bat)
|
||||
u3t_come(u3_noun lab)
|
||||
{
|
||||
if ( (u3_nul == u3R->pro.don) || !_(u3r_sing(bat, u3h(u3R->pro.don))) ) {
|
||||
u3R->pro.don = u3nc(u3k(bat), u3R->pro.don);
|
||||
if ( (u3_nul == u3R->pro.don) || !_(u3r_sing(lab, u3h(u3R->pro.don))) ) {
|
||||
u3a_gain(lab);
|
||||
_ct_lop_o = c3y;
|
||||
u3R->pro.don = u3nc(lab, u3R->pro.don);
|
||||
_ct_lop_o = c3n;
|
||||
return c3y;
|
||||
}
|
||||
else return c3n;
|
||||
@ -293,10 +288,11 @@ u3t_come(u3_noun bat)
|
||||
void
|
||||
u3t_flee(void)
|
||||
{
|
||||
u3_noun t_don = u3k(u3t(u3R->pro.don));
|
||||
|
||||
u3z(u3R->pro.don);
|
||||
u3R->pro.don = t_don;
|
||||
_ct_lop_o = c3y;
|
||||
u3_noun don = u3R->pro.don;
|
||||
u3R->pro.don = u3k(u3t(don));
|
||||
_ct_lop_o = c3n;
|
||||
u3z(don);
|
||||
}
|
||||
|
||||
extern FILE*
|
||||
@ -391,6 +387,7 @@ void
|
||||
u3t_boot(void)
|
||||
{
|
||||
if ( u3C.wag_w & u3o_debug_cpu ) {
|
||||
_ct_lop_o = c3n;
|
||||
#if defined(U3_OS_osx)
|
||||
#if 1
|
||||
{
|
||||
|
@ -89,34 +89,23 @@ u3v_start(u3_noun now)
|
||||
u3_noun
|
||||
u3v_wish(const c3_c* str_c)
|
||||
{
|
||||
u3_noun exp;
|
||||
|
||||
if ( u3R == &u3H->rod_u ) {
|
||||
u3_noun txt = u3i_string(str_c);
|
||||
|
||||
exp = u3kdb_get(u3k(u3A->yot), u3k(txt));
|
||||
u3_weak exp = u3kdb_get(u3k(u3A->yot), 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));
|
||||
}
|
||||
}
|
||||
|
||||
/* _cv_mung(): formula wrapper with gate and sample.
|
||||
*/
|
||||
|
154
vere/ames.c
154
vere/ames.c
@ -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,6 +330,12 @@ static void
|
||||
_ames_time_cb(uv_timer_t* tim_uo)
|
||||
{
|
||||
u3_ames* sam_u = &u3_Host.sam_u;
|
||||
|
||||
// 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);
|
||||
@ -336,6 +346,7 @@ _ames_time_cb(uv_timer_t* tim_uo)
|
||||
}
|
||||
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,9 +562,13 @@ u3_ames_io_exit()
|
||||
{
|
||||
u3_ames* sam_u = &u3_Host.sam_u;
|
||||
|
||||
// XX close wax_u instead
|
||||
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.
|
||||
*/
|
||||
|
@ -936,7 +936,7 @@ _cttp_init_h2o()
|
||||
{
|
||||
h2o_timeout_t* tim_u = c3_malloc(sizeof(*tim_u));
|
||||
|
||||
h2o_timeout_init(u3L, tim_u, 120 * 1000);
|
||||
h2o_timeout_init(u3L, tim_u, 300 * 1000);
|
||||
|
||||
h2o_http1client_ctx_t* ctx_u = c3_calloc(sizeof(*ctx_u));
|
||||
ctx_u->loop = u3L;
|
||||
|
121
vere/http.c
121
vere/http.c
@ -649,7 +649,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);
|
||||
|
||||
@ -1424,13 +1424,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;
|
||||
}
|
||||
@ -1474,6 +1478,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
|
||||
@ -1635,7 +1640,8 @@ _http_serv_start_all(void)
|
||||
|
||||
c3_assert( 0 != for_u );
|
||||
|
||||
u3_lo_open();
|
||||
// disabled, as this causes a memory leak
|
||||
// u3_lo_open();
|
||||
|
||||
// if the SSL_CTX existed, it'll be freed with the servers
|
||||
u3_Host.tls_u = 0;
|
||||
@ -1652,7 +1658,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);
|
||||
}
|
||||
|
||||
@ -1667,7 +1673,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);
|
||||
}
|
||||
|
||||
@ -1696,7 +1702,8 @@ _http_serv_start_all(void)
|
||||
_http_write_ports_file(u3_Host.dir_c);
|
||||
_http_form_free();
|
||||
|
||||
u3_lo_shut(c3y);
|
||||
// disabled, see above
|
||||
// u3_lo_shut(c3y);
|
||||
}
|
||||
|
||||
/* _http_serv_restart(): gracefully shutdown, then start servers.
|
||||
@ -1751,15 +1758,26 @@ _http_form_free(void)
|
||||
void
|
||||
u3_http_ef_form(u3_noun fig)
|
||||
{
|
||||
// XX validate / test axes?
|
||||
u3_noun sec = u3h(fig);
|
||||
u3_noun lob = u3t(fig);
|
||||
u3_noun sec, pro, log, red;
|
||||
|
||||
if ( (c3n == u3r_qual(fig, &sec, &pro, &log, &red) ) ||
|
||||
// confirm sec is a valid (unit ^)
|
||||
!( u3_nul == sec || ( c3y == u3du(sec) &&
|
||||
c3y == u3du(u3t(sec)) &&
|
||||
u3_nul == u3h(sec) ) ) ||
|
||||
// confirm valid flags ("loobeans")
|
||||
!( c3y == pro || c3n == pro ) ||
|
||||
!( c3y == log || c3n == log ) ||
|
||||
!( c3y == red || c3n == red ) ) {
|
||||
uL(fprintf(uH, "http: form: invalid card\n"));
|
||||
u3z(fig);
|
||||
return;
|
||||
}
|
||||
|
||||
u3_form* for_u = c3_malloc(sizeof(*for_u));
|
||||
|
||||
for_u->pro = (c3_o)u3h(lob);
|
||||
for_u->log = (c3_o)u3h(u3t(lob));
|
||||
for_u->red = (c3_o)u3t(u3t(lob));
|
||||
for_u->pro = (c3_o)pro;
|
||||
for_u->log = (c3_o)log;
|
||||
for_u->red = (c3_o)red;
|
||||
|
||||
if ( u3_nul != sec ) {
|
||||
u3_noun key = u3h(u3t(sec));
|
||||
@ -2057,17 +2075,40 @@ _proxy_conn_new(u3_proxy_type typ_e, void* src_u)
|
||||
return con_u;
|
||||
}
|
||||
|
||||
typedef struct _proxy_write_ctx {
|
||||
u3_pcon* con_u;
|
||||
uv_stream_t* str_u;
|
||||
c3_c* buf_c;
|
||||
} proxy_write_ctx;
|
||||
|
||||
/* _proxy_write_cb(): free uv_write_t and linked buffer.
|
||||
*/
|
||||
static void
|
||||
_proxy_write_cb(uv_write_t* wri_u, c3_i sas_i)
|
||||
{
|
||||
if ( 0 != sas_i ) {
|
||||
if ( 0 != wri_u->data ) {
|
||||
proxy_write_ctx* ctx_u = wri_u->data;
|
||||
|
||||
if ( ctx_u->str_u == (uv_stream_t*)ctx_u->con_u->upt_u ) {
|
||||
uL(fprintf(uH, "proxy: write upstream: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
else if ( ctx_u->str_u == (uv_stream_t*)&(ctx_u->con_u->don_u) ) {
|
||||
uL(fprintf(uH, "proxy: write downstream: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
else {
|
||||
uL(fprintf(uH, "proxy: write: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
uL(fprintf(uH, "proxy: write: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 != wri_u->data ) {
|
||||
free(wri_u->data);
|
||||
proxy_write_ctx* ctx_u = wri_u->data;
|
||||
free(ctx_u->buf_c);
|
||||
free(ctx_u);
|
||||
}
|
||||
|
||||
free(wri_u);
|
||||
@ -2079,7 +2120,12 @@ static c3_i
|
||||
_proxy_write(u3_pcon* con_u, uv_stream_t* str_u, uv_buf_t buf_u)
|
||||
{
|
||||
uv_write_t* wri_u = c3_malloc(sizeof(*wri_u));
|
||||
wri_u->data = buf_u.base;
|
||||
|
||||
proxy_write_ctx* ctx_u = c3_malloc(sizeof(*ctx_u));
|
||||
ctx_u->con_u = con_u;
|
||||
ctx_u->str_u = str_u;
|
||||
ctx_u->buf_c = buf_u.base;
|
||||
wri_u->data = ctx_u;
|
||||
|
||||
c3_i sas_i;
|
||||
if ( 0 != (sas_i = uv_write(wri_u, str_u, &buf_u, 1, _proxy_write_cb)) ) {
|
||||
@ -2562,7 +2608,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);
|
||||
}
|
||||
@ -2663,12 +2709,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);
|
||||
@ -2780,11 +2829,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;
|
||||
}
|
||||
|
||||
@ -2810,25 +2862,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));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3063,15 +3106,13 @@ _proxy_serv_start(u3_prox* lis_u)
|
||||
void
|
||||
u3_http_ef_that(u3_noun tat)
|
||||
{
|
||||
u3_noun sip = u3h(tat);
|
||||
u3_noun por = u3h(u3t(tat));
|
||||
u3_noun sec = u3h(u3t(u3t(tat)));
|
||||
u3_noun non = u3t(u3t(u3t(tat)));
|
||||
u3_noun sip, por, sec, non;
|
||||
|
||||
if( c3n == u3ud(sip) ||
|
||||
c3n == u3a_is_cat(por) ||
|
||||
if ( ( c3n == u3r_qual(tat, &sip, &por, &sec, &non) ) ||
|
||||
( c3n == u3ud(sip) ) ||
|
||||
( c3n == u3a_is_cat(por) ) ||
|
||||
!( c3y == sec || c3n == sec ) ||
|
||||
c3n == u3ud(non) ) {
|
||||
( c3n == u3ud(non) ) ) {
|
||||
uL(fprintf(uH, "http: that: invalid card\n"));
|
||||
u3z(tat);
|
||||
return;
|
||||
@ -3093,6 +3134,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
|
||||
@ -3111,6 +3153,7 @@ u3_http_ef_that(u3_noun tat)
|
||||
if ( c3n == u3_Host.ops_u.net ) {
|
||||
cli_u->ipf_w = INADDR_LOOPBACK;
|
||||
_proxy_ward_connect(cli_u);
|
||||
u3z(tat);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
133
vere/main.c
133
vere/main.c
@ -77,10 +77,11 @@ _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;
|
||||
u3_Host.ops_u.has = c3n;
|
||||
u3_Host.ops_u.net = c3n;
|
||||
u3_Host.ops_u.mem = c3n;
|
||||
u3_Host.ops_u.nuu = c3n;
|
||||
@ -91,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:NabcdgqsvxFMPDXR")) != -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;
|
||||
@ -109,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': {
|
||||
@ -126,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;
|
||||
@ -144,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;
|
||||
@ -175,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; }
|
||||
@ -186,42 +190,67 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
case 'q': { u3_Host.ops_u.qui = c3y; break; }
|
||||
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;
|
||||
} else if ( u3_Host.ops_u.fak == c3n && u3_Host.ops_u.net == 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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -230,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;
|
||||
@ -247,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;
|
||||
@ -265,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 ) {
|
||||
@ -277,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 ) {
|
||||
@ -330,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",
|
||||
@ -596,6 +627,12 @@ main(c3_i argc,
|
||||
if ( _(u3_Host.ops_u.dry) ) {
|
||||
u3C.wag_w |= u3o_dryrun;
|
||||
}
|
||||
|
||||
/* Set hashboard flag
|
||||
*/
|
||||
if ( _(u3_Host.ops_u.has) ) {
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
}
|
||||
}
|
||||
u3m_boot(u3_Host.ops_u.nuu,
|
||||
u3_Host.ops_u.gab,
|
||||
|
@ -1880,11 +1880,11 @@ _raft_grab(u3_noun ova)
|
||||
fprintf(stderr, "arvo stuff: ");
|
||||
_raft_print_memory(utv_w);
|
||||
|
||||
har_w = u3h_mark(u3R->jed.har_p);
|
||||
har_w = u3h_mark(u3R->jed.war_p);
|
||||
fprintf(stderr, " warm jet state: ");
|
||||
_raft_print_memory(har_w);
|
||||
|
||||
das_w = u3a_mark_noun(u3R->jed.das);
|
||||
das_w = u3h_mark(u3R->jed.cod_p);
|
||||
fprintf(stderr, " cold jet state: ");
|
||||
_raft_print_memory(das_w);
|
||||
|
||||
|
46
vere/reck.c
46
vere/reck.c
@ -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);
|
||||
@ -206,6 +202,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)
|
||||
{
|
||||
@ -218,24 +216,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;
|
||||
}
|
||||
@ -311,23 +294,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;
|
||||
|
598
vere/sist.c
598
vere/sist.c
@ -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,191 @@ _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"));
|
||||
// XX review persistent options
|
||||
|
||||
pig = u3nq(c3__make, u3_nul, 11, u3nc(ten, u3_Host.ops_u.fak));
|
||||
// disable networking
|
||||
u3_Host.ops_u.net = c3n;
|
||||
// disable battery hashes
|
||||
u3_Host.ops_u.has = c3y;
|
||||
u3C.wag_w |= u3o_hashless;
|
||||
}
|
||||
}
|
||||
else {
|
||||
u3_noun imp = u3i_string(u3_Host.ops_u.imp_c);
|
||||
u3_noun whu = u3dc("slaw", 'p', u3k(imp));
|
||||
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");
|
||||
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);
|
||||
}
|
||||
_sist_make(pig);
|
||||
|
||||
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);
|
||||
}
|
||||
else {
|
||||
_sist_rest();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
34
vere/term.c
34
vere/term.c
@ -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
|
||||
@ -1212,15 +1186,19 @@ u3_term_io_hija(void)
|
||||
else {
|
||||
if ( c3n == u3_Host.ops_u.dem ) {
|
||||
if ( 0 != tcsetattr(1, TCSADRAIN, &uty_u->bak_u) ) {
|
||||
perror("hija-tcsetattr-1");
|
||||
c3_assert(!"hija-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(1, F_SETFL, uty_u->cug_i) ) {
|
||||
perror("hija-fcntl-1");
|
||||
c3_assert(!"hija-fcntl");
|
||||
}
|
||||
if ( 0 != tcsetattr(0, TCSADRAIN, &uty_u->bak_u) ) {
|
||||
perror("hija-tcsetattr-0");
|
||||
c3_assert(!"hija-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(0, F_SETFL, uty_u->cug_i) ) {
|
||||
perror("hija-fcntl-0");
|
||||
c3_assert(!"hija-fcntl");
|
||||
}
|
||||
write(uty_u->fid_i, "\r", 1);
|
||||
@ -1253,15 +1231,19 @@ u3_term_io_loja(int x)
|
||||
}
|
||||
else {
|
||||
if ( 0 != tcsetattr(1, TCSADRAIN, &uty_u->raw_u) ) {
|
||||
perror("loja-tcsetattr-1");
|
||||
c3_assert(!"loja-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(1, F_SETFL, uty_u->nob_i) ) {
|
||||
perror("hija-fcntl-1");
|
||||
c3_assert(!"loja-fcntl");
|
||||
}
|
||||
if ( 0 != tcsetattr(0, TCSADRAIN, &uty_u->raw_u) ) {
|
||||
perror("loja-tcsetattr-0");
|
||||
c3_assert(!"loja-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(0, F_SETFL, uty_u->nob_i) ) {
|
||||
perror("hija-fcntl-0");
|
||||
c3_assert(!"loja-fcntl");
|
||||
}
|
||||
_term_it_refresh_line(uty_u);
|
||||
|
Loading…
Reference in New Issue
Block a user